Skip to content

Commit 78dc4d1

Browse files
committed
feat(package): added support of angular schematics
1 parent d948027 commit 78dc4d1

File tree

10 files changed

+926
-13
lines changed

10 files changed

+926
-13
lines changed

gulpfile.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,18 @@ gulp.task('build', ['clean'], (cb) => {
271271
runSequence('compile', 'test', 'npm-package', 'rollup-bundle', cb);
272272
});
273273

274+
// Build the schematics in dist
275+
gulp.task('build:schematics', () => {
276+
// return execDemoCmd(`build --preserve-symlinks --prod --aot --build-optimizer`, {cwd: `${config.demoDir}`});
277+
return execCmd('tsc', '-p src/schematics/tsconfig.json').then(exitCode => {
278+
if (exitCode === 0) {
279+
return execCmd('webpack', '--config src/schematics/webpack.config.js --progress --colors');
280+
} else {
281+
Promise.reject(1);
282+
}
283+
});
284+
});
285+
274286
// Same as 'build' but without cleaning temp folders (to avoid breaking demo app, if currently being served)
275287
gulp.task('build-watch', (cb) => {
276288
runSequence('compile', 'test', 'npm-package', 'rollup-bundle', cb);
@@ -300,7 +312,7 @@ gulp.task('build:watch-fast', ['build-watch-no-tests'], () => {
300312
gulp.task('npm-package', (cb) => {
301313
let pkgJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
302314
let targetPkgJson = {};
303-
let fieldsToCopy = ['version', 'description', 'keywords', 'author', 'repository', 'license', 'bugs', 'homepage'];
315+
let fieldsToCopy = ['version', 'description', 'keywords', 'author', 'repository', 'license', 'bugs', 'homepage', 'schematics'];
304316

305317
targetPkgJson['name'] = config.libraryName;
306318

@@ -487,8 +499,7 @@ gulp.task('serve:doc', ['clean:doc'], (cb) => {
487499
const execDemoCmd = (args, opts) => {
488500
if (fs.existsSync(`${config.demoDir}/node_modules`)) {
489501
return execCmd('ng', args, opts, `/${config.demoDir}`);
490-
}
491-
else {
502+
} else {
492503
fancyLog(acolors.yellow(`No 'node_modules' found in '${config.demoDir}'. Installing dependencies for you...`));
493504
return helpers.installDependencies({cwd: `${config.demoDir}`})
494505
.then(exitCode => exitCode === 0 ? execCmd('ng', args, opts, `/${config.demoDir}`) : Promise.reject())
@@ -642,7 +653,7 @@ gulp.task('create-new-tag', (cb) => {
642653
});
643654

644655
// Build and then Publish 'dist' folder to NPM
645-
gulp.task('npm-publish', ['build'], () => {
656+
gulp.task('npm-publish', ['build', 'build:schematics'], () => {
646657
return execExternalCmd('npm', `publish ${config.outputDir} --access public`)
647658
});
648659

@@ -657,8 +668,7 @@ gulp.task('release', (cb) => {
657668
if (!readyToRelease()) {
658669
fancyLog(acolors.red('# Pre-Release Checks have failed. Please fix them and try again. Aborting...'));
659670
cb();
660-
}
661-
else {
671+
} else {
662672
fancyLog(acolors.green('# Pre-Release Checks have succeeded. Continuing...'));
663673
runSequence(
664674
'bump-version',

0 commit comments

Comments
 (0)