Skip to content

Commit 462539c

Browse files
authored
feat: migrate build system to ESM with tsdown (#969)
1 parent 7922200 commit 462539c

File tree

286 files changed

+6720
-7248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+6720
-7248
lines changed

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ runs:
1313
- uses: pnpm/action-setup@v4
1414
- uses: actions/setup-node@v3
1515
with:
16-
node-version: '20.11.1'
16+
node-version: '24.11.1'
1717
cache: 'pnpm'
1818

1919
- name: Install dependencies

.github/workflows/e2e-tests-pr.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,16 @@ jobs:
108108
- name: Verify built CLI
109109
run: |
110110
# Verify the built CLI exists
111-
if [ ! -f "packages/snap/dist/cjs/cli.js" ]; then
112-
echo "❌ Built CLI not found at packages/snap/dist/cjs/cli.js"
111+
if [ ! -f "packages/snap/dist/cli.mjs" ]; then
112+
echo "❌ Built CLI not found at packages/snap/dist/cli.mjs"
113113
echo "Available files in dist:"
114114
ls -la packages/snap/dist/ || echo "dist directory not found"
115115
exit 1
116116
fi
117117
118118
# Make CLI executable through node
119-
echo "✅ Built CLI found at packages/snap/dist/cjs/cli.js"
120-
node packages/snap/dist/cjs/cli.js --version || echo "CLI version check failed"
119+
echo "✅ Built CLI found at packages/snap/dist/cli.mjs"
120+
node packages/snap/dist/cli.mjs --version || echo "CLI version check failed"
121121
122122
- name: Record test start time
123123
run: echo "START_TIME=$(date +%s)" >> $GITHUB_ENV
@@ -135,7 +135,7 @@ jobs:
135135
echo "🧪 Starting PR E2E tests - Template: ${{ matrix.template }}, OS: ${{ matrix.os }}"
136136
137137
# Export the built CLI path for tests to use
138-
export MOTIA_CLI_PATH="$GITHUB_WORKSPACE/packages/snap/dist/cjs/cli.js"
138+
export MOTIA_CLI_PATH="$GITHUB_WORKSPACE/packages/snap/dist/cli.mjs"
139139
export MOTIA_ANALYTICS_DISABLED=true
140140
export MOTIA_API_URL=http://localhost:3000
141141
export MOTIA_TEST_TEMPLATE=${{ matrix.template }}

.github/workflows/e2e-tests-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
- uses: pnpm/action-setup@v4
9999
- uses: actions/setup-node@v4 # Versão mais recente
100100
with:
101-
node-version: '20.11.1'
101+
node-version: '24.11.1'
102102
cache: 'pnpm'
103103

104104
# Cache global do npm para melhor performance

.github/workflows/motia.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- 'docs/**'
1212
- 'contributors/**'
1313
- 'packages/docs/**'
14+
1415
push:
1516
branches:
1617
- main
@@ -42,7 +43,7 @@ jobs:
4243
pnpm python-setup
4344
4445
- name: Run tests
45-
run: PATH=python_modules/bin:$PATH pnpm -r run test
46+
run: PATH=python_modules/bin:$PATH pnpm -r --filter='!./plugins/**' --filter='!./playground/**' run test
4647

4748
# Note: Publishing is now handled by the deploy.yml workflow
4849
# This workflow only handles CI/CD quality checks

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.6/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.5/schema.json",
33
"vcs": {
44
"enabled": true,
55
"clientKind": "git",

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@
5757
},
5858
"packageManager": "pnpm@10.11.0",
5959
"volta": {
60-
"node": "20.11.1"
60+
"node": "24.11.1"
61+
},
62+
"pnpm": {
63+
"overrides": {
64+
"axe-core": "4.10.3",
65+
"dompurify": "3.2.6",
66+
"@vercel/analytics": "1.5.0"
67+
}
6168
},
6269
"version": "0.0.7"
6370
}

packages/adapter-rabbitmq-events/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"name": "@motiadev/adapter-rabbitmq-events",
33
"description": "RabbitMQ event adapter for Motia framework, enabling distributed event handling across multiple instances.",
4-
"main": "dist/index.js",
5-
"types": "dist/index.d.ts",
4+
"type": "module",
5+
"main": "dist/index.mjs",
6+
"module": "dist/index.mjs",
7+
"types": "dist/index.d.mts",
68
"version": "0.14.0-beta.164",
79
"scripts": {
8-
"build": "rm -rf dist && tsc",
10+
"build": "tsdown",
11+
"dev": "tsdown --watch",
912
"lint": "biome check .",
10-
"watch": "tsc --watch"
13+
"clean": "rm -rf dist"
1114
},
1215
"dependencies": {
1316
"@motiadev/core": "workspace:*",
@@ -16,6 +19,7 @@
1619
},
1720
"devDependencies": {
1821
"@types/amqplib": "^0.10.5",
22+
"tsdown": "^0.16.6",
1923
"typescript": "^5.7.2"
2024
},
2125
"peerDependencies": {

packages/adapter-rabbitmq-events/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
33
"target": "ES2020",
4-
"module": "commonjs",
4+
"module": "ESNext",
55
"lib": ["ES2020"],
66
"declaration": true,
77
"declarationMap": true,
@@ -12,7 +12,7 @@
1212
"skipLibCheck": true,
1313
"forceConsistentCasingInFileNames": true,
1414
"resolveJsonModule": true,
15-
"moduleResolution": "node"
15+
"moduleResolution": "bundler"
1616
},
1717
"include": ["src/**/*"],
1818
"exclude": ["node_modules", "dist"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineConfig } from 'tsdown'
2+
3+
export default defineConfig({
4+
entry: {
5+
index: './src/index.ts',
6+
},
7+
format: 'esm',
8+
platform: 'node',
9+
external: ['@motiadev/core', 'amqplib', 'uuid'],
10+
dts: {
11+
build: true,
12+
},
13+
clean: true,
14+
outDir: 'dist',
15+
sourcemap: true,
16+
unbundle: true,
17+
})

packages/adapter-redis-cron/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
{
22
"name": "@motiadev/adapter-redis-cron",
33
"description": "Redis cron adapter for Motia framework, enabling distributed cron job coordination to prevent duplicate executions across multiple instances.",
4-
"main": "dist/index.js",
5-
"types": "dist/index.d.ts",
4+
"type": "module",
5+
"main": "dist/index.mjs",
6+
"module": "dist/index.mjs",
7+
"types": "dist/index.d.mts",
68
"version": "0.14.0-beta.164",
79
"scripts": {
8-
"build": "rm -rf dist && tsc",
10+
"build": "tsdown",
11+
"dev": "tsdown --watch",
912
"lint": "biome check .",
10-
"watch": "tsc --watch"
13+
"clean": "rm -rf dist"
1114
},
1215
"dependencies": {
1316
"@motiadev/core": "workspace:*",
@@ -16,6 +19,7 @@
1619
},
1720
"devDependencies": {
1821
"@types/node": "^22.10.2",
22+
"tsdown": "^0.16.6",
1923
"typescript": "^5.7.2"
2024
},
2125
"peerDependencies": {

0 commit comments

Comments
 (0)