@friggframework/devtools 2.0.0--canary.731.44132f0.0 → 2.0.0--canary.731.1c0b281.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.
package/infrastructure/README.md
CHANGED
|
@@ -323,7 +323,7 @@ Before you flip an app to `arm64`:
|
|
|
323
323
|
- The deploy host must reach Prisma's engine CDN (`binaries.prisma.sh`) at package time: the migration worker's engines for the target are fetched there, and packaging fails if either is missing.
|
|
324
324
|
- This runs on every compose where the migration worker is enabled, and downloads only when the target's engines are missing from the app's `node_modules/@prisma/engines`.
|
|
325
325
|
- Air-gapped or offline deploy hosts set `PRISMA_ENGINES_MIRROR` to an internal mirror of the CDN. Prisma's download honours it (`@prisma/fetch-engine` 6.19.3, `dist/chunk-LONQL55G.js`, where the download URL is built from `PRISMA_BINARIES_MIRROR || PRISMA_ENGINES_MIRROR || "https://binaries.prisma.sh"`).
|
|
326
|
-
- The app must have `prisma` installed in its own `node_modules`, not only in a hoisted parent: the worker ships its engines from there, and packaging fails otherwise. The worker pins `PRISMA_SCHEMA_ENGINE_BINARY` and `PRISMA_QUERY_ENGINE_LIBRARY` to that `@prisma/engines`, so its
|
|
326
|
+
- The app must have `prisma` installed in its own `node_modules`, not only in a hoisted parent: the worker ships its engines from there, and packaging fails otherwise. The worker runs the app's own `prisma` CLI and pins `PRISMA_SCHEMA_ENGINE_BINARY` and `PRISMA_QUERY_ENGINE_LIBRARY` to that `@prisma/engines`, so the CLI and its engines always agree. That `prisma` must still be able to run the schema and migrations of `@friggframework/core`.
|
|
327
327
|
- Published core carries one more query engine per generated client (about 15 MB unpacked each).
|
|
328
328
|
- Native addons of the app itself (`sharp`, `bcrypt`, and the like) are built for the deploy host's architecture by `npm ci`, not for the target. Build them for arm64 or replace them.
|
|
329
329
|
- During the stack update, functions run mixed for a short time, so flip in a low-traffic window.
|
|
@@ -31,16 +31,21 @@ function resolveEnginesDir(cwd) {
|
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Runs the @prisma/engines postinstall for one target. It downloads only
|
|
34
|
-
* the engines that are missing, so the host's own engines stay.
|
|
34
|
+
* the engines that are missing, so the host's own engines stay. The host's
|
|
35
|
+
* pinned engine paths are hidden from it: with them set, the postinstall
|
|
36
|
+
* skips those engines instead of downloading them.
|
|
35
37
|
*/
|
|
36
38
|
function runEnginesPostinstall({ enginesDir, prismaBinaryTarget }) {
|
|
39
|
+
const hostEnv = { ...process.env };
|
|
40
|
+
delete hostEnv.PRISMA_SCHEMA_ENGINE_BINARY;
|
|
41
|
+
delete hostEnv.PRISMA_QUERY_ENGINE_LIBRARY;
|
|
37
42
|
execFileSync(
|
|
38
43
|
process.execPath,
|
|
39
44
|
[path.join(enginesDir, 'scripts', 'postinstall.js')],
|
|
40
45
|
{
|
|
41
46
|
cwd: enginesDir,
|
|
42
47
|
stdio: 'inherit',
|
|
43
|
-
env: { ...
|
|
48
|
+
env: { ...hostEnv, PRISMA_CLI_BINARY_TARGETS: prismaBinaryTarget },
|
|
44
49
|
}
|
|
45
50
|
);
|
|
46
51
|
}
|
|
@@ -103,4 +103,40 @@ describe('ensureMigrationEngines()', () => {
|
|
|
103
103
|
expect(fetchEngines).not.toHaveBeenCalled();
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
|
+
|
|
107
|
+
describe('running the @prisma/engines postinstall', () => {
|
|
108
|
+
const pinnedEngineVars = ['PRISMA_SCHEMA_ENGINE_BINARY', 'PRISMA_QUERY_ENGINE_LIBRARY'];
|
|
109
|
+
let appDir;
|
|
110
|
+
let seenEnvPath;
|
|
111
|
+
|
|
112
|
+
beforeEach(() => {
|
|
113
|
+
appDir = fs.mkdtempSync(path.join(os.tmpdir(), 'frigg-app-'));
|
|
114
|
+
const engines = path.join(appDir, 'node_modules', '@prisma', 'engines');
|
|
115
|
+
fs.mkdirSync(path.join(engines, 'scripts'), { recursive: true });
|
|
116
|
+
seenEnvPath = path.join(appDir, 'seen-env.json');
|
|
117
|
+
fs.writeFileSync(
|
|
118
|
+
path.join(engines, 'scripts', 'postinstall.js'),
|
|
119
|
+
`const fs = require('fs');
|
|
120
|
+
fs.writeFileSync(${JSON.stringify(seenEnvPath)}, JSON.stringify(process.env));
|
|
121
|
+
for (const name of ${JSON.stringify([schemaEngine, queryEngineLibrary])}) fs.writeFileSync(name, '');`
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
afterEach(() => {
|
|
126
|
+
fs.rmSync(appDir, { recursive: true, force: true });
|
|
127
|
+
pinnedEngineVars.forEach((name) => delete process.env[name]);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("hides the host's pinned engine paths, so the postinstall does not skip the download", async () => {
|
|
131
|
+
pinnedEngineVars.forEach((name) => {
|
|
132
|
+
process.env[name] = `/host/${name}`;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
await ensureMigrationEngines({ prismaBinaryTarget: target, cwd: appDir });
|
|
136
|
+
|
|
137
|
+
const seenEnv = JSON.parse(fs.readFileSync(seenEnvPath, 'utf-8'));
|
|
138
|
+
expect(seenEnv.PRISMA_CLI_BINARY_TARGETS).toBe(target);
|
|
139
|
+
pinnedEngineVars.forEach((name) => expect(seenEnv).not.toHaveProperty(name));
|
|
140
|
+
});
|
|
141
|
+
});
|
|
106
142
|
});
|
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.731.
|
|
4
|
+
"version": "2.0.0--canary.731.1c0b281.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"frigg": "./frigg-cli/index.js"
|
|
7
7
|
},
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@babel/eslint-parser": "^7.18.9",
|
|
29
29
|
"@babel/parser": "^7.25.3",
|
|
30
30
|
"@babel/traverse": "^7.25.3",
|
|
31
|
-
"@friggframework/core": "2.0.0--canary.731.
|
|
32
|
-
"@friggframework/schemas": "2.0.0--canary.731.
|
|
33
|
-
"@friggframework/test": "2.0.0--canary.731.
|
|
31
|
+
"@friggframework/core": "2.0.0--canary.731.1c0b281.0",
|
|
32
|
+
"@friggframework/schemas": "2.0.0--canary.731.1c0b281.0",
|
|
33
|
+
"@friggframework/test": "2.0.0--canary.731.1c0b281.0",
|
|
34
34
|
"@hapi/boom": "^10.0.1",
|
|
35
35
|
"@inquirer/prompts": "^5.3.8",
|
|
36
36
|
"axios": "^1.18.0",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"validate-npm-package-name": "^5.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@friggframework/eslint-config": "2.0.0--canary.731.
|
|
62
|
-
"@friggframework/prettier-config": "2.0.0--canary.731.
|
|
61
|
+
"@friggframework/eslint-config": "2.0.0--canary.731.1c0b281.0",
|
|
62
|
+
"@friggframework/prettier-config": "2.0.0--canary.731.1c0b281.0",
|
|
63
63
|
"aws-sdk-client-mock": "^4.1.0",
|
|
64
64
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
65
65
|
"jest": "^30.1.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "1c0b281b7ee4a47cff0a73cc2736a380a839517b"
|
|
95
95
|
}
|