From 8fbe49a5f03e8ad6b204599b6cc4016cb7861926 Mon Sep 17 00:00:00 2001 From: Sergey Andrievskiy Date: Tue, 15 Jan 2019 09:48:04 +0300 Subject: [PATCH 1/3] feat(playground schematics): remove watch task --- package.json | 4 +- .../tasks/playground/playground-schematic.ts | 43 ------------------- 2 files changed, 2 insertions(+), 45 deletions(-) delete mode 100644 scripts/gulp/tasks/playground/playground-schematic.ts diff --git a/package.json b/package.json index 04ef403aae..c5042fe02f 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "gulp": "gulp", "firebase": "firebase", "conventional-changelog": "conventional-changelog", - "prestart": "run-s build:schematics gen:playground", - "start": "run-p \"ng -- serve {@}\" \"gulp -- watch:gen:playground\" -- ", + "prestart": "npm run gen:playground", + "start": "ng serve", "start:prod": "npm run start -- --prod --aot", "start:wp": "npm run start:prod -- playground-wp", "docs:parse": "gulp docs", diff --git a/scripts/gulp/tasks/playground/playground-schematic.ts b/scripts/gulp/tasks/playground/playground-schematic.ts deleted file mode 100644 index f792ab851e..0000000000 --- a/scripts/gulp/tasks/playground/playground-schematic.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { exec } from 'child_process'; -import { task } from 'gulp'; -import { watch } from 'chokidar'; -import { PLAYGROUND_ROOT } from '../config'; - -const PG_GLOB = PLAYGROUND_ROOT + '**/*.ts'; -const DEBOUNCE_TIME = 3000; - -function debounce(callback, delay: number = DEBOUNCE_TIME) { - let timeoutId; - return function debounced() { - clearTimeout(timeoutId); - timeoutId = setTimeout(callback, delay); - } -} - -function startWatch() { - const watcher = watch(PG_GLOB, { ignoreInitial: true }); - const debouncedSchematic = debounce(() => stopWatchRunSchematic(watcher)); - watcher.on('add', debouncedSchematic); - watcher.on('change', debouncedSchematic); -} - -function stopWatchRunSchematic(watcher) { - watcher.close(); - exec('npm run gen:playground', logAndRestart); -} - -function logAndRestart(error: Error, stdout: string, stderr: string): void { - if (error) { - console.error(error); - } - if (stdout) { - // tslint:disable-next-line:no-console - console.log(stdout); - } - if (stderr) { - console.error(stderr); - } - startWatch(); -} - -task('watch:gen:playground', startWatch); From 827812ba8c4da82a5caf261ce7fc81f240ba50c4 Mon Sep 17 00:00:00 2001 From: Sergey Andrievskiy Date: Tue, 15 Jan 2019 14:12:14 +0300 Subject: [PATCH 2/3] docs(schematic): remove watch mentions --- DEV_DOCS.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DEV_DOCS.md b/DEV_DOCS.md index 2b876f8563..49266f2fd7 100644 --- a/DEV_DOCS.md +++ b/DEV_DOCS.md @@ -401,7 +401,8 @@ add it to docs/structure.ts create example usage of your component src/playground/[with-layout|without-layout]/your-component/your-component-showcase.component.ts -module and route will be created automatically if you running playground or docs app. + +run 'npm run gen:playground' to generate boilerplate code, such as modules, routes, etc. your-component.component.ts (add line in docs section- * @stacked-example(Your component, your-component/your-component-showcase.component) ```` @@ -415,9 +416,9 @@ Playground is a set of modules containing all Nebular examples. It has two base directories: `with-layout` and `without-layout`. All components in `with-layout` directory will be nested inside of `nb-layout` component. Components from `without-layout` directory will be direct children of router outlet. Put components into `without-layout` directory, if they don't need to or can't be children of layout component, such as a layout itself. ## Playground schematic -Playground schematic watches playground files and generates all boilerplate code for you. Basically, after adding a new component, directive or service declaration, all needed modules and components routes will be generated or modified. +Playground schematic generates all boilerplate code for you. Basically, after adding a new component, directive or service declaration, all needed modules and components routes will be generated or modified. -Schematic starts if you run playground or docs app with `npm start` or `npm run docs:serve` commands. +You can run it via 'npm run gen:playground' command. ### How it works From aa3f6e05e1d2ed1db53a4d6e811e52d6d48db2a2 Mon Sep 17 00:00:00 2001 From: Sergey Andrievskiy Date: Tue, 15 Jan 2019 17:12:36 +0300 Subject: [PATCH 3/3] fix(playground schematic): remove import from deleted file --- scripts/gulp/gulpfile.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/gulp/gulpfile.ts b/scripts/gulp/gulpfile.ts index d26b16ce33..b6f5e0c40b 100644 --- a/scripts/gulp/gulpfile.ts +++ b/scripts/gulp/gulpfile.ts @@ -5,6 +5,5 @@ import './tasks/bundle/bundle'; import './tasks/docs/docs'; import './tasks/copy-sources'; import './tasks/bump-versions'; -import './tasks/playground/playground-schematic'; task('default', ['copy-sources']);