-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(Admin): improve workflow for widgets
- change output name declaration with ViteJS. - add note when importing external globals. - install chokidar + concurrency in code/admin to allow hot-reload workflow when developing a plugin's widget.
- Loading branch information
1 parent
c6780df
commit 6602076
Showing
9 changed files
with
118 additions
and
34 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,29 @@ | ||
// NOTE: common script for plugins when implementing a widget in Admin/. | ||
// run `pnpm build:watch` to watch changes, build widget, copy output in | ||
// debug directory of the plugin. You'll need to hit F5 to reload the | ||
// widget when running `pnpm start` in `code/admin`. | ||
import chokidar from 'chokidar'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
const plugin = path.basename(path.dirname(process.cwd())); | ||
const src = path.resolve(path.join(process.cwd(), 'dist')); | ||
const dst = path.resolve(path.join('..', '..', '..', '..', '..', 'build', 'windows', 'x64', 'debug', 'plugins', plugin, 'assets')); | ||
|
||
console.log(`watching Admin.${plugin}`); | ||
console.log(`copying from "${src}"`); | ||
console.log(` to "${dst}"`); | ||
|
||
const watcher = chokidar.watch('dist/**/*'); | ||
|
||
process.once('SIGINT', abort); | ||
process.once('SIGTERM', abort); | ||
|
||
watcher.on('change', () => { | ||
fs.cpSync(src, dst, {recursive: true}); | ||
}); | ||
|
||
function abort() { | ||
console.log('Stopping watcher...'); | ||
watcher.close(); | ||
} |
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
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