@mp-lb/arcnet 0.7.17 → 0.7.19

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.
Files changed (64) hide show
  1. package/README.md +10 -0
  2. package/dist/checkIdentity.d.ts.map +1 -1
  3. package/dist/checkIdentity.js +2 -0
  4. package/dist/checkIdentity.js.map +1 -1
  5. package/dist/checkProjectSettings.d.ts +3 -0
  6. package/dist/checkProjectSettings.d.ts.map +1 -0
  7. package/dist/checkProjectSettings.js +9 -0
  8. package/dist/checkProjectSettings.js.map +1 -0
  9. package/dist/createCli.d.ts.map +1 -1
  10. package/dist/createCli.js +1 -0
  11. package/dist/createCli.js.map +1 -1
  12. package/dist/createProject.d.ts +1 -1
  13. package/dist/createProject.d.ts.map +1 -1
  14. package/dist/createProject.js +6 -2
  15. package/dist/createProject.js.map +1 -1
  16. package/dist/deploy.d.ts.map +1 -1
  17. package/dist/deploy.js +17 -5
  18. package/dist/deploy.js.map +1 -1
  19. package/dist/readNodeVersion.d.ts +2 -0
  20. package/dist/readNodeVersion.d.ts.map +1 -0
  21. package/dist/readNodeVersion.js +11 -0
  22. package/dist/readNodeVersion.js.map +1 -0
  23. package/dist/resolveDeploymentProjects.d.ts +1 -1
  24. package/dist/resolveDeploymentProjects.d.ts.map +1 -1
  25. package/dist/resolveDeploymentProjects.js +9 -7
  26. package/dist/resolveDeploymentProjects.js.map +1 -1
  27. package/dist/resolveVercelSite.d.ts.map +1 -1
  28. package/dist/resolveVercelSite.js +17 -6
  29. package/dist/resolveVercelSite.js.map +1 -1
  30. package/dist/runVercel.d.ts.map +1 -1
  31. package/dist/runVercel.js +1 -1
  32. package/dist/runVercel.js.map +1 -1
  33. package/dist/secrets/writeSecretsWorkflow.js +3 -3
  34. package/dist/setupArcnet.d.ts.map +1 -1
  35. package/dist/setupArcnet.js +11 -4
  36. package/dist/setupArcnet.js.map +1 -1
  37. package/dist/setupVercel.d.ts.map +1 -1
  38. package/dist/setupVercel.js +8 -2
  39. package/dist/setupVercel.js.map +1 -1
  40. package/dist/vercelGitFiles.d.ts +3 -0
  41. package/dist/vercelGitFiles.d.ts.map +1 -0
  42. package/dist/vercelGitFiles.js +29 -0
  43. package/dist/vercelGitFiles.js.map +1 -0
  44. package/docs/public/llms-full.txt +10 -0
  45. package/environments/mp-lb.yaml +1 -1
  46. package/package.json +2 -2
  47. package/src/checkIdentity.ts +2 -0
  48. package/src/checkProjectSettings.ts +19 -0
  49. package/src/createCli.ts +1 -0
  50. package/src/createProject.ts +6 -1
  51. package/src/deploy.ts +37 -5
  52. package/src/readNodeVersion.ts +11 -0
  53. package/src/resolveDeploymentProjects.ts +38 -13
  54. package/src/resolveVercelSite.ts +32 -9
  55. package/src/runVercel.ts +2 -3
  56. package/src/secrets/writeSecretsWorkflow.ts +3 -3
  57. package/src/setupArcnet.ts +13 -3
  58. package/src/setupVercel.ts +9 -3
  59. package/src/vercelGitFiles.ts +45 -0
  60. package/templates/deploy-arc.yaml +10 -9
  61. package/templates/deploy-mixed.yaml +10 -9
  62. package/templates/deploy-vercel.yaml +7 -6
  63. package/templates/network.yaml +1 -1
  64. package/templates/vercel-static/module.yaml +5 -4
@@ -0,0 +1,29 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { safePath } from "./safePath.js";
4
+ export const vercelGitFiles = (root, config) => {
5
+ const files = new Map();
6
+ const roots = new Set([
7
+ ".",
8
+ ...Object.values(config.sites).map((site) => site.root ?? "."),
9
+ ]);
10
+ for (const directory of roots) {
11
+ const name = join(directory, "vercel.json");
12
+ const path = safePath(root, name);
13
+ if (existsSync(safePath(root, join(directory, "vercel.ts"))))
14
+ throw new Error(`ArcNet cannot safely edit ${directory}/vercel.ts. Configure its delivery policy and workflow manually; no parallel JSON config was written.`);
15
+ const current = existsSync(path)
16
+ ? JSON.parse(readFileSync(path, "utf8"))
17
+ : {};
18
+ if (!current || typeof current !== "object" || Array.isArray(current))
19
+ throw new Error(`Invalid Vercel config: ${name}.`);
20
+ const enabled = current.git?.deploymentEnabled;
21
+ if (enabled !== undefined && enabled !== false)
22
+ throw new Error(`Conflicting Git deployment policy in ${name}; set git.deploymentEnabled=false explicitly before using ArcNet delivery.`);
23
+ if (enabled === false)
24
+ continue;
25
+ files.set(name, JSON.stringify({ ...current, git: { ...current.git, deploymentEnabled: false } }, null, 2) + "\n");
26
+ }
27
+ return files;
28
+ };
29
+ //# sourceMappingURL=vercelGitFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vercelGitFiles.js","sourceRoot":"","sources":["../src/vercelGitFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,MAAoB,EAAE,EAAE;IACnE,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IAExC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC;QACpB,GAAG;QACH,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC;KAC/D,CAAC,CAAC;IAEH,KAAK,MAAM,SAAS,IAAI,KAAK,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;QAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;YAC1D,MAAM,IAAI,KAAK,CACb,6BAA6B,SAAS,uGAAuG,CAC9I,CAAC;QAEJ,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC;YAC9B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACxC,CAAC,CAAC,EAAE,CAAC;QAEP,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YACnE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,GAAG,CAAC,CAAC;QACrD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC;QAC/C,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK;YAC5C,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,4EAA4E,CACzH,CAAC;QACJ,IAAI,OAAO,KAAK,KAAK;YAAE,SAAS;QAChC,KAAK,CAAC,GAAG,CACP,IAAI,EACJ,IAAI,CAAC,SAAS,CACZ,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,EAAE,EACjE,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CACT,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -44,6 +44,16 @@ inherited policies, keep project IDs and Terraform state locations unchanged,
44
44
  and verify deployments after moving. Updating ArcNet can propose a project
45
45
  parent change; review the plan before deployment.
46
46
 
47
+ ## Setup guarantees
48
+
49
+ Generated deployment workflows validate workspace lint, types, tests and builds before deployment. Their Actions runtimes are independent of the application's Node pin. New Vercel projects receive the Node major from the exact root `.node-version`; inspect existing provider settings separately when adopting an existing project. Vercel CLI authentication stays in `VERCEL_TOKEN`, never subprocess arguments.
50
+
51
+ The MAP Lab CI defaults do not grant billing-management access unless explicitly selected for a capability that requires it. Cloud Run custom-domain ownership delegation remains an operator prerequisite before applying the mapping.
52
+
53
+ React/Vite SPA sites inferred from a package root carry filesystem-first/index fallback routes into prebuilt output; explicit output routing still wins. Existing provider projects are checked for compatible root/framework settings before builds or uploads, and before Terraform apply in mixed deployments. A static prebuilt site's provider root is the repository root, independent of its source build directory.
54
+
55
+ Vercel setup writes `git.deploymentEnabled: false` in JSON configs at the repository and selected source roots, preserving other settings such as rewrites. Dry runs do not write them. An explicit conflicting Git policy stops setup for review, so a Vercel Git build cannot silently compete with the validated ArcNet pipeline. Existing programmatic Vercel config requires manual integration.
56
+
47
57
  # ArcNet command reference
48
58
 
49
59
  Generated from the CLI command tree.
@@ -61,7 +61,7 @@ module-defaults:
61
61
  # The project CI identity cannot manage IAM on the platform project.
62
62
  # Environment bootstrap grants quota-project access outside project Terraform.
63
63
  network-project: ""
64
- billing-account: "{billing-account}"
64
+ billing-account: "" # Billing management belongs only to the budget capability.
65
65
  gcp-project:
66
66
  organization-id: "{gcp-organization}"
67
67
  project-id: "{gcp-project}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mp-lb/arcnet",
3
- "version": "0.7.17",
3
+ "version": "0.7.19",
4
4
  "description": "ArcNet project installation and deployment CLI.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@mp-lb/forum-secrets": "0.2.1",
39
- "@mp-lb/zapper": "0.21.10",
39
+ "@mp-lb/zapper": "0.21.13",
40
40
  "commander": "14.0.3",
41
41
  "yaml": "2.8.1",
42
42
  "zod": "4.4.1"
@@ -1,3 +1,4 @@
1
+ import { checkProjectSettings } from "./checkProjectSettings.js";
1
2
  import { fail } from "./fail.js";
2
3
  import type { VercelAccount, VercelResponse, VercelSite } from "./schemas.js";
3
4
 
@@ -15,4 +16,5 @@ export const checkIdentity = (
15
16
  fail(
16
17
  `Project identity/scope mismatch for ${site.projectName}. No deployment attempted.`,
17
18
  );
19
+ checkProjectSettings(project!, site);
18
20
  };
@@ -0,0 +1,19 @@
1
+ import { fail } from "./fail.js";
2
+ import type { VercelResponse, VercelSite } from "./schemas.js";
3
+
4
+ export const checkProjectSettings = (
5
+ project: VercelResponse,
6
+ site: VercelSite,
7
+ ) => {
8
+ const root =
9
+ site.framework === "vercel" && site.root !== "." ? site.root : null;
10
+
11
+ const framework = site.framework === "vercel" ? "nextjs" : null;
12
+ if (
13
+ (project.rootDirectory !== undefined && project.rootDirectory !== root) ||
14
+ (project.framework !== undefined && project.framework !== framework)
15
+ )
16
+ fail(
17
+ `Project identity/settings mismatch for ${site.projectName}. Expected provider root ${root ?? "repository root"} and framework ${framework ?? "none"}; the source build root is separate. Correct the verified project settings before deploying. No settings were changed.`,
18
+ );
19
+ };
package/src/createCli.ts CHANGED
@@ -185,6 +185,7 @@ export const createCli = () => {
185
185
  return { terraform, vercel };
186
186
  }
187
187
 
188
+ await runVercel("inspect", root, undefined, machine);
188
189
  runTerraform("deploy", root, machine);
189
190
  return runVercel("deploy", root, undefined, machine);
190
191
  }
@@ -1,3 +1,4 @@
1
+ import { readNodeVersion } from "./readNodeVersion.js";
1
2
  import { checkIdentity } from "./checkIdentity.js";
2
3
  import { fail } from "./fail.js";
3
4
  import type { VercelConfig, VercelRequest } from "./schemas.js";
@@ -6,6 +7,7 @@ export const createProject = async (
6
7
  config: VercelConfig,
7
8
  name: string,
8
9
  request: VercelRequest,
10
+ root = process.cwd(),
9
11
  ) => {
10
12
  const site = config.sites[name];
11
13
  if (!site) fail("Choose a configured site.");
@@ -41,8 +43,11 @@ export const createProject = async (
41
43
 
42
44
  const created = await request("POST", "/v11/projects", config.account, {
43
45
  name: site.projectName,
46
+ nodeVersion: readNodeVersion(root),
44
47
  framework: site.framework === "vercel" ? "nextjs" : null,
45
- ...(site.framework === "vercel" && site.root !== "." ? { rootDirectory: site.root } : {}),
48
+ ...(site.framework === "vercel" && site.root !== "."
49
+ ? { rootDirectory: site.root }
50
+ : {}),
46
51
  });
47
52
 
48
53
  if (
package/src/deploy.ts CHANGED
@@ -30,7 +30,13 @@ export const deploy = async (
30
30
  fail(
31
31
  "CI deployment is restricted to the configured repository main branch.",
32
32
  );
33
- config = await resolveDeploymentProjects(config, request, target === "production");
33
+ config = await resolveDeploymentProjects(
34
+ config,
35
+ request,
36
+ target === "production",
37
+ root,
38
+ );
39
+
34
40
  if (target === "production") await syncDomains(config, request, environment);
35
41
  const stages: Array<[VercelSite, string | null]> = [];
36
42
 
@@ -40,6 +46,7 @@ export const deploy = async (
40
46
  stages.push([site, null]);
41
47
  continue;
42
48
  }
49
+
43
50
  const buildEnv = Object.fromEntries(
44
51
  Object.entries(environment).filter(([k]) => !k.startsWith("VERCEL_")),
45
52
  );
@@ -54,11 +61,38 @@ export const deploy = async (
54
61
  VERCEL_PROJECT_ID: site.projectId,
55
62
  VERCEL_ORG_ID: config.account.id,
56
63
  };
64
+
57
65
  if (site.framework === "vercel") {
58
66
  const cli = ["--yes", "vercel@63.1.2"];
59
- await run("npx", [...cli, "pull", "--project", site.projectId!, "--yes", `--environment=${target}`, "--token", environment.VERCEL_TOKEN!], root, siteEnv);
60
- await run("npx", [...cli, "build", "--project", site.projectId!, ...(target === "production" ? ["--prod"] : []), "--yes", "--token", environment.VERCEL_TOKEN!], root, siteEnv);
67
+ await run(
68
+ "npx",
69
+ [
70
+ ...cli,
71
+ "pull",
72
+ "--project",
73
+ site.projectId!,
74
+ "--yes",
75
+ `--environment=${target}`,
76
+ ],
77
+ root,
78
+ siteEnv,
79
+ );
80
+
81
+ await run(
82
+ "npx",
83
+ [
84
+ ...cli,
85
+ "build",
86
+ "--project",
87
+ site.projectId!,
88
+ ...(target === "production" ? ["--prod"] : []),
89
+ "--yes",
90
+ ],
91
+ root,
92
+ siteEnv,
93
+ );
61
94
  }
95
+
62
96
  const args = [
63
97
  "--yes",
64
98
  "vercel@63.1.2",
@@ -67,8 +101,6 @@ export const deploy = async (
67
101
  ...(site.framework === "vercel" ? ["--project", site.projectId!] : []),
68
102
  "--yes",
69
103
  ...(target === "production" ? ["--prod"] : []),
70
- "--token",
71
- environment.VERCEL_TOKEN!,
72
104
  ];
73
105
 
74
106
  await run("npx", args, stage ?? root, siteEnv);
@@ -0,0 +1,11 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { fail } from "./fail.js";
4
+
5
+ export const readNodeVersion = (root: string): string => {
6
+ const pin = readFileSync(join(root, ".node-version"), "utf8").trim();
7
+ const match = /^v?(\d+)\.\d+\.\d+$/.exec(pin);
8
+ if (!match)
9
+ fail("Vercel creation requires an exact Node version in .node-version.");
10
+ return `${match![1]}.x`;
11
+ };
@@ -1,6 +1,13 @@
1
+ import { checkProjectSettings } from "./checkProjectSettings.js";
2
+ import { readNodeVersion } from "./readNodeVersion.js";
1
3
  import { checkIdentity } from "./checkIdentity.js";
2
4
  import { fail } from "./fail.js";
3
- import type { VercelConfig, VercelRequest, VercelResponse, VercelSite } from "./schemas.js";
5
+ import type {
6
+ VercelConfig,
7
+ VercelRequest,
8
+ VercelResponse,
9
+ VercelSite,
10
+ } from "./schemas.js";
4
11
 
5
12
  export const checkNamedProject = (
6
13
  project: VercelResponse,
@@ -10,13 +17,12 @@ export const checkNamedProject = (
10
17
  if (
11
18
  !/^prj_[A-Za-z0-9]+$/.test(project.id ?? "") ||
12
19
  project.name !== site.projectName ||
13
- project.accountId !== accountId ||
14
- (project.rootDirectory !== undefined &&
15
- project.rootDirectory !== (site.framework === "vercel" && site.root !== "." ? site.root : null)) ||
16
- (project.framework !== undefined &&
17
- project.framework !== (site.framework === "vercel" ? "nextjs" : null))
20
+ project.accountId !== accountId
18
21
  )
19
- fail(`Project identity/settings mismatch for ${site.projectName}. No deployment attempted.`);
22
+ fail(
23
+ `Project identity/settings mismatch for ${site.projectName}. No deployment attempted.`,
24
+ );
25
+ checkProjectSettings(project, site);
20
26
  return project.id!;
21
27
  };
22
28
 
@@ -24,6 +30,7 @@ export const resolveDeploymentProjects = async (
24
30
  config: VercelConfig,
25
31
  request: VercelRequest,
26
32
  allowCreate = true,
33
+ root = process.cwd(),
27
34
  ): Promise<VercelConfig> => {
28
35
  const resolved = structuredClone(config);
29
36
  const missing: string[] = [];
@@ -36,15 +43,22 @@ export const resolveDeploymentProjects = async (
36
43
  site,
37
44
  config.account,
38
45
  );
46
+
39
47
  continue;
40
48
  }
49
+
41
50
  const project = await request(
42
51
  "GET",
43
52
  `/v9/projects/${encodeURIComponent(site.projectName)}`,
44
53
  config.account,
45
54
  );
55
+
46
56
  if (project) {
47
- resolved.sites[name]!.projectId = checkNamedProject(project, site, config.account.id);
57
+ resolved.sites[name]!.projectId = checkNamedProject(
58
+ project,
59
+ site,
60
+ config.account.id,
61
+ );
48
62
  } else {
49
63
  missing.push(name);
50
64
  }
@@ -56,23 +70,34 @@ export const resolveDeploymentProjects = async (
56
70
  if (missing.length && config.account.type === "personal") {
57
71
  const who = await request("GET", "/v2/user", config.account);
58
72
  if (who?.user?.id !== config.account.id)
59
- fail("Token personal account does not match configured account; no project created.");
73
+ fail(
74
+ "Token personal account does not match configured account; no project created.",
75
+ );
60
76
  }
61
77
 
62
78
  for (const name of missing) {
63
79
  const site = config.sites[name]!;
80
+
64
81
  const created = await request("POST", "/v11/projects", config.account, {
65
82
  name: site.projectName,
83
+ nodeVersion: readNodeVersion(root),
66
84
  framework: site.framework === "vercel" ? "nextjs" : null,
67
- ...(site.framework === "vercel" && site.root !== "." ? { rootDirectory: site.root } : {}),
85
+ ...(site.framework === "vercel" && site.root !== "."
86
+ ? { rootDirectory: site.root }
87
+ : {}),
68
88
  });
69
- if (!created)
70
- fail(`Vercel returned no project for ${site.projectName}.`);
71
- resolved.sites[name]!.projectId = checkNamedProject(created, site, config.account.id);
89
+
90
+ if (!created) fail(`Vercel returned no project for ${site.projectName}.`);
91
+ resolved.sites[name]!.projectId = checkNamedProject(
92
+ created,
93
+ site,
94
+ config.account.id,
95
+ );
72
96
  }
73
97
 
74
98
  for (const site of Object.values(resolved.sites)) {
75
99
  site.mode = "existing";
76
100
  }
101
+
77
102
  return resolved;
78
103
  };
@@ -4,7 +4,10 @@ import { fail } from "./fail.js";
4
4
  import { safePath } from "./safePath.js";
5
5
  import type { VercelSite } from "./schemas.js";
6
6
 
7
- export const resolveVercelSite = (root: string, site: VercelSite): VercelSite => {
7
+ export const resolveVercelSite = (
8
+ root: string,
9
+ site: VercelSite,
10
+ ): VercelSite => {
8
11
  if (!site.root) return site;
9
12
  const directory = site.root === "." ? root : safePath(root, site.root);
10
13
  const path = join(directory, "package.json");
@@ -12,24 +15,44 @@ export const resolveVercelSite = (root: string, site: VercelSite): VercelSite =>
12
15
  const manifest = JSON.parse(readFileSync(path, "utf8"));
13
16
  const deps = { ...manifest.dependencies, ...manifest.devDependencies };
14
17
  const framework = site.framework ?? (deps.next ? "vercel" : "static");
18
+
15
19
  if (framework === "vercel") {
16
- if (!deps.next) fail(`Unsupported Vercel framework at ${site.root}; specify a static build explicitly.`);
20
+ if (!deps.next)
21
+ fail(
22
+ `Unsupported Vercel framework at ${site.root}; specify a static build explicitly.`,
23
+ );
17
24
  return { ...site, framework };
18
25
  }
26
+
19
27
  const name = manifest.name;
20
28
  if (typeof name !== "string" || !manifest.scripts?.build)
21
29
  fail(`Vercel site needs a named package with a build script: ${site.root}`);
22
- const output = site.output ?? (deps.vitepress
23
- ? join(site.root, ".vitepress/dist")
24
- : deps["react-router"] && manifest.scripts.start?.includes("build/client")
25
- ? join(site.root, "build/client")
26
- : join(site.root, "dist"));
27
- if (relative(root, safePath(root, output)).startsWith("..")) fail("Invalid output path.");
30
+
31
+ const output =
32
+ site.output ??
33
+ (deps.vitepress
34
+ ? join(site.root, ".vitepress/dist")
35
+ : deps["react-router"] && manifest.scripts.start?.includes("build/client")
36
+ ? join(site.root, "build/client")
37
+ : join(site.root, "dist"));
38
+
39
+ if (relative(root, safePath(root, output)).startsWith(".."))
40
+ fail("Invalid output path.");
28
41
  return {
29
42
  ...site,
30
43
  framework,
31
44
  build: site.build ?? ["pnpm", "--filter", name, "build"],
32
45
  output,
33
- outputConfig: site.outputConfig ?? { version: 3 },
46
+ outputConfig: site.outputConfig ?? {
47
+ version: 3,
48
+ ...(deps.vite && deps.react && !deps.vitepress
49
+ ? {
50
+ routes: [
51
+ { handle: "filesystem" },
52
+ { src: "/(.*)", dest: "/index.html" },
53
+ ],
54
+ }
55
+ : {}),
56
+ },
34
57
  };
35
58
  };
package/src/runVercel.ts CHANGED
@@ -59,7 +59,7 @@ export const runVercel = async (
59
59
 
60
60
  if (command === "create") {
61
61
  if (!argument) throw new Error("Choose a configured site.");
62
- const next = await createProject(config, argument, request);
62
+ const next = await createProject(config, argument, request, root);
63
63
  if (next === config)
64
64
  return {
65
65
  operation: command,
@@ -96,8 +96,7 @@ export const runVercel = async (
96
96
  return {
97
97
  operation: command,
98
98
  projectId: next.sites[argument]!.projectId,
99
- message:
100
- "Created project; review and commit project.json before CI.",
99
+ message: "Created project; review and commit project.json before CI.",
101
100
  };
102
101
  }
103
102
 
@@ -66,12 +66,12 @@ export const writeSecretsWorkflow = (
66
66
  "timeout-minutes": 10,
67
67
  steps: [
68
68
  {
69
- uses: "actions/checkout@v4",
69
+ uses: "actions/checkout@v5",
70
70
  with: { "persist-credentials": false },
71
71
  },
72
- { uses: "pnpm/action-setup@v4" },
72
+ { uses: "pnpm/action-setup@v5" },
73
73
  {
74
- uses: "actions/setup-node@v4",
74
+ uses: "actions/setup-node@v5",
75
75
  with: existsSync(safeTargetPath(root, ".node-version"))
76
76
  ? { "node-version-file": ".node-version" }
77
77
  : { "node-version": 22 },
@@ -1,3 +1,4 @@
1
+ import { vercelGitFiles } from "./vercelGitFiles.js";
1
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
3
  import { dirname, join } from "node:path";
3
4
  import { parse } from "yaml";
@@ -54,7 +55,10 @@ export const setupArcnet = (root: string, dry: boolean) => {
54
55
  }
55
56
  }
56
57
 
57
- if (mode === "vercel" || mode === "mixed") compileVercel(config, root);
58
+ const gitFiles =
59
+ mode === "vercel" || mode === "mixed"
60
+ ? vercelGitFiles(root, compileVercel(config, root))
61
+ : new Map<string, string>();
58
62
 
59
63
  const workflow =
60
64
  mode === "package" ? undefined : ".github/workflows/deploy-arc.yaml";
@@ -67,7 +71,7 @@ export const setupArcnet = (root: string, dry: boolean) => {
67
71
  if (dry)
68
72
  return setupReport(
69
73
  "dry-run",
70
- [...files, ...publishingFiles],
74
+ [...files, ...publishingFiles, ...gitFiles.keys()],
71
75
  `Would install ArcNet ${mode} configuration; no cloud resources changed.`,
72
76
  );
73
77
 
@@ -97,13 +101,19 @@ export const setupArcnet = (root: string, dry: boolean) => {
97
101
  );
98
102
  }
99
103
 
104
+ for (const [name, content] of gitFiles) {
105
+ const path = join(root, name);
106
+ mkdirSync(dirname(path), { recursive: true });
107
+ writeFileSync(path, content);
108
+ }
109
+
100
110
  if (!hasDependency(root)) writeFileSync(manifestPath, nextManifest);
101
111
  wireFssstackPublishing(root, false);
102
112
  if (config.secrets)
103
113
  writeSecretsWorkflow(readSecretsConfig(root), root, ".arcnet/arcnet.yaml");
104
114
  return setupReport(
105
115
  "installed",
106
- files,
116
+ [...files, ...gitFiles.keys()],
107
117
  "ArcNet installed from .arcnet/arcnet.yaml. Run pnpm install and pnpm exec arcnet check.",
108
118
  );
109
119
  };
@@ -1,3 +1,4 @@
1
+ import { vercelGitFiles } from "./vercelGitFiles.js";
1
2
  import { setupReport } from "./setupReport.js";
2
3
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
4
  import { dirname, join } from "node:path";
@@ -53,6 +54,7 @@ export const setupVercel = ({
53
54
  throw new Error(
54
55
  "Vercel input supports only repository, account and sites; ownership/import is separate.",
55
56
  );
57
+ const gitFiles = vercelGitFiles(root, config);
56
58
  const path = safe(".arcnet/project.json");
57
59
 
58
60
  const files = new Map([
@@ -77,7 +79,6 @@ export const setupVercel = ({
77
79
  mode: "existing",
78
80
  projectId: previous.sites[name].projectId,
79
81
  };
80
-
81
82
  }
82
83
  }
83
84
 
@@ -106,7 +107,7 @@ export const setupVercel = ({
106
107
  if (dry)
107
108
  return setupReport(
108
109
  "dry-run",
109
- [...files.keys(), "package.json"],
110
+ [...files.keys(), ...gitFiles.keys(), "package.json"],
110
111
  `Dry run: Vercel-only references for ${Object.keys(config.sites).join(", ")}. No files or cloud resources changed; no GCP/WIF/Terraform.`,
111
112
  );
112
113
 
@@ -115,10 +116,15 @@ export const setupVercel = ({
115
116
  writeFileSync(safe(name), content, { flag: "wx" });
116
117
  }
117
118
 
119
+ for (const [name, content] of gitFiles) {
120
+ mkdirSync(dirname(safe(name)), { recursive: true });
121
+ writeFileSync(safe(name), content);
122
+ }
123
+
118
124
  writeFileSync(safe("package.json"), manifest);
119
125
  return setupReport(
120
126
  "installed",
121
- [...files.keys(), "package.json"],
127
+ [...files.keys(), ...gitFiles.keys(), "package.json"],
122
128
  "Generated Vercel-only config and GitHub workflow. No zap.yaml changes, GCP, Terraform, DNS or project settings ownership. Offline plan: pnpm install, then pnpm exec arcnet plan",
123
129
  );
124
130
  };
@@ -0,0 +1,45 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { safePath } from "./safePath.js";
4
+ import type { VercelConfig } from "./schemas.js";
5
+
6
+ export const vercelGitFiles = (root: string, config: VercelConfig) => {
7
+ const files = new Map<string, string>();
8
+
9
+ const roots = new Set([
10
+ ".",
11
+ ...Object.values(config.sites).map((site) => site.root ?? "."),
12
+ ]);
13
+
14
+ for (const directory of roots) {
15
+ const name = join(directory, "vercel.json");
16
+ const path = safePath(root, name);
17
+ if (existsSync(safePath(root, join(directory, "vercel.ts"))))
18
+ throw new Error(
19
+ `ArcNet cannot safely edit ${directory}/vercel.ts. Configure its delivery policy and workflow manually; no parallel JSON config was written.`,
20
+ );
21
+
22
+ const current = existsSync(path)
23
+ ? JSON.parse(readFileSync(path, "utf8"))
24
+ : {};
25
+
26
+ if (!current || typeof current !== "object" || Array.isArray(current))
27
+ throw new Error(`Invalid Vercel config: ${name}.`);
28
+ const enabled = current.git?.deploymentEnabled;
29
+ if (enabled !== undefined && enabled !== false)
30
+ throw new Error(
31
+ `Conflicting Git deployment policy in ${name}; set git.deploymentEnabled=false explicitly before using ArcNet delivery.`,
32
+ );
33
+ if (enabled === false) continue;
34
+ files.set(
35
+ name,
36
+ JSON.stringify(
37
+ { ...current, git: { ...current.git, deploymentEnabled: false } },
38
+ null,
39
+ 2,
40
+ ) + "\n",
41
+ );
42
+ }
43
+
44
+ return files;
45
+ };
@@ -16,14 +16,15 @@ jobs:
16
16
  account: ${{ steps.config.outputs.account }}
17
17
  registry: ${{ steps.config.outputs.registry }}
18
18
  steps:
19
- - uses: actions/checkout@v4
20
- - uses: pnpm/action-setup@v4
19
+ - uses: actions/checkout@v5
20
+ - uses: pnpm/action-setup@v5
21
21
  with:
22
22
  package_json_file: package.json
23
- - uses: actions/setup-node@v4
23
+ - uses: actions/setup-node@v5
24
24
  with:
25
25
  node-version-file: .node-version
26
26
  - run: pnpm install --frozen-lockfile
27
+ - run: pnpm lint && pnpm typecheck && pnpm test && pnpm build
27
28
  - run: pnpm exec arcnet check
28
29
  - id: config
29
30
  run: pnpm exec arcnet ci
@@ -38,23 +39,23 @@ jobs:
38
39
  contents: read
39
40
  id-token: write
40
41
  steps:
41
- - uses: actions/checkout@v4
42
- - uses: pnpm/action-setup@v4
42
+ - uses: actions/checkout@v5
43
+ - uses: pnpm/action-setup@v5
43
44
  with:
44
45
  package_json_file: package.json
45
- - uses: actions/setup-node@v4
46
+ - uses: actions/setup-node@v5
46
47
  with:
47
48
  node-version-file: .node-version
48
49
  - run: pnpm install --frozen-lockfile
49
- - uses: google-github-actions/auth@v2
50
+ - uses: google-github-actions/auth@v3
50
51
  with:
51
52
  workload_identity_provider: ${{ needs.configuration.outputs.provider }}
52
53
  service_account: ${{ needs.configuration.outputs.account }}
53
- - uses: google-github-actions/setup-gcloud@v2
54
+ - uses: google-github-actions/setup-gcloud@v3
54
55
  - run: gcloud auth configure-docker "$REGISTRY" --quiet
55
56
  env:
56
57
  REGISTRY: ${{ needs.configuration.outputs.registry }}
57
- - uses: hashicorp/setup-terraform@v3
58
+ - uses: hashicorp/setup-terraform@v4
58
59
  with:
59
60
  terraform_version: 1.15.6
60
61
  terraform_wrapper: false