@haatlabs-core/templates 0.0.0-stage → 0.11.1
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.
- package/LICENSE +201 -0
- package/README.md +27 -2
- package/dist/index.d.ts +36 -0
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -0
- package/files/.github/workflows/ci.yml +142 -0
- package/files/.github/workflows/deploy-pages.yml +176 -0
- package/files/.github/workflows/deploy-shared.yml +170 -0
- package/files/.github/workflows/deploy.yml +156 -0
- package/files/.github/workflows/images.yml +130 -0
- package/files/infra/ansible/ansible.cfg +21 -0
- package/files/infra/ansible/playbooks/dev.yml +19 -0
- package/files/infra/ansible/playbooks/logs.yml +33 -0
- package/files/infra/ansible/playbooks/prod.yml +19 -0
- package/files/infra/ansible/playbooks/restart.yml +32 -0
- package/files/infra/ansible/playbooks/server-check.yml +69 -0
- package/files/infra/ansible/playbooks/setup.yml +213 -0
- package/files/infra/ansible/playbooks/shared.yml +128 -0
- package/files/infra/ansible/playbooks/staging.yml +19 -0
- package/files/infra/ansible/playbooks/tasks/clean.yml +24 -0
- package/files/infra/ansible/playbooks/tasks/deploy.yml +165 -0
- package/files/infra/docker/nginx.conf +28 -0
- package/files/infra/docker/node.Dockerfile +57 -0
- package/files/infra/docker/stack/docker-compose.yml +238 -0
- package/files/infra/docker/web.Dockerfile +24 -0
- package/files/infra/scripts/build-images.sh +54 -0
- package/files/infra/scripts/ca-bundle.sh +26 -0
- package/files/infra/scripts/check-infra.sh +65 -0
- package/files/infra/scripts/gh-secrets.sh +284 -0
- package/files/infra/scripts/pages.sh +229 -0
- package/files/infra/scripts/with-env.sh +51 -0
- package/files/make/platform.mk +766 -0
- package/files/pnpm-workspace.yaml +28 -0
- package/files/turbo.json +13 -0
- package/package.json +46 -4
- package/standalone/LICENSE +201 -0
- package/standalone/NOTICE +2 -0
- package/standalone/dot-github/workflows/ci.yml +29 -0
- package/standalone/infra/ansible/README.md +21 -0
- package/standalone/infra/ansible/playbooks/deploy.yml +95 -0
- package/standalone/infra/caddy/Caddyfile +39 -0
- package/standalone/infra/docker/node.Dockerfile +39 -0
- package/standalone/infra/docker/postgres/init-app-user.sh +9 -0
- package/standalone/infra/docker/stack/docker-compose.yml +146 -0
- package/standalone/infra/docker/web.Dockerfile +27 -0
- package/standalone/infra/scripts/check-infra.sh +45 -0
- package/standalone/make/standalone.mk +224 -0
- package/starter/Makefile +11 -0
- package/starter/README.md +121 -0
- package/starter/apps/admin/dot-env.example +10 -0
- package/starter/apps/admin/index.html +15 -0
- package/starter/apps/admin/package.json.tmpl +23 -0
- package/starter/apps/admin/public/favicon.svg +1 -0
- package/starter/apps/admin/src/main.tsx +19 -0
- package/starter/apps/admin/tsconfig.json +9 -0
- package/starter/apps/admin/vite.config.ts +23 -0
- package/starter/apps/api/package.json.tmpl +65 -0
- package/starter/apps/api/seed/plans.json +88 -0
- package/starter/apps/api/src/admin/admin-actions.int.test.ts +326 -0
- package/starter/apps/api/src/admin/admin.controller.ts +86 -0
- package/starter/apps/api/src/admin/admin.int.test.ts +295 -0
- package/starter/apps/api/src/admin-user.ts +26 -0
- package/starter/apps/api/src/app.module.ts +226 -0
- package/starter/apps/api/src/assign-plan.ts +18 -0
- package/starter/apps/api/src/auth/auth.hardening.int.test.ts +339 -0
- package/starter/apps/api/src/auth/auth.int.test.ts +411 -0
- package/starter/apps/api/src/auth/email-sign-in.int.test.ts +312 -0
- package/starter/apps/api/src/auth/extension-keys.int.test.ts +65 -0
- package/starter/apps/api/src/billing/payments.int.test.ts +448 -0
- package/starter/apps/api/src/billing/plan-features.int.test.ts +124 -0
- package/starter/apps/api/src/billing/shopify-billing.int.test.ts +600 -0
- package/starter/apps/api/src/billing/usage.int.test.ts +95 -0
- package/starter/apps/api/src/bootstrap.ts +31 -0
- package/starter/apps/api/src/combined.int.test.ts +90 -0
- package/starter/apps/api/src/combined.ts +16 -0
- package/starter/apps/api/src/common/error.filter.int.test.ts +278 -0
- package/starter/apps/api/src/contract.int.test.ts +99 -0
- package/starter/apps/api/src/examples/find-images.controller.test.ts +26 -0
- package/starter/apps/api/src/examples/find-images.controller.ts +39 -0
- package/starter/apps/api/src/health/health.int.test.ts +65 -0
- package/starter/apps/api/src/infra/infra.module.ts +269 -0
- package/starter/apps/api/src/infra/tokens.ts +20 -0
- package/starter/apps/api/src/main.ts +32 -0
- package/starter/apps/api/src/observability.int.test.ts +40 -0
- package/starter/apps/api/src/security-sweep.int.test.ts +705 -0
- package/starter/apps/api/src/seed-plans.int.test.ts +68 -0
- package/starter/apps/api/src/seed-plans.test.ts +67 -0
- package/starter/apps/api/src/seed-plans.ts +27 -0
- package/starter/apps/api/src/seed.ts +24 -0
- package/starter/apps/api/src/set-price.ts +31 -0
- package/starter/apps/api/src/shopify/shopify-auth.int.test.ts +908 -0
- package/starter/apps/api/src/shopify/store-only.int.test.ts +209 -0
- package/starter/apps/api/src/shopify/webhook-subscriptions.service.ts +46 -0
- package/starter/apps/api/src/shopify/webhooks.controller.ts +181 -0
- package/starter/apps/api/src/shopify/webhooks.int.test.ts +564 -0
- package/starter/apps/api/src/stores/stores.controller.test.ts +23 -0
- package/starter/apps/api/src/stores/stores.controller.ts +43 -0
- package/starter/apps/api/src/tenant-isolation.int.test.ts +329 -0
- package/starter/apps/api/src/testing/harness.ts +169 -0
- package/starter/apps/api/tsconfig.json +4 -0
- package/starter/apps/api/vitest.config.ts +1 -0
- package/starter/apps/api/vitest.int.config.ts +1 -0
- package/starter/apps/shopify-app/dot-env.example +11 -0
- package/starter/apps/shopify-app/index.html +16 -0
- package/starter/apps/shopify-app/package.json.tmpl +24 -0
- package/starter/apps/shopify-app/public/favicon.svg +1 -0
- package/starter/apps/shopify-app/src/main.tsx +34 -0
- package/starter/apps/shopify-app/tsconfig.json +9 -0
- package/starter/apps/shopify-app/vite.config.ts +19 -0
- package/starter/apps/web/dot-env.example +27 -0
- package/starter/apps/web/index.html +13 -0
- package/starter/apps/web/package.json.tmpl +23 -0
- package/starter/apps/web/public/favicon.svg +1 -0
- package/starter/apps/web/src/main.tsx +27 -0
- package/starter/apps/web/tsconfig.json +9 -0
- package/starter/apps/web/vite.config.ts +30 -0
- package/starter/apps/worker/package.json.tmpl +34 -0
- package/starter/apps/worker/src/billing/store-billing-sync.int.test.ts +349 -0
- package/starter/apps/worker/src/billing/store-billing-sync.ts +44 -0
- package/starter/apps/worker/src/handlers/shopify-sync.handler.test.ts +64 -0
- package/starter/apps/worker/src/handlers/shopify-sync.handler.ts +48 -0
- package/starter/apps/worker/src/health.test.ts +77 -0
- package/starter/apps/worker/src/health.ts +71 -0
- package/starter/apps/worker/src/main.ts +21 -0
- package/starter/apps/worker/src/runtime.int.test.ts +176 -0
- package/starter/apps/worker/src/runtime.ts +181 -0
- package/starter/apps/worker/tsconfig.json +4 -0
- package/starter/apps/worker/vitest.config.ts +1 -0
- package/starter/apps/worker/vitest.int.config.ts +1 -0
- package/starter/dot-dockerignore +18 -0
- package/starter/dot-env.example +283 -0
- package/starter/dot-gitignore +21 -0
- package/starter/dot-npmrc +1 -0
- package/starter/dot-prettierignore +8 -0
- package/starter/dot-prettierrc.json +1 -0
- package/starter/e2e/package.json.tmpl +22 -0
- package/starter/e2e/src/local-database.test.ts +50 -0
- package/starter/e2e/src/local-database.ts +32 -0
- package/starter/e2e/src/sign-in.ts +50 -0
- package/starter/e2e/tsconfig.json +1 -0
- package/starter/e2e/vitest.config.ts +1 -0
- package/starter/e2e/vitest.int.config.ts +1 -0
- package/starter/eslint.config.js +1 -0
- package/starter/infra/ansible/README.md +25 -0
- package/starter/infra/ansible/inventory/hosts.yml +34 -0
- package/starter/infra/certs/dot-gitkeep +0 -0
- package/starter/infra/docker/local/docker-compose.yml +205 -0
- package/starter/infra/docker/local/init-app-user.sh +9 -0
- package/starter/package.json.tmpl +39 -0
- package/starter/packages/billing/package.json.tmpl +16 -0
- package/starter/packages/billing/src/index.test.ts +21 -0
- package/starter/packages/billing/src/index.ts +31 -0
- package/starter/packages/billing/tsconfig.json +1 -0
- package/starter/packages/billing/vitest.config.ts +1 -0
- package/starter/packages/config/package.json.tmpl +18 -0
- package/starter/packages/config/src/config.test.ts +228 -0
- package/starter/packages/config/src/config.ts +106 -0
- package/starter/packages/config/src/extension.test.ts +20 -0
- package/starter/packages/config/src/index.ts +3 -0
- package/starter/packages/config/src/refuse-in-production.test.ts +14 -0
- package/starter/packages/config/src/refuse-in-production.ts +1 -0
- package/starter/packages/config/src/testing.ts +4 -0
- package/starter/packages/config/tsconfig.json +1 -0
- package/starter/packages/config/vitest.config.ts +1 -0
- package/starter/packages/contracts/package.json.tmpl +20 -0
- package/starter/packages/contracts/src/admin.test.ts +47 -0
- package/starter/packages/contracts/src/admin.ts +113 -0
- package/starter/packages/contracts/src/api-keys.ts +12 -0
- package/starter/packages/contracts/src/auth.ts +34 -0
- package/starter/packages/contracts/src/billing.test.ts +218 -0
- package/starter/packages/contracts/src/billing.ts +190 -0
- package/starter/packages/contracts/src/errors.test.ts +127 -0
- package/starter/packages/contracts/src/errors.ts +22 -0
- package/starter/packages/contracts/src/examples.ts +23 -0
- package/starter/packages/contracts/src/features.ts +32 -0
- package/starter/packages/contracts/src/index.ts +12 -0
- package/starter/packages/contracts/src/messages.ts +16 -0
- package/starter/packages/contracts/src/openapi.test.ts +37 -0
- package/starter/packages/contracts/src/openapi.ts +244 -0
- package/starter/packages/contracts/src/stores.ts +21 -0
- package/starter/packages/contracts/tsconfig.json +1 -0
- package/starter/packages/contracts/vitest.config.ts +1 -0
- package/starter/packages/database/drizzle/0000_initial.sql +268 -0
- package/starter/packages/database/drizzle/0001_roles_rls_and_plans.sql +111 -0
- package/starter/packages/database/drizzle/0002_admin_panel.sql +18 -0
- package/starter/packages/database/drizzle/0003_admin_panel_rls.sql +9 -0
- package/starter/packages/database/drizzle/0004_extension_keys.sql +18 -0
- package/starter/packages/database/drizzle/0005_extension_keys_rls.sql +9 -0
- package/starter/packages/database/drizzle/0006_platform_audit.sql +1 -0
- package/starter/packages/database/drizzle/meta/0000_snapshot.json +1532 -0
- package/starter/packages/database/drizzle/meta/0001_snapshot.json +1532 -0
- package/starter/packages/database/drizzle/meta/0002_snapshot.json +1666 -0
- package/starter/packages/database/drizzle/meta/0003_snapshot.json +1666 -0
- package/starter/packages/database/drizzle/meta/0004_snapshot.json +1805 -0
- package/starter/packages/database/drizzle/meta/0005_snapshot.json +1805 -0
- package/starter/packages/database/drizzle/meta/0006_snapshot.json +1805 -0
- package/starter/packages/database/drizzle/meta/_journal.json +55 -0
- package/starter/packages/database/drizzle.config.ts +7 -0
- package/starter/packages/database/package.json.tmpl +32 -0
- package/starter/packages/database/src/billing-schema.int.test.ts +142 -0
- package/starter/packages/database/src/client.int.test.ts +47 -0
- package/starter/packages/database/src/client.ts +3 -0
- package/starter/packages/database/src/index.ts +16 -0
- package/starter/packages/database/src/migrate-cli.ts +4 -0
- package/starter/packages/database/src/migrate.ts +7 -0
- package/starter/packages/database/src/repositories/admin.int.test.ts +179 -0
- package/starter/packages/database/src/repositories/admin.repository.ts +300 -0
- package/starter/packages/database/src/repositories/api-key.repository.ts +11 -0
- package/starter/packages/database/src/repositories/billing.int.test.ts +828 -0
- package/starter/packages/database/src/repositories/billing.repository.ts +90 -0
- package/starter/packages/database/src/repositories/extension-key.repository.ts +12 -0
- package/starter/packages/database/src/repositories/feature.int.test.ts +614 -0
- package/starter/packages/database/src/repositories/feature.repository.ts +42 -0
- package/starter/packages/database/src/repositories/identity.repository.ts +10 -0
- package/starter/packages/database/src/repositories/metrics.repository.ts +37 -0
- package/starter/packages/database/src/repositories/outbox.repository.ts +9 -0
- package/starter/packages/database/src/repositories/shared.ts +33 -0
- package/starter/packages/database/src/repositories/store.repository.ts +35 -0
- package/starter/packages/database/src/repositories/system-store.repository.ts +422 -0
- package/starter/packages/database/src/repositories/system.int.test.ts +516 -0
- package/starter/packages/database/src/repositories/tenant.int.test.ts +75 -0
- package/starter/packages/database/src/repositories/webhook-event.repository.ts +9 -0
- package/starter/packages/database/src/rls.int.test.ts +137 -0
- package/starter/packages/database/src/schema/billing.ts +74 -0
- package/starter/packages/database/src/schema/identity.ts +46 -0
- package/starter/packages/database/src/schema/index.ts +4 -0
- package/starter/packages/database/src/schema/stores.ts +29 -0
- package/starter/packages/database/src/schema/system.ts +34 -0
- package/starter/packages/database/src/schema-tables.int.test.ts +99 -0
- package/starter/packages/database/src/tenant.ts +2 -0
- package/starter/packages/database/src/testing.ts +23 -0
- package/starter/packages/database/tsconfig.json +1 -0
- package/starter/packages/database/vitest.config.ts +1 -0
- package/starter/packages/database/vitest.int.config.ts +1 -0
- package/starter/packages/observability/package.json.tmpl +18 -0
- package/starter/packages/observability/src/index.ts +3 -0
- package/starter/packages/observability/src/metrics.test.ts +170 -0
- package/starter/packages/observability/src/metrics.ts +66 -0
- package/starter/packages/observability/tsconfig.json +1 -0
- package/starter/packages/observability/vitest.config.ts +1 -0
- package/starter/packages/queue/package.json.tmpl +23 -0
- package/starter/packages/queue/src/index.ts +3 -0
- package/starter/packages/queue/src/queue.int.test.ts +260 -0
- package/starter/packages/queue/src/topology.test.ts +18 -0
- package/starter/packages/queue/src/topology.ts +38 -0
- package/starter/packages/queue/tsconfig.json +1 -0
- package/starter/packages/queue/vitest.config.ts +1 -0
- package/starter/packages/queue/vitest.int.config.ts +1 -0
- package/starter/packages/shopify/package.json.tmpl +17 -0
- package/starter/packages/shopify/src/index.test.ts +8 -0
- package/starter/packages/shopify/src/index.ts +30 -0
- package/starter/packages/shopify/src/store-import.test.ts +142 -0
- package/starter/packages/shopify/src/store-import.ts +157 -0
- package/starter/packages/shopify/tsconfig.json +1 -0
- package/starter/packages/shopify/vitest.config.ts +1 -0
- package/starter/packages/web-ui/package.json.tmpl +34 -0
- package/starter/packages/web-ui/src/App.test.tsx +377 -0
- package/starter/packages/web-ui/src/App.tsx +366 -0
- package/starter/packages/web-ui/src/Brand.test.tsx +74 -0
- package/starter/packages/web-ui/src/api-client.test.ts +258 -0
- package/starter/packages/web-ui/src/api-client.ts +238 -0
- package/starter/packages/web-ui/src/components/Logo.tsx +69 -0
- package/starter/packages/web-ui/src/components/StoreNav.tsx +6 -0
- package/starter/packages/web-ui/src/css.d.ts +1 -0
- package/starter/packages/web-ui/src/index.ts +7 -0
- package/starter/packages/web-ui/src/pages/ConnectExtensionPage.test.tsx +126 -0
- package/starter/packages/web-ui/src/pages/ConnectExtensionPage.tsx +133 -0
- package/starter/packages/web-ui/src/pages/FindImagesPage.tsx +44 -0
- package/starter/packages/web-ui/src/pages/HomePage.tsx +22 -0
- package/starter/packages/web-ui/src/pages/LoginPage.tsx +30 -0
- package/starter/packages/web-ui/src/pages/UsagePage.test.tsx +547 -0
- package/starter/packages/web-ui/src/pages/UsagePage.tsx +37 -0
- package/starter/packages/web-ui/src/pages/admin/AdminApp.test.tsx +373 -0
- package/starter/packages/web-ui/src/pages/admin/AdminApp.tsx +480 -0
- package/starter/packages/web-ui/src/pages/admin/format.ts +3 -0
- package/starter/packages/web-ui/src/pages/stores/Stores.test.tsx +265 -0
- package/starter/packages/web-ui/src/pages/stores/StoresPage.tsx +97 -0
- package/starter/packages/web-ui/src/store-only.ts +11 -0
- package/starter/packages/web-ui/src/styles.css +2200 -0
- package/starter/packages/web-ui/src/testing/fake-client.ts +145 -0
- package/starter/packages/web-ui/tsconfig.json +9 -0
- package/starter/packages/web-ui/vitest.config.ts +1 -0
- package/starter/scripts/build-app.mjs +84 -0
- package/starter/tsconfig.base.json +1 -0
- package/starter/vitest.shared.ts +1 -0
- package/starter-extension/LICENSE +201 -0
- package/starter-extension/Makefile +41 -0
- package/starter-extension/NOTICE +2 -0
- package/starter-extension/README.md +42 -0
- package/starter-extension/apps/extension/index.html +12 -0
- package/starter-extension/apps/extension/manifest.config.ts +43 -0
- package/starter-extension/apps/extension/package.json.tmpl +31 -0
- package/starter-extension/apps/extension/public/icons/128.png +0 -0
- package/starter-extension/apps/extension/public/icons/16.png +0 -0
- package/starter-extension/apps/extension/public/icons/32.png +0 -0
- package/starter-extension/apps/extension/public/icons/48.png +0 -0
- package/starter-extension/apps/extension/src/Panel.test.tsx +78 -0
- package/starter-extension/apps/extension/src/Panel.tsx +85 -0
- package/starter-extension/apps/extension/src/background.ts +6 -0
- package/starter-extension/apps/extension/src/brand.tsx +19 -0
- package/starter-extension/apps/extension/src/main.tsx +20 -0
- package/starter-extension/apps/extension/src/origins.ts +12 -0
- package/starter-extension/apps/extension/src/vite-env.d.ts +1 -0
- package/starter-extension/apps/extension/tsconfig.json +15 -0
- package/starter-extension/apps/extension/vite.config.ts +48 -0
- package/starter-extension/apps/extension/vitest.config.ts +6 -0
- package/starter-extension/dot-gitignore +6 -0
- package/starter-extension/dot-npmrc +1 -0
- package/starter-extension/package.json.tmpl +14 -0
- package/starter-extension/pnpm-workspace.yaml +4 -0
- package/starter-extension/scripts/make-key.mjs +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Haatlabs
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @haatlabs-core/templates
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The files a project cannot import (the Makefile's shared targets, Dockerfiles, compose,
|
|
4
|
+
ansible, workflows and deploy scripts), as templates, and the starting files of a new
|
|
5
|
+
project. `haatlabs sync` (`@haatlabs-core/cli`) writes them into a project from its
|
|
6
|
+
`platform.json`; nothing here runs on its own.
|
|
7
|
+
|
|
8
|
+
- `files/`: one template per managed path, at that path. `@@name@@` is replaced; lines
|
|
9
|
+
between `#@if <condition>` and `#@end` are kept only when the condition holds
|
|
10
|
+
(`web`, `shopify`, `admin`, `dashboards`, `sharedServices`, `sharedImage`, `nodeHeap`,
|
|
11
|
+
`workerConcurrency`, `cache`; `!` inverts). `@@nameSnake@@` is the name with underscores,
|
|
12
|
+
for Postgres, Prometheus and variable names; `@@NAME@@` is it in capitals.
|
|
13
|
+
- `starter/`: what `haatlabs create` writes once into a new project, which then owns it.
|
|
14
|
+
- `TEMPLATES` lists each managed path, its condition and its comment style.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
pnpm add @haatlabs-core/templates --save-dev
|
|
19
|
+
|
|
20
|
+
## The run stage
|
|
21
|
+
|
|
22
|
+
The api and worker images (`files/infra/docker/node.Dockerfile`) build in a `node:24-slim`
|
|
23
|
+
stage and run in a distroless one (`nodejs24-debian13:nonroot`): Node and glibc, no shell and
|
|
24
|
+
no package manager, as the nonroot user. The entrypoint is cleared, so `node dist/migrate.mjs`
|
|
25
|
+
(make migrate-image) and `node dist/main.mjs` both run as they did on slim. Because nothing
|
|
26
|
+
can be installed or inspected inside the image, the build fails if the bundle's external
|
|
27
|
+
packages (`dist/externals.json`) are missing, and the images workflow runs the same check
|
|
28
|
+
against the built image, native packages included.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const CONDITIONS: readonly ["web", "shopify", "admin", "dashboards", "sharedServices", "sharedImage", "nodeHeap", "combinedWorker", "registryGithub", "workerConcurrency", "cache", "standalone", "kindShopify"];
|
|
2
|
+
export type Condition = (typeof CONDITIONS)[number];
|
|
3
|
+
export interface TemplateFile {
|
|
4
|
+
/** Where the file goes in a project; the template sits at the same path under files/. */
|
|
5
|
+
path: string;
|
|
6
|
+
/** Written only when this holds for the project. */
|
|
7
|
+
when?: Condition | `!${Condition}`;
|
|
8
|
+
/** 'file': the whole file. 'block': the lines between the platform markers. */
|
|
9
|
+
mode?: 'file' | 'block';
|
|
10
|
+
/** How a comment starts in this file; null where the format has none (JSON). */
|
|
11
|
+
comment: '#' | null;
|
|
12
|
+
executable?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const templatesRoot: string;
|
|
15
|
+
export declare const starterRoot: string;
|
|
16
|
+
/** What a standalone app (`infra: standalone`) gets on top of the starter, and owns. */
|
|
17
|
+
export declare const standaloneRoot: string;
|
|
18
|
+
/** A browser extension of an app (`haatlabs create --kind extension`). */
|
|
19
|
+
export declare const starterExtensionRoot: string;
|
|
20
|
+
export declare const templatesVersion: string;
|
|
21
|
+
export declare const TEMPLATES: readonly TemplateFile[];
|
|
22
|
+
/**
|
|
23
|
+
* Starter files written only when their condition holds: a path ending in / is a whole
|
|
24
|
+
* directory. Everything else in the starter is always written (its own `#@if` blocks aside).
|
|
25
|
+
*/
|
|
26
|
+
export declare const STARTER_WHEN: readonly {
|
|
27
|
+
path: string;
|
|
28
|
+
when: Condition | `!${Condition}`;
|
|
29
|
+
}[];
|
|
30
|
+
/**
|
|
31
|
+
* Managed templates that a standalone app is also given, once, as files of its own: the
|
|
32
|
+
* generic ones, which name nothing of Haatlabs' own infrastructure.
|
|
33
|
+
*/
|
|
34
|
+
export declare const STANDALONE_SHARED: readonly string[];
|
|
35
|
+
/** Whether a starter file (its path in the starter) is written for a project with these conditions. */
|
|
36
|
+
export declare function starterFileWanted(path: string, conditions: Record<string, boolean>): boolean;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
export const CONDITIONS = [
|
|
4
|
+
'web',
|
|
5
|
+
'shopify',
|
|
6
|
+
'admin',
|
|
7
|
+
/** Any of web, shopify and admin. */
|
|
8
|
+
'dashboards',
|
|
9
|
+
'sharedServices',
|
|
10
|
+
'sharedImage',
|
|
11
|
+
'nodeHeap',
|
|
12
|
+
'combinedWorker',
|
|
13
|
+
/** The app installs from GitHub Packages (platform.json registry "github"). */
|
|
14
|
+
'registryGithub',
|
|
15
|
+
'workerConcurrency',
|
|
16
|
+
'cache',
|
|
17
|
+
/** The app brings its own Postgres, Redis and proxy (`infra: standalone`). */
|
|
18
|
+
'standalone',
|
|
19
|
+
/** A Shopify app (`kind: shopify`), not a plain web app. */
|
|
20
|
+
'kindShopify',
|
|
21
|
+
];
|
|
22
|
+
export const templatesRoot = fileURLToPath(new URL('../files/', import.meta.url));
|
|
23
|
+
export const starterRoot = fileURLToPath(new URL('../starter/', import.meta.url));
|
|
24
|
+
/** What a standalone app (`infra: standalone`) gets on top of the starter, and owns. */
|
|
25
|
+
export const standaloneRoot = fileURLToPath(new URL('../standalone/', import.meta.url));
|
|
26
|
+
/** A browser extension of an app (`haatlabs create --kind extension`). */
|
|
27
|
+
export const starterExtensionRoot = fileURLToPath(new URL('../starter-extension/', import.meta.url));
|
|
28
|
+
export const templatesVersion = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
29
|
+
export const TEMPLATES = [
|
|
30
|
+
{ path: 'turbo.json', comment: null },
|
|
31
|
+
{ path: 'pnpm-workspace.yaml', mode: 'block', comment: '#' },
|
|
32
|
+
{ path: 'make/platform.mk', comment: '#' },
|
|
33
|
+
{ path: 'infra/docker/node.Dockerfile', comment: '#' },
|
|
34
|
+
{ path: 'infra/docker/web.Dockerfile', comment: '#', when: 'web' },
|
|
35
|
+
{ path: 'infra/docker/nginx.conf', comment: '#', when: 'web' },
|
|
36
|
+
{ path: 'infra/docker/stack/docker-compose.yml', comment: '#' },
|
|
37
|
+
{ path: 'infra/ansible/ansible.cfg', comment: '#' },
|
|
38
|
+
{ path: 'infra/ansible/playbooks/dev.yml', comment: '#' },
|
|
39
|
+
{ path: 'infra/ansible/playbooks/staging.yml', comment: '#' },
|
|
40
|
+
{ path: 'infra/ansible/playbooks/prod.yml', comment: '#' },
|
|
41
|
+
{ path: 'infra/ansible/playbooks/setup.yml', comment: '#' },
|
|
42
|
+
{ path: 'infra/ansible/playbooks/logs.yml', comment: '#' },
|
|
43
|
+
{ path: 'infra/ansible/playbooks/restart.yml', comment: '#' },
|
|
44
|
+
{ path: 'infra/ansible/playbooks/server-check.yml', comment: '#' },
|
|
45
|
+
{ path: 'infra/ansible/playbooks/shared.yml', comment: '#', when: 'sharedServices' },
|
|
46
|
+
{ path: 'infra/ansible/playbooks/tasks/clean.yml', comment: '#' },
|
|
47
|
+
{ path: 'infra/ansible/playbooks/tasks/deploy.yml', comment: '#' },
|
|
48
|
+
{ path: 'infra/scripts/with-env.sh', comment: '#', executable: true },
|
|
49
|
+
{ path: 'infra/scripts/gh-secrets.sh', comment: '#', executable: true },
|
|
50
|
+
{ path: 'infra/scripts/ca-bundle.sh', comment: '#', executable: true },
|
|
51
|
+
{ path: 'infra/scripts/build-images.sh', comment: '#', executable: true },
|
|
52
|
+
{ path: 'infra/scripts/pages.sh', comment: '#', executable: true, when: 'dashboards' },
|
|
53
|
+
{ path: 'infra/scripts/check-infra.sh', comment: '#', executable: true },
|
|
54
|
+
{ path: '.github/workflows/ci.yml', comment: '#' },
|
|
55
|
+
{ path: '.github/workflows/images.yml', comment: '#' },
|
|
56
|
+
{ path: '.github/workflows/deploy.yml', comment: '#' },
|
|
57
|
+
{ path: '.github/workflows/deploy-pages.yml', comment: '#', when: 'dashboards' },
|
|
58
|
+
{ path: '.github/workflows/deploy-shared.yml', comment: '#', when: 'sharedServices' },
|
|
59
|
+
];
|
|
60
|
+
/**
|
|
61
|
+
* Starter files written only when their condition holds: a path ending in / is a whole
|
|
62
|
+
* directory. Everything else in the starter is always written (its own `#@if` blocks aside).
|
|
63
|
+
*/
|
|
64
|
+
export const STARTER_WHEN = [
|
|
65
|
+
{ path: 'apps/shopify-app/', when: 'kindShopify' },
|
|
66
|
+
{ path: 'packages/shopify/', when: 'kindShopify' },
|
|
67
|
+
{ path: 'apps/api/src/shopify/', when: 'kindShopify' },
|
|
68
|
+
{ path: 'apps/api/src/stores/', when: 'kindShopify' },
|
|
69
|
+
{ path: 'apps/api/src/billing/shopify-billing.int.test.ts', when: 'kindShopify' },
|
|
70
|
+
{ path: 'apps/api/src/auth/email-sign-in.int.test.ts', when: 'kindShopify' },
|
|
71
|
+
{ path: 'apps/worker/src/handlers/shopify-sync.handler.ts', when: 'kindShopify' },
|
|
72
|
+
{ path: 'apps/worker/src/handlers/shopify-sync.handler.test.ts', when: 'kindShopify' },
|
|
73
|
+
{ path: 'apps/worker/src/billing/', when: 'kindShopify' },
|
|
74
|
+
{ path: 'packages/web-ui/src/pages/stores/', when: 'kindShopify' },
|
|
75
|
+
{ path: 'packages/web-ui/src/store-only.ts', when: 'kindShopify' },
|
|
76
|
+
// A standalone app installs from the public npm registry.
|
|
77
|
+
// The scope line that sends @haatlabs-core to GitHub Packages: what a GitHub app installs from.
|
|
78
|
+
{ path: 'dot-npmrc', when: 'registryGithub' },
|
|
79
|
+
// The example page on the Haatlabs API, for a developer's own app.
|
|
80
|
+
{ path: 'packages/contracts/src/examples.ts', when: 'standalone' },
|
|
81
|
+
{ path: 'apps/api/src/examples/', when: 'standalone' },
|
|
82
|
+
{ path: 'packages/web-ui/src/pages/FindImagesPage.tsx', when: 'standalone' },
|
|
83
|
+
];
|
|
84
|
+
/**
|
|
85
|
+
* Managed templates that a standalone app is also given, once, as files of its own: the
|
|
86
|
+
* generic ones, which name nothing of Haatlabs' own infrastructure.
|
|
87
|
+
*/
|
|
88
|
+
export const STANDALONE_SHARED = [
|
|
89
|
+
'turbo.json',
|
|
90
|
+
'pnpm-workspace.yaml',
|
|
91
|
+
'infra/ansible/ansible.cfg',
|
|
92
|
+
'infra/ansible/playbooks/setup.yml',
|
|
93
|
+
'infra/scripts/with-env.sh',
|
|
94
|
+
];
|
|
95
|
+
/** Whether a starter file (its path in the starter) is written for a project with these conditions. */
|
|
96
|
+
export function starterFileWanted(path, conditions) {
|
|
97
|
+
return STARTER_WHEN.every(({ path: prefix, when }) => {
|
|
98
|
+
const applies = prefix.endsWith('/') ? path.startsWith(prefix) : path === prefix;
|
|
99
|
+
if (!applies)
|
|
100
|
+
return true;
|
|
101
|
+
const not = when.startsWith('!');
|
|
102
|
+
return conditions[not ? when.slice(1) : when] !== not;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK;IACL,SAAS;IACT,OAAO;IACP,qCAAqC;IACrC,YAAY;IACZ,gBAAgB;IAChB,aAAa;IACb,UAAU;IACV,gBAAgB;IAChB,+EAA+E;IAC/E,gBAAgB;IAChB,mBAAmB;IACnB,OAAO;IACP,8EAA8E;IAC9E,YAAY;IACZ,4DAA4D;IAC5D,aAAa;CACL,CAAC;AAeX,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAClF,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACxF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAC/C,IAAI,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAClD,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAC3B,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,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AI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;QACjF,IAAI,CAAC,OAAO;YAAE,OAAO,IAAI,CAAC;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACjC,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Validates the code on every push, to any branch. Nothing here deploys, and nothing
|
|
2
|
+
#@if registryGithub
|
|
3
|
+
# here talks to @@ciTalksTo@@ or a real host. The one secret is a read-only
|
|
4
|
+
# token for the @haatlabs-core packages (HAATLABS_PACKAGES_TOKEN; `make gh-packages-token`), given
|
|
5
|
+
# to the install steps and the image builds only.
|
|
6
|
+
#@end
|
|
7
|
+
#@if !registryGithub
|
|
8
|
+
# here talks to @@ciTalksTo@@ or a real host. It uses no secret: the platform's
|
|
9
|
+
# packages are public on npmjs.com.
|
|
10
|
+
#@end
|
|
11
|
+
# Deploying is a separate workflow, started by hand: deploy.yml.
|
|
12
|
+
#
|
|
13
|
+
# checks the managed files, type check, lint, format, unit tests
|
|
14
|
+
# integration the integration and end-to-end suites; each test file starts its own
|
|
15
|
+
# Postgres and Redis containers, so no env file is involved
|
|
16
|
+
# infra the deploy files: compose files resolve, scripts parse, playbooks pass
|
|
17
|
+
# ansible's syntax check
|
|
18
|
+
#@if web
|
|
19
|
+
# images the api, worker and dashboard images build
|
|
20
|
+
#@end
|
|
21
|
+
#@if !web
|
|
22
|
+
# images the api and worker images build
|
|
23
|
+
#@end
|
|
24
|
+
#
|
|
25
|
+
# Not here: `make test-real`, which needs what only a person can set up.
|
|
26
|
+
name: CI
|
|
27
|
+
|
|
28
|
+
on:
|
|
29
|
+
push:
|
|
30
|
+
|
|
31
|
+
# A newer push to the same branch makes the older run pointless.
|
|
32
|
+
concurrency:
|
|
33
|
+
group: ci-${{ github.ref }}
|
|
34
|
+
cancel-in-progress: true
|
|
35
|
+
|
|
36
|
+
permissions:
|
|
37
|
+
contents: read
|
|
38
|
+
|
|
39
|
+
jobs:
|
|
40
|
+
checks:
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
timeout-minutes: 15
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@v4
|
|
45
|
+
# First, before anything installs: a link to a local platform checkout is never merged.
|
|
46
|
+
# `pnpm link` writes one into a package.json and an override into pnpm-workspace.yaml.
|
|
47
|
+
- name: The platform comes from the registry, not a local checkout
|
|
48
|
+
run: |
|
|
49
|
+
if grep -nE "@haatlabs-core/[^'\"[:space:]]+['\"]?[[:space:]]*:[[:space:]]*['\"]?(link|file):" \
|
|
50
|
+
pnpm-workspace.yaml $(git ls-files '*package.json'); then
|
|
51
|
+
echo "::error::A @haatlabs-core dependency points at a local checkout: unlink it before committing"
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
- uses: pnpm/action-setup@v4
|
|
55
|
+
- uses: actions/setup-node@v4
|
|
56
|
+
with:
|
|
57
|
+
node-version: 24
|
|
58
|
+
cache: pnpm
|
|
59
|
+
#@if registryGithub
|
|
60
|
+
# Writes the user-level npmrc line pnpm reads NODE_AUTH_TOKEN from.
|
|
61
|
+
registry-url: https://npm.pkg.github.com
|
|
62
|
+
scope: '@haatlabs-core'
|
|
63
|
+
#@end
|
|
64
|
+
#@if registryGithub
|
|
65
|
+
- run: make install
|
|
66
|
+
env:
|
|
67
|
+
NODE_AUTH_TOKEN: ${{ secrets.HAATLABS_PACKAGES_TOKEN }}
|
|
68
|
+
#@end
|
|
69
|
+
#@if !registryGithub
|
|
70
|
+
- run: make install
|
|
71
|
+
#@end
|
|
72
|
+
# A managed file edited by hand, or not synced after an upgrade: make sync.
|
|
73
|
+
- run: make sync-check
|
|
74
|
+
- run: make typecheck
|
|
75
|
+
- run: make lint
|
|
76
|
+
- run: make format-check
|
|
77
|
+
- run: make test
|
|
78
|
+
|
|
79
|
+
integration:
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
timeout-minutes: 30
|
|
82
|
+
steps:
|
|
83
|
+
- uses: actions/checkout@v4
|
|
84
|
+
- uses: pnpm/action-setup@v4
|
|
85
|
+
- uses: actions/setup-node@v4
|
|
86
|
+
with:
|
|
87
|
+
node-version: 24
|
|
88
|
+
cache: pnpm
|
|
89
|
+
#@if registryGithub
|
|
90
|
+
# Writes the user-level npmrc line pnpm reads NODE_AUTH_TOKEN from.
|
|
91
|
+
registry-url: https://npm.pkg.github.com
|
|
92
|
+
scope: '@haatlabs-core'
|
|
93
|
+
#@end
|
|
94
|
+
#@if registryGithub
|
|
95
|
+
- run: make install
|
|
96
|
+
env:
|
|
97
|
+
NODE_AUTH_TOKEN: ${{ secrets.HAATLABS_PACKAGES_TOKEN }}
|
|
98
|
+
#@end
|
|
99
|
+
#@if !registryGithub
|
|
100
|
+
- run: make install
|
|
101
|
+
#@end
|
|
102
|
+
- run: make test-int
|
|
103
|
+
|
|
104
|
+
infra:
|
|
105
|
+
runs-on: ubuntu-latest
|
|
106
|
+
timeout-minutes: 10
|
|
107
|
+
steps:
|
|
108
|
+
- uses: actions/checkout@v4
|
|
109
|
+
- run: make check-infra
|
|
110
|
+
|
|
111
|
+
images:
|
|
112
|
+
runs-on: ubuntu-latest
|
|
113
|
+
timeout-minutes: 30
|
|
114
|
+
strategy:
|
|
115
|
+
fail-fast: false
|
|
116
|
+
matrix:
|
|
117
|
+
include:
|
|
118
|
+
- name: api
|
|
119
|
+
dockerfile: infra/docker/node.Dockerfile
|
|
120
|
+
args: APP=api
|
|
121
|
+
- name: worker
|
|
122
|
+
dockerfile: infra/docker/node.Dockerfile
|
|
123
|
+
args: APP=worker
|
|
124
|
+
#@if web
|
|
125
|
+
- name: web
|
|
126
|
+
dockerfile: infra/docker/web.Dockerfile
|
|
127
|
+
args: ''
|
|
128
|
+
#@end
|
|
129
|
+
steps:
|
|
130
|
+
- uses: actions/checkout@v4
|
|
131
|
+
- uses: docker/setup-buildx-action@v3
|
|
132
|
+
- uses: docker/build-push-action@v6
|
|
133
|
+
with:
|
|
134
|
+
context: .
|
|
135
|
+
file: ${{ matrix.dockerfile }}
|
|
136
|
+
build-args: ${{ matrix.args }}
|
|
137
|
+
#@if registryGithub
|
|
138
|
+
secrets: npm_token=${{ secrets.HAATLABS_PACKAGES_TOKEN }}
|
|
139
|
+
#@end
|
|
140
|
+
push: false
|
|
141
|
+
cache-from: type=gha,scope=${{ matrix.name }}
|
|
142
|
+
cache-to: type=gha,scope=${{ matrix.name }},mode=max
|