@fern-api/generator-migrations 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1327 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +842 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +5 -35
- package/README.md +0 -352
- package/lib/generators/typescript/migrations/1.0.0.d.ts +0 -152
- package/lib/generators/typescript/migrations/1.0.0.d.ts.map +0 -1
- package/lib/generators/typescript/migrations/1.0.0.js +0 -166
- package/lib/generators/typescript/migrations/1.0.0.js.map +0 -1
- package/lib/generators/typescript/migrations/2.0.0.d.ts +0 -153
- package/lib/generators/typescript/migrations/2.0.0.d.ts.map +0 -1
- package/lib/generators/typescript/migrations/2.0.0.js +0 -163
- package/lib/generators/typescript/migrations/2.0.0.js.map +0 -1
- package/lib/generators/typescript/migrations/3.0.0.d.ts +0 -242
- package/lib/generators/typescript/migrations/3.0.0.d.ts.map +0 -1
- package/lib/generators/typescript/migrations/3.0.0.js +0 -250
- package/lib/generators/typescript/migrations/3.0.0.js.map +0 -1
- package/lib/generators/typescript/migrations/index.d.ts +0 -18
- package/lib/generators/typescript/migrations/index.d.ts.map +0 -1
- package/lib/generators/typescript/migrations/index.js +0 -22
- package/lib/generators/typescript/migrations/index.js.map +0 -1
- package/lib/index.d.ts +0 -18
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -24
- package/lib/index.js.map +0 -1
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import type { Migration } from "@fern-api/migrations-base";
|
|
2
|
-
/**
|
|
3
|
-
* Migration for version 3.0.0
|
|
4
|
-
*
|
|
5
|
-
* ## Context
|
|
6
|
-
*
|
|
7
|
-
* Version 3.0.0 modernized the generated SDK tooling by switching to pnpm and Vitest,
|
|
8
|
-
* which offer better performance, smaller disk usage, and faster test execution compared
|
|
9
|
-
* to yarn and Jest. However, teams with existing workflows may prefer to maintain their
|
|
10
|
-
* current tooling.
|
|
11
|
-
*
|
|
12
|
-
* This migration explicitly sets the old defaults for users upgrading from pre-3.0.0
|
|
13
|
-
* versions, allowing them to continue using yarn and Jest without any changes to their
|
|
14
|
-
* development workflow.
|
|
15
|
-
*
|
|
16
|
-
* ## Changed Defaults
|
|
17
|
-
*
|
|
18
|
-
* | Field | Old Default (pre-3.0.0) | New Default (3.0.0+) | Impact |
|
|
19
|
-
* |-------|-------------------------|----------------------|--------|
|
|
20
|
-
* | `packageManager` | `"yarn"` | `"pnpm"` | Generated package.json uses pnpm for dependency management |
|
|
21
|
-
* | `testFramework` | `"jest"` | `"vitest"` | Generated tests use Vitest instead of Jest |
|
|
22
|
-
*
|
|
23
|
-
* ## Migration Strategy
|
|
24
|
-
*
|
|
25
|
-
* This migration uses the nullish coalescing assignment operator (`??=`) to only set
|
|
26
|
-
* values that are explicitly undefined. This means:
|
|
27
|
-
* - ✅ If a user has explicitly configured a field, that value is preserved
|
|
28
|
-
* - ✅ If a field is undefined, the old default is set
|
|
29
|
-
* - ✅ Users can opt into modern tooling by removing these fields later
|
|
30
|
-
*
|
|
31
|
-
* ## Examples
|
|
32
|
-
*
|
|
33
|
-
* ### Example 1: Empty Config (Migration Applied - Keep Yarn + Jest)
|
|
34
|
-
*
|
|
35
|
-
* **Before Migration (2.9.0 → 3.0.0):**
|
|
36
|
-
* ```yaml
|
|
37
|
-
* generators:
|
|
38
|
-
* - name: fernapi/fern-typescript-sdk
|
|
39
|
-
* version: 2.9.0
|
|
40
|
-
* config: {}
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* **After Migration:**
|
|
44
|
-
* ```yaml
|
|
45
|
-
* generators:
|
|
46
|
-
* - name: fernapi/fern-typescript-sdk
|
|
47
|
-
* version: 3.0.0
|
|
48
|
-
* config:
|
|
49
|
-
* packageManager: yarn # Set by migration - keeps yarn
|
|
50
|
-
* testFramework: jest # Set by migration - keeps jest
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* **Result:** Generated SDK continues using yarn and Jest.
|
|
54
|
-
*
|
|
55
|
-
* **Generated Files:**
|
|
56
|
-
* - `package.json` with yarn scripts and Jest config
|
|
57
|
-
* - Test files using Jest syntax (`describe`, `it`, `expect`)
|
|
58
|
-
* - `.yarnrc` or `.yarnrc.yml` if applicable
|
|
59
|
-
*
|
|
60
|
-
* ### Example 2: Adopting Modern Tooling (pnpm + Vitest)
|
|
61
|
-
*
|
|
62
|
-
* **After Initial Migration:**
|
|
63
|
-
* ```yaml
|
|
64
|
-
* generators:
|
|
65
|
-
* - name: fernapi/fern-typescript-sdk
|
|
66
|
-
* version: 3.0.0
|
|
67
|
-
* config:
|
|
68
|
-
* packageManager: yarn
|
|
69
|
-
* testFramework: jest
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* **To Adopt pnpm + Vitest:**
|
|
73
|
-
* ```yaml
|
|
74
|
-
* generators:
|
|
75
|
-
* - name: fernapi/fern-typescript-sdk
|
|
76
|
-
* version: 3.0.0
|
|
77
|
-
* config: {} # Remove to use new defaults
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* **Result:** Generated SDK uses pnpm and Vitest.
|
|
81
|
-
*
|
|
82
|
-
* **Generated Files:**
|
|
83
|
-
* - `package.json` with pnpm scripts
|
|
84
|
-
* - `vitest.config.ts` for test configuration
|
|
85
|
-
* - Test files using Vitest syntax (compatible with Jest)
|
|
86
|
-
* - `pnpm-workspace.yaml` if applicable
|
|
87
|
-
*
|
|
88
|
-
* ### Example 3: Mixed Tooling (Custom Configuration)
|
|
89
|
-
*
|
|
90
|
-
* **Keep yarn but adopt Vitest:**
|
|
91
|
-
* ```yaml
|
|
92
|
-
* generators:
|
|
93
|
-
* - name: fernapi/fern-typescript-sdk
|
|
94
|
-
* version: 3.0.0
|
|
95
|
-
* config:
|
|
96
|
-
* packageManager: yarn # Keep yarn
|
|
97
|
-
* # testFramework defaults to vitest
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* **Keep Jest but adopt pnpm:**
|
|
101
|
-
* ```yaml
|
|
102
|
-
* generators:
|
|
103
|
-
* - name: fernapi/fern-typescript-sdk
|
|
104
|
-
* version: 3.0.0
|
|
105
|
-
* config:
|
|
106
|
-
* testFramework: jest # Keep Jest
|
|
107
|
-
* # packageManager defaults to pnpm
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* ## Why These Defaults Changed
|
|
111
|
-
*
|
|
112
|
-
* ### pnpm vs yarn
|
|
113
|
-
*
|
|
114
|
-
* **Performance:**
|
|
115
|
-
* - pnpm install is 2-3x faster than yarn
|
|
116
|
-
* - Uses hard links instead of copying files
|
|
117
|
-
* - Significantly smaller `node_modules` (50-70% reduction)
|
|
118
|
-
*
|
|
119
|
-
* **Correctness:**
|
|
120
|
-
* - Strict dependency resolution prevents phantom dependencies
|
|
121
|
-
* - Better monorepo support with workspaces
|
|
122
|
-
* - More deterministic builds
|
|
123
|
-
*
|
|
124
|
-
* **Ecosystem:**
|
|
125
|
-
* - Growing adoption in major projects (Vue 3, Prisma, Turborepo)
|
|
126
|
-
* - Better compatibility with modern tooling
|
|
127
|
-
*
|
|
128
|
-
* ### Vitest vs Jest
|
|
129
|
-
*
|
|
130
|
-
* **Performance:**
|
|
131
|
-
* - 10-20x faster test execution with native ESM
|
|
132
|
-
* - Built-in watch mode with instant HMR
|
|
133
|
-
* - Parallel test execution by default
|
|
134
|
-
*
|
|
135
|
-
* **Developer Experience:**
|
|
136
|
-
* - Native TypeScript support (no ts-jest needed)
|
|
137
|
-
* - Vite-powered with instant module reloading
|
|
138
|
-
* - Jest-compatible API (easy migration)
|
|
139
|
-
* - Better error messages and stack traces
|
|
140
|
-
*
|
|
141
|
-
* **Modern Features:**
|
|
142
|
-
* - Native ESM support
|
|
143
|
-
* - Web Workers and multi-threading support
|
|
144
|
-
* - In-source testing capabilities
|
|
145
|
-
*
|
|
146
|
-
* ## Compatibility Notes
|
|
147
|
-
*
|
|
148
|
-
* ### Vitest Limitations
|
|
149
|
-
*
|
|
150
|
-
* Vitest is **not compatible** with certain generator configurations:
|
|
151
|
-
*
|
|
152
|
-
* 1. **`useBigInt: true`**: Vitest doesn't handle BigInt serialization the same way as Jest
|
|
153
|
-
* - **Workaround**: Keep `testFramework: jest` if using BigInt
|
|
154
|
-
*
|
|
155
|
-
* 2. **`streamType: wrapper`**: Older stream wrappers may not work with Vitest's ESM mode
|
|
156
|
-
* - **Workaround**: Either use `streamType: web` or keep `testFramework: jest`
|
|
157
|
-
*
|
|
158
|
-
* 3. **`packagePath` (custom paths)**: May have module resolution issues with Vitest
|
|
159
|
-
* - **Workaround**: Keep `testFramework: jest` for complex custom paths
|
|
160
|
-
*
|
|
161
|
-
* If you have any of these configurations, the migration correctly keeps Jest as the test framework.
|
|
162
|
-
*
|
|
163
|
-
* ## Migration Path to Modern Tooling
|
|
164
|
-
*
|
|
165
|
-
* ### Step 1: Upgrade with Migration (Safe)
|
|
166
|
-
* ```bash
|
|
167
|
-
* fern generator upgrade
|
|
168
|
-
* ```
|
|
169
|
-
* Result: Keeps yarn and Jest, no workflow changes needed.
|
|
170
|
-
*
|
|
171
|
-
* ### Step 2: Install pnpm (Optional)
|
|
172
|
-
* ```bash
|
|
173
|
-
* npm install -g pnpm@latest
|
|
174
|
-
* ```
|
|
175
|
-
*
|
|
176
|
-
* ### Step 3: Adopt Modern Tooling (Optional)
|
|
177
|
-
* Edit `generators.yml`:
|
|
178
|
-
* ```yaml
|
|
179
|
-
* config: {} # Use pnpm + vitest
|
|
180
|
-
* ```
|
|
181
|
-
*
|
|
182
|
-
* ### Step 4: Update CI/CD (Optional)
|
|
183
|
-
* Update CI scripts to use pnpm:
|
|
184
|
-
* ```yaml
|
|
185
|
-
* # GitHub Actions example
|
|
186
|
-
* - uses: pnpm/action-setup@v2
|
|
187
|
-
* with:
|
|
188
|
-
* version: 8
|
|
189
|
-
* - run: pnpm install
|
|
190
|
-
* - run: pnpm test
|
|
191
|
-
* ```
|
|
192
|
-
*
|
|
193
|
-
* ### Step 5: Migrate yarn.lock (Optional)
|
|
194
|
-
* ```bash
|
|
195
|
-
* # Convert yarn.lock to pnpm-lock.yaml
|
|
196
|
-
* pnpm import
|
|
197
|
-
* rm yarn.lock
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* ## Troubleshooting
|
|
201
|
-
*
|
|
202
|
-
* ### "pnpm: command not found"
|
|
203
|
-
* **Cause:** pnpm not installed globally.
|
|
204
|
-
* **Solution:** Install pnpm: `npm install -g pnpm`
|
|
205
|
-
*
|
|
206
|
-
* ### Vitest errors with BigInt
|
|
207
|
-
* **Cause:** Vitest and BigInt serialization incompatibility.
|
|
208
|
-
* **Solution:** Use `testFramework: jest` in config.
|
|
209
|
-
*
|
|
210
|
-
* ### Module resolution errors with Vitest
|
|
211
|
-
* **Cause:** ESM/CommonJS compatibility issues.
|
|
212
|
-
* **Solution:** Either fix module format or use `testFramework: jest`.
|
|
213
|
-
*
|
|
214
|
-
* ### Tests fail after switching to Vitest
|
|
215
|
-
* **Cause:** Vitest has stricter ESM requirements.
|
|
216
|
-
* **Solution:** Ensure `package.json` has `"type": "module"` or use `.ts` extensions.
|
|
217
|
-
*
|
|
218
|
-
* ## Performance Comparison
|
|
219
|
-
*
|
|
220
|
-
* Based on typical SDK project (50 tests, 1000 LOC):
|
|
221
|
-
*
|
|
222
|
-
* **Install Time:**
|
|
223
|
-
* - yarn: ~15s
|
|
224
|
-
* - pnpm: ~5s (3x faster)
|
|
225
|
-
*
|
|
226
|
-
* **Test Execution:**
|
|
227
|
-
* - Jest: ~8s
|
|
228
|
-
* - Vitest: ~0.8s (10x faster)
|
|
229
|
-
*
|
|
230
|
-
* **Disk Usage:**
|
|
231
|
-
* - yarn: ~200MB node_modules
|
|
232
|
-
* - pnpm: ~80MB node_modules (60% reduction)
|
|
233
|
-
*
|
|
234
|
-
* ## Recommendations
|
|
235
|
-
*
|
|
236
|
-
* - **New projects**: Use the new defaults (pnpm + Vitest)
|
|
237
|
-
* - **Existing projects**: Keep old defaults initially, migrate when convenient
|
|
238
|
-
* - **CI/CD-heavy projects**: Consider pnpm for faster installs
|
|
239
|
-
* - **Projects with BigInt**: Keep Jest until Vitest improves BigInt support
|
|
240
|
-
*/
|
|
241
|
-
export declare const migration_3_0_0: Migration;
|
|
242
|
-
//# sourceMappingURL=3.0.0.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3.0.0.d.ts","sourceRoot":"","sources":["../../../../src/generators/typescript/migrations/3.0.0.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8OG;AACH,eAAO,MAAM,eAAe,EAAE,SAW7B,CAAC"}
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { migrateConfig } from "@fern-api/migrations-base";
|
|
2
|
-
/**
|
|
3
|
-
* Migration for version 3.0.0
|
|
4
|
-
*
|
|
5
|
-
* ## Context
|
|
6
|
-
*
|
|
7
|
-
* Version 3.0.0 modernized the generated SDK tooling by switching to pnpm and Vitest,
|
|
8
|
-
* which offer better performance, smaller disk usage, and faster test execution compared
|
|
9
|
-
* to yarn and Jest. However, teams with existing workflows may prefer to maintain their
|
|
10
|
-
* current tooling.
|
|
11
|
-
*
|
|
12
|
-
* This migration explicitly sets the old defaults for users upgrading from pre-3.0.0
|
|
13
|
-
* versions, allowing them to continue using yarn and Jest without any changes to their
|
|
14
|
-
* development workflow.
|
|
15
|
-
*
|
|
16
|
-
* ## Changed Defaults
|
|
17
|
-
*
|
|
18
|
-
* | Field | Old Default (pre-3.0.0) | New Default (3.0.0+) | Impact |
|
|
19
|
-
* |-------|-------------------------|----------------------|--------|
|
|
20
|
-
* | `packageManager` | `"yarn"` | `"pnpm"` | Generated package.json uses pnpm for dependency management |
|
|
21
|
-
* | `testFramework` | `"jest"` | `"vitest"` | Generated tests use Vitest instead of Jest |
|
|
22
|
-
*
|
|
23
|
-
* ## Migration Strategy
|
|
24
|
-
*
|
|
25
|
-
* This migration uses the nullish coalescing assignment operator (`??=`) to only set
|
|
26
|
-
* values that are explicitly undefined. This means:
|
|
27
|
-
* - ✅ If a user has explicitly configured a field, that value is preserved
|
|
28
|
-
* - ✅ If a field is undefined, the old default is set
|
|
29
|
-
* - ✅ Users can opt into modern tooling by removing these fields later
|
|
30
|
-
*
|
|
31
|
-
* ## Examples
|
|
32
|
-
*
|
|
33
|
-
* ### Example 1: Empty Config (Migration Applied - Keep Yarn + Jest)
|
|
34
|
-
*
|
|
35
|
-
* **Before Migration (2.9.0 → 3.0.0):**
|
|
36
|
-
* ```yaml
|
|
37
|
-
* generators:
|
|
38
|
-
* - name: fernapi/fern-typescript-sdk
|
|
39
|
-
* version: 2.9.0
|
|
40
|
-
* config: {}
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* **After Migration:**
|
|
44
|
-
* ```yaml
|
|
45
|
-
* generators:
|
|
46
|
-
* - name: fernapi/fern-typescript-sdk
|
|
47
|
-
* version: 3.0.0
|
|
48
|
-
* config:
|
|
49
|
-
* packageManager: yarn # Set by migration - keeps yarn
|
|
50
|
-
* testFramework: jest # Set by migration - keeps jest
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* **Result:** Generated SDK continues using yarn and Jest.
|
|
54
|
-
*
|
|
55
|
-
* **Generated Files:**
|
|
56
|
-
* - `package.json` with yarn scripts and Jest config
|
|
57
|
-
* - Test files using Jest syntax (`describe`, `it`, `expect`)
|
|
58
|
-
* - `.yarnrc` or `.yarnrc.yml` if applicable
|
|
59
|
-
*
|
|
60
|
-
* ### Example 2: Adopting Modern Tooling (pnpm + Vitest)
|
|
61
|
-
*
|
|
62
|
-
* **After Initial Migration:**
|
|
63
|
-
* ```yaml
|
|
64
|
-
* generators:
|
|
65
|
-
* - name: fernapi/fern-typescript-sdk
|
|
66
|
-
* version: 3.0.0
|
|
67
|
-
* config:
|
|
68
|
-
* packageManager: yarn
|
|
69
|
-
* testFramework: jest
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* **To Adopt pnpm + Vitest:**
|
|
73
|
-
* ```yaml
|
|
74
|
-
* generators:
|
|
75
|
-
* - name: fernapi/fern-typescript-sdk
|
|
76
|
-
* version: 3.0.0
|
|
77
|
-
* config: {} # Remove to use new defaults
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* **Result:** Generated SDK uses pnpm and Vitest.
|
|
81
|
-
*
|
|
82
|
-
* **Generated Files:**
|
|
83
|
-
* - `package.json` with pnpm scripts
|
|
84
|
-
* - `vitest.config.ts` for test configuration
|
|
85
|
-
* - Test files using Vitest syntax (compatible with Jest)
|
|
86
|
-
* - `pnpm-workspace.yaml` if applicable
|
|
87
|
-
*
|
|
88
|
-
* ### Example 3: Mixed Tooling (Custom Configuration)
|
|
89
|
-
*
|
|
90
|
-
* **Keep yarn but adopt Vitest:**
|
|
91
|
-
* ```yaml
|
|
92
|
-
* generators:
|
|
93
|
-
* - name: fernapi/fern-typescript-sdk
|
|
94
|
-
* version: 3.0.0
|
|
95
|
-
* config:
|
|
96
|
-
* packageManager: yarn # Keep yarn
|
|
97
|
-
* # testFramework defaults to vitest
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* **Keep Jest but adopt pnpm:**
|
|
101
|
-
* ```yaml
|
|
102
|
-
* generators:
|
|
103
|
-
* - name: fernapi/fern-typescript-sdk
|
|
104
|
-
* version: 3.0.0
|
|
105
|
-
* config:
|
|
106
|
-
* testFramework: jest # Keep Jest
|
|
107
|
-
* # packageManager defaults to pnpm
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* ## Why These Defaults Changed
|
|
111
|
-
*
|
|
112
|
-
* ### pnpm vs yarn
|
|
113
|
-
*
|
|
114
|
-
* **Performance:**
|
|
115
|
-
* - pnpm install is 2-3x faster than yarn
|
|
116
|
-
* - Uses hard links instead of copying files
|
|
117
|
-
* - Significantly smaller `node_modules` (50-70% reduction)
|
|
118
|
-
*
|
|
119
|
-
* **Correctness:**
|
|
120
|
-
* - Strict dependency resolution prevents phantom dependencies
|
|
121
|
-
* - Better monorepo support with workspaces
|
|
122
|
-
* - More deterministic builds
|
|
123
|
-
*
|
|
124
|
-
* **Ecosystem:**
|
|
125
|
-
* - Growing adoption in major projects (Vue 3, Prisma, Turborepo)
|
|
126
|
-
* - Better compatibility with modern tooling
|
|
127
|
-
*
|
|
128
|
-
* ### Vitest vs Jest
|
|
129
|
-
*
|
|
130
|
-
* **Performance:**
|
|
131
|
-
* - 10-20x faster test execution with native ESM
|
|
132
|
-
* - Built-in watch mode with instant HMR
|
|
133
|
-
* - Parallel test execution by default
|
|
134
|
-
*
|
|
135
|
-
* **Developer Experience:**
|
|
136
|
-
* - Native TypeScript support (no ts-jest needed)
|
|
137
|
-
* - Vite-powered with instant module reloading
|
|
138
|
-
* - Jest-compatible API (easy migration)
|
|
139
|
-
* - Better error messages and stack traces
|
|
140
|
-
*
|
|
141
|
-
* **Modern Features:**
|
|
142
|
-
* - Native ESM support
|
|
143
|
-
* - Web Workers and multi-threading support
|
|
144
|
-
* - In-source testing capabilities
|
|
145
|
-
*
|
|
146
|
-
* ## Compatibility Notes
|
|
147
|
-
*
|
|
148
|
-
* ### Vitest Limitations
|
|
149
|
-
*
|
|
150
|
-
* Vitest is **not compatible** with certain generator configurations:
|
|
151
|
-
*
|
|
152
|
-
* 1. **`useBigInt: true`**: Vitest doesn't handle BigInt serialization the same way as Jest
|
|
153
|
-
* - **Workaround**: Keep `testFramework: jest` if using BigInt
|
|
154
|
-
*
|
|
155
|
-
* 2. **`streamType: wrapper`**: Older stream wrappers may not work with Vitest's ESM mode
|
|
156
|
-
* - **Workaround**: Either use `streamType: web` or keep `testFramework: jest`
|
|
157
|
-
*
|
|
158
|
-
* 3. **`packagePath` (custom paths)**: May have module resolution issues with Vitest
|
|
159
|
-
* - **Workaround**: Keep `testFramework: jest` for complex custom paths
|
|
160
|
-
*
|
|
161
|
-
* If you have any of these configurations, the migration correctly keeps Jest as the test framework.
|
|
162
|
-
*
|
|
163
|
-
* ## Migration Path to Modern Tooling
|
|
164
|
-
*
|
|
165
|
-
* ### Step 1: Upgrade with Migration (Safe)
|
|
166
|
-
* ```bash
|
|
167
|
-
* fern generator upgrade
|
|
168
|
-
* ```
|
|
169
|
-
* Result: Keeps yarn and Jest, no workflow changes needed.
|
|
170
|
-
*
|
|
171
|
-
* ### Step 2: Install pnpm (Optional)
|
|
172
|
-
* ```bash
|
|
173
|
-
* npm install -g pnpm@latest
|
|
174
|
-
* ```
|
|
175
|
-
*
|
|
176
|
-
* ### Step 3: Adopt Modern Tooling (Optional)
|
|
177
|
-
* Edit `generators.yml`:
|
|
178
|
-
* ```yaml
|
|
179
|
-
* config: {} # Use pnpm + vitest
|
|
180
|
-
* ```
|
|
181
|
-
*
|
|
182
|
-
* ### Step 4: Update CI/CD (Optional)
|
|
183
|
-
* Update CI scripts to use pnpm:
|
|
184
|
-
* ```yaml
|
|
185
|
-
* # GitHub Actions example
|
|
186
|
-
* - uses: pnpm/action-setup@v2
|
|
187
|
-
* with:
|
|
188
|
-
* version: 8
|
|
189
|
-
* - run: pnpm install
|
|
190
|
-
* - run: pnpm test
|
|
191
|
-
* ```
|
|
192
|
-
*
|
|
193
|
-
* ### Step 5: Migrate yarn.lock (Optional)
|
|
194
|
-
* ```bash
|
|
195
|
-
* # Convert yarn.lock to pnpm-lock.yaml
|
|
196
|
-
* pnpm import
|
|
197
|
-
* rm yarn.lock
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* ## Troubleshooting
|
|
201
|
-
*
|
|
202
|
-
* ### "pnpm: command not found"
|
|
203
|
-
* **Cause:** pnpm not installed globally.
|
|
204
|
-
* **Solution:** Install pnpm: `npm install -g pnpm`
|
|
205
|
-
*
|
|
206
|
-
* ### Vitest errors with BigInt
|
|
207
|
-
* **Cause:** Vitest and BigInt serialization incompatibility.
|
|
208
|
-
* **Solution:** Use `testFramework: jest` in config.
|
|
209
|
-
*
|
|
210
|
-
* ### Module resolution errors with Vitest
|
|
211
|
-
* **Cause:** ESM/CommonJS compatibility issues.
|
|
212
|
-
* **Solution:** Either fix module format or use `testFramework: jest`.
|
|
213
|
-
*
|
|
214
|
-
* ### Tests fail after switching to Vitest
|
|
215
|
-
* **Cause:** Vitest has stricter ESM requirements.
|
|
216
|
-
* **Solution:** Ensure `package.json` has `"type": "module"` or use `.ts` extensions.
|
|
217
|
-
*
|
|
218
|
-
* ## Performance Comparison
|
|
219
|
-
*
|
|
220
|
-
* Based on typical SDK project (50 tests, 1000 LOC):
|
|
221
|
-
*
|
|
222
|
-
* **Install Time:**
|
|
223
|
-
* - yarn: ~15s
|
|
224
|
-
* - pnpm: ~5s (3x faster)
|
|
225
|
-
*
|
|
226
|
-
* **Test Execution:**
|
|
227
|
-
* - Jest: ~8s
|
|
228
|
-
* - Vitest: ~0.8s (10x faster)
|
|
229
|
-
*
|
|
230
|
-
* **Disk Usage:**
|
|
231
|
-
* - yarn: ~200MB node_modules
|
|
232
|
-
* - pnpm: ~80MB node_modules (60% reduction)
|
|
233
|
-
*
|
|
234
|
-
* ## Recommendations
|
|
235
|
-
*
|
|
236
|
-
* - **New projects**: Use the new defaults (pnpm + Vitest)
|
|
237
|
-
* - **Existing projects**: Keep old defaults initially, migrate when convenient
|
|
238
|
-
* - **CI/CD-heavy projects**: Consider pnpm for faster installs
|
|
239
|
-
* - **Projects with BigInt**: Keep Jest until Vitest improves BigInt support
|
|
240
|
-
*/
|
|
241
|
-
export const migration_3_0_0 = {
|
|
242
|
-
version: "3.0.0",
|
|
243
|
-
migrateGeneratorConfig: ({ config }) => migrateConfig(config, (draft) => {
|
|
244
|
-
// Only set old defaults if the fields are not already explicitly configured
|
|
245
|
-
draft.packageManager ??= "yarn";
|
|
246
|
-
draft.testFramework ??= "jest";
|
|
247
|
-
}),
|
|
248
|
-
migrateGeneratorsYml: ({ document }) => document
|
|
249
|
-
};
|
|
250
|
-
//# sourceMappingURL=3.0.0.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3.0.0.js","sourceRoot":"","sources":["../../../../src/generators/typescript/migrations/3.0.0.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8OG;AACH,MAAM,CAAC,MAAM,eAAe,GAAc;IACtC,OAAO,EAAE,OAAO;IAEhB,sBAAsB,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CACnC,aAAa,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;QAC5B,4EAA4E;QAC5E,KAAK,CAAC,cAAc,KAAK,MAAM,CAAC;QAChC,KAAK,CAAC,aAAa,KAAK,MAAM,CAAC;IACnC,CAAC,CAAC;IAEN,oBAAoB,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ;CACnD,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { MigrationModule } from "@fern-api/migrations-base";
|
|
2
|
-
/**
|
|
3
|
-
* Migration module for TypeScript SDK generators.
|
|
4
|
-
*
|
|
5
|
-
* This module contains migrations for configuration changes across
|
|
6
|
-
* all TypeScript SDK generator variants:
|
|
7
|
-
* - fernapi/fern-typescript
|
|
8
|
-
* - fernapi/fern-typescript-sdk
|
|
9
|
-
* - fernapi/fern-typescript-node-sdk
|
|
10
|
-
* - fernapi/fern-typescript-browser-sdk
|
|
11
|
-
*
|
|
12
|
-
* Each migration is defined in a separate file under this directory.
|
|
13
|
-
* Migrations are automatically applied by the Fern CLI when running:
|
|
14
|
-
* `fern generator upgrade --generator typescript-sdk`
|
|
15
|
-
*/
|
|
16
|
-
declare const migrationModule: MigrationModule;
|
|
17
|
-
export default migrationModule;
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/generators/typescript/migrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAMjE;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,eAAe,EAAE,eAEtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { migration_1_0_0 } from "./1.0.0.js";
|
|
2
|
-
import { migration_2_0_0 } from "./2.0.0.js";
|
|
3
|
-
import { migration_3_0_0 } from "./3.0.0.js";
|
|
4
|
-
/**
|
|
5
|
-
* Migration module for TypeScript SDK generators.
|
|
6
|
-
*
|
|
7
|
-
* This module contains migrations for configuration changes across
|
|
8
|
-
* all TypeScript SDK generator variants:
|
|
9
|
-
* - fernapi/fern-typescript
|
|
10
|
-
* - fernapi/fern-typescript-sdk
|
|
11
|
-
* - fernapi/fern-typescript-node-sdk
|
|
12
|
-
* - fernapi/fern-typescript-browser-sdk
|
|
13
|
-
*
|
|
14
|
-
* Each migration is defined in a separate file under this directory.
|
|
15
|
-
* Migrations are automatically applied by the Fern CLI when running:
|
|
16
|
-
* `fern generator upgrade --generator typescript-sdk`
|
|
17
|
-
*/
|
|
18
|
-
const migrationModule = {
|
|
19
|
-
migrations: [migration_1_0_0, migration_2_0_0, migration_3_0_0]
|
|
20
|
-
};
|
|
21
|
-
export default migrationModule;
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generators/typescript/migrations/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;;;;;;;;;;GAaG;AACH,MAAM,eAAe,GAAoB;IACrC,UAAU,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,eAAe,CAAC;CAClE,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/lib/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fern-api/generator-migrations
|
|
3
|
-
*
|
|
4
|
-
* Unified migration package for all Fern generator configurations.
|
|
5
|
-
*
|
|
6
|
-
* This package contains migrations for all generators, organized by generator name.
|
|
7
|
-
*/
|
|
8
|
-
import type { MigrationModule } from "@fern-api/migrations-base";
|
|
9
|
-
/**
|
|
10
|
-
* All generator migrations indexed by full generator name.
|
|
11
|
-
*
|
|
12
|
-
* When adding migrations for a new generator:
|
|
13
|
-
* 1. Add migrations under src/generators/{language}/migrations/
|
|
14
|
-
* 2. Import the migration module
|
|
15
|
-
* 3. Add entries for all generator name variants
|
|
16
|
-
*/
|
|
17
|
-
export declare const migrations: Record<string, MigrationModule>;
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAMtD,CAAC"}
|
package/lib/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fern-api/generator-migrations
|
|
3
|
-
*
|
|
4
|
-
* Unified migration package for all Fern generator configurations.
|
|
5
|
-
*
|
|
6
|
-
* This package contains migrations for all generators, organized by generator name.
|
|
7
|
-
*/
|
|
8
|
-
import typescriptSdkMigrations from "./generators/typescript/migrations/index.js";
|
|
9
|
-
/**
|
|
10
|
-
* All generator migrations indexed by full generator name.
|
|
11
|
-
*
|
|
12
|
-
* When adding migrations for a new generator:
|
|
13
|
-
* 1. Add migrations under src/generators/{language}/migrations/
|
|
14
|
-
* 2. Import the migration module
|
|
15
|
-
* 3. Add entries for all generator name variants
|
|
16
|
-
*/
|
|
17
|
-
export const migrations = {
|
|
18
|
-
// TypeScript SDK - all variants share the same migrations
|
|
19
|
-
"fernapi/fern-typescript": typescriptSdkMigrations,
|
|
20
|
-
"fernapi/fern-typescript-sdk": typescriptSdkMigrations,
|
|
21
|
-
"fernapi/fern-typescript-node-sdk": typescriptSdkMigrations,
|
|
22
|
-
"fernapi/fern-typescript-browser-sdk": typescriptSdkMigrations
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,uBAAuB,MAAM,6CAA6C,CAAC;AAElF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAoC;IACvD,0DAA0D;IAC1D,yBAAyB,EAAE,uBAAuB;IAClD,6BAA6B,EAAE,uBAAuB;IACtD,kCAAkC,EAAE,uBAAuB;IAC3D,qCAAqC,EAAE,uBAAuB;CACjE,CAAC"}
|