generated from bywhitebird/starter-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04478cc
commit 6263eba
Showing
9 changed files
with
256 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// declare module 'commander' { | ||
// export * from '@commander-js/extra-typings' | ||
// } | ||
declare module 'commander' { | ||
export * from '@commander-js/extra-typings' | ||
} |
This file contains 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 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,32 @@ | ||
import chokidar from 'chokidar' | ||
|
||
import { generate } from './generate' | ||
|
||
const getFilesToWatch = ([config, configPath]: Parameters<typeof generate>): string[] => { | ||
if (!Array.isArray(config)) | ||
config = [config] | ||
|
||
return [ | ||
...config.flatMap(config => config.input), | ||
configPath, | ||
] | ||
} | ||
|
||
export const generateWatch = (...argsGenerate: Parameters<typeof generate>) => { | ||
return new Promise<void>((_resolve, reject) => { | ||
// Generate once before watching | ||
generate(...argsGenerate) | ||
|
||
const watcher = chokidar.watch(getFilesToWatch(argsGenerate), { | ||
persistent: true, | ||
}) | ||
|
||
watcher.on('change', async () => { | ||
await generate(...argsGenerate) | ||
}) | ||
|
||
watcher.on('error', (error) => { | ||
reject(error) | ||
}) | ||
}) | ||
} |
This file contains 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 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 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
Oops, something went wrong.