@friggframework/devtools 2.0.0--canary.461.630a739.0 → 2.0.0--canary.461.72f71f4.0
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.
|
@@ -104,11 +104,17 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
104
104
|
|
|
105
105
|
console.log(' ✓ Created DbMigrationQueue resource');
|
|
106
106
|
|
|
107
|
-
// Package configuration for migration
|
|
108
|
-
const
|
|
107
|
+
// Package configuration for migration WORKER (needs Prisma CLI with WASM)
|
|
108
|
+
const migrationWorkerPackageConfig = {
|
|
109
109
|
individually: true,
|
|
110
110
|
exclude: [
|
|
111
|
-
// Exclude
|
|
111
|
+
// Exclude Prisma runtime client - it's in the Lambda Layer
|
|
112
|
+
'node_modules/@prisma/client/**',
|
|
113
|
+
'node_modules/.prisma/**',
|
|
114
|
+
'node_modules/@friggframework/core/generated/**',
|
|
115
|
+
// But KEEP node_modules/prisma/** (the CLI with WASM)
|
|
116
|
+
|
|
117
|
+
// Same base exclusions as router
|
|
112
118
|
'node_modules/**/node_modules/**',
|
|
113
119
|
'node_modules/aws-sdk/**',
|
|
114
120
|
'node_modules/@aws-sdk/**',
|
|
@@ -132,9 +138,8 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
132
138
|
'node_modules/prettier/**',
|
|
133
139
|
'node_modules/eslint/**',
|
|
134
140
|
'node_modules/@friggframework/core/generated/prisma-mongodb/**',
|
|
135
|
-
|
|
141
|
+
'node_modules/@friggframework/core/integrations/**',
|
|
136
142
|
'node_modules/@friggframework/core/user/**',
|
|
137
|
-
// Note: DO NOT exclude handlers/routers/** or handlers/workers/** - migration functions need them!
|
|
138
143
|
'**/query-engine-darwin*',
|
|
139
144
|
'**/schema-engine-darwin*',
|
|
140
145
|
'**/libquery_engine-darwin*',
|
|
@@ -160,16 +165,72 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
160
165
|
],
|
|
161
166
|
};
|
|
162
167
|
|
|
168
|
+
// Package configuration for migration ROUTER (doesn't need Prisma CLI)
|
|
169
|
+
const migrationRouterPackageConfig = {
|
|
170
|
+
individually: true,
|
|
171
|
+
exclude: [
|
|
172
|
+
// Same base exclusions but EXCLUDE all WASM (router doesn't run migrations)
|
|
173
|
+
'node_modules/**/node_modules/**',
|
|
174
|
+
'node_modules/aws-sdk/**',
|
|
175
|
+
'node_modules/@aws-sdk/**',
|
|
176
|
+
'node_modules/esbuild/**',
|
|
177
|
+
'node_modules/@esbuild/**',
|
|
178
|
+
'node_modules/typescript/**',
|
|
179
|
+
'node_modules/webpack/**',
|
|
180
|
+
'node_modules/osls/**',
|
|
181
|
+
'node_modules/serverless-esbuild/**',
|
|
182
|
+
'node_modules/serverless-jetpack/**',
|
|
183
|
+
'node_modules/serverless-offline/**',
|
|
184
|
+
'node_modules/serverless-offline-sqs/**',
|
|
185
|
+
'node_modules/serverless-dotenv-plugin/**',
|
|
186
|
+
'node_modules/serverless-kms-grants/**',
|
|
187
|
+
'node_modules/@friggframework/test/**',
|
|
188
|
+
'node_modules/@friggframework/eslint-config/**',
|
|
189
|
+
'node_modules/@friggframework/prettier-config/**',
|
|
190
|
+
'node_modules/@friggframework/devtools/**',
|
|
191
|
+
'node_modules/@friggframework/serverless-plugin/**',
|
|
192
|
+
'node_modules/jest/**',
|
|
193
|
+
'node_modules/prettier/**',
|
|
194
|
+
'node_modules/eslint/**',
|
|
195
|
+
'node_modules/@friggframework/core/generated/prisma-mongodb/**',
|
|
196
|
+
// Note: DO NOT exclude integrations/** - migration router needs process-repository-factory
|
|
197
|
+
'node_modules/@friggframework/core/user/**',
|
|
198
|
+
// Note: DO NOT exclude handlers/routers/** or handlers/workers/** - migration functions need them!
|
|
199
|
+
'**/query-engine-darwin*',
|
|
200
|
+
'**/schema-engine-darwin*',
|
|
201
|
+
'**/libquery_engine-darwin*',
|
|
202
|
+
'**/*-darwin-arm64*',
|
|
203
|
+
'**/*-darwin*',
|
|
204
|
+
// Router doesn't run migrations - exclude ALL WASM files
|
|
205
|
+
'**/runtime/*.wasm',
|
|
206
|
+
'**/*.wasm*', // Exclude all WASM (Prisma CLI + query engine)
|
|
207
|
+
'src/**',
|
|
208
|
+
'test/**',
|
|
209
|
+
'layers/**',
|
|
210
|
+
'coverage/**',
|
|
211
|
+
'deploy.log',
|
|
212
|
+
'.env.backup',
|
|
213
|
+
'docker-compose.yml',
|
|
214
|
+
'jest.config.js',
|
|
215
|
+
'jest.unit.config.js',
|
|
216
|
+
'package-lock.json',
|
|
217
|
+
'**/*.test.js',
|
|
218
|
+
'**/*.spec.js',
|
|
219
|
+
'**/.claude-flow/**',
|
|
220
|
+
'**/.swarm/**',
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
|
|
163
224
|
// Create migration worker Lambda (triggered by SQS)
|
|
164
225
|
result.functions.dbMigrationWorker = {
|
|
165
226
|
handler: 'node_modules/@friggframework/core/handlers/workers/db-migration.handler',
|
|
166
|
-
layers: [{ Ref: 'PrismaLambdaLayer' }],
|
|
227
|
+
layers: [{ Ref: 'PrismaLambdaLayer' }], // Use layer for Prisma client runtime
|
|
167
228
|
skipEsbuild: true,
|
|
168
229
|
timeout: 900, // 15 minutes for long migrations
|
|
169
230
|
memorySize: 1024, // Extra memory for Prisma operations
|
|
170
231
|
reservedConcurrency: 1, // Process one migration at a time (critical for safety)
|
|
171
232
|
description: 'Database migration worker (triggered by SQS queue)',
|
|
172
|
-
package:
|
|
233
|
+
package: migrationWorkerPackageConfig,
|
|
173
234
|
environment: {
|
|
174
235
|
// Ensure migration functions get DATABASE_URL from provider.environment
|
|
175
236
|
// Note: Serverless will merge this with provider.environment
|
|
@@ -194,7 +255,7 @@ class MigrationBuilder extends InfrastructureBuilder {
|
|
|
194
255
|
timeout: 30, // Router just queues jobs, doesn't run migrations
|
|
195
256
|
memorySize: 512,
|
|
196
257
|
description: 'Database migration HTTP API (POST to trigger, GET to check status)',
|
|
197
|
-
package:
|
|
258
|
+
package: migrationRouterPackageConfig,
|
|
198
259
|
environment: {
|
|
199
260
|
// Ensure migration functions get DATABASE_URL from provider.environment
|
|
200
261
|
// Note: Serverless will merge this with provider.environment
|
|
@@ -183,36 +183,29 @@ describe('MigrationBuilder', () => {
|
|
|
183
183
|
|
|
184
184
|
const result = await builder.build(appDef, {});
|
|
185
185
|
|
|
186
|
-
//
|
|
186
|
+
// Worker and router now have DIFFERENT package configs (split for size optimization)
|
|
187
187
|
expect(result.functions.dbMigrationWorker.package).toBeDefined();
|
|
188
188
|
expect(result.functions.dbMigrationRouter.package).toBeDefined();
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
expect(
|
|
196
|
-
expect(
|
|
197
|
-
|
|
198
|
-
//
|
|
199
|
-
expect(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
expect(
|
|
203
|
-
expect(
|
|
204
|
-
expect(
|
|
205
|
-
expect(packageConfig.exclude).toContain('src/**'); // Migration handlers don't need backend source
|
|
206
|
-
|
|
207
|
-
// Should NOT exclude generated Prisma clients/schemas - worker needs them
|
|
208
|
-
expect(packageConfig.exclude).not.toContain('node_modules/@friggframework/core/generated/**');
|
|
189
|
+
expect(result.functions.dbMigrationWorker.package).not.toBe(result.functions.dbMigrationRouter.package);
|
|
190
|
+
|
|
191
|
+
const workerPackage = result.functions.dbMigrationWorker.package;
|
|
192
|
+
const routerPackage = result.functions.dbMigrationRouter.package;
|
|
193
|
+
|
|
194
|
+
// Verify worker excludes Prisma client (in layer) but keeps CLI
|
|
195
|
+
expect(workerPackage.exclude).toContain('node_modules/@prisma/client/**');
|
|
196
|
+
expect(workerPackage.exclude).toContain('node_modules/@friggframework/core/generated/**');
|
|
197
|
+
|
|
198
|
+
// Verify router excludes ALL WASM files (doesn't run migrations)
|
|
199
|
+
expect(routerPackage.exclude).toContain('**/*.wasm*');
|
|
200
|
+
|
|
201
|
+
// Verify common exclusions for both
|
|
202
|
+
expect(workerPackage.exclude).toContain('node_modules/**/node_modules/**');
|
|
203
|
+
expect(workerPackage.exclude).toContain('**/*.test.js');
|
|
204
|
+
expect(workerPackage.exclude).toContain('src/**');
|
|
209
205
|
|
|
210
206
|
// Should NOT exclude migration handlers - they're needed!
|
|
211
|
-
expect(
|
|
212
|
-
expect(
|
|
213
|
-
|
|
214
|
-
// Should NOT exclude integrations module - migration router needs process-repository-factory
|
|
215
|
-
expect(packageConfig.exclude).not.toContain('node_modules/@friggframework/core/integrations/**');
|
|
207
|
+
expect(workerPackage.exclude).not.toContain('node_modules/@friggframework/core/handlers/routers/**');
|
|
208
|
+
expect(workerPackage.exclude).not.toContain('node_modules/@friggframework/core/handlers/workers/**');
|
|
216
209
|
});
|
|
217
210
|
|
|
218
211
|
it('should add queue URL to environment', async () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.461.
|
|
4
|
+
"version": "2.0.0--canary.461.72f71f4.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-ec2": "^3.835.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.835.0",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"@babel/eslint-parser": "^7.18.9",
|
|
12
12
|
"@babel/parser": "^7.25.3",
|
|
13
13
|
"@babel/traverse": "^7.25.3",
|
|
14
|
-
"@friggframework/schemas": "2.0.0--canary.461.
|
|
15
|
-
"@friggframework/test": "2.0.0--canary.461.
|
|
14
|
+
"@friggframework/schemas": "2.0.0--canary.461.72f71f4.0",
|
|
15
|
+
"@friggframework/test": "2.0.0--canary.461.72f71f4.0",
|
|
16
16
|
"@hapi/boom": "^10.0.1",
|
|
17
17
|
"@inquirer/prompts": "^5.3.8",
|
|
18
18
|
"axios": "^1.7.2",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"serverless-http": "^2.7.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@friggframework/eslint-config": "2.0.0--canary.461.
|
|
38
|
-
"@friggframework/prettier-config": "2.0.0--canary.461.
|
|
37
|
+
"@friggframework/eslint-config": "2.0.0--canary.461.72f71f4.0",
|
|
38
|
+
"@friggframework/prettier-config": "2.0.0--canary.461.72f71f4.0",
|
|
39
39
|
"aws-sdk-client-mock": "^4.1.0",
|
|
40
40
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
41
41
|
"jest": "^30.1.3",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "72f71f44658fc1a13dbafc12fd1467ae4a471d4c"
|
|
74
74
|
}
|