To release a new version of a package (@integration-app/sdk, @integration-app/ui, @integration-app/react), do the following:
- Go to the package and type
npm version -- patch
(ornpm version -- minor
ornpm version -- major
) to bump the version. - Create a PR with the changes.
- Merge the PR.
- Run a Github Action to publish a package.
To see the complete configuration, refer to the rollup.config.mjs
and rollup.dts.config.mjs
files. Although these files are self-explanatory, here's some additional information:
In rollup.config.mjs
, we set {external: [/node_modules/]}
to exclude our dependencies from being bundled.
When using rollup-plugin-dts
and @rollup/plugin-typescript
in the same configuration, we experienced issues with generating incorrect DTS files. To solve this, we use two Rollup configurations:
-
rollup.config.mjs
for generating bundles -
rollup.dts.config.mjs
for generating DTS files.
For build, the following steps are taken:
- Clean the
/dist
folder and./bundle.*
files. - Rollup with
rollup.config.mjs
configuration generates bundle files and basic DTS files, which are placed in thedist/dts
folder. - Rollup with
rollup.dts.config.mjs
configuration uses the basic DTS files to generate*.d.ts
files for each bundle.
During development, the following steps are taken:
- Run
build
to generate bundle and DTS files.- If not, Rollup with
rollup.dts.config.mjs
in watch mode fails due to missing DTS files (race condition).
- If not, Rollup with
- Concurrently run two Rollup processes in watch mode:
- Rollup with
rollup.config.mjs
configuration to generate bundle files and basic DTS files. - Rollup with
rollup.dts.config.mjs
configuration to generate DTS files for each bundle.
- Rollup with
{
"exports": {
"types": "./dist/index.d.ts", // TypeScript typings for NodeNext modules
"require": "./dist/index.js", // used for require() in Node 12+
"import": "./dist/index.module.mjs" // ESM bundle
},
"types": "./dist/index.d.ts", // TypeScript typings
"main": "./dist/index.js", // CommonJS bundle
"module": "./dist/index.module.mjs", // ESM bundle
"unpkg": "./bundle.js", // UMD bundle
}