chore: improve dev script so output can be meaningfully watched

This makes it work well in VS Code (f.e. it will use $ts-watch mode to read errors from stdout and display them in the "PROBLEMS" pane).

Plus this tells newcomers how to quickly get things started in dev mode (watch mode) for easy dev cycles.
This commit is contained in:
Joe Pea 2020-10-22 00:51:50 -07:00
parent 0ed1d45e2d
commit db581b5dfd
2 changed files with 7 additions and 0 deletions

View File

@ -25,6 +25,7 @@
],
"dependencies": {},
"scripts": {
"dev": "(npm run tsc-watch -- --preserveWatchOutput & p1=$!; npm run rollup-build -- --watch & p2=$!; wait $p1 $p2)",
"build": "rimraf dist .tmp && node scripts/write-version.js && npm run tsc && npm run rollup-build",
"rollup-build": "rollup -c ./rollup.config.js",
"tsc": "tsc",

View File

@ -5,28 +5,34 @@ export default [
input: '.tmp/Index.js',
// https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
context: 'this',
watch: {clearScreen: false},
output: [
{
file: 'dist/tween.umd.js',
name: 'TWEEN',
format: 'umd',
exports: 'named',
},
{
file: 'dist/tween.amd.js',
format: 'amd',
exports: 'named',
},
{
file: 'dist/tween.cjs.js',
format: 'cjs',
exports: 'named',
},
{
file: 'dist/tween.esm.js',
format: 'es',
exports: 'named',
},
],
},
{
input: './.tmp/Index.d.ts',
watch: {clearScreen: false},
output: [{file: 'dist/tween.d.ts', format: 'es'}],
plugins: [dts()],
},