From db581b5dfd07ecb1c013aee456ebee8757a6e5c0 Mon Sep 17 00:00:00 2001 From: Joe Pea Date: Thu, 22 Oct 2020 00:51:50 -0700 Subject: [PATCH] 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. --- package.json | 1 + rollup.config.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/package.json b/package.json index 41b493c..6fc9c0c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/rollup.config.js b/rollup.config.js index 8641d95..f25911b 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -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()], },