# 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 created tsconfig.build.json file.

Before:

tsup.dev.ts
import { defineDevConfig } from "@workleap/tsup-configs";

export default defineDevConfig();

After:

rslib.dev.ts
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 created tsconfig.build.json file.

Before:

tsup.build.ts
import { defineBuildConfig } from "@workleap/tsup-configs";

export default defineBuildConfig();

After:

rslib.build.ts
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:

package.json
"scripts": {
    "dev": "tsup --config ./tsup.dev.ts"
}

After:

package.json
"scripts": {
    "dev": "rslib build -w -c ./rslib.dev.ts"
}

# build

Update the build script to run Rslib instead of tsup.

Before:

package.json
"scripts": {
    "build": "tsup"
}

After:

package.json
"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.