@powerhousedao/codegen 6.0.0-dev.16 → 6.0.0-dev.18

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/dist/src/codegen/__tests__/generate-doc-model.test.js +1 -0
  2. package/dist/src/codegen/__tests__/generate-doc-model.test.js.map +1 -1
  3. package/dist/src/codegen/__tests__/generate-drive-editor.test.js +35 -10
  4. package/dist/src/codegen/__tests__/generate-drive-editor.test.js.map +1 -1
  5. package/dist/src/codegen/__tests__/generate-editor.test.js +10 -6
  6. package/dist/src/codegen/__tests__/generate-editor.test.js.map +1 -1
  7. package/dist/src/codegen/generate.d.ts +10 -10
  8. package/dist/src/codegen/generate.d.ts.map +1 -1
  9. package/dist/src/codegen/generate.js +21 -23
  10. package/dist/src/codegen/generate.js.map +1 -1
  11. package/dist/src/create-lib/create-project.d.ts.map +1 -1
  12. package/dist/src/create-lib/create-project.js +9 -1
  13. package/dist/src/create-lib/create-project.js.map +1 -1
  14. package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts +2 -0
  15. package/dist/src/file-builders/boilerplate/ci-templates.test.d.ts.map +1 -0
  16. package/dist/src/file-builders/boilerplate/ci-templates.test.js +114 -0
  17. package/dist/src/file-builders/boilerplate/ci-templates.test.js.map +1 -0
  18. package/dist/src/file-builders/clis/generate-cli-docs.d.ts +17 -0
  19. package/dist/src/file-builders/clis/generate-cli-docs.d.ts.map +1 -0
  20. package/dist/src/file-builders/clis/generate-cli-docs.js +36 -0
  21. package/dist/src/file-builders/clis/generate-cli-docs.js.map +1 -0
  22. package/dist/src/file-builders/index.d.ts +1 -0
  23. package/dist/src/file-builders/index.d.ts.map +1 -1
  24. package/dist/src/file-builders/index.js +1 -0
  25. package/dist/src/file-builders/index.js.map +1 -1
  26. package/dist/src/file-builders/types.d.ts +18 -0
  27. package/dist/src/file-builders/types.d.ts.map +1 -1
  28. package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts +2 -0
  29. package/dist/src/templates/boilerplate/docker/Dockerfile.d.ts.map +1 -0
  30. package/dist/src/templates/boilerplate/docker/Dockerfile.js +144 -0
  31. package/dist/src/templates/boilerplate/docker/Dockerfile.js.map +1 -0
  32. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts +2 -0
  33. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.d.ts.map +1 -0
  34. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js +18 -0
  35. package/dist/src/templates/boilerplate/docker/connect-entrypoint.sh.js.map +1 -0
  36. package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts +2 -0
  37. package/dist/src/templates/boilerplate/docker/nginx.conf.d.ts.map +1 -0
  38. package/dist/src/templates/boilerplate/docker/nginx.conf.js +79 -0
  39. package/dist/src/templates/boilerplate/docker/nginx.conf.js.map +1 -0
  40. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts +2 -0
  41. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.d.ts.map +1 -0
  42. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js +19 -0
  43. package/dist/src/templates/boilerplate/docker/switchboard-entrypoint.sh.js.map +1 -0
  44. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts +2 -0
  45. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.d.ts.map +1 -0
  46. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js +376 -0
  47. package/dist/src/templates/boilerplate/github/sync-and-publish.yml.js.map +1 -0
  48. package/dist/src/templates/boilerplate/package.json.d.ts.map +1 -1
  49. package/dist/src/templates/boilerplate/package.json.js +0 -1
  50. package/dist/src/templates/boilerplate/package.json.js.map +1 -1
  51. package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts +8 -0
  52. package/dist/src/templates/cli-docs/docs-from-cli-help.d.ts.map +1 -0
  53. package/dist/src/templates/cli-docs/docs-from-cli-help.js +86 -0
  54. package/dist/src/templates/cli-docs/docs-from-cli-help.js.map +1 -0
  55. package/dist/src/templates/index.d.ts +6 -0
  56. package/dist/src/templates/index.d.ts.map +1 -1
  57. package/dist/src/templates/index.js +6 -0
  58. package/dist/src/templates/index.js.map +1 -1
  59. package/dist/src/utils/dependencies.d.ts +21 -0
  60. package/dist/src/utils/dependencies.d.ts.map +1 -1
  61. package/dist/src/utils/dependencies.js +65 -2
  62. package/dist/src/utils/dependencies.js.map +1 -1
  63. package/dist/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +8 -7
@@ -0,0 +1,114 @@
1
+ import { describe, expect, test } from "vitest";
2
+ import { syncAndPublishWorkflowTemplate } from "../../templates/boilerplate/github/sync-and-publish.yml.js";
3
+ import { dockerfileTemplate } from "../../templates/boilerplate/docker/Dockerfile.js";
4
+ import { nginxConfTemplate } from "../../templates/boilerplate/docker/nginx.conf.js";
5
+ import { connectEntrypointTemplate } from "../../templates/boilerplate/docker/connect-entrypoint.sh.js";
6
+ import { switchboardEntrypointTemplate } from "../../templates/boilerplate/docker/switchboard-entrypoint.sh.js";
7
+ describe("CI/CD Templates", () => {
8
+ describe("sync-and-publish.yml", () => {
9
+ test("should be a non-empty string", () => {
10
+ expect(typeof syncAndPublishWorkflowTemplate).toBe("string");
11
+ expect(syncAndPublishWorkflowTemplate.length).toBeGreaterThan(0);
12
+ });
13
+ test("should have correct workflow name", () => {
14
+ expect(syncAndPublishWorkflowTemplate).toContain("name: Sync and Publish");
15
+ });
16
+ test("should contain required jobs", () => {
17
+ expect(syncAndPublishWorkflowTemplate).toContain("prepare:");
18
+ expect(syncAndPublishWorkflowTemplate).toContain("update-and-publish:");
19
+ expect(syncAndPublishWorkflowTemplate).toContain("build-docker:");
20
+ expect(syncAndPublishWorkflowTemplate).toContain("summary:");
21
+ });
22
+ test("should have workflow_dispatch trigger with channel options", () => {
23
+ expect(syncAndPublishWorkflowTemplate).toContain("workflow_dispatch:");
24
+ expect(syncAndPublishWorkflowTemplate).toContain("- dev");
25
+ expect(syncAndPublishWorkflowTemplate).toContain("- staging");
26
+ expect(syncAndPublishWorkflowTemplate).toContain("- latest");
27
+ });
28
+ test("should have repository_dispatch trigger", () => {
29
+ expect(syncAndPublishWorkflowTemplate).toContain("repository_dispatch:");
30
+ expect(syncAndPublishWorkflowTemplate).toContain("powerhouse-release");
31
+ });
32
+ test("should configure Docker and GHCR registries", () => {
33
+ expect(syncAndPublishWorkflowTemplate).toContain("DOCKER_REGISTRY:");
34
+ expect(syncAndPublishWorkflowTemplate).toContain("GHCR_REGISTRY:");
35
+ expect(syncAndPublishWorkflowTemplate).toContain("cr.vetra.io");
36
+ expect(syncAndPublishWorkflowTemplate).toContain("ghcr.io");
37
+ });
38
+ });
39
+ describe("Dockerfile", () => {
40
+ test("should be a non-empty string", () => {
41
+ expect(typeof dockerfileTemplate).toBe("string");
42
+ expect(dockerfileTemplate.length).toBeGreaterThan(0);
43
+ });
44
+ test("should contain base stage", () => {
45
+ expect(dockerfileTemplate).toContain("FROM node:22-alpine AS base");
46
+ });
47
+ test("should contain connect-builder stage", () => {
48
+ expect(dockerfileTemplate).toContain("FROM base AS connect-builder");
49
+ });
50
+ test("should contain connect final stage", () => {
51
+ expect(dockerfileTemplate).toContain("FROM nginx:alpine AS connect");
52
+ });
53
+ test("should contain switchboard final stage", () => {
54
+ expect(dockerfileTemplate).toContain("FROM node:22-alpine AS switchboard");
55
+ });
56
+ test("should configure pnpm", () => {
57
+ expect(dockerfileTemplate).toContain("corepack enable");
58
+ expect(dockerfileTemplate).toContain("PNPM_HOME");
59
+ });
60
+ test("should install ph-cmd", () => {
61
+ expect(dockerfileTemplate).toContain("ph-cmd@$TAG");
62
+ });
63
+ test("should have health checks", () => {
64
+ expect(dockerfileTemplate).toContain("HEALTHCHECK");
65
+ });
66
+ });
67
+ describe("nginx.conf", () => {
68
+ test("should be a non-empty string", () => {
69
+ expect(typeof nginxConfTemplate).toBe("string");
70
+ expect(nginxConfTemplate.length).toBeGreaterThan(0);
71
+ });
72
+ test("should contain health check endpoint", () => {
73
+ expect(nginxConfTemplate).toContain("location /health");
74
+ });
75
+ test("should configure gzip compression", () => {
76
+ expect(nginxConfTemplate).toContain("gzip on");
77
+ });
78
+ test("should use PORT environment variable", () => {
79
+ expect(nginxConfTemplate).toContain("${PORT}");
80
+ });
81
+ test("should configure caching for assets", () => {
82
+ expect(nginxConfTemplate).toContain("Cache-Control");
83
+ expect(nginxConfTemplate).toContain("/assets/");
84
+ });
85
+ });
86
+ describe("connect-entrypoint.sh", () => {
87
+ test("should be a non-empty string", () => {
88
+ expect(typeof connectEntrypointTemplate).toBe("string");
89
+ expect(connectEntrypointTemplate.length).toBeGreaterThan(0);
90
+ });
91
+ test("should start with shebang", () => {
92
+ expect(connectEntrypointTemplate).toMatch(/^#!/);
93
+ });
94
+ test("should use envsubst for nginx config", () => {
95
+ expect(connectEntrypointTemplate).toContain("envsubst");
96
+ });
97
+ test("should start nginx", () => {
98
+ expect(connectEntrypointTemplate).toContain("nginx");
99
+ });
100
+ });
101
+ describe("switchboard-entrypoint.sh", () => {
102
+ test("should be a non-empty string", () => {
103
+ expect(typeof switchboardEntrypointTemplate).toBe("string");
104
+ expect(switchboardEntrypointTemplate.length).toBeGreaterThan(0);
105
+ });
106
+ test("should start with shebang", () => {
107
+ expect(switchboardEntrypointTemplate).toMatch(/^#!/);
108
+ });
109
+ test("should start switchboard", () => {
110
+ expect(switchboardEntrypointTemplate).toContain("ph switchboard");
111
+ });
112
+ });
113
+ });
114
+ //# sourceMappingURL=ci-templates.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ci-templates.test.js","sourceRoot":"","sources":["../../../../src/file-builders/boilerplate/ci-templates.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;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B,EAAE,GAAG,EAAE;YACxC,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC5D,MAAM,CAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACrC,MAAM,CAAC,6BAA6B,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,6BAA6B,CAAC,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACpE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { CommandEntry, CommandHelpInfo } from "@powerhousedao/codegen";
2
+ export declare function getCommandHelpInfo<TEntry extends CommandEntry>(entry: TEntry): CommandHelpInfo;
3
+ export declare function getCommandsHelpInfo<TEntry extends CommandEntry>(entries: TEntry[]): CommandHelpInfo[];
4
+ export declare function makeCliDocsFromHelp<TEntry extends CommandEntry>(args: {
5
+ cliDescription: string;
6
+ docsTitle: string;
7
+ docsIntroduction: string;
8
+ entries: TEntry[];
9
+ }): string;
10
+ export declare function writeCliDocsMarkdownFile<TEntry extends CommandEntry>(args: {
11
+ filePath: string;
12
+ cliDescription: string;
13
+ docsTitle: string;
14
+ docsIntroduction: string;
15
+ entries: TEntry[];
16
+ }): Promise<void>;
17
+ //# sourceMappingURL=generate-cli-docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-cli-docs.d.ts","sourceRoot":"","sources":["../../../../src/file-builders/clis/generate-cli-docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI5E,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,YAAY,EAC5D,KAAK,EAAE,MAAM,GACZ,eAAe,CASjB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,YAAY,EAC7D,OAAO,EAAE,MAAM,EAAE,qBAGlB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,YAAY,EAAE,IAAI,EAAE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,UAcA;AAED,wBAAsB,wBAAwB,CAC5C,MAAM,SAAS,YAAY,EAC3B,IAAI,EAAE;IACN,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,iBAOA"}
@@ -0,0 +1,36 @@
1
+ import { docsFromCliHelpTemplate } from "@powerhousedao/codegen/templates";
2
+ import { writeFile } from "node:fs/promises";
3
+ import { stripVTControlCharacters } from "node:util";
4
+ export function getCommandHelpInfo(entry) {
5
+ const name = entry.name;
6
+ const description = entry.command.description ?? "";
7
+ const helpTopics = entry.command.helpTopics?.() ?? [];
8
+ return {
9
+ name,
10
+ description,
11
+ helpTopics,
12
+ };
13
+ }
14
+ export function getCommandsHelpInfo(entries) {
15
+ return entries.map(getCommandHelpInfo);
16
+ }
17
+ export function makeCliDocsFromHelp(args) {
18
+ const { cliDescription, docsIntroduction, docsTitle, entries } = args;
19
+ const commandsHelpInfo = getCommandsHelpInfo(entries);
20
+ const template = docsFromCliHelpTemplate({
21
+ cliDescription,
22
+ docsIntroduction,
23
+ docsTitle,
24
+ commandsHelpInfo,
25
+ });
26
+ const templateWithAnsiEscapesRemoved = stripVTControlCharacters(template);
27
+ return templateWithAnsiEscapesRemoved;
28
+ }
29
+ export async function writeCliDocsMarkdownFile(args) {
30
+ const { filePath, ...restArgs } = args;
31
+ const markdownFileContent = makeCliDocsFromHelp(restArgs);
32
+ await writeFile(filePath, markdownFileContent, {
33
+ encoding: "utf-8",
34
+ });
35
+ }
36
+ //# sourceMappingURL=generate-cli-docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-cli-docs.js","sourceRoot":"","sources":["../../../../src/file-builders/clis/generate-cli-docs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,MAAM,UAAU,kBAAkB,CAChC,KAAa;IAEb,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;IACpD,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC;IACtD,OAAO;QACL,IAAI;QACJ,WAAW;QACX,UAAU;KACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,OAAiB;IAEjB,OAAO,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAA8B,IAKhE;IACC,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACtE,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAEtD,MAAM,QAAQ,GAAG,uBAAuB,CAAC;QACvC,cAAc;QACd,gBAAgB;QAChB,SAAS;QACT,gBAAgB;KACjB,CAAC,CAAC;IAEH,MAAM,8BAA8B,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAE1E,OAAO,8BAA8B,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAE5C,IAMD;IACC,MAAM,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;IACvC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IAE1D,MAAM,SAAS,CAAC,QAAQ,EAAE,mBAAmB,EAAE;QAC7C,QAAQ,EAAE,OAAO;KAClB,CAAC,CAAC;AACL,CAAC"}
@@ -7,4 +7,5 @@ export * from "./index-files.js";
7
7
  export * from "./module-files.js";
8
8
  export * from "./subgraphs.js";
9
9
  export type * from "./types.js";
10
+ export * from "./clis/generate-cli-docs.js";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-builders/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,mBAAmB,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/file-builders/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,mBAAmB,YAAY,CAAC;AAChC,cAAc,6BAA6B,CAAC"}
@@ -6,4 +6,5 @@ export * from "./editor-common.js";
6
6
  export * from "./index-files.js";
7
7
  export * from "./module-files.js";
8
8
  export * from "./subgraphs.js";
9
+ export * from "./clis/generate-cli-docs.js";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-builders/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/file-builders/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAE/B,cAAc,6BAA6B,CAAC"}
@@ -63,4 +63,22 @@ export type DocumentModelFileMakerArgs = DocumentModelVariableNames & GenerateDo
63
63
  reducersDirPath: string;
64
64
  fileExtension: string;
65
65
  };
66
+ export type CommandEntry = {
67
+ name: string;
68
+ command: {
69
+ description?: string;
70
+ helpTopics?: () => HelpTopic[];
71
+ };
72
+ };
73
+ export type HelpTopic = {
74
+ category: string;
75
+ usage: string;
76
+ description: string;
77
+ defaults: string[];
78
+ };
79
+ export type CommandHelpInfo = {
80
+ name: string;
81
+ description: string;
82
+ helpTopics: HelpTopic[];
83
+ };
66
84
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/file-builders/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6CAA6C,EAC7C,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KA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AC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const dockerfileTemplate = "# =============================================================================\n# Multi-stage Dockerfile for Powerhouse Document Model Packages\n# Produces two images: connect (frontend) and switchboard (backend)\n#\n# Build commands:\n# docker build --target connect -t <registry>/<project>/connect:<tag> .\n# docker build --target switchboard -t <registry>/<project>/switchboard:<tag> .\n# =============================================================================\n\n# -----------------------------------------------------------------------------\n# Base stage: Common setup for building\n# -----------------------------------------------------------------------------\nFROM node:22-alpine AS base\n\nWORKDIR /app\n\n# Install build dependencies\nRUN apk add --no-cache python3 make g++ git bash \\\n && ln -sf /usr/bin/python3 /usr/bin/python\n\n# Setup pnpm\nENV PNPM_HOME=\"/pnpm\"\nENV PATH=\"$PNPM_HOME:$PATH\"\nRUN corepack enable && corepack prepare pnpm@latest --activate\n\n# Configure JSR registry\nRUN pnpm config set @jsr:registry https://npm.jsr.io\n\n# Build arguments\nARG TAG=latest\nARG PH_CONNECT_BASE_PATH=\"/\"\n\n# Install ph-cmd, prisma, and prettier globally\nRUN pnpm add -g ph-cmd@$TAG prisma@5.17.0 prettier\n\n# Initialize project based on tag (dev/staging/latest)\nRUN case \"$TAG\" in \\\n *dev*) ph init project --dev --package-manager pnpm ;; \\\n *staging*) ph init project --staging --package-manager pnpm ;; \\\n *) ph init project --package-manager pnpm ;; \\\n esac\n\nWORKDIR /app/project\n\n# Copy package files for the current package\nCOPY package.json pnpm-lock.yaml ./\n\n# Install the current package (this package)\nARG PACKAGE_NAME\nRUN if [ -n \"$PACKAGE_NAME\" ]; then \\\n echo \"Installing package: $PACKAGE_NAME\"; \\\n ph install \"$PACKAGE_NAME\"; \\\n else \\\n echo \"Warning: PACKAGE_NAME not provided, using local build\"; \\\n pnpm install; \\\n fi\n\n# Regenerate Prisma client for Alpine Linux\nRUN prisma generate --schema node_modules/document-drive/dist/prisma/schema.prisma || true\n\n# -----------------------------------------------------------------------------\n# Connect build stage\n# -----------------------------------------------------------------------------\nFROM base AS connect-builder\n\nARG PH_CONNECT_BASE_PATH=\"/\"\n\n# Build connect\nRUN ph connect build --base ${PH_CONNECT_BASE_PATH}\n\n# -----------------------------------------------------------------------------\n# Connect final stage - nginx\n# -----------------------------------------------------------------------------\nFROM nginx:alpine AS connect\n\n# Install envsubst for config templating\nRUN apk add --no-cache gettext\n\n# Copy nginx config template\nCOPY docker/nginx.conf /etc/nginx/nginx.conf.template\n\n# Copy built static files from build stage\nCOPY --from=connect-builder /app/project/.ph/connect-build/dist /var/www/html/project\n\n# Environment variables for nginx config\nENV PORT=3001\nENV PH_CONNECT_BASE_PATH=\"/\"\n\n# Copy and setup entrypoint\nCOPY docker/connect-entrypoint.sh /docker-entrypoint.sh\nRUN chmod +x /docker-entrypoint.sh\n\nEXPOSE ${PORT}\n\nHEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \\\n CMD wget -q --spider http://localhost:${PORT}/health || exit 1\n\nENTRYPOINT [\"/docker-entrypoint.sh\"]\n\n# -----------------------------------------------------------------------------\n# Switchboard final stage - node runtime\n# -----------------------------------------------------------------------------\nFROM node:22-alpine AS switchboard\n\nWORKDIR /app\n\n# Install runtime dependencies\nRUN apk add --no-cache curl openssl\n\n# Setup pnpm\nENV PNPM_HOME=\"/pnpm\"\nENV PATH=\"$PNPM_HOME:$PATH\"\nRUN corepack enable && corepack prepare pnpm@latest --activate\n\n# Configure JSR registry\nRUN pnpm config set @jsr:registry https://npm.jsr.io\n\n# Install ph-cmd and prisma globally (needed at runtime)\nARG TAG=latest\nRUN pnpm add -g ph-cmd@$TAG prisma@5.17.0\n\n# Copy built project from build stage\nCOPY --from=base /app/project /app/project\n\nWORKDIR /app/project\n\n# Copy entrypoint\nCOPY docker/switchboard-entrypoint.sh /app/entrypoint.sh\nRUN chmod +x /app/entrypoint.sh\n\n# Environment variables\nENV NODE_ENV=production\nENV PORT=3000\nENV DATABASE_URL=\"\"\nENV SKIP_DB_MIGRATIONS=\"false\"\n\nEXPOSE ${PORT}\n\nHEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \\\n CMD curl -f http://localhost:${PORT}/health || exit 1\n\nENTRYPOINT [\"/app/entrypoint.sh\"]\n";
2
+ //# sourceMappingURL=Dockerfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dockerfile.d.ts","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/Dockerfile.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,++IA8I9B,CAAC"}
@@ -0,0 +1,144 @@
1
+ export const dockerfileTemplate = `# =============================================================================
2
+ # Multi-stage Dockerfile for Powerhouse Document Model Packages
3
+ # Produces two images: connect (frontend) and switchboard (backend)
4
+ #
5
+ # Build commands:
6
+ # docker build --target connect -t <registry>/<project>/connect:<tag> .
7
+ # docker build --target switchboard -t <registry>/<project>/switchboard:<tag> .
8
+ # =============================================================================
9
+
10
+ # -----------------------------------------------------------------------------
11
+ # Base stage: Common setup for building
12
+ # -----------------------------------------------------------------------------
13
+ FROM node:22-alpine AS base
14
+
15
+ WORKDIR /app
16
+
17
+ # Install build dependencies
18
+ RUN apk add --no-cache python3 make g++ git bash \\
19
+ && ln -sf /usr/bin/python3 /usr/bin/python
20
+
21
+ # Setup pnpm
22
+ ENV PNPM_HOME="/pnpm"
23
+ ENV PATH="$PNPM_HOME:$PATH"
24
+ RUN corepack enable && corepack prepare pnpm@latest --activate
25
+
26
+ # Configure JSR registry
27
+ RUN pnpm config set @jsr:registry https://npm.jsr.io
28
+
29
+ # Build arguments
30
+ ARG TAG=latest
31
+ ARG PH_CONNECT_BASE_PATH="/"
32
+
33
+ # Install ph-cmd, prisma, and prettier globally
34
+ RUN pnpm add -g ph-cmd@$TAG prisma@5.17.0 prettier
35
+
36
+ # Initialize project based on tag (dev/staging/latest)
37
+ RUN case "$TAG" in \\
38
+ *dev*) ph init project --dev --package-manager pnpm ;; \\
39
+ *staging*) ph init project --staging --package-manager pnpm ;; \\
40
+ *) ph init project --package-manager pnpm ;; \\
41
+ esac
42
+
43
+ WORKDIR /app/project
44
+
45
+ # Copy package files for the current package
46
+ COPY package.json pnpm-lock.yaml ./
47
+
48
+ # Install the current package (this package)
49
+ ARG PACKAGE_NAME
50
+ RUN if [ -n "$PACKAGE_NAME" ]; then \\
51
+ echo "Installing package: $PACKAGE_NAME"; \\
52
+ ph install "$PACKAGE_NAME"; \\
53
+ else \\
54
+ echo "Warning: PACKAGE_NAME not provided, using local build"; \\
55
+ pnpm install; \\
56
+ fi
57
+
58
+ # Regenerate Prisma client for Alpine Linux
59
+ RUN prisma generate --schema node_modules/document-drive/dist/prisma/schema.prisma || true
60
+
61
+ # -----------------------------------------------------------------------------
62
+ # Connect build stage
63
+ # -----------------------------------------------------------------------------
64
+ FROM base AS connect-builder
65
+
66
+ ARG PH_CONNECT_BASE_PATH="/"
67
+
68
+ # Build connect
69
+ RUN ph connect build --base \${PH_CONNECT_BASE_PATH}
70
+
71
+ # -----------------------------------------------------------------------------
72
+ # Connect final stage - nginx
73
+ # -----------------------------------------------------------------------------
74
+ FROM nginx:alpine AS connect
75
+
76
+ # Install envsubst for config templating
77
+ RUN apk add --no-cache gettext
78
+
79
+ # Copy nginx config template
80
+ COPY docker/nginx.conf /etc/nginx/nginx.conf.template
81
+
82
+ # Copy built static files from build stage
83
+ COPY --from=connect-builder /app/project/.ph/connect-build/dist /var/www/html/project
84
+
85
+ # Environment variables for nginx config
86
+ ENV PORT=3001
87
+ ENV PH_CONNECT_BASE_PATH="/"
88
+
89
+ # Copy and setup entrypoint
90
+ COPY docker/connect-entrypoint.sh /docker-entrypoint.sh
91
+ RUN chmod +x /docker-entrypoint.sh
92
+
93
+ EXPOSE \${PORT}
94
+
95
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \\
96
+ CMD wget -q --spider http://localhost:\${PORT}/health || exit 1
97
+
98
+ ENTRYPOINT ["/docker-entrypoint.sh"]
99
+
100
+ # -----------------------------------------------------------------------------
101
+ # Switchboard final stage - node runtime
102
+ # -----------------------------------------------------------------------------
103
+ FROM node:22-alpine AS switchboard
104
+
105
+ WORKDIR /app
106
+
107
+ # Install runtime dependencies
108
+ RUN apk add --no-cache curl openssl
109
+
110
+ # Setup pnpm
111
+ ENV PNPM_HOME="/pnpm"
112
+ ENV PATH="$PNPM_HOME:$PATH"
113
+ RUN corepack enable && corepack prepare pnpm@latest --activate
114
+
115
+ # Configure JSR registry
116
+ RUN pnpm config set @jsr:registry https://npm.jsr.io
117
+
118
+ # Install ph-cmd and prisma globally (needed at runtime)
119
+ ARG TAG=latest
120
+ RUN pnpm add -g ph-cmd@$TAG prisma@5.17.0
121
+
122
+ # Copy built project from build stage
123
+ COPY --from=base /app/project /app/project
124
+
125
+ WORKDIR /app/project
126
+
127
+ # Copy entrypoint
128
+ COPY docker/switchboard-entrypoint.sh /app/entrypoint.sh
129
+ RUN chmod +x /app/entrypoint.sh
130
+
131
+ # Environment variables
132
+ ENV NODE_ENV=production
133
+ ENV PORT=3000
134
+ ENV DATABASE_URL=""
135
+ ENV SKIP_DB_MIGRATIONS="false"
136
+
137
+ EXPOSE \${PORT}
138
+
139
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=30s --retries=3 \\
140
+ CMD curl -f http://localhost:\${PORT}/health || exit 1
141
+
142
+ ENTRYPOINT ["/app/entrypoint.sh"]
143
+ `;
144
+ //# sourceMappingURL=Dockerfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dockerfile.js","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/Dockerfile.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8IjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const connectEntrypointTemplate = "#!/bin/sh\nset -e\n\n# Substitute environment variables in nginx configuration\nenvsubst '${PORT},${PH_CONNECT_BASE_PATH}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf\n\necho \"Testing nginx configuration...\"\nnginx -t\n\nif [ $? -eq 0 ]; then\n echo \"Connect available at: http://localhost:${PORT}${PH_CONNECT_BASE_PATH}\"\n exec nginx -g \"daemon off;\"\nelse\n echo \"Nginx configuration test failed\"\n exit 1\nfi\n";
2
+ //# sourceMappingURL=connect-entrypoint.sh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-entrypoint.sh.d.ts","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/connect-entrypoint.sh.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,mcAgBrC,CAAC"}
@@ -0,0 +1,18 @@
1
+ export const connectEntrypointTemplate = `#!/bin/sh
2
+ set -e
3
+
4
+ # Substitute environment variables in nginx configuration
5
+ envsubst '\${PORT},\${PH_CONNECT_BASE_PATH}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
6
+
7
+ echo "Testing nginx configuration..."
8
+ nginx -t
9
+
10
+ if [ $? -eq 0 ]; then
11
+ echo "Connect available at: http://localhost:\${PORT}\${PH_CONNECT_BASE_PATH}"
12
+ exec nginx -g "daemon off;"
13
+ else
14
+ echo "Nginx configuration test failed"
15
+ exit 1
16
+ fi
17
+ `;
18
+ //# sourceMappingURL=connect-entrypoint.sh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-entrypoint.sh.js","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/connect-entrypoint.sh.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;CAgBxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const nginxConfTemplate = "user nginx;\nworker_processes auto;\nerror_log /var/log/nginx/error.log warn;\npid /var/run/nginx.pid;\n\nevents {\n worker_connections 1024;\n}\n\nhttp {\n include /etc/nginx/mime.types;\n default_type application/octet-stream;\n\n # Gzip compression\n gzip on;\n gzip_vary on;\n gzip_proxied any;\n gzip_comp_level 6;\n gzip_buffers 16 8k;\n gzip_http_version 1.1;\n gzip_types text/plain text/css application/javascript application/json image/svg+xml application/xml+rss image/avif;\n\n server {\n listen 0.0.0.0:${PORT};\n server_name _;\n root /var/www/html/project;\n\n # Health check endpoint\n location /health {\n access_log off;\n add_header Content-Type text/plain;\n return 200 'OK';\n }\n\n location ${PH_CONNECT_BASE_PATH}/assets/ {\n alias /var/www/html/project/assets/;\n access_log off;\n log_not_found off;\n etag off;\n expires max;\n add_header Cache-Control \"public, max-age=31536000, immutable\";\n }\n\n location ${PH_CONNECT_BASE_PATH}/fonts/ {\n alias /var/www/html/project/fonts/;\n access_log off;\n log_not_found off;\n expires max;\n add_header Cache-Control \"public, max-age=31536000, immutable\";\n }\n\n location = ${PH_CONNECT_BASE_PATH}/service-worker.js {\n alias /var/www/html/project/service-worker.js;\n\n access_log off;\n log_not_found off;\n etag off;\n\n add_header Cache-Control \"no-cache, no-store, must-revalidate\";\n add_header Pragma \"no-cache\";\n add_header Expires \"0\";\n }\n\n # match any file in the root folder, except index.html\n location ~ ${PH_CONNECT_BASE_PATH}/(?!index\\.html$)([^/]+\\.[a-zA-Z0-9]+)$ {\n alias /var/www/html/project/$1;\n access_log off;\n log_not_found off;\n etag on;\n add_header Cache-Control \"public, must-revalidate\";\n }\n\n location ${PH_CONNECT_BASE_PATH} {\n try_files $uri $uri/ /index.html;\n }\n }\n}\n";
2
+ //# sourceMappingURL=nginx.conf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nginx.conf.d.ts","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/nginx.conf.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,qtEA6E7B,CAAC"}
@@ -0,0 +1,79 @@
1
+ export const nginxConfTemplate = `user nginx;
2
+ worker_processes auto;
3
+ error_log /var/log/nginx/error.log warn;
4
+ pid /var/run/nginx.pid;
5
+
6
+ events {
7
+ worker_connections 1024;
8
+ }
9
+
10
+ http {
11
+ include /etc/nginx/mime.types;
12
+ default_type application/octet-stream;
13
+
14
+ # Gzip compression
15
+ gzip on;
16
+ gzip_vary on;
17
+ gzip_proxied any;
18
+ gzip_comp_level 6;
19
+ gzip_buffers 16 8k;
20
+ gzip_http_version 1.1;
21
+ gzip_types text/plain text/css application/javascript application/json image/svg+xml application/xml+rss image/avif;
22
+
23
+ server {
24
+ listen 0.0.0.0:\${PORT};
25
+ server_name _;
26
+ root /var/www/html/project;
27
+
28
+ # Health check endpoint
29
+ location /health {
30
+ access_log off;
31
+ add_header Content-Type text/plain;
32
+ return 200 'OK';
33
+ }
34
+
35
+ location \${PH_CONNECT_BASE_PATH}/assets/ {
36
+ alias /var/www/html/project/assets/;
37
+ access_log off;
38
+ log_not_found off;
39
+ etag off;
40
+ expires max;
41
+ add_header Cache-Control "public, max-age=31536000, immutable";
42
+ }
43
+
44
+ location \${PH_CONNECT_BASE_PATH}/fonts/ {
45
+ alias /var/www/html/project/fonts/;
46
+ access_log off;
47
+ log_not_found off;
48
+ expires max;
49
+ add_header Cache-Control "public, max-age=31536000, immutable";
50
+ }
51
+
52
+ location = \${PH_CONNECT_BASE_PATH}/service-worker.js {
53
+ alias /var/www/html/project/service-worker.js;
54
+
55
+ access_log off;
56
+ log_not_found off;
57
+ etag off;
58
+
59
+ add_header Cache-Control "no-cache, no-store, must-revalidate";
60
+ add_header Pragma "no-cache";
61
+ add_header Expires "0";
62
+ }
63
+
64
+ # match any file in the root folder, except index.html
65
+ location ~ \${PH_CONNECT_BASE_PATH}/(?!index\\.html$)([^/]+\\.[a-zA-Z0-9]+)$ {
66
+ alias /var/www/html/project/$1;
67
+ access_log off;
68
+ log_not_found off;
69
+ etag on;
70
+ add_header Cache-Control "public, must-revalidate";
71
+ }
72
+
73
+ location \${PH_CONNECT_BASE_PATH} {
74
+ try_files $uri $uri/ /index.html;
75
+ }
76
+ }
77
+ }
78
+ `;
79
+ //# sourceMappingURL=nginx.conf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nginx.conf.js","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/nginx.conf.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6EhC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const switchboardEntrypointTemplate = "#!/bin/sh\nset -e\n\n# Regenerate Prisma client for current platform (fixes darwin-arm64 vs linux-musl-openssl mismatch)\necho \"[entrypoint] Regenerating Prisma client for current platform...\"\nprisma generate --schema node_modules/document-drive/dist/prisma/schema.prisma\n\n# Run migrations if DATABASE_URL is postgres and migrations not skipped\nif [ -n \"$DATABASE_URL\" ] && echo \"$DATABASE_URL\" | grep -q \"^postgres\" && [ \"$SKIP_DB_MIGRATIONS\" != \"true\" ]; then\n echo \"[entrypoint] Running Prisma db push...\"\n prisma db push --schema node_modules/document-drive/dist/prisma/schema.prisma --skip-generate\n echo \"[entrypoint] Running migrations...\"\n ph switchboard --migrate\nfi\n\necho \"[entrypoint] Starting switchboard on port ${PORT:-3000}...\"\nexec ph switchboard --port ${PORT:-3000}\n";
2
+ //# sourceMappingURL=switchboard-entrypoint.sh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switchboard-entrypoint.sh.d.ts","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/switchboard-entrypoint.sh.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,g0BAiBzC,CAAC"}
@@ -0,0 +1,19 @@
1
+ export const switchboardEntrypointTemplate = `#!/bin/sh
2
+ set -e
3
+
4
+ # Regenerate Prisma client for current platform (fixes darwin-arm64 vs linux-musl-openssl mismatch)
5
+ echo "[entrypoint] Regenerating Prisma client for current platform..."
6
+ prisma generate --schema node_modules/document-drive/dist/prisma/schema.prisma
7
+
8
+ # Run migrations if DATABASE_URL is postgres and migrations not skipped
9
+ if [ -n "$DATABASE_URL" ] && echo "$DATABASE_URL" | grep -q "^postgres" && [ "$SKIP_DB_MIGRATIONS" != "true" ]; then
10
+ echo "[entrypoint] Running Prisma db push..."
11
+ prisma db push --schema node_modules/document-drive/dist/prisma/schema.prisma --skip-generate
12
+ echo "[entrypoint] Running migrations..."
13
+ ph switchboard --migrate
14
+ fi
15
+
16
+ echo "[entrypoint] Starting switchboard on port \${PORT:-3000}..."
17
+ exec ph switchboard --port \${PORT:-3000}
18
+ `;
19
+ //# sourceMappingURL=switchboard-entrypoint.sh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switchboard-entrypoint.sh.js","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/docker/switchboard-entrypoint.sh.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;;;;CAiB5C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const syncAndPublishWorkflowTemplate: string;
2
+ //# sourceMappingURL=sync-and-publish.yml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-and-publish.yml.d.ts","sourceRoot":"","sources":["../../../../../src/templates/boilerplate/github/sync-and-publish.yml.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,8BAA8B,QAqXtC,CAAC"}