docs/build-pieces/misc/migrate-nx-to-turbo.mdx
If you have an existing fork with custom pieces built using the old Nx-based build system, you need to migrate them to the new Turbo-based build system. This guide explains what changed and provides a migration script.
The Activepieces monorepo replaced Nx with Turbo as its build orchestrator. For pieces, this means:
| Old (Nx) | New (Turbo) | |
|---|---|---|
| Build config | project.json per piece | package.json scripts |
| Build command | nx build pieces-{name} | turbo run build --filter=@activepieces/piece-{name} |
| Output directory | dist/out-tsc (shared) | ./dist (local per piece) |
| Task runner | Nx executor (@nx/js:tsc) | Direct tsc -p tsconfig.lib.json && cp package.json dist/ |
| Dependencies | Inferred by Nx graph | Workspace protocol (workspace:*) in package.json |
project.json — Deleted (no longer needed)package.json — Added build and lint scripts, added main and types fields, added workspace dependenciestsconfig.lib.json — Updated outDir, added rootDir, baseUrl, pathsRun the migration script to update all custom pieces at once:
npx ts-node tools/scripts/migrate-custom-piece-to-turbo.ts
This scans packages/pieces/custom/ and applies all necessary changes.
You can also pass a path to migrate a single piece:
npx ts-node tools/scripts/migrate-custom-piece-to-turbo.ts packages/pieces/custom/my-piece
For each piece, the script:
package.json — adds build and lint scripts, sets main and types entry points, ensures @activepieces/pieces-framework, @activepieces/shared, and tslib are listed as dependenciestsconfig.lib.json — sets outDir to ./dist, adds rootDir, baseUrl, paths, and declaration settingstsconfig.json if missing — extends the root tsconfig.base.jsonproject.json — removes Nx configurationAfter migrating, build your piece to verify everything works:
npx turbo run build --filter=@activepieces/piece-your-piece --force
Or use the CLI:
npm run build-piece your-piece
The build output should appear in packages/pieces/custom/your-piece/dist/.