v3: Copy over more of the project's package.json keys into the deployed package.json (support for custom config like zenstack)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"trigger.dev": patch
|
||||
---
|
||||
|
||||
v3: Copy over more of the project's package.json keys into the deployed package.json (support for custom config like zenstack)
|
||||
@@ -1317,9 +1317,7 @@ async function compileProject(
|
||||
logger.debug("gatherRequiredDependencies()", { dependencies });
|
||||
|
||||
const packageJsonContents = {
|
||||
name: "trigger-worker",
|
||||
version: "0.0.0",
|
||||
description: "",
|
||||
...javascriptProject.allowedPackageJson,
|
||||
dependencies,
|
||||
scripts: {
|
||||
...javascriptProject.scripts,
|
||||
|
||||
@@ -26,10 +26,58 @@ export class JavascriptProject {
|
||||
return this._packageJson;
|
||||
}
|
||||
|
||||
public get allowedPackageJson(): Record<string, unknown> {
|
||||
const disallowedKeys = [
|
||||
"scripts",
|
||||
"devDependencies",
|
||||
"dependencies",
|
||||
"peerDependencies",
|
||||
"author",
|
||||
"contributors",
|
||||
"funding",
|
||||
"bugs",
|
||||
"files",
|
||||
"keywords",
|
||||
"main",
|
||||
"module",
|
||||
"type",
|
||||
"bin",
|
||||
"browser",
|
||||
"man",
|
||||
"directories",
|
||||
"repository",
|
||||
"peerDependenciesMeta",
|
||||
"optionalDependencies",
|
||||
"engines",
|
||||
"os",
|
||||
"cpu",
|
||||
"private",
|
||||
"publishConfig",
|
||||
"workspaces",
|
||||
];
|
||||
|
||||
return Object.keys(this.packageJson).reduce(
|
||||
(acc, key) => {
|
||||
if (!disallowedKeys.includes(key)) {
|
||||
acc[key] = this.packageJson[key];
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, unknown>
|
||||
);
|
||||
}
|
||||
|
||||
public get scripts(): Record<string, string> {
|
||||
return {
|
||||
postinstall: this.packageJson.scripts?.postinstall ?? "",
|
||||
};
|
||||
return this.#filterScripts();
|
||||
}
|
||||
|
||||
#filterScripts(): Record<string, string> {
|
||||
if (!this.packageJson.scripts || typeof this.packageJson.scripts !== "object") {
|
||||
return {};
|
||||
}
|
||||
|
||||
return this.packageJson.scripts as Record<string, string>;
|
||||
}
|
||||
|
||||
async install(): Promise<void> {
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
"name": "@references/v3-catalog",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"zenstack": {
|
||||
"schema": "./prisma/schema.zmodel"
|
||||
},
|
||||
"scripts": {
|
||||
"dev:trigger": "triggerdev dev",
|
||||
"management": "ts-node -r tsconfig-paths/register ./src/management.ts",
|
||||
|
||||
Reference in New Issue
Block a user