-
Notifications
You must be signed in to change notification settings - Fork 252
Fix/watchmode #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix/watchmode #259
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
fbf9a26
remove old config
jorgeucano 3783f87
scully(watch-mode): add more files
jorgeucano 62546ad
Merge branch 'master' of https://github.com/scullyio/scully into fix/…
jorgeucano 0890235
scully(watchMode): merge with master and fix double build
jorgeucano 18ec2e2
feat(watch): add support for build only the minimal change
jorgeucano eace9d9
add files to test
jorgeucano 930301a
merge with master
jorgeucano 782c11e
fix(perfomrance metrics): reset metrics on rebuild
SanderElias 9e03bf3
fix(remove stray folder): fox
SanderElias 029def4
more test
jorgeucano fd06f2f
Merge branch 'fix/watchmode' of https://github.com/scullyio/scully in…
jorgeucano 3f78a99
add more test
jorgeucano 36df086
fix(watch): add fix for route import
jorgeucano 8495bed
feat(watch-mode): add the watchmode with the new config
jorgeucano ad04256
fix
SanderElias ef6fed2
Merge branch 'fix/watchmode' of github.com:scullyio/scully into fix/w…
SanderElias 6db7f4b
fix
SanderElias 7a6a396
feat(cahche geuss): cach the angular routes
SanderElias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * NodeFsFolder | ||
| * read directorys and files | ||
| * reactive 100% | ||
| * */ | ||
| import {existsSync} from 'fs'; | ||
| import {join} from 'path'; | ||
| import {log, red} from './log'; | ||
| import {BehaviorSubject, Observable} from 'rxjs'; | ||
| import * as fs from 'fs'; | ||
| import {throttleTime} from 'rxjs/operators'; | ||
|
|
||
| // tslint:disable-next-line:no-shadowed-variable | ||
| function readPath(folder: string) { | ||
| // tslint:disable-next-line:variable-name | ||
| const _path: string = join(__dirname, folder); | ||
| if (existFolder(_path)) { | ||
| return true; | ||
| } else { | ||
| log(`${red(`${folder} folder not found, directory ${_path}`)}.`); | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| function existFolder(src) { | ||
| try { | ||
| return existsSync(src); | ||
| } catch (e) { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| function watchFolder(folder): Observable<{eventType: string; fileName: string}> { | ||
| return new Observable(obs => { | ||
| let watcher; | ||
| try { | ||
| watcher = fs.watch(folder, (event, fname) => { | ||
| console.log('--------------------------------------------------'); | ||
| console.log(`New ${event} in ${fname}, re run scully.`); | ||
| console.log('--------------------------------------------------'); | ||
| obs.next({eventType: event, fileName: fname}); | ||
| }); | ||
| } catch (e) { | ||
| obs.error(e); | ||
| } | ||
| return () => watcher.close(); | ||
| }); | ||
| } | ||
|
|
||
| export function startWatch(folder: string) { | ||
| console.log('start process', folder); | ||
| if (readPath(folder)) { | ||
| const fxwatch = this.watchFolder(folder); | ||
| fxwatch.pipe(throttleTime(3000)).subscribe(x => { | ||
| console.log(x); | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.