Skip to content

Commit

Permalink
feat(package): added schematics support
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed Mar 17, 2019
1 parent 7bf5b7c commit 2cab789
Show file tree
Hide file tree
Showing 10 changed files with 2,370 additions and 32 deletions.
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@
],
"setupTestFrameworkScriptFile": "<rootDir>/src/setupJest.ts"
}
}
}
15 changes: 13 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@ gulp.task('build', ['clean'], (cb) => {
runSequence('compile', 'test', 'npm-package', 'rollup-bundle', cb);
});

gulp.task('build:schematics', () => {
// return execDemoCmd(`build --preserve-symlinks --prod --aot --build-optimizer`, {cwd: `${config.demoDir}`});
return execCmd('tsc', '-p src/schematics/tsconfig.json').then(exitCode => {
if (exitCode === 0) {
return execCmd('webpack', '--config src/schematics/webpack.config.js --progress --colors');
} else {
Promise.reject(1);
}
});
});

// Same as 'build' but without cleaning temp folders (to avoid breaking demo app, if currently being served)
gulp.task('build-watch', (cb) => {
runSequence('compile', 'test', 'npm-package', 'rollup-bundle', cb);
Expand All @@ -299,10 +310,10 @@ gulp.task('build:watch-fast', ['build-watch-no-tests'], () => {
/////////////////////////////////////////////////////////////////////////////

// Prepare 'dist' folder for publication to NPM
gulp.task('npm-package', (cb) => {
gulp.task('npm-package', ['build:schematics'], (cb) => {
let pkgJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
let targetPkgJson = {};
let fieldsToCopy = ['version', 'description', 'keywords', 'author', 'repository', 'license', 'bugs', 'homepage'];
let fieldsToCopy = ['version', 'description', 'keywords', 'author', 'repository', 'license', 'bugs', 'homepage', 'schematics'];

targetPkgJson['name'] = config.libraryName;

Expand Down
Loading

0 comments on commit 2cab789

Please sign in to comment.