diff --git a/package.json b/package.json index c20f04d49..7f40da3ca 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "@types/enzyme": "^3.1.12", "@types/jest": "^23.3.1", "@types/lodash": "^4.14.165", - "@types/node": "^10.5.2", + "@types/node": "^10.17.49", "@types/react": "16.4.7", "@types/react-dom": "16.0.7", "@types/react-transition-group": "^2.9.2", diff --git a/tools/buildDist.js b/tools/buildDist.js index c1d14d7ae..6995be493 100644 --- a/tools/buildDist.js +++ b/tools/buildDist.js @@ -8,7 +8,6 @@ const webpack = require('webpack'); const ora = require('ora'); const config = require('../webpack.config.prod.dist'); const {chalkError, chalkSuccess, chalkWarning, chalkProcessing} = require('./chalkConfig'); -// const copyComponentsStyle = require('./copyComponentsStyle'); console.log(chalkProcessing('dist: Generating minified bundle for production via Webpack. This will take a moment...')); @@ -19,7 +18,6 @@ webpack(config).run((error, stats) => { if (error) { // so a fatal error occurred. Stop here. console.log(chalkError(error)); process.exit(1); - return 1; } const jsonStats = stats.toJson(); @@ -27,22 +25,12 @@ webpack(config).run((error, stats) => { if (jsonStats.hasErrors) { jsonStats.errors.map(error => console.log(chalkError(error))); process.exit(1); - return; } if (jsonStats.hasWarnings) { console.log(chalkWarning('Webpack generated the following warnings: ')); jsonStats.warnings.map(warning => console.log(chalkWarning(warning))); } - spinner.start('dist: Copying style files...'); - // try{ - // copyComponentsStyle(); - // }catch(e){ - // console.log(chalkError(e)); - // process.exit(1); - // return; - // } - spinner.stop(); console.log(stats.toString({ colors: true, @@ -56,6 +44,5 @@ webpack(config).run((error, stats) => { // if we got this far, the build succeeded. console.log(chalkSuccess('Your app is compiled in production mode in /dist. It\'s ready to roll!')); - - return 0; + process.exit(0); }); diff --git a/tools/buildOthers.sh b/tools/buildOthers.sh index f2c5bcb4b..aab31cf2f 100755 --- a/tools/buildOthers.sh +++ b/tools/buildOthers.sh @@ -76,14 +76,16 @@ cd ../../ # CommonJS babel "./$temp_dir/" --out-dir "./$lib_dir/" +tsc --emitDeclarationOnly --outDir lib node tools/compileTs/copy.js $lib_dir $node_dir + # less 编译为 css compileLess $node_dir # ES6 setBabelModules false babel "./$temp_dir/" --out-dir "./$es_dir/" - +tsc --emitDeclarationOnly --outDir es # 清理、还原 rm -rf $temp_dir setBabelModules commonjs diff --git a/tsconfig.json b/tsconfig.json index fcc25481e..2a3d2ab68 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "outDir": "./dist/", "sourceMap": false, + "declaration": true, "experimentalDecorators": true, "module": "commonjs", "target": "es5",