Skip to content

Commit

Permalink
build: update component init
Browse files Browse the repository at this point in the history
  • Loading branch information
xxyan0205 committed Jan 23, 2019
1 parent 6f354f1 commit cd75c09
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions build/component-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const CWD = process.cwd()
const COMPONENTS_PATH = path.resolve(CWD, './components')
const EXPECT_SHELL = path.resolve(CWD, './build/template.exp')
const DEMO_INDEX_PATH = path.resolve(CWD, './examples/demo-index.js')
const DEMO_INDEX_PATH_INDEMAND = path.resolve(CWD, './examples/demo-index.indemand.js')
const TYPES = path.resolve(CWD, './types/index.d.ts')
const COMPONENT_INDEX = path.resolve(CWD, './components/index.js')
const COMPONENT_JSON = path.resolve(CWD, './examples/components.json')

Expand Down Expand Up @@ -47,7 +47,7 @@ function changeKebabToCamel(str) {
}

function sync(answers) {
return Promise.all([syncToComponentJson(answers), syncToExample(answers), syncToIndex(answers), syncToExampleIndemand(answers)]).then(() =>answers)
return Promise.all([syncToComponentJson(answers), syncToExample(answers), syncToIndex(answers), syncToTypes(answers)]).then(() =>answers)
}

function syncToExample(answers) {
Expand All @@ -58,12 +58,12 @@ function syncToExample(answers) {
.then(str => fs.writeFileAsync(DEMO_INDEX_PATH, str, 'utf8'))
.then(() => answers)
}
function syncToExampleIndemand(answers) {
fs.readFileAsync(DEMO_INDEX_PATH_INDEMAND, 'utf8')
function syncToTypes(answers) {
fs.readFileAsync(TYPES, 'utf8')
.then(str => {
return compile(answers, str)
})
.then(str => fs.writeFileAsync(DEMO_INDEX_PATH_INDEMAND, str, 'utf8'))
.then(str => fs.writeFileAsync(TYPES, str, 'utf8'))
.then(() => answers)
}

Expand Down
3 changes: 3 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class Progress extends MandComponent { }
export class Radio extends MandComponent { }
export class RadioList extends MandComponent { }
export class ResultPage extends MandComponent { }
export class Ruler extends MandComponent { }
export class ScrollView extends MandComponent { }
export class ScrollViewMore extends MandComponent { }
export class ScrollViewRefresh extends MandComponent { }
Expand All @@ -58,6 +59,8 @@ export class Tag extends MandComponent { }
export class Tip extends MandComponent { }
export class Transition extends MandComponent { }
export class WaterMark extends MandComponent { }
/* @init<%export class ${componentNameUpper} extends MandComponent { }%> */



// declare module 'mand-mobile/lib/image-reader/image-processor' {
Expand Down

0 comments on commit cd75c09

Please sign in to comment.