Skip to content

Commit 6251113

Browse files
committed
feat(package): added angular schematics support
1 parent b6f42d3 commit 6251113

File tree

10 files changed

+870
-26
lines changed

10 files changed

+870
-26
lines changed

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@
8383
"typescript": "~3.2.4",
8484
"webpack-node-externals": "~1.7.2"
8585
}
86-
}
86+
}

gulpfile.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,17 @@ gulp.task('build', ['clean'], (cb) => {
284284
runSequence('compile', 'npm-package', 'rollup-bundle', cb);
285285
});
286286

287+
gulp.task('build:schematics', () => {
288+
// return execDemoCmd(`build --preserve-symlinks --prod --aot --build-optimizer`, {cwd: `${config.demoDir}`});
289+
return execCmd('tsc', '-p src/schematics/tsconfig.json').then(exitCode => {
290+
if (exitCode === 0) {
291+
return execCmd('webpack', '--config src/schematics/webpack.config.js --progress --colors');
292+
} else {
293+
Promise.reject(1);
294+
}
295+
});
296+
});
297+
287298
// Same as 'build' but without cleaning temp folders (to avoid breaking demo app, if currently being served)
288299
gulp.task('build-watch', (cb) => {
289300
runSequence('compile', 'test', 'npm-package', 'rollup-bundle', cb);
@@ -310,10 +321,10 @@ gulp.task('build:watch-fast', ['build-watch-no-tests'], () => {
310321
/////////////////////////////////////////////////////////////////////////////
311322

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

318329
targetPkgJson['name'] = config.libraryName;
319330

@@ -503,8 +514,7 @@ gulp.task('serve:doc', ['clean:doc'], (cb) => {
503514
const execDemoCmd = (args, opts) => {
504515
if (fs.existsSync(`${config.demoDir}/node_modules`)) {
505516
return execCmd('ng', args, opts, `/${config.demoDir}`);
506-
}
507-
else {
517+
} else {
508518
gulpUtil.log(gulpUtil.colors.yellow(`No 'node_modules' found in '${config.demoDir}'. Installing dependencies for you...`));
509519
return helpers.installDependencies({cwd: `${config.demoDir}`})
510520
.then(exitCode => exitCode === 0 ? execCmd('ng', args, opts, `/${config.demoDir}`) : Promise.reject())
@@ -671,8 +681,7 @@ gulp.task('release', (cb) => {
671681
if (!readyToRelease()) {
672682
gulpUtil.log(gulpUtil.colors.red('# Pre-Release Checks have failed. Please fix them and try again. Aborting...'));
673683
cb();
674-
}
675-
else {
684+
} else {
676685
gulpUtil.log(gulpUtil.colors.green('# Pre-Release Checks have succeeded. Continuing...'));
677686
runSequence(
678687
'bump-version',

0 commit comments

Comments
 (0)