#
Migrate from tsup
To migrate from @workleap/tsup-configs
to @workleap/rslib-configs
, execute the following steps 👇
#
Update packages
Open a terminal at the root of the library project and install the following packages:
pnpm add -D @workleap/rslib-configs @rslib/core @rsbuild/core
yarn add -D @workleap/rslib-configs @rslib/core @rsbuild/core
npm install -D @workleap/rslib-configs @rslib/core @rsbuild/core
Then, using the same terminal, remove the following packages:
pnpm remove @workleap/tsup-configs tsup
yarn remove @workleap/tsup-configs tsup
npm uninstall @workleap/tsup-configs tsup
#
Create a new tsconfig.build.json
file
TBD
#
Update files
library-project
βββ tsup.dev.ts --> rslib.dev.ts
βββ tsup.build.ts --> rslib.build.ts
βββ tsconfig.json
βββ package.json
#
tsup.dev.ts
Rename the file from tsup.dev.ts
to rslib.dev.ts
.
Then, open the rslib.dev.ts
file and and apply the following changes:
- Replace
"@workleap/tsup-configs"
for"@workleap/rslib-configs"
. - Add a
tsconfigPath
option and reference the previously createdtsconfig.build.json
file.
Before:
import { defineDevConfig } from "@workleap/tsup-configs";
export default defineDevConfig();
After:
import { defineDevConfig } from "@workleap/rslib-configs";
import path from "node:path";
export default defineDevConfig({
tsconfigPath: path.resolve("./tsconfig.build.json")
});
#
tsup.build.ts
Rename the file from tsup.build.ts
to rslib.build.ts
.
Then, open the rslib.build.ts
file and and apply the following changes:
- Replace
"@workleap/tsup-configs"
for"@workleap/rslib-configs"
. - Add a
tsconfigPath
option and reference the previously createdtsconfig.build.json
file.
Before:
import { defineBuildConfig } from "@workleap/tsup-configs";
export default defineBuildConfig();
After:
import { defineBuildConfig } from "@workleap/rslib-configs";
import path from "node:path";
export default defineBuildConfig({
tsconfigPath: path.resolve("./tsconfig.build.json")
});
#
Update scripts
#
dev
Update the dev
script to run Rslib instead of tsup.
Before:
"scripts": {
"dev": "tsup --config ./tsup.dev.ts"
}
After:
"scripts": {
"dev": "rslib build -w -c ./rslib.dev.ts"
}
#
build
Update the build
script to run Rslib instead of tsup.
Before:
"scripts": {
"build": "tsup"
}
After:
"scripts": {
"build": "rslib build -c ./rslib.build.ts"
}
#
Typings
If you're encountering typing issues, consider adding type declarations for the following
#
Storybook
Consider using the new Rslib Storybook shared configurations.
#
Try it 🚀
Start the application in a development environment using the dev
and build
script. Everything should run smoothly without any warnings or errors outputted in the terminal.