diff --git a/tools/ice-devtools/database/generate-marterials-database.js b/tools/ice-devtools/database/generate-marterials-database.js index 531837a21e..78575eb67b 100755 --- a/tools/ice-devtools/database/generate-marterials-database.js +++ b/tools/ice-devtools/database/generate-marterials-database.js @@ -8,7 +8,6 @@ const cp = require('child_process'); const os = require('os'); const uppercamelcase = require('uppercamelcase'); const rp = require('request-promise'); -const chalk = require('chalk'); const depAnalyze = require('../shared/dep-analyze'); const { checkAndQueryNpmTime } = require('../shared/utils'); @@ -138,8 +137,8 @@ function generateBlocks(files, SPACE, type, done) { if (item.source.type !== 'npm') { return Promise.resolve(); } else { - return checkAndQueryNpmTime(item.source.npm, item.source.version).then( - ([code, npmResult]) => { + return checkAndQueryNpmTime(item.source.npm, item.source.version) + .then(([code, npmResult]) => { if (code == 0) { item.publishTime = npmResult.created; item.updateTime = npmResult.modified; @@ -149,23 +148,16 @@ function generateBlocks(files, SPACE, type, done) { item.updateTime = null; return Promise.resolve(npmResult); } - } - ); + }) } }) ).then((allCheckStatus) => { - const failedStatus = allCheckStatus.filter((n) => typeof n !== 'undefined'); + const failedStatus = allCheckStatus.filter(n=> typeof n !== 'undefined') if (failedStatus.length > 0) { failedStatus.forEach((status) => { console.error(status.npm, status.version); console.error(status.message); - - console.log('=========================================='); - console.log(chalk.green('发布提示:')); - console.log('首次新增的物料,"未发布 npm 包" 可忽略该错误提示。'); - console.log('项目成员在 review 通过后会合并代码,并发布到 npm 。'); - console.log('=========================================='); - }); + }) process.exit(1); } done(result); @@ -207,17 +199,18 @@ function generateScaffolds(files, SPACE, done) { }; tasks.push( - checkAndQueryNpmTime(pkg.name, pkg.version).then(([code, npmResult]) => { - if (code == 0) { - payload.publishTime = npmResult.created; - payload.updateTime = npmResult.modified; - return Promise.resolve(); - } else { - item.publishTime = null; - item.updateTime = null; - return Promise.resolve(npmResult); - } - }) + checkAndQueryNpmTime(pkg.name, pkg.version) + .then(([code, npmResult]) => { + if (code == 0) { + payload.publishTime = npmResult.created; + payload.updateTime = npmResult.modified; + return Promise.resolve(); + } else { + item.publishTime = null; + item.updateTime = null; + return Promise.resolve(npmResult); + } + }) ); generatePartciple(payload, { @@ -265,18 +258,12 @@ function generateScaffolds(files, SPACE, done) { return payload; }); Promise.all(tasks).then((allCheckStatus) => { - const failedStatus = allCheckStatus.filter((n) => typeof n !== 'undefined'); + const failedStatus = allCheckStatus.filter(n=> typeof n !== 'undefined') if (failedStatus.length > 0) { failedStatus.forEach((status) => { console.error(status.npm, status.version); console.error(status.message); - - console.log('=========================================='); - console.log(chalk.green('发布提示:')); - console.log('首次新增的物料,"未发布 npm 包" 可忽略该错误提示。'); - console.log('项目成员在 review 通过后会合并代码,并发布到 npm 。'); - console.log('=========================================='); - }); + }) process.exit(1); } done(result);