test: dogfood rpt2 as configPlugin w/ rollup.config.ts#460
test: dogfood rpt2 as configPlugin w/ rollup.config.ts#460agilgur5 wants to merge 4 commits intoezolenko:masterfrom
configPlugin w/ rollup.config.ts#460Conversation
- use rpt2 as a `configPlugin` within our own build process, as well as to build itself - doubly dogfood - we don't have any tests for `configPlugin`s, and it's a Rollup CLI option, so this is one of the few ways to test it - create a helper `_build-self` script so we don't need to type/repeat as much (or have as much potential for mistakes) NOTE: this commit fails to build, need to make some more adjustments to the base config to get it to work in TS - will do that in the next commits so that it's easier to read/differentiate/review
- replace the unmaintained `rollup-plugin-re` w/ `@rollup/plugin-replace`
- `rollup-plugin-re` hasn't had a commit in ~5 years and doesn't have typings (natively or in DT)
- also import the plugins in the same order that they're used
- `require("package.json")` -> `import`
- and add `resolveJsonModule` to `configPlugin` `tsconfigOverride` to handle this
- only used by the `configPlugin`, not everything else, so not added to `tsconfig.json`
- fix the usage of the `resolve` plugin as it didn't type-check/had outdated usage
- need to use `createRequire` in ESM mode - deps: bump `@types/node` to support the types for that as well - this is a BREAKING CHANGE as it requires Node 14+ - fix `fs-extra` error due to it being CJS - add `build-self/*` to `prebuild` clean - not to `build-self` script, as the `build-self/` directory has to exist for that - output as `build-self/index.mjs` instead of `build-self/dist/rollup-plugin-typescript2.es.js` - so that types work out of the box -- due to `index.d.ts` - and so that Rollup correctly loads it as ESM and not CJS
|
As this is a breaking change due to use of |
- set `engines.node` in `package.json` to show this as well
|
Tests are failing due to use of |
|
I'm also getting an error on Windows trying one of the |
|
Dang thought we were past all Windows pathing issues 😅 Looks like something is expanding/converting the path in a way Rollup doesn't like |
Summary
Dogfood rpt2 more by using it as a
configPluginon our own internalrollup.config.tsDetails
Motivation
use rpt2 as a
configPluginwithin our own build process, as well as to build itselfwe don't have any tests for
configPlugins, and it's a Rollup CLI option, so this is one of the few ways to test it_build-selfscript so we don't need to type/repeat as much (or have as much potential for mistakes)0.34.0not handling JSON import inrollup.config.ts#426TS Fixes
replace the unmaintained
rollup-plugin-rew/@rollup/plugin-replacerollup-plugin-rehasn't had a commit in ~5 years and doesn't have typings (natively or in DT)fix the usage of the
resolveplugin as it didn't type-check/had outdated usageESM Fixes
need to use
createRequirein ESM mode@types/nodeto support the types for that as wellfix
fs-extraerror due to it being CJSrequire("package.json")->importresolveJsonModuletoconfigPlugintsconfigOverrideto handle thisconfigPlugin, not everything else, so not added totsconfig.jsonoutput as
build-self/index.mjsinstead ofbuild-self/dist/rollup-plugin-typescript2.es.jsindex.d.tsMisc
#456 was split out of this as it took me quite a while to get builds to pass