chore!: fix build:cjs run script, drop node 12#471
chore!: fix build:cjs run script, drop node 12#471shadowspawn wants to merge 12 commits intoyargs:mainfrom
Conversation
|
Cough: well, that broke all the CI! Some reading to do... |
|
Bump the minimum node version for engine, and tests. Pinned back Update, |
|
The official rollup typescript plugin appears to work fine (tests pass) and supports |
|
Coverage dropped slightly and failed CI check, presumably because some extra code included by different typescript plugin. I have not been brave enough to try a diff on the output yet, but now might be the time... Note to self: run more of the checks before pushing! I am used to editor catching the lint problems... |
|
Some interaction between tsconfig Edit: removed override. Generating sourcemap is expected for test due to env? |
|
Pulled this branch down locally and it's working for me to compile and run tests. Rollup supports setting environment variables through its CLI, meaning we can get rid of - "pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
+ "pretest": "rimraf build && tsc -p tsconfig.test.json && npm run build:cjs -- --environment NODE_ENV:test",This could also be simplified to just a // package.json
- npm run build:cjs -- --environment NODE_ENV:test
+ npm run build:cjs -- --environment TEST
// rollup.config.js
- if (process.env.NODE_ENV === 'test') output.sourcemap = true
+ if (process.env.TEST === 'true') output.sourcemap = true |
|
Thanks @tommy-mitchell. I will look into those suggestions. |
|
I like the (The pattern of passing options into another run-script is a little unfamiliar to me, but I am coming around to the idea.) |
|
Reminded by the failure that the coverage fails because it is being run against the test build which adds a last line to file: |
The build is broken (#470), possibly by interaction of
ts-transform-default-exportandrollup-plugin-ts.I tried upgrading
rollupand failing to get the build working, stuck at new error:However,
ts-transform-default-exportmay no longer be required!Installing yargs-parser (currently v21.1.1) the export in
build/build.cjslooks like:Removing
ts-transform-default-export, the export inbuild/build.cjslooks as desired:I see that rollup has a related configuration option, which we could perhaps set explicitly to reduce chance it changes in future: https://rollupjs.org/configuration-options/#output-exports
Update: already have
output.exports = 'default'.Fixes: #470
(Opening this PR as a draft since I hacked my way to a working build without deep knowledge of rollup et al. Feedback from gentle readers on things to check whether this is an adequate solution are welcome!)