@friggframework/devtools 2.0.0--canary.454.1c50057.0 → 2.0.0--canary.454.16de0f8.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.
@@ -24,20 +24,42 @@ const fs = require('fs-extra');
24
24
  const path = require('path');
25
25
  const { execSync } = require('child_process');
26
26
 
27
+ /**
28
+ * Find @friggframework/core package, handling workspace hoisting
29
+ * Searches up the directory tree to find node_modules/@friggframework/core
30
+ */
31
+ function findCorePackage(startDir) {
32
+ let currentDir = startDir;
33
+ const root = path.parse(currentDir).root;
34
+
35
+ while (currentDir !== root) {
36
+ const candidatePath = path.join(currentDir, 'node_modules/@friggframework/core');
37
+ if (fs.existsSync(candidatePath)) {
38
+ return candidatePath;
39
+ }
40
+ currentDir = path.dirname(currentDir);
41
+ }
42
+
43
+ throw new Error(
44
+ '@friggframework/core not found in node_modules.\n' +
45
+ 'Run "npm install" to install dependencies.'
46
+ );
47
+ }
48
+
27
49
  // Configuration
28
50
  // Script runs from integration project root (e.g., backend/)
29
51
  // and reads Prisma packages from @friggframework/core
30
52
  const PROJECT_ROOT = process.cwd();
31
- const CORE_PACKAGE_PATH = path.join(PROJECT_ROOT, 'node_modules/@friggframework/core');
53
+ const CORE_PACKAGE_PATH = findCorePackage(PROJECT_ROOT);
32
54
  const LAYER_OUTPUT_PATH = path.join(PROJECT_ROOT, 'layers/prisma');
33
55
  const LAYER_NODE_MODULES = path.join(LAYER_OUTPUT_PATH, 'nodejs/node_modules');
34
56
 
35
57
  // Packages to include in the layer
36
58
  const PRISMA_PACKAGES = [
37
- '@prisma/client',
38
- '@prisma-mongodb/client',
39
- '@prisma-postgresql/client',
40
- 'prisma', // CLI for migrations
59
+ '@prisma/client', // From project node_modules
60
+ 'generated/prisma-mongodb', // From @friggframework/core package
61
+ 'generated/prisma-postgresql', // From @friggframework/core package
62
+ 'prisma', // CLI from project node_modules
41
63
  ];
42
64
 
43
65
  // Binary patterns to remove (non-rhel)
@@ -123,13 +145,19 @@ async function createLayerStructure() {
123
145
  async function copyPrismaPackages() {
124
146
  logStep(3, 'Copying Prisma packages from @friggframework/core');
125
147
 
126
- // Prisma packages can be in:
127
- // 1. node_modules/@friggframework/core/node_modules/ (if core has its own)
128
- // 2. node_modules/ (if hoisted by npm/yarn to project root)
129
- const coreNodeModules = path.join(CORE_PACKAGE_PATH, 'node_modules');
130
- const projectNodeModules = path.join(PROJECT_ROOT, 'node_modules');
131
-
132
- const nodeModulesPaths = [coreNodeModules, projectNodeModules];
148
+ // Build search paths, handling workspace hoisting
149
+ // Packages can be in:
150
+ // 1. Core's own node_modules (if not hoisted)
151
+ // 2. Project root node_modules (if hoisted from project)
152
+ // 3. Workspace root node_modules (where core is located - handles hoisting)
153
+ // 4. Core package itself (for generated/ directories)
154
+ const workspaceNodeModules = path.join(path.dirname(CORE_PACKAGE_PATH), '..');
155
+ const searchPaths = [
156
+ path.join(CORE_PACKAGE_PATH, 'node_modules'), // Core's own node_modules
157
+ path.join(PROJECT_ROOT, 'node_modules'), // Project node_modules
158
+ workspaceNodeModules, // Workspace root node_modules
159
+ CORE_PACKAGE_PATH, // Core package itself (for generated/)
160
+ ];
133
161
 
134
162
  let copiedCount = 0;
135
163
  let missingPackages = [];
@@ -137,9 +165,9 @@ async function copyPrismaPackages() {
137
165
  for (const pkg of PRISMA_PACKAGES) {
138
166
  let sourcePath = null;
139
167
 
140
- // Try to find package in core or root node_modules
141
- for (const nodeModulesPath of nodeModulesPaths) {
142
- const candidatePath = path.join(nodeModulesPath, pkg);
168
+ // Try to find package in search paths
169
+ for (const searchPath of searchPaths) {
170
+ const candidatePath = path.join(searchPath, pkg);
143
171
  if (await fs.pathExists(candidatePath)) {
144
172
  sourcePath = candidatePath;
145
173
  break;
@@ -155,9 +183,11 @@ async function copyPrismaPackages() {
155
183
  return !src.includes('/node_modules/node_modules/');
156
184
  }
157
185
  });
158
- const fromLocation = sourcePath.includes('@friggframework/core/node_modules')
159
- ? 'core package'
160
- : 'project root';
186
+ const fromLocation = sourcePath.includes('@friggframework/core/generated')
187
+ ? 'core package (generated)'
188
+ : sourcePath.includes('@friggframework/core/node_modules')
189
+ ? 'core node_modules'
190
+ : 'workspace';
161
191
  logSuccess(`Copied ${pkg} (from ${fromLocation})`);
162
192
  copiedCount++;
163
193
  } else {
@@ -254,8 +284,8 @@ async function verifyLayerStructure() {
254
284
  const requiredPaths = [
255
285
  '@prisma/client/runtime',
256
286
  '@prisma/client/index.d.ts',
257
- '@prisma-mongodb/client/schema.prisma',
258
- '@prisma-postgresql/client/schema.prisma',
287
+ 'generated/prisma-mongodb/schema.prisma',
288
+ 'generated/prisma-postgresql/schema.prisma',
259
289
  'prisma/build',
260
290
  ];
261
291
 
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.454.1c50057.0",
4
+ "version": "2.0.0--canary.454.16de0f8.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.454.1c50057.0",
15
- "@friggframework/test": "2.0.0--canary.454.1c50057.0",
14
+ "@friggframework/schemas": "2.0.0--canary.454.16de0f8.0",
15
+ "@friggframework/test": "2.0.0--canary.454.16de0f8.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.454.1c50057.0",
38
- "@friggframework/prettier-config": "2.0.0--canary.454.1c50057.0",
37
+ "@friggframework/eslint-config": "2.0.0--canary.454.16de0f8.0",
38
+ "@friggframework/prettier-config": "2.0.0--canary.454.16de0f8.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": "1c5005735e6a245830ae658d28c0448c54bf0e6a"
73
+ "gitHead": "16de0f8e421d3d1b83cc686c3c1d3629169bc9a6"
74
74
  }