@mp-lb/arcnet 0.5.1 → 0.5.2

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 (66) hide show
  1. package/README.md +4 -4
  2. package/dist/arcnetConfig.d.ts +9 -4
  3. package/dist/arcnetConfig.d.ts.map +1 -1
  4. package/dist/arcnetConfig.js +1 -2
  5. package/dist/arcnetConfig.js.map +1 -1
  6. package/dist/ciOutputs.d.ts.map +1 -1
  7. package/dist/ciOutputs.js +6 -3
  8. package/dist/ciOutputs.js.map +1 -1
  9. package/dist/compileArcnet.d.ts +10 -8
  10. package/dist/compileArcnet.d.ts.map +1 -1
  11. package/dist/compileArcnet.js +5 -7
  12. package/dist/compileArcnet.js.map +1 -1
  13. package/dist/createCli.d.ts.map +1 -1
  14. package/dist/createCli.js +18 -3
  15. package/dist/createCli.js.map +1 -1
  16. package/dist/createProject.d.ts +8 -6
  17. package/dist/createProject.d.ts.map +1 -1
  18. package/dist/createProject.js +2 -1
  19. package/dist/createProject.js.map +1 -1
  20. package/dist/deploy.d.ts.map +1 -1
  21. package/dist/deploy.js +18 -6
  22. package/dist/deploy.js.map +1 -1
  23. package/dist/renderPlan.d.ts +4 -3
  24. package/dist/renderPlan.d.ts.map +1 -1
  25. package/dist/renderPlan.js +3 -2
  26. package/dist/renderPlan.js.map +1 -1
  27. package/dist/resolveVercelSite.d.ts +3 -0
  28. package/dist/resolveVercelSite.d.ts.map +1 -0
  29. package/dist/resolveVercelSite.js +38 -0
  30. package/dist/resolveVercelSite.js.map +1 -0
  31. package/dist/runVercel.d.ts +4 -3
  32. package/dist/runVercel.d.ts.map +1 -1
  33. package/dist/runVercel.js +2 -2
  34. package/dist/runVercel.js.map +1 -1
  35. package/dist/schemas.d.ts +27 -12
  36. package/dist/schemas.d.ts.map +1 -1
  37. package/dist/schemas.js +11 -4
  38. package/dist/schemas.js.map +1 -1
  39. package/dist/setupArcnet.d.ts.map +1 -1
  40. package/dist/setupArcnet.js +6 -4
  41. package/dist/setupArcnet.js.map +1 -1
  42. package/dist/stageSite.d.ts.map +1 -1
  43. package/dist/stageSite.js +2 -0
  44. package/dist/stageSite.js.map +1 -1
  45. package/dist/validateConfig.d.ts.map +1 -1
  46. package/dist/validateConfig.js +10 -2
  47. package/dist/validateConfig.js.map +1 -1
  48. package/docs/public/commands.md +2 -2
  49. package/docs/public/llms-full.txt +6 -6
  50. package/package.json +1 -1
  51. package/src/arcnetConfig.ts +1 -5
  52. package/src/ciOutputs.ts +6 -3
  53. package/src/compileArcnet.ts +5 -9
  54. package/src/createCli.ts +18 -3
  55. package/src/createProject.ts +2 -1
  56. package/src/deploy.ts +19 -8
  57. package/src/renderPlan.ts +3 -2
  58. package/src/resolveVercelSite.ts +35 -0
  59. package/src/runVercel.ts +2 -2
  60. package/src/schemas.ts +14 -3
  61. package/src/setupArcnet.ts +10 -8
  62. package/src/stageSite.ts +1 -0
  63. package/src/validateConfig.ts +8 -2
  64. package/templates/deploy-arc.yaml +1 -0
  65. package/templates/deploy-mixed.yaml +75 -0
  66. package/templates/deploy-vercel.yaml +1 -0
@@ -41,7 +41,7 @@ export const setupArcnet = (root: string, dry: boolean) => {
41
41
  const nextManifest = addDependency(manifestPath);
42
42
  const mode = arcnetMode(config);
43
43
 
44
- if (mode === "terraform") {
44
+ if (mode === "terraform" || mode === "mixed") {
45
45
  const { deployment } = compileTerraform(config);
46
46
 
47
47
  for (const [name, service] of Object.entries(deployment.services)) {
@@ -53,7 +53,7 @@ export const setupArcnet = (root: string, dry: boolean) => {
53
53
  }
54
54
  }
55
55
 
56
- if (mode === "vercel") compileVercel(config);
56
+ if (mode === "vercel" || mode === "mixed") compileVercel(config, root);
57
57
 
58
58
  const workflow =
59
59
  mode === "package" ? undefined : ".github/workflows/deploy-arc.yaml";
@@ -73,14 +73,16 @@ export const setupArcnet = (root: string, dry: boolean) => {
73
73
 
74
74
  if (workflowPath && !existsSync(workflowPath)) {
75
75
  mkdirSync(dirname(workflowPath), { recursive: true });
76
+ const template = readFileSync(
77
+ join(packageRoot, `templates/deploy-${mode === "vercel" ? "vercel" : mode === "mixed" ? "mixed" : "arc"}.yaml`),
78
+ "utf8",
79
+ );
80
+ const secretKeys = config.secrets?.sources.map((source) =>
81
+ ` ${source.key}: \${{ secrets.${source.key} }}`,
82
+ ).join("\n") ?? "";
76
83
  writeFileSync(
77
84
  workflowPath,
78
- readFileSync(
79
- join(
80
- packageRoot,
81
- `templates/deploy-${mode === "vercel" ? "vercel" : "arc"}.yaml`,
82
- ),
83
- ),
85
+ template.replace(" # ARCNET_SECRET_KEYS", secretKeys),
84
86
  { flag: "wx" },
85
87
  );
86
88
  }
package/src/stageSite.ts CHANGED
@@ -19,6 +19,7 @@ export const stageSite = (
19
19
  site: VercelSite,
20
20
  account: VercelAccount,
21
21
  ) => {
22
+ if (!site.output || !site.outputConfig) fail("Static site needs output and outputConfig.");
22
23
  const output = safePath(root, site.output);
23
24
  if (
24
25
  !existsSync(output) ||
@@ -2,9 +2,14 @@ import { fail } from "./fail.js";
2
2
  import { safePath } from "./safePath.js";
3
3
  import type { VercelConfig } from "./schemas.js";
4
4
  import { vercelConfigSchema } from "./schemas.js";
5
+ import { resolveVercelSite } from "./resolveVercelSite.js";
5
6
 
6
7
  export const validateConfig = (input: unknown, root: string): VercelConfig => {
7
- const config = vercelConfigSchema.parse(input);
8
+ const raw = input as VercelConfig;
9
+ const config = vercelConfigSchema.parse({
10
+ ...raw,
11
+ sites: Object.fromEntries(Object.entries(raw.sites).map(([name, site]) => [name, resolveVercelSite(root, site)])),
12
+ });
8
13
  const identities = new Set<string>();
9
14
 
10
15
  for (const site of Object.values(config.sites)) {
@@ -15,7 +20,8 @@ export const validateConfig = (input: unknown, root: string): VercelConfig => {
15
20
  identities.add(id);
16
21
  }
17
22
 
18
- safePath(root, site.output);
23
+ if (site.output) safePath(root, site.output);
24
+ if (site.root) safePath(root, site.root);
19
25
  }
20
26
 
21
27
  return config;
@@ -71,3 +71,4 @@ jobs:
71
71
  ARC_AWS_ACCESS_KEY_ID: ${{ secrets.ARC_AWS_ACCESS_KEY_ID }}
72
72
  ARC_AWS_SECRET_ACCESS_KEY: ${{ secrets.ARC_AWS_SECRET_ACCESS_KEY }}
73
73
  ARCNET_ENV_JSON: ${{ secrets.ARCNET_ENV_JSON }}
74
+ # ARCNET_SECRET_KEYS
@@ -0,0 +1,75 @@
1
+ name: Deploy ArcNet project and sites
2
+ on:
3
+ push:
4
+ branches: [main]
5
+ workflow_dispatch:
6
+ permissions:
7
+ contents: read
8
+ concurrency:
9
+ group: arcnet-production
10
+ cancel-in-progress: false
11
+ jobs:
12
+ configuration:
13
+ runs-on: ubuntu-latest
14
+ outputs:
15
+ approved: ${{ steps.config.outputs.approved }}
16
+ provider: ${{ steps.config.outputs.provider }}
17
+ account: ${{ steps.config.outputs.account }}
18
+ registry: ${{ steps.config.outputs.registry }}
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: pnpm/action-setup@v4
22
+ with:
23
+ package_json_file: package.json
24
+ - uses: actions/setup-node@v4
25
+ with:
26
+ node-version: 22
27
+ - run: pnpm install --frozen-lockfile
28
+ - run: pnpm exec arcnet check
29
+ - id: config
30
+ run: pnpm exec arcnet ci
31
+
32
+ deploy:
33
+ needs: configuration
34
+ if: needs.configuration.outputs.approved == 'true' && github.ref == 'refs/heads/main'
35
+ runs-on: ubuntu-latest
36
+ timeout-minutes: 45
37
+ environment: arcnet-production
38
+ permissions:
39
+ contents: read
40
+ id-token: write
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+ - uses: pnpm/action-setup@v4
44
+ with:
45
+ package_json_file: package.json
46
+ - uses: actions/setup-node@v4
47
+ with:
48
+ node-version: 22
49
+ - run: pnpm install --frozen-lockfile
50
+ - uses: google-github-actions/auth@v2
51
+ with:
52
+ workload_identity_provider: ${{ needs.configuration.outputs.provider }}
53
+ service_account: ${{ needs.configuration.outputs.account }}
54
+ - uses: google-github-actions/setup-gcloud@v2
55
+ - run: gcloud auth configure-docker "$REGISTRY" --quiet
56
+ env:
57
+ REGISTRY: ${{ needs.configuration.outputs.registry }}
58
+ - uses: hashicorp/setup-terraform@v3
59
+ with:
60
+ terraform_version: 1.15.6
61
+ terraform_wrapper: false
62
+ - name: Deploy selected services
63
+ run: pnpm exec arcnet deploy
64
+ env:
65
+ VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
66
+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
67
+ VERCEL_API_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
68
+ UPSTASH_EMAIL: ${{ secrets.UPSTASH_EMAIL }}
69
+ UPSTASH_API_KEY: ${{ secrets.UPSTASH_API_KEY }}
70
+ MONGODB_ATLAS_PUBLIC_KEY: ${{ secrets.MONGODB_ATLAS_PUBLIC_KEY }}
71
+ MONGODB_ATLAS_PRIVATE_KEY: ${{ secrets.MONGODB_ATLAS_PRIVATE_KEY }}
72
+ ARC_AWS_ACCESS_KEY_ID: ${{ secrets.ARC_AWS_ACCESS_KEY_ID }}
73
+ ARC_AWS_SECRET_ACCESS_KEY: ${{ secrets.ARC_AWS_SECRET_ACCESS_KEY }}
74
+ ARCNET_ENV_JSON: ${{ secrets.ARCNET_ENV_JSON }}
75
+ # ARCNET_SECRET_KEYS
@@ -41,3 +41,4 @@ jobs:
41
41
  run: pnpm exec arcnet deploy
42
42
  env:
43
43
  VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
44
+ # ARCNET_SECRET_KEYS