v3: Prevent legacy-peer-deps=true from breaking deploys

This commit is contained in:
Eric Allam
2024-05-22 15:46:13 +01:00
parent a86f36cefa
commit c092c0f9db
4 changed files with 39 additions and 12 deletions
+7
View File
@@ -0,0 +1,7 @@
---
"trigger.dev": patch
---
v3: Prevent legacy-peer-deps=true from breaking deploys
When a global `.npmrc` file includes `legacy-peer-deps=true`, deploys would fail on the `npm ci` step because the package-lock.json wouldn't match the `package.json` file. This is because inside the image build, the `.npmrc` file would not be picked up and so `legacy-peer-deps` would end up being false (which is the default). This change forces the `package-lock.json` file to be created using `legacy-peer-deps=false`
+25 -4
View File
@@ -1452,10 +1452,31 @@ async function resolveDependencies(
logger.debug(`No cached package-lock.json found for ${digest}`);
try {
await execa("npm", ["install", "--package-lock-only", "--ignore-scripts", "--no-audit"], {
cwd: projectDir,
stdio: logger.loggerLevel === "debug" ? "inherit" : "pipe",
});
if (logger.loggerLevel === "debug") {
const childProcess = await execa("npm", ["config", "list"], {
cwd: projectDir,
stdio: "inherit",
});
logger.debug("npm config list");
console.log(childProcess.stdout);
}
await execa(
"npm",
[
"install",
"--package-lock-only",
"--ignore-scripts",
"--no-audit",
"--legacy-peer-deps=false",
"--strict-peer-deps=false",
],
{
cwd: projectDir,
stdio: logger.loggerLevel === "debug" ? "inherit" : "pipe",
}
);
const packageLockContents = await readFile(join(projectDir, "package-lock.json"), "utf-8");
+6 -7
View File
@@ -3096,8 +3096,8 @@ importers:
specifier: ^2.2.1
version: 2.2.1(typescript@5.3.3)
openai:
specifier: ^4.28.0
version: 4.28.0
specifier: ^4.47.0
version: 4.47.1
pg:
specifier: ^8.11.5
version: 8.11.5
@@ -28164,15 +28164,14 @@ packages:
- encoding
dev: false
/openai@4.28.0:
resolution: {integrity: sha512-JM8fhcpmpGN0vrUwGquYIzdcEQHtFuom6sRCbbCM6CfzZXNuRk33G7KfeRAIfnaCxSpzrP5iHtwJzIm6biUZ2Q==}
/openai@4.33.1:
resolution: {integrity: sha512-0DH572aSxGTT1JPOXgJQ9mjiuSPg/7scPot8hLc5I1mfQxPxLXTZWJpWerKaIWOuPkR2nrB0SamGDEehH8RuWA==}
hasBin: true
dependencies:
'@types/node': 18.19.20
'@types/node-fetch': 2.6.4
abort-controller: 3.0.0
agentkeepalive: 4.5.0
digest-fetch: 1.3.0
form-data-encoder: 1.7.2
formdata-node: 4.4.1
node-fetch: 2.6.12
@@ -28181,8 +28180,8 @@ packages:
- encoding
dev: false
/openai@4.33.1:
resolution: {integrity: sha512-0DH572aSxGTT1JPOXgJQ9mjiuSPg/7scPot8hLc5I1mfQxPxLXTZWJpWerKaIWOuPkR2nrB0SamGDEehH8RuWA==}
/openai@4.47.1:
resolution: {integrity: sha512-WWSxhC/69ZhYWxH/OBsLEirIjUcfpQ5+ihkXKp06hmeYXgBBIUCa9IptMzYx6NdkiOCsSGYCnTIsxaic3AjRCQ==}
hasBin: true
dependencies:
'@types/node': 18.19.20
+1 -1
View File
@@ -19,7 +19,7 @@
"dotenv": "^16.4.5",
"execa": "^8.0.1",
"msw": "^2.2.1",
"openai": "^4.28.0",
"openai": "^4.47.0",
"pg": "^8.11.5",
"react": "^18.2.0",
"react-email": "^1.6.1",