@endora-commerce/cli 0.100.0
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 +21 -0
- package/README.md +37 -0
- package/dist/bin/endora.d.ts +28 -0
- package/dist/bin/endora.d.ts.map +1 -0
- package/dist/bin/endora.js +926 -0
- package/dist/bin/endora.js.map +1 -0
- package/dist/check/estate.d.ts +189 -0
- package/dist/check/estate.d.ts.map +1 -0
- package/dist/check/estate.js +1037 -0
- package/dist/check/estate.js.map +1 -0
- package/dist/check/hosts.d.ts +25 -0
- package/dist/check/hosts.d.ts.map +1 -0
- package/dist/check/hosts.js +1347 -0
- package/dist/check/hosts.js.map +1 -0
- package/dist/check/index.d.ts +60 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +111 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/layout.d.ts +136 -0
- package/dist/check/layout.d.ts.map +1 -0
- package/dist/check/layout.js +262 -0
- package/dist/check/layout.js.map +1 -0
- package/dist/check/ledger.d.ts +98 -0
- package/dist/check/ledger.d.ts.map +1 -0
- package/dist/check/ledger.js +173 -0
- package/dist/check/ledger.js.map +1 -0
- package/dist/check/peer-owners.d.ts +116 -0
- package/dist/check/peer-owners.d.ts.map +1 -0
- package/dist/check/peer-owners.js +225 -0
- package/dist/check/peer-owners.js.map +1 -0
- package/dist/check/report.d.ts +33 -0
- package/dist/check/report.d.ts.map +1 -0
- package/dist/check/report.js +107 -0
- package/dist/check/report.js.map +1 -0
- package/dist/check/run.d.ts +147 -0
- package/dist/check/run.d.ts.map +1 -0
- package/dist/check/run.js +111 -0
- package/dist/check/run.js.map +1 -0
- package/dist/checks.d.ts +17 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +17 -0
- package/dist/checks.js.map +1 -0
- package/dist/dev/index.d.ts +83 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +298 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/generate/divergence.d.ts +38 -0
- package/dist/generate/divergence.d.ts.map +1 -0
- package/dist/generate/divergence.js +237 -0
- package/dist/generate/divergence.js.map +1 -0
- package/dist/generate/index.d.ts +90 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +369 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/declaration.d.ts +18 -0
- package/dist/inputs/declaration.d.ts.map +1 -0
- package/dist/inputs/declaration.js +64 -0
- package/dist/inputs/declaration.js.map +1 -0
- package/dist/inputs/env-file.d.ts +73 -0
- package/dist/inputs/env-file.d.ts.map +1 -0
- package/dist/inputs/env-file.js +134 -0
- package/dist/inputs/env-file.js.map +1 -0
- package/dist/inputs/prompt.d.ts +21 -0
- package/dist/inputs/prompt.d.ts.map +1 -0
- package/dist/inputs/prompt.js +59 -0
- package/dist/inputs/prompt.js.map +1 -0
- package/dist/inputs/resolve.d.ts +163 -0
- package/dist/inputs/resolve.d.ts.map +1 -0
- package/dist/inputs/resolve.js +290 -0
- package/dist/inputs/resolve.js.map +1 -0
- package/dist/install/host.d.ts +27 -0
- package/dist/install/host.d.ts.map +1 -0
- package/dist/install/host.js +90 -0
- package/dist/install/host.js.map +1 -0
- package/dist/install/index.d.ts +173 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +793 -0
- package/dist/install/index.js.map +1 -0
- package/dist/install/wizard.d.ts +144 -0
- package/dist/install/wizard.d.ts.map +1 -0
- package/dist/install/wizard.js +362 -0
- package/dist/install/wizard.js.map +1 -0
- package/dist/lib/admin-artefacts.d.ts +70 -0
- package/dist/lib/admin-artefacts.d.ts.map +1 -0
- package/dist/lib/admin-artefacts.js +354 -0
- package/dist/lib/admin-artefacts.js.map +1 -0
- package/dist/lib/admin-surfaces.d.ts +298 -0
- package/dist/lib/admin-surfaces.d.ts.map +1 -0
- package/dist/lib/admin-surfaces.js +669 -0
- package/dist/lib/admin-surfaces.js.map +1 -0
- package/dist/lib/delegated-composer.d.ts +85 -0
- package/dist/lib/delegated-composer.d.ts.map +1 -0
- package/dist/lib/delegated-composer.js +241 -0
- package/dist/lib/delegated-composer.js.map +1 -0
- package/dist/lib/divergence-artefacts.d.ts +305 -0
- package/dist/lib/divergence-artefacts.d.ts.map +1 -0
- package/dist/lib/divergence-artefacts.js +828 -0
- package/dist/lib/divergence-artefacts.js.map +1 -0
- package/dist/lib/divergence.d.ts +337 -0
- package/dist/lib/divergence.d.ts.map +1 -0
- package/dist/lib/divergence.js +1005 -0
- package/dist/lib/divergence.js.map +1 -0
- package/dist/lib/docs-artefacts.d.ts +395 -0
- package/dist/lib/docs-artefacts.d.ts.map +1 -0
- package/dist/lib/docs-artefacts.js +781 -0
- package/dist/lib/docs-artefacts.js.map +1 -0
- package/dist/lib/emitted-exports.d.ts +21 -0
- package/dist/lib/emitted-exports.d.ts.map +1 -0
- package/dist/lib/emitted-exports.js +96 -0
- package/dist/lib/emitted-exports.js.map +1 -0
- package/dist/lib/emitted-freshness.d.ts +112 -0
- package/dist/lib/emitted-freshness.d.ts.map +1 -0
- package/dist/lib/emitted-freshness.js +288 -0
- package/dist/lib/emitted-freshness.js.map +1 -0
- package/dist/lib/entity-index-artefact.d.ts +95 -0
- package/dist/lib/entity-index-artefact.d.ts.map +1 -0
- package/dist/lib/entity-index-artefact.js +210 -0
- package/dist/lib/entity-index-artefact.js.map +1 -0
- package/dist/lib/instance-build-inputs.d.ts +108 -0
- package/dist/lib/instance-build-inputs.d.ts.map +1 -0
- package/dist/lib/instance-build-inputs.js +165 -0
- package/dist/lib/instance-build-inputs.js.map +1 -0
- package/dist/lib/module-docs.d.ts +473 -0
- package/dist/lib/module-docs.d.ts.map +1 -0
- package/dist/lib/module-docs.js +711 -0
- package/dist/lib/module-docs.js.map +1 -0
- package/dist/lib/module-package-subpaths.d.ts +56 -0
- package/dist/lib/module-package-subpaths.d.ts.map +1 -0
- package/dist/lib/module-package-subpaths.js +223 -0
- package/dist/lib/module-package-subpaths.js.map +1 -0
- package/dist/lib/module-packages.d.ts +200 -0
- package/dist/lib/module-packages.d.ts.map +1 -0
- package/dist/lib/module-packages.js +580 -0
- package/dist/lib/module-packages.js.map +1 -0
- package/dist/lib/module-population.d.ts +129 -0
- package/dist/lib/module-population.d.ts.map +1 -0
- package/dist/lib/module-population.js +172 -0
- package/dist/lib/module-population.js.map +1 -0
- package/dist/lib/module-roots.d.ts +337 -0
- package/dist/lib/module-roots.d.ts.map +1 -0
- package/dist/lib/module-roots.js +586 -0
- package/dist/lib/module-roots.js.map +1 -0
- package/dist/lib/nested-checkouts.d.ts +33 -0
- package/dist/lib/nested-checkouts.d.ts.map +1 -0
- package/dist/lib/nested-checkouts.js +160 -0
- package/dist/lib/nested-checkouts.js.map +1 -0
- package/dist/lib/platform-root.d.ts +43 -0
- package/dist/lib/platform-root.d.ts.map +1 -0
- package/dist/lib/platform-root.js +134 -0
- package/dist/lib/platform-root.js.map +1 -0
- package/dist/lib/platform-surface.d.ts +235 -0
- package/dist/lib/platform-surface.d.ts.map +1 -0
- package/dist/lib/platform-surface.js +393 -0
- package/dist/lib/platform-surface.js.map +1 -0
- package/dist/lib/port-registrations.d.ts +223 -0
- package/dist/lib/port-registrations.d.ts.map +1 -0
- package/dist/lib/port-registrations.js +532 -0
- package/dist/lib/port-registrations.js.map +1 -0
- package/dist/lib/read-size.d.ts +154 -0
- package/dist/lib/read-size.d.ts.map +1 -0
- package/dist/lib/read-size.js +182 -0
- package/dist/lib/read-size.js.map +1 -0
- package/dist/lib/registration-owners.d.ts +79 -0
- package/dist/lib/registration-owners.d.ts.map +1 -0
- package/dist/lib/registration-owners.js +77 -0
- package/dist/lib/registration-owners.js.map +1 -0
- package/dist/lib/release-index.d.ts +53 -0
- package/dist/lib/release-index.d.ts.map +1 -0
- package/dist/lib/release-index.js +162 -0
- package/dist/lib/release-index.js.map +1 -0
- package/dist/lib/repeating-timers.d.ts +79 -0
- package/dist/lib/repeating-timers.d.ts.map +1 -0
- package/dist/lib/repeating-timers.js +189 -0
- package/dist/lib/repeating-timers.js.map +1 -0
- package/dist/lib/source-text.d.ts +34 -0
- package/dist/lib/source-text.d.ts.map +1 -0
- package/dist/lib/source-text.js +80 -0
- package/dist/lib/source-text.js.map +1 -0
- package/dist/lib/specifiers.d.ts +20 -0
- package/dist/lib/specifiers.d.ts.map +1 -0
- package/dist/lib/specifiers.js +130 -0
- package/dist/lib/specifiers.js.map +1 -0
- package/dist/lib/sql-tables.d.ts +166 -0
- package/dist/lib/sql-tables.d.ts.map +1 -0
- package/dist/lib/sql-tables.js +464 -0
- package/dist/lib/sql-tables.js.map +1 -0
- package/dist/lib/switchable-modules.d.ts +54 -0
- package/dist/lib/switchable-modules.d.ts.map +1 -0
- package/dist/lib/switchable-modules.js +104 -0
- package/dist/lib/switchable-modules.js.map +1 -0
- package/dist/lib/tailwind-sources.d.ts +136 -0
- package/dist/lib/tailwind-sources.d.ts.map +1 -0
- package/dist/lib/tailwind-sources.js +307 -0
- package/dist/lib/tailwind-sources.js.map +1 -0
- package/dist/lib/ui-layer.d.ts +54 -0
- package/dist/lib/ui-layer.d.ts.map +1 -0
- package/dist/lib/ui-layer.js +57 -0
- package/dist/lib/ui-layer.js.map +1 -0
- package/dist/lib/workspace-packages.d.ts +186 -0
- package/dist/lib/workspace-packages.d.ts.map +1 -0
- package/dist/lib/workspace-packages.js +351 -0
- package/dist/lib/workspace-packages.js.map +1 -0
- package/dist/new-instance/deploy.d.ts +211 -0
- package/dist/new-instance/deploy.d.ts.map +1 -0
- package/dist/new-instance/deploy.js +1381 -0
- package/dist/new-instance/deploy.js.map +1 -0
- package/dist/new-instance/docs-toolchain.d.ts +66 -0
- package/dist/new-instance/docs-toolchain.d.ts.map +1 -0
- package/dist/new-instance/docs-toolchain.js +69 -0
- package/dist/new-instance/docs-toolchain.js.map +1 -0
- package/dist/new-instance/host.d.ts +124 -0
- package/dist/new-instance/host.d.ts.map +1 -0
- package/dist/new-instance/host.js +276 -0
- package/dist/new-instance/host.js.map +1 -0
- package/dist/new-instance/index.d.ts +118 -0
- package/dist/new-instance/index.d.ts.map +1 -0
- package/dist/new-instance/index.js +567 -0
- package/dist/new-instance/index.js.map +1 -0
- package/dist/new-instance/modules.d.ts +188 -0
- package/dist/new-instance/modules.d.ts.map +1 -0
- package/dist/new-instance/modules.js +392 -0
- package/dist/new-instance/modules.js.map +1 -0
- package/dist/new-instance/template.d.ts +505 -0
- package/dist/new-instance/template.d.ts.map +1 -0
- package/dist/new-instance/template.js +1886 -0
- package/dist/new-instance/template.js.map +1 -0
- package/dist/new-module/emit.d.ts +67 -0
- package/dist/new-module/emit.d.ts.map +1 -0
- package/dist/new-module/emit.js +1393 -0
- package/dist/new-module/emit.js.map +1 -0
- package/dist/new-module/host.d.ts +67 -0
- package/dist/new-module/host.d.ts.map +1 -0
- package/dist/new-module/host.js +224 -0
- package/dist/new-module/host.js.map +1 -0
- package/dist/new-module/index.d.ts +32 -0
- package/dist/new-module/index.d.ts.map +1 -0
- package/dist/new-module/index.js +193 -0
- package/dist/new-module/index.js.map +1 -0
- package/dist/new-module/spec.d.ts +188 -0
- package/dist/new-module/spec.d.ts.map +1 -0
- package/dist/new-module/spec.js +404 -0
- package/dist/new-module/spec.js.map +1 -0
- package/dist/new-module/text.d.ts +15 -0
- package/dist/new-module/text.d.ts.map +1 -0
- package/dist/new-module/text.js +22 -0
- package/dist/new-module/text.js.map +1 -0
- package/dist/new-storefront/dockerfile.d.ts +20 -0
- package/dist/new-storefront/dockerfile.d.ts.map +1 -0
- package/dist/new-storefront/dockerfile.js +131 -0
- package/dist/new-storefront/dockerfile.js.map +1 -0
- package/dist/new-storefront/gitignore.d.ts +23 -0
- package/dist/new-storefront/gitignore.d.ts.map +1 -0
- package/dist/new-storefront/gitignore.js +39 -0
- package/dist/new-storefront/gitignore.js.map +1 -0
- package/dist/new-storefront/index.d.ts +93 -0
- package/dist/new-storefront/index.d.ts.map +1 -0
- package/dist/new-storefront/index.js +329 -0
- package/dist/new-storefront/index.js.map +1 -0
- package/dist/new-storefront/npmrc.d.ts +98 -0
- package/dist/new-storefront/npmrc.d.ts.map +1 -0
- package/dist/new-storefront/npmrc.js +217 -0
- package/dist/new-storefront/npmrc.js.map +1 -0
- package/dist/new-storefront/reference.d.ts +189 -0
- package/dist/new-storefront/reference.d.ts.map +1 -0
- package/dist/new-storefront/reference.js +430 -0
- package/dist/new-storefront/reference.js.map +1 -0
- package/dist/new-storefront/rewrite.d.ts +171 -0
- package/dist/new-storefront/rewrite.d.ts.map +1 -0
- package/dist/new-storefront/rewrite.js +701 -0
- package/dist/new-storefront/rewrite.js.map +1 -0
- package/dist/release-index.json +284 -0
- package/dist/rules/action-route-permissions.d.ts +141 -0
- package/dist/rules/action-route-permissions.d.ts.map +1 -0
- package/dist/rules/action-route-permissions.js +556 -0
- package/dist/rules/action-route-permissions.js.map +1 -0
- package/dist/rules/bundle-pairing.d.ts +74 -0
- package/dist/rules/bundle-pairing.d.ts.map +1 -0
- package/dist/rules/bundle-pairing.js +281 -0
- package/dist/rules/bundle-pairing.js.map +1 -0
- package/dist/rules/channel-resolution.d.ts +17 -0
- package/dist/rules/channel-resolution.d.ts.map +1 -0
- package/dist/rules/channel-resolution.js +382 -0
- package/dist/rules/channel-resolution.js.map +1 -0
- package/dist/rules/command-coverage.d.ts +210 -0
- package/dist/rules/command-coverage.d.ts.map +1 -0
- package/dist/rules/command-coverage.js +714 -0
- package/dist/rules/command-coverage.js.map +1 -0
- package/dist/rules/container-imports.d.ts +60 -0
- package/dist/rules/container-imports.d.ts.map +1 -0
- package/dist/rules/container-imports.js +158 -0
- package/dist/rules/container-imports.js.map +1 -0
- package/dist/rules/default-language-prose.d.ts +212 -0
- package/dist/rules/default-language-prose.d.ts.map +1 -0
- package/dist/rules/default-language-prose.js +710 -0
- package/dist/rules/default-language-prose.js.map +1 -0
- package/dist/rules/diacritic-folds.d.ts +238 -0
- package/dist/rules/diacritic-folds.d.ts.map +1 -0
- package/dist/rules/diacritic-folds.js +681 -0
- package/dist/rules/diacritic-folds.js.map +1 -0
- package/dist/rules/entity-tenant-classification.d.ts +171 -0
- package/dist/rules/entity-tenant-classification.d.ts.map +1 -0
- package/dist/rules/entity-tenant-classification.js +323 -0
- package/dist/rules/entity-tenant-classification.js.map +1 -0
- package/dist/rules/entry-presence.d.ts +142 -0
- package/dist/rules/entry-presence.d.ts.map +1 -0
- package/dist/rules/entry-presence.js +339 -0
- package/dist/rules/entry-presence.js.map +1 -0
- package/dist/rules/entry-scope.d.ts +91 -0
- package/dist/rules/entry-scope.d.ts.map +1 -0
- package/dist/rules/entry-scope.js +404 -0
- package/dist/rules/entry-scope.js.map +1 -0
- package/dist/rules/env-inputs.d.ts +222 -0
- package/dist/rules/env-inputs.d.ts.map +1 -0
- package/dist/rules/env-inputs.js +951 -0
- package/dist/rules/env-inputs.js.map +1 -0
- package/dist/rules/kernel-boundary.d.ts +37 -0
- package/dist/rules/kernel-boundary.d.ts.map +1 -0
- package/dist/rules/kernel-boundary.js +195 -0
- package/dist/rules/kernel-boundary.js.map +1 -0
- package/dist/rules/nul-bytes.d.ts +233 -0
- package/dist/rules/nul-bytes.d.ts.map +1 -0
- package/dist/rules/nul-bytes.js +332 -0
- package/dist/rules/nul-bytes.js.map +1 -0
- package/dist/rules/platform-surface.d.ts +479 -0
- package/dist/rules/platform-surface.d.ts.map +1 -0
- package/dist/rules/platform-surface.js +749 -0
- package/dist/rules/platform-surface.js.map +1 -0
- package/dist/rules/port-catches.d.ts +225 -0
- package/dist/rules/port-catches.d.ts.map +1 -0
- package/dist/rules/port-catches.js +1374 -0
- package/dist/rules/port-catches.js.map +1 -0
- package/dist/rules/port-shape.d.ts +213 -0
- package/dist/rules/port-shape.d.ts.map +1 -0
- package/dist/rules/port-shape.js +670 -0
- package/dist/rules/port-shape.js.map +1 -0
- package/dist/rules/queue-names.d.ts +108 -0
- package/dist/rules/queue-names.d.ts.map +1 -0
- package/dist/rules/queue-names.js +395 -0
- package/dist/rules/queue-names.js.map +1 -0
- package/dist/rules/singleton-identity.d.ts +205 -0
- package/dist/rules/singleton-identity.d.ts.map +1 -0
- package/dist/rules/singleton-identity.js +830 -0
- package/dist/rules/singleton-identity.js.map +1 -0
- package/dist/rules/subscribe-seam.d.ts +121 -0
- package/dist/rules/subscribe-seam.d.ts.map +1 -0
- package/dist/rules/subscribe-seam.js +594 -0
- package/dist/rules/subscribe-seam.js.map +1 -0
- package/dist/rules/transaction-context.d.ts +40 -0
- package/dist/rules/transaction-context.d.ts.map +1 -0
- package/dist/rules/transaction-context.js +294 -0
- package/dist/rules/transaction-context.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `endora generate` — the artefacts an instance builds from and commits none of
|
|
3
|
+
* (`contracts/instance-repository.md` R3.2, `contracts/instance-tree.md` §2.6).
|
|
4
|
+
*
|
|
5
|
+
* ## Why the command exists
|
|
6
|
+
*
|
|
7
|
+
* An instance's admin project holds six files and imports two it does not have:
|
|
8
|
+
* the contribution registry `main.tsx` hands the shell, and the stylesheet
|
|
9
|
+
* enumeration `index.css` imports. Both are **facts about the process** — which
|
|
10
|
+
* packages this client installed — so R3.1 says they are resolved at build time
|
|
11
|
+
* and never committed, and R3.2 says Vite and Tailwind are static, so they have
|
|
12
|
+
* to exist as files before either runs.
|
|
13
|
+
*
|
|
14
|
+
* Until this command existed the renderer lived in `backend/scripts`, which no
|
|
15
|
+
* client can reach: the file manifest §2.4 writes was a tree that could not be
|
|
16
|
+
* built. The renderer is `../lib/admin-artefacts.js`' now and is the **same**
|
|
17
|
+
* program `composer:generate` runs over this repository's workspace members —
|
|
18
|
+
* R3.5's *"one generator, one derivation … never a second implementation"*.
|
|
19
|
+
*
|
|
20
|
+
* ## It reports what it excluded (R8.2)
|
|
21
|
+
*
|
|
22
|
+
* A `link:`, a `file:` and a workspace member are invisible to the platform's
|
|
23
|
+
* runtime discovery by design (§8 R8.1), and these artefacts apply the same
|
|
24
|
+
* rule because they must: *"an admin registry naming a module the backend will
|
|
25
|
+
* not compose is a nav entry that 404s"*. So every exclusion is printed with the
|
|
26
|
+
* package name and the real path it resolved to. A module that is simply not
|
|
27
|
+
* there is indistinguishable from a module nobody installed, and a client whose
|
|
28
|
+
* screen never appeared has nothing to read.
|
|
29
|
+
*
|
|
30
|
+
* ## Exit codes are `cli-surface.md` §2's, unchanged
|
|
31
|
+
*
|
|
32
|
+
* **0** it did what it was asked, **1** a refusal the operator can act on, **2**
|
|
33
|
+
* an input it could not read. An instance with no admin member is **1** and
|
|
34
|
+
* names the remedy; a directory that is no workspace at all is **2**, because a
|
|
35
|
+
* run that could not find the tree it was pointed at has said nothing.
|
|
36
|
+
*/
|
|
37
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
38
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
39
|
+
import { adminRegistryOutputPathIn, collectAdminContributions, collectTailwindSources, emitAdminRegistry, emitTailwindRegistry, tailwindRegistryOutputPathIn, } from '../lib/admin-artefacts.js';
|
|
40
|
+
import { AdminLayoutUnresolvableError } from '../lib/admin-surfaces.js';
|
|
41
|
+
import { collectEntityIndexEntries, emitEntityIndex, entityIndexOutputPathIn, } from '../lib/entity-index-artefact.js';
|
|
42
|
+
import { collectDocsIntoSiteFrom, docsRegistryOf, installedDocsModules, renderDocsSidebarFrom, renderModuleMapFrom, renderModuleReferencesFrom, } from '../lib/docs-artefacts.js';
|
|
43
|
+
import { DocsLayoutUnresolvableError, resolveDocsLayout } from '../lib/module-docs.js';
|
|
44
|
+
import { scanInstalledModulePackages, } from '../lib/module-packages.js';
|
|
45
|
+
import { renderInstanceDivergence, DivergenceHostError, } from './divergence.js';
|
|
46
|
+
/** A refusal the operator can act on — exit 1. */
|
|
47
|
+
export class GenerateInputError extends Error {
|
|
48
|
+
name = 'GenerateInputError';
|
|
49
|
+
}
|
|
50
|
+
/** An input this run could not read — exit 2. */
|
|
51
|
+
export class GenerateHostError extends Error {
|
|
52
|
+
name = 'GenerateHostError';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The instance root: the nearest directory above `from` holding a
|
|
56
|
+
* `pnpm-workspace.yaml`.
|
|
57
|
+
*
|
|
58
|
+
* Upwards, so the command works from the admin member as well as from the root
|
|
59
|
+
* — `pnpm -C admin run generate` runs it with the member as its working
|
|
60
|
+
* directory, and a client typing it in the directory they are editing is the
|
|
61
|
+
* ordinary case.
|
|
62
|
+
*/
|
|
63
|
+
export function findInstanceRoot(from) {
|
|
64
|
+
let current = resolve(from);
|
|
65
|
+
for (;;) {
|
|
66
|
+
if (existsSync(join(current, 'pnpm-workspace.yaml')))
|
|
67
|
+
return current;
|
|
68
|
+
const parent = dirname(current);
|
|
69
|
+
if (parent === current)
|
|
70
|
+
return null;
|
|
71
|
+
current = parent;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Render the instance's build artefacts, and write them unless this is a dry
|
|
76
|
+
* run.
|
|
77
|
+
*
|
|
78
|
+
* Every artefact is rendered **before** any is written, in `new instance`'s own
|
|
79
|
+
* discipline (R5.2): a half-written pair is a bundle that names modules the
|
|
80
|
+
* stylesheet did not scan, which is the silent failure
|
|
81
|
+
* `admin-stylesheet-composition.md` exists to remove.
|
|
82
|
+
*/
|
|
83
|
+
export async function runGenerate(options = {}) {
|
|
84
|
+
const cwd = options.cwd ?? process.cwd();
|
|
85
|
+
const root = findInstanceRoot(cwd);
|
|
86
|
+
if (root === null) {
|
|
87
|
+
throw new GenerateHostError(`no \`pnpm-workspace.yaml\` above ${cwd}, so there is no instance to render artefacts ` +
|
|
88
|
+
`for. This command renders the files an instance's admin project and documentation ` +
|
|
89
|
+
`site are built from; run it inside the tree \`endora new instance\` wrote.`);
|
|
90
|
+
}
|
|
91
|
+
const scan = scanInstalledModulePackages(root);
|
|
92
|
+
if (scan.root === null) {
|
|
93
|
+
throw new GenerateHostError(`${join(root, 'node_modules')} is not there, so which modules this instance installed ` +
|
|
94
|
+
`cannot be read and the artefacts would name none. Run \`pnpm install\` first — an ` +
|
|
95
|
+
`empty registry is a bundle with no screens in it, rendered without an error.`);
|
|
96
|
+
}
|
|
97
|
+
const artefacts = [];
|
|
98
|
+
const omitted = [];
|
|
99
|
+
// --- the admin project's two (§2.6) --------------------------------------
|
|
100
|
+
//
|
|
101
|
+
// The project is found through the `"@/*"` tsconfig alias, exactly as every
|
|
102
|
+
// other admin derivation in this estate finds it. A workspace with no such
|
|
103
|
+
// member is an instance with no admin project, which is an **omission** and
|
|
104
|
+
// not a refusal: `endora new instance` writes one only when the shell and the
|
|
105
|
+
// design system resolve, so a headless instance is a tree this command must
|
|
106
|
+
// still be able to serve.
|
|
107
|
+
try {
|
|
108
|
+
const contributions = collectAdminContributions(scan.packages);
|
|
109
|
+
const sources = collectTailwindSources(root, scan.packages);
|
|
110
|
+
artefacts.push({
|
|
111
|
+
path: adminRegistryOutputPathIn(root),
|
|
112
|
+
content: emitAdminRegistry(contributions, GENERATED_REGISTRY_HEADER),
|
|
113
|
+
label: `the admin contribution registry (${String(contributions.length)} module(s))`,
|
|
114
|
+
}, {
|
|
115
|
+
path: tailwindRegistryOutputPathIn(root),
|
|
116
|
+
content: emitTailwindRegistry(sources, GENERATED_STYLESHEET_HEADER),
|
|
117
|
+
label: `the admin stylesheet enumeration (${String(sources.length)} package(s))`,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (!(error instanceof AdminLayoutUnresolvableError))
|
|
122
|
+
throw error;
|
|
123
|
+
omitted.push(`the admin project's two artefacts — ${error.message}. They land in the source root of ` +
|
|
124
|
+
`the workspace member declaring the \`"@/*"\` path its tsconfig carries, so an instance ` +
|
|
125
|
+
`scaffolded without an admin member has nothing here to write`);
|
|
126
|
+
}
|
|
127
|
+
// --- the documentation site's (§2.6, feature 100) -------------------------
|
|
128
|
+
//
|
|
129
|
+
// The site is found by the workspace member holding a Docusaurus
|
|
130
|
+
// configuration — the same derivation `check:module-docs` and
|
|
131
|
+
// `composer:generate` share — and the population is the packages above, so a
|
|
132
|
+
// navigation names exactly the modules this client installed. Same omission
|
|
133
|
+
// discipline as the admin half.
|
|
134
|
+
let collected = null;
|
|
135
|
+
let swept = [];
|
|
136
|
+
try {
|
|
137
|
+
const layout = resolveDocsLayout(root);
|
|
138
|
+
const registry = docsRegistryOf(layout, installedDocsModules(scan.packages), scan.packages);
|
|
139
|
+
artefacts.push({
|
|
140
|
+
path: renderDocsSidebarFrom(registry, INSTANCE_DOCS_HEADER).outputPath,
|
|
141
|
+
content: renderDocsSidebarFrom(registry, INSTANCE_DOCS_HEADER).content,
|
|
142
|
+
label: `the documentation navigation (${String(registry.entries.length)} module(s))`,
|
|
143
|
+
}, {
|
|
144
|
+
path: renderModuleMapFrom(registry, INSTANCE_DOCS_PAGE_HEADER).outputPath,
|
|
145
|
+
content: renderModuleMapFrom(registry, INSTANCE_DOCS_PAGE_HEADER).content,
|
|
146
|
+
label: 'the module map',
|
|
147
|
+
});
|
|
148
|
+
// `stray: 'sweep'` because in an instance this category is generated and
|
|
149
|
+
// git-ignored: a module the client uninstalled would otherwise leave a page
|
|
150
|
+
// that refuses every subsequent run, with a remedy (`git rm`) naming a tool
|
|
151
|
+
// the file is not under.
|
|
152
|
+
const references = await renderModuleReferencesFrom(registry, {
|
|
153
|
+
header: INSTANCE_DOCS_PAGE_HEADER,
|
|
154
|
+
stray: options.dryRun === true ? 'report' : 'sweep',
|
|
155
|
+
});
|
|
156
|
+
for (const page of references.pages) {
|
|
157
|
+
artefacts.push({ path: page.outputPath, content: page.content, label: page.label });
|
|
158
|
+
}
|
|
159
|
+
swept = references.swept;
|
|
160
|
+
// The copies are a filesystem operation rather than a rendered artefact —
|
|
161
|
+
// a module's page is copied verbatim, byte for byte — so it is not in the
|
|
162
|
+
// list above and is skipped on a dry run with everything else.
|
|
163
|
+
if (options.dryRun !== true)
|
|
164
|
+
collected = collectDocsIntoSiteFrom(registry);
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (!(error instanceof DocsLayoutUnresolvableError))
|
|
168
|
+
throw error;
|
|
169
|
+
omitted.push(`the documentation site's artefacts — ${error.message}. The site is the workspace member ` +
|
|
170
|
+
`holding a Docusaurus configuration; an instance scaffolded without one has nothing ` +
|
|
171
|
+
`here to write`);
|
|
172
|
+
}
|
|
173
|
+
// --- the entity index (§2.6, feature 109 T065) ----------------------------
|
|
174
|
+
//
|
|
175
|
+
// Last of the `.gitignore`d three-become-four, and the only one that belongs
|
|
176
|
+
// to **no member**: its consumer is a test, and a test is not a member of a
|
|
177
|
+
// client's workspace. So it is rendered whenever this host installed a module
|
|
178
|
+
// at all, with no omission branch above it to fall into — there is no
|
|
179
|
+
// directory it needs and nothing about it that can be absent.
|
|
180
|
+
//
|
|
181
|
+
// **Why every instance gets it, including one that runs no test.** The
|
|
182
|
+
// population is *which modules this host installed*, which is §2.6's own
|
|
183
|
+
// predicate for a generated artefact, and it is the one fact
|
|
184
|
+
// `@endora-commerce/test-kit` may not know (109 R2.2, FR-001). A client who
|
|
185
|
+
// writes no test never imports the file and it is git-ignored, so the cost is
|
|
186
|
+
// one small file; the alternative is a flag nobody asked for, and a repository
|
|
187
|
+
// built on published packages — `specs/134-paid-module-extraction/` T018's
|
|
188
|
+
// host is the first — could write no server-bound test at all without it.
|
|
189
|
+
if (scan.packages.length > 0) {
|
|
190
|
+
const entries = collectEntityIndexEntries(scan.packages);
|
|
191
|
+
artefacts.push({
|
|
192
|
+
path: entityIndexOutputPathIn(root),
|
|
193
|
+
content: emitEntityIndex(entries, INSTANCE_ENTITY_INDEX_HEADER),
|
|
194
|
+
label: `the test entity index (${String(entries.length)} module(s))`,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
// --- the deployment's own (§2.2, feature 107) ---------------------------
|
|
198
|
+
//
|
|
199
|
+
// Not an `artefacts.push`, and the difference is the whole of the report
|
|
200
|
+
// contract's §1: those three are `.gitignore`d facts about *this install* and
|
|
201
|
+
// these are a committed fact about the client's own tree. Rendering them in
|
|
202
|
+
// the same run is right — one walk of `node_modules` answers both — but
|
|
203
|
+
// mixing them into one list would put a committed artefact under a header
|
|
204
|
+
// telling its reader not to commit it.
|
|
205
|
+
//
|
|
206
|
+
// A deployment tree that is not there is an omission and not a refusal, in the
|
|
207
|
+
// discipline the two members above already use: `endora new instance` writes
|
|
208
|
+
// `apps/<deployment>/`, and a client who deleted it has said something.
|
|
209
|
+
let divergence = [];
|
|
210
|
+
try {
|
|
211
|
+
divergence = renderInstanceDivergence({ root, packages: scan.packages });
|
|
212
|
+
if (divergence.length === 0) {
|
|
213
|
+
omitted.push(`the divergence report — this instance has no \`apps/<deployment>/\` tree, so there is ` +
|
|
214
|
+
`no deployment whose divergence from core could be derived. \`endora new instance\` ` +
|
|
215
|
+
`writes one`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
if (!(error instanceof DivergenceHostError))
|
|
220
|
+
throw error;
|
|
221
|
+
// Exit 2, never a silent skip: the report's own §5 is one refusal per input
|
|
222
|
+
// whose absence would make a predicate vacuously clean, and every one of
|
|
223
|
+
// this half's inputs is of that kind — an unread composition reports every
|
|
224
|
+
// decoration as owned by nobody.
|
|
225
|
+
throw new GenerateHostError(error.message);
|
|
226
|
+
}
|
|
227
|
+
// No member and no deployment is a workspace this command has anything to do
|
|
228
|
+
// with, and a run that wrote nothing and said it succeeded is the silent green
|
|
229
|
+
// the whole estate refuses. It is a refusal the operator can act on — exit 1 —
|
|
230
|
+
// because the remedy is theirs: scaffold a member, or stop running this.
|
|
231
|
+
//
|
|
232
|
+
// The divergence half counts toward "it rendered something": a headless
|
|
233
|
+
// instance with a deployment tree is a tree this command still has an answer
|
|
234
|
+
// for, and refusing it would be the command declining to describe the one
|
|
235
|
+
// thing about that tree a client is asked to trust.
|
|
236
|
+
//
|
|
237
|
+
// **The entity index counts too, and that narrows this refusal rather than
|
|
238
|
+
// weakening it** (T065). Its reason is *a run that wrote nothing and said it
|
|
239
|
+
// succeeded*, so what it may fire on is an empty `artefacts` — and a host with
|
|
240
|
+
// a module installed now has one entry there whatever its members are. The
|
|
241
|
+
// state that remains is a workspace with no member, no deployment **and no
|
|
242
|
+
// module**, which is a directory this command genuinely has nothing to say
|
|
243
|
+
// about. The message names that third condition rather than continuing to
|
|
244
|
+
// claim the first two are the whole of it.
|
|
245
|
+
if (artefacts.length === 0 && divergence.length === 0) {
|
|
246
|
+
throw new GenerateInputError(`${root} has no admin project, no documentation site, no \`apps/<deployment>/\` tree and ` +
|
|
247
|
+
`no installed module package, so this command has nothing to render:\n` +
|
|
248
|
+
`${omitted.map((reason) => ` - ${reason}`).join('\n')}\n` +
|
|
249
|
+
` - the test entity index — ${scan.packages.length === 0
|
|
250
|
+
? 'no `@endora-commerce/*` module package is installed, so the index would name none'
|
|
251
|
+
: 'rendered'}`);
|
|
252
|
+
}
|
|
253
|
+
if (options.dryRun !== true) {
|
|
254
|
+
for (const artefact of artefacts) {
|
|
255
|
+
mkdirSync(dirname(artefact.path), { recursive: true });
|
|
256
|
+
writeFileSync(artefact.path, artefact.content, 'utf8');
|
|
257
|
+
}
|
|
258
|
+
for (const report of divergence) {
|
|
259
|
+
for (const rendering of report.renderings) {
|
|
260
|
+
mkdirSync(dirname(rendering.outputPath), { recursive: true });
|
|
261
|
+
writeFileSync(rendering.outputPath, rendering.content, 'utf8');
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
root,
|
|
267
|
+
artefacts,
|
|
268
|
+
modules: scan.packages.length,
|
|
269
|
+
excluded: scan.skipped,
|
|
270
|
+
omitted,
|
|
271
|
+
collected,
|
|
272
|
+
swept,
|
|
273
|
+
divergence,
|
|
274
|
+
dryRun: options.dryRun === true,
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
/** The lines the command prints, in order. Exported so a proof reads them. */
|
|
278
|
+
export function generateReport(result) {
|
|
279
|
+
const lines = result.artefacts.map((artefact) => `${result.dryRun ? 'would write' : 'wrote'} ${relative(result.root, artefact.path)} — ` +
|
|
280
|
+
`${artefact.label}`);
|
|
281
|
+
if (result.swept.length > 0) {
|
|
282
|
+
lines.push(`removed ${String(result.swept.length)} module reference page(s) no installed module ` +
|
|
283
|
+
`renders any more`);
|
|
284
|
+
}
|
|
285
|
+
for (const report of result.divergence) {
|
|
286
|
+
for (const rendering of report.renderings) {
|
|
287
|
+
lines.push(`${result.dryRun ? 'would write' : 'wrote'} ` +
|
|
288
|
+
`${relative(result.root, rendering.outputPath)} — ${rendering.label} ` +
|
|
289
|
+
`(${String(report.overlayModules.length)} overlay module(s), ` +
|
|
290
|
+
`${String(report.entries)} divergence(s)). Commit it: it is a fact about your tree`);
|
|
291
|
+
}
|
|
292
|
+
// The generator writes the artefact whatever it found, exactly as this
|
|
293
|
+
// repository's does; a finding is something the client can act on and the
|
|
294
|
+
// person running this is the person who can.
|
|
295
|
+
for (const finding of report.findings) {
|
|
296
|
+
lines.push(` [${finding.kind}] ${finding.where}: ${finding.detail}`);
|
|
297
|
+
}
|
|
298
|
+
// Never folded into "declares nothing": an absent declaration and one this
|
|
299
|
+
// run could not read are the same answer only if you let them be.
|
|
300
|
+
for (const field of report.unresolvedDeclaration) {
|
|
301
|
+
lines.push(` [unreadable-declaration] ${report.deployment}: ${field} is not written as a literal, ` +
|
|
302
|
+
`so this report was derived as though it were absent`);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (result.collected !== null) {
|
|
306
|
+
lines.push(`copied ${String(result.collected.copied.length)} module-owned page(s) into ` +
|
|
307
|
+
`${result.collected.modulesRoot}` +
|
|
308
|
+
(result.collected.removed.length === 0
|
|
309
|
+
? ''
|
|
310
|
+
: `, removing ${String(result.collected.removed.length)} the previous run wrote`));
|
|
311
|
+
}
|
|
312
|
+
// A member this instance does not have is named, never silently skipped:
|
|
313
|
+
// a client who does not know a surface is missing goes looking for it.
|
|
314
|
+
for (const reason of result.omitted)
|
|
315
|
+
lines.push(`omitted ${reason}`);
|
|
316
|
+
// R8.2 — the exclusion is said out loud. A module that is simply not there is
|
|
317
|
+
// indistinguishable from a module nobody installed.
|
|
318
|
+
for (const skipped of result.excluded) {
|
|
319
|
+
lines.push(skipped.kind === 'links-out-of-node-modules'
|
|
320
|
+
? `excluded ${skipped.name} — links-out-of-node-modules, real path ${skipped.realPath}. ` +
|
|
321
|
+
`A linked package is invisible to this instance's runtime discovery too, so an ` +
|
|
322
|
+
`artefact naming it would register a screen the backend never composes. Develop it ` +
|
|
323
|
+
`as an overlay module under \`apps/<deployment>/modules/\`, or \`pnpm pack\` it and ` +
|
|
324
|
+
`install the tarball.`
|
|
325
|
+
: `excluded ${skipped.at} — unreadable: ${skipped.reason}`);
|
|
326
|
+
}
|
|
327
|
+
return lines;
|
|
328
|
+
}
|
|
329
|
+
/** Is this instance's admin registry the same as the one on disk? */
|
|
330
|
+
export function artefactIsCurrent(artefact) {
|
|
331
|
+
if (!existsSync(artefact.path))
|
|
332
|
+
return false;
|
|
333
|
+
return readFileSync(artefact.path, 'utf8') === artefact.content;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* The "do not edit" header the documentation artefacts carry in an instance.
|
|
337
|
+
*
|
|
338
|
+
* A separate value from the registry's because the comment syntax differs — a
|
|
339
|
+
* `.js` sidebar fragment and a markdown page — and separate from
|
|
340
|
+
* `composer:generate`'s because the two hosts tell a reader different things to
|
|
341
|
+
* run. An artefact naming `composer:generate` would send a client to a script
|
|
342
|
+
* their tree does not have.
|
|
343
|
+
*/
|
|
344
|
+
const INSTANCE_DOCS_HEADER = `// AUTO-GENERATED by \`endora generate\` — DO NOT EDIT, and do not commit.\n` +
|
|
345
|
+
`// It names the module packages THIS instance installed, so it is a fact about\n` +
|
|
346
|
+
`// the install and not about the tree. \`.gitignore\` covers it;\n` +
|
|
347
|
+
`// \`pnpm run generate\` rewrites it.\n`;
|
|
348
|
+
/** The same, for a markdown page, whose comment syntax is HTML's. */
|
|
349
|
+
const INSTANCE_DOCS_PAGE_HEADER = `<!-- AUTO-GENERATED by \`endora generate\` — DO NOT EDIT, and do not commit.\n` +
|
|
350
|
+
` It names the module packages THIS instance installed, so it is a fact\n` +
|
|
351
|
+
` about the install and not about the tree. \`.gitignore\` covers it;\n` +
|
|
352
|
+
` \`pnpm run generate\` rewrites it. -->`;
|
|
353
|
+
/** The "do not edit" header an instance's artefacts carry. */
|
|
354
|
+
const GENERATED_REGISTRY_HEADER = `// AUTO-GENERATED by \`endora generate\` — DO NOT EDIT, and do not commit.\n` +
|
|
355
|
+
`// It names the module packages THIS instance installed, so it is a fact about\n` +
|
|
356
|
+
`// the install and not about the tree: a different module set is a different\n` +
|
|
357
|
+
`// bundle. \`.gitignore\` covers it; \`pnpm run generate\` rewrites it.\n`;
|
|
358
|
+
/** The same, for the entity index, whose staleness is a test asking about no table. */
|
|
359
|
+
const INSTANCE_ENTITY_INDEX_HEADER = `// AUTO-GENERATED by \`endora generate\` — DO NOT EDIT, and do not commit.\n` +
|
|
360
|
+
`// It names the module packages THIS instance installed, so it is a fact about\n` +
|
|
361
|
+
`// the install and not about the tree. \`.gitignore\` covers it;\n` +
|
|
362
|
+
`// \`pnpm run generate\` rewrites it, and a stale index is a test asking the ORM\n` +
|
|
363
|
+
`// about a table nothing mapped.\n`;
|
|
364
|
+
/** The same, for the stylesheet, whose comment syntax is CSS's. */
|
|
365
|
+
const GENERATED_STYLESHEET_HEADER = `/* AUTO-GENERATED by \`endora generate\` — DO NOT EDIT, and do not commit.\n` +
|
|
366
|
+
` * It names the packages THIS instance installed, so it is a fact about the\n` +
|
|
367
|
+
` * install and not about the tree. \`.gitignore\` covers it; \`pnpm run generate\`\n` +
|
|
368
|
+
` * rewrites it.\n`;
|
|
369
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","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C,IAAI,2CAA2C,OAAO,CAAC,QAAQ,IAAI;gBACvF,gFAAgF;gBAChF,oFAAoF;gBACpF,qFAAqF;gBACrF,sBAAsB;YACxB,CAAC,CAAC,YAAY,OAAO,CAAC,EAAE,kBAAkB,OAAO,CAAC,MAAM,EAAE,CAC7D,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,iBAAiB,CAAC,QAA2B;IAC3D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,QAAQ,CAAC,OAAO,CAAC;AAClE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,oBAAoB,GACxB,8EAA8E;IAC9E,kFAAkF;IAClF,oEAAoE;IACpE,yCAAyC,CAAC;AAE5C,qEAAqE;AACrE,MAAM,yBAAyB,GAC7B,gFAAgF;IAChF,8EAA8E;IAC9E,4EAA4E;IAC5E,6CAA6C,CAAC;AAEhD,8DAA8D;AAC9D,MAAM,yBAAyB,GAC7B,8EAA8E;IAC9E,kFAAkF;IAClF,gFAAgF;IAChF,2EAA2E,CAAC;AAE9E,uFAAuF;AACvF,MAAM,4BAA4B,GAChC,8EAA8E;IAC9E,kFAAkF;IAClF,oEAAoE;IACpE,oFAAoF;IACpF,oCAAoC,CAAC;AAEvC,mEAAmE;AACnE,MAAM,2BAA2B,GAC/B,8EAA8E;IAC9E,+EAA+E;IAC/E,sFAAsF;IACtF,mBAAmB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@endora-commerce/cli` — the programmatic surface of the `endora` command.
|
|
3
|
+
*
|
|
4
|
+
* The argv layer is `src/bin/endora.ts` and is deliberately not exported: a
|
|
5
|
+
* caller that wants the scaffold wants {@link runNewModule}, not a parser.
|
|
6
|
+
*/
|
|
7
|
+
export { runNewModule, type NewModuleOptions, type NewModuleResult, } from './new-module/index.js';
|
|
8
|
+
export { bundleEntries, emitModuleFiles, entityClassOf, entityFileOf, migrationClassOf, migrationFileOf, portInterfaceOf, portNameOf, tableNameOf, type EmittedFile, } from './new-module/emit.js';
|
|
9
|
+
export { BASELINE_THROUGH, buildScaffoldSpec, camelOf, camelOfActionId, formatStamp, manifestObjectFor, migrationStampFor, npmNameFor, pascalOf, ScaffoldHostError, ScaffoldInputError, segmentOf, slugOf, TENANT_SCOPE_DECORATORS, TENANT_SCOPES, type ModuleScaffoldSpec, type ScaffoldAction, type ScaffoldActivation, type ScaffoldInput, type ScaffoldLayers, type ScaffoldPermission, type TenantScope, } from './new-module/spec.js';
|
|
10
|
+
export { defaultModulesRootOf, findRepoRoot, resolveHost, workspaceGlobs, workspaceScopeOf, type ScaffoldHost, } from './new-module/host.js';
|
|
11
|
+
export { runNewInstance, type NewInstanceOptions, type NewInstanceResult, } from './new-instance/index.js';
|
|
12
|
+
export { assertTopology, deployFiles, DEFAULT_TOPOLOGY, TOPOLOGIES, type DeployFile, type DeployInput, type Topology, } from './new-instance/deploy.js';
|
|
13
|
+
export { InstanceHostError, InstanceInputError, resolveInstanceHost, scopeOfPackageName, type InstanceHost, type ResolvedPackage, } from './new-instance/host.js';
|
|
14
|
+
export { loadModuleCandidates, requiredModuleIds, resolveModuleSet, type ModuleCandidate, type ModuleSetResolution, } from './new-instance/modules.js';
|
|
15
|
+
export { assertDeploymentName, assertWorkspaceName, devDependenciesFor, envExample, GENERATED_ARTEFACTS, GENERATED_TREES, planInstance, wiringLineCount, type FileKind, type InstancePlan, type MemberName, type PlanInput, type PlannedFile as PlannedInstanceFile, type PlannedOmission, } from './new-instance/template.js';
|
|
16
|
+
export { artefactIsCurrent, findInstanceRoot, generateReport, GenerateHostError, GenerateInputError, runGenerate, type GeneratedArtefact, type GenerateOptions, type GenerateResult, } from './generate/index.js';
|
|
17
|
+
export { runNewStorefront, storefrontDeclaredInputs, type NewStorefrontOptions, type NewStorefrontResult, } from './new-storefront/index.js';
|
|
18
|
+
export { flagFor } from './inputs/resolve.js';
|
|
19
|
+
export { parseEnvFile, renderEnvValue, writeEnvFile } from './inputs/env-file.js';
|
|
20
|
+
export { addressVariables, backendAddressVariablesOf, declaredVariablesOf, storefrontAddressVariablesOf, STOREFRONT_DECLARATION_EXPORT, ENV_EXAMPLE_FILE, envExampleDeclarations, envExampleDeclarationsOf, outwardReferences, resolveReference, StorefrontHostError, StorefrontInputError, trackedFiles, workspaceRanges, type OutwardReference, type StorefrontReference, type WorkspaceRange, } from './new-storefront/reference.js';
|
|
21
|
+
export { authKeys, installedScopes, normalizeRegistry, npmrcContent, TOKEN_VARIABLE, } from './new-storefront/npmrc.js';
|
|
22
|
+
export { cutForeignImports, cutForeignJsonPaths, packageManagerFor, planStorefront, publishedRange, retargetPackageGlob, testRoots, UnclassifiedReferenceError, type PlannedFile, type PlanOptions, type RangeRewrite, type StorefrontPlan, } from './new-storefront/rewrite.js';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,UAAU,EACV,WAAW,EACX,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,uBAAuB,E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,wBAAwB,EACxB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM9C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,0BAA0B,EAC1B,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@endora-commerce/cli` — the programmatic surface of the `endora` command.
|
|
3
|
+
*
|
|
4
|
+
* The argv layer is `src/bin/endora.ts` and is deliberately not exported: a
|
|
5
|
+
* caller that wants the scaffold wants {@link runNewModule}, not a parser.
|
|
6
|
+
*/
|
|
7
|
+
export { runNewModule, } from './new-module/index.js';
|
|
8
|
+
export { bundleEntries, emitModuleFiles, entityClassOf, entityFileOf, migrationClassOf, migrationFileOf, portInterfaceOf, portNameOf, tableNameOf, } from './new-module/emit.js';
|
|
9
|
+
export { BASELINE_THROUGH, buildScaffoldSpec, camelOf, camelOfActionId, formatStamp, manifestObjectFor, migrationStampFor, npmNameFor, pascalOf, ScaffoldHostError, ScaffoldInputError, segmentOf, slugOf, TENANT_SCOPE_DECORATORS, TENANT_SCOPES, } from './new-module/spec.js';
|
|
10
|
+
export { defaultModulesRootOf, findRepoRoot, resolveHost, workspaceGlobs, workspaceScopeOf, } from './new-module/host.js';
|
|
11
|
+
export { runNewInstance, } from './new-instance/index.js';
|
|
12
|
+
// The deployment examples' two axes. `Topology` is exported because `PlanInput`
|
|
13
|
+
// carries one and a caller that cannot name the type cannot build the input;
|
|
14
|
+
// `TOPOLOGIES` and `assertTopology` are exported because a caller offering the
|
|
15
|
+
// flag needs the vocabulary and the refusal rather than a second copy of both.
|
|
16
|
+
export { assertTopology, deployFiles, DEFAULT_TOPOLOGY, TOPOLOGIES, } from './new-instance/deploy.js';
|
|
17
|
+
export { InstanceHostError, InstanceInputError, resolveInstanceHost, scopeOfPackageName, } from './new-instance/host.js';
|
|
18
|
+
export { loadModuleCandidates, requiredModuleIds, resolveModuleSet, } from './new-instance/modules.js';
|
|
19
|
+
export { assertDeploymentName, assertWorkspaceName, devDependenciesFor, envExample, GENERATED_ARTEFACTS, GENERATED_TREES, planInstance, wiringLineCount, } from './new-instance/template.js';
|
|
20
|
+
export { artefactIsCurrent, findInstanceRoot, generateReport, GenerateHostError, GenerateInputError, runGenerate, } from './generate/index.js';
|
|
21
|
+
export { runNewStorefront, storefrontDeclaredInputs, } from './new-storefront/index.js';
|
|
22
|
+
// The flag spelling is derived from the variable's name and never written down,
|
|
23
|
+
// so a caller that builds an `endora new storefront` command line takes the
|
|
24
|
+
// derivation rather than re-deriving it — see `storefrontDeclaredInputs`.
|
|
25
|
+
export { flagFor } from './inputs/resolve.js';
|
|
26
|
+
// The `.env` writer, exported for the one caller outside this package that has
|
|
27
|
+
// to put a value into a scaffolded tree's own configuration: the instance
|
|
28
|
+
// acceptance criterion, which fills the file `endora new instance` wrote exactly
|
|
29
|
+
// as a client would. A second merge implementation there would be a second set
|
|
30
|
+
// of rules about quoting, blank values and the operator's own lines.
|
|
31
|
+
export { parseEnvFile, renderEnvValue, writeEnvFile } from './inputs/env-file.js';
|
|
32
|
+
export { addressVariables, backendAddressVariablesOf, declaredVariablesOf, storefrontAddressVariablesOf, STOREFRONT_DECLARATION_EXPORT, ENV_EXAMPLE_FILE, envExampleDeclarations, envExampleDeclarationsOf, outwardReferences, resolveReference, StorefrontHostError, StorefrontInputError, trackedFiles, workspaceRanges, } from './new-storefront/reference.js';
|
|
33
|
+
export { authKeys, installedScopes, normalizeRegistry, npmrcContent, TOKEN_VARIABLE, } from './new-storefront/npmrc.js';
|
|
34
|
+
export { cutForeignImports, cutForeignJsonPaths, packageManagerFor, planStorefront, publishedRange, retargetPackageGlob, testRoots, UnclassifiedReferenceError, } from './new-storefront/rewrite.js';
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,UAAU,EACV,WAAW,GAEZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,EACP,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,uBAAuB,EACvB,aAAa,GAQd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,cAAc,GAGf,MAAM,yBAAyB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BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,0BAA0B,GAK3B,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type EnvironmentInput } from '@endora-commerce/contracts';
|
|
2
|
+
/** The file every application-level declaration is named, in every tree. */
|
|
3
|
+
export declare const DECLARATION_FILE = "environment-inputs.mjs";
|
|
4
|
+
/** Raised when a tree's declaration is absent or is not one. Exit 2's shape. */
|
|
5
|
+
export declare class DeclarationLoadError extends Error {
|
|
6
|
+
readonly name = "DeclarationLoadError";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The declaration a tree ships, or a refusal.
|
|
10
|
+
*
|
|
11
|
+
* **Absent is a refusal, never "this tree needs nothing"**, which is the failure
|
|
12
|
+
* `manifest-locations.ts` was written to end one surface over: a command that
|
|
13
|
+
* read a missing declaration as an empty one would write a `.env` holding
|
|
14
|
+
* nothing, print `total=0 defaulted=0` — perfectly true, and about a population
|
|
15
|
+
* it never found — and hand its author a storefront that refuses to build.
|
|
16
|
+
*/
|
|
17
|
+
export declare function loadTreeDeclaration(treeDir: string, exportName: string): Promise<readonly EnvironmentInput[]>;
|
|
18
|
+
//# sourceMappingURL=declaration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration.d.ts","sourceRoot":"","sources":["../../src/inputs/declaration.ts"],"names":[],"mappings":"AAuBA,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AAEzD,gFAAgF;AAChF,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,SAAkB,IAAI,0BAA0B;CACjD;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,SAAS,gBAAgB,EAAE,CAAC,CA6BtC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a tree's own environment-input declaration
|
|
3
|
+
* (`environment-inputs.md` §R2.3).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this loads the file rather than importing a package
|
|
6
|
+
*
|
|
7
|
+
* The declaration a scaffolding command resolves against is the **declaration
|
|
8
|
+
* of the tree being written** — the reference storefront's here, a client's own
|
|
9
|
+
* copy of it once they have one. Under D-195 that tree is a repository the
|
|
10
|
+
* client owns outright: its declaration travels in the copy and is edited there,
|
|
11
|
+
* so it cannot be a constant compiled into this program. A list in the CLI would
|
|
12
|
+
* be a derived fact written down (D-100) that could never see a tree a client
|
|
13
|
+
* changed.
|
|
14
|
+
*
|
|
15
|
+
* The declaration is `.mjs` for the reason `storefront/lib/env.mjs` is: it has
|
|
16
|
+
* to be readable by a plain Node process before the tree it describes has been
|
|
17
|
+
* installed or built. `import()` of a file URL is therefore all that is needed,
|
|
18
|
+
* and there is no compiler in the path.
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync } from 'node:fs';
|
|
21
|
+
import { join } from 'node:path';
|
|
22
|
+
import { pathToFileURL } from 'node:url';
|
|
23
|
+
import { EnvironmentInputsSchema } from '@endora-commerce/contracts';
|
|
24
|
+
/** The file every application-level declaration is named, in every tree. */
|
|
25
|
+
export const DECLARATION_FILE = 'environment-inputs.mjs';
|
|
26
|
+
/** Raised when a tree's declaration is absent or is not one. Exit 2's shape. */
|
|
27
|
+
export class DeclarationLoadError extends Error {
|
|
28
|
+
name = 'DeclarationLoadError';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The declaration a tree ships, or a refusal.
|
|
32
|
+
*
|
|
33
|
+
* **Absent is a refusal, never "this tree needs nothing"**, which is the failure
|
|
34
|
+
* `manifest-locations.ts` was written to end one surface over: a command that
|
|
35
|
+
* read a missing declaration as an empty one would write a `.env` holding
|
|
36
|
+
* nothing, print `total=0 defaulted=0` — perfectly true, and about a population
|
|
37
|
+
* it never found — and hand its author a storefront that refuses to build.
|
|
38
|
+
*/
|
|
39
|
+
export async function loadTreeDeclaration(treeDir, exportName) {
|
|
40
|
+
const path = join(treeDir, DECLARATION_FILE);
|
|
41
|
+
if (!existsSync(path)) {
|
|
42
|
+
throw new DeclarationLoadError(`${path} is not there, so this run cannot say what the tree needs from its ` +
|
|
43
|
+
`environment. A declaration that is absent is not a tree with no requirements.`);
|
|
44
|
+
}
|
|
45
|
+
let loaded;
|
|
46
|
+
try {
|
|
47
|
+
loaded = (await import(pathToFileURL(path).href));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new DeclarationLoadError(`${path} could not be loaded: ${error instanceof Error ? error.message : String(error)}`);
|
|
51
|
+
}
|
|
52
|
+
const parsed = EnvironmentInputsSchema.safeParse(loaded[exportName]);
|
|
53
|
+
if (!parsed.success) {
|
|
54
|
+
throw new DeclarationLoadError(`${path} does not export \`${exportName}\` as an environment-input declaration — ` +
|
|
55
|
+
parsed.error.issues
|
|
56
|
+
.map((issue) => `${issue.path.join('.')}: ${issue.message}`)
|
|
57
|
+
.join('; '));
|
|
58
|
+
}
|
|
59
|
+
if (parsed.data.length === 0) {
|
|
60
|
+
throw new DeclarationLoadError(`${path} declares no input at all`);
|
|
61
|
+
}
|
|
62
|
+
return parsed.data;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=declaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declaration.js","sourceRoot":"","sources":["../../src/inputs/declaration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,E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EAAE,CAAC;iBAC3D,IAAI,CAAC,IAAI,CAAC,CAChB,CAAC;IACJ,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,oBAAoB,CAAC,GAAG,IAAI,2BAA2B,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `.env` a command reads values from and writes values into.
|
|
3
|
+
*
|
|
4
|
+
* `specs/117-instance-bring-up/contracts/input-resolution.md` tier 2, and R1.3:
|
|
5
|
+
* **this is not a configuration file for the tool**. `cli-product.md` R2.5's
|
|
6
|
+
* *"there is no `.endorarc`"* stands unamended. Nothing in a `.env` changes a
|
|
7
|
+
* verdict, a rule or a behaviour of the CLI — it supplies values, exactly as a
|
|
8
|
+
* flag does, and it is the *instance's* own runtime configuration, which is to
|
|
9
|
+
* say the artefact the command's own output already contains.
|
|
10
|
+
*
|
|
11
|
+
* ## Blank does not answer
|
|
12
|
+
*
|
|
13
|
+
* `SESSION_COOKIE_SECRET=` and no line at all are the same state for whoever has
|
|
14
|
+
* to fix it, so a blank value does not resolve an input: it is skipped, and the
|
|
15
|
+
* input goes on to the next tier. Reading it as an answer would let a run print
|
|
16
|
+
* `env-file=6` over six empty strings and a shop boot with an unsigned session
|
|
17
|
+
* cookie — a provenance line that is true about where it looked and false about
|
|
18
|
+
* what it found. `storefront/lib/env.mjs` makes the same call for the same
|
|
19
|
+
* reason and calls the state `missing` rather than malformed.
|
|
20
|
+
*
|
|
21
|
+
* ## What it deliberately does not implement
|
|
22
|
+
*
|
|
23
|
+
* No variable expansion (`${OTHER}`), no multi-line values, no `.env.local`
|
|
24
|
+
* chain. Each is a dialect: `dotenv`, `pnpm`, Next and Docker Compose disagree
|
|
25
|
+
* about all three, and a scaffold that picked one would write a file that means
|
|
26
|
+
* something different to the tool that reads it next. What is implemented is the
|
|
27
|
+
* intersection every one of them agrees on — `KEY=value`, one line, optional
|
|
28
|
+
* quotes, `#` comments — and a line outside it is left alone rather than
|
|
29
|
+
* rewritten.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Every value the file supplies, in file order.
|
|
33
|
+
*
|
|
34
|
+
* A blank value is **absent** — see the header. A key repeated in one file keeps
|
|
35
|
+
* the last assignment, which is what every reader of a `.env` does.
|
|
36
|
+
*/
|
|
37
|
+
export declare function parseEnvFile(text: string): ReadonlyMap<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* A value as it is written back, quoted only where it has to be.
|
|
40
|
+
*
|
|
41
|
+
* A generated secret is base64 and needs no quoting; a URL needs none. What does
|
|
42
|
+
* is a value carrying a space, a quote or a `#`, because an unquoted `#` starts
|
|
43
|
+
* a comment in every dialect above and would truncate the value silently.
|
|
44
|
+
*/
|
|
45
|
+
export declare function renderEnvValue(value: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* The file's new text: every existing line kept, in place, with the values this
|
|
48
|
+
* run resolved written over the keys they name and appended where they are new.
|
|
49
|
+
*
|
|
50
|
+
* **Kept in place** rather than re-rendered, because the operator may already
|
|
51
|
+
* have put comments, ordering and their own keys in it, and a scaffold that
|
|
52
|
+
* rewrote the file would silently discard all three. That is the same rule
|
|
53
|
+
* `endora new storefront` applies to a directory it will not merge into, one
|
|
54
|
+
* granularity down.
|
|
55
|
+
*
|
|
56
|
+
* ## A commented-out placeholder is filled in, not duplicated
|
|
57
|
+
*
|
|
58
|
+
* `endora new instance` writes its `.env` with every declared input present and
|
|
59
|
+
* **commented out**, because a blank assignment is not the same state as no
|
|
60
|
+
* assignment: Node's `--env-file` sets `MEILISEARCH_URL=` to the empty string,
|
|
61
|
+
* and the platform's `??` fallbacks read that as a value. Measured — the
|
|
62
|
+
* instance acceptance criterion's health route answered 503 over a search
|
|
63
|
+
* engine that was running, because a file listing every optional input as a
|
|
64
|
+
* blank had turned twenty "unset"s into twenty empty strings.
|
|
65
|
+
*
|
|
66
|
+
* So a value written over such a placeholder replaces the commented line rather
|
|
67
|
+
* than being appended below it, which keeps the operator's ordering and the
|
|
68
|
+
* sentence above it and leaves no second assignment of the same key for a
|
|
69
|
+
* reader to wonder about. A key the run has no value for stays commented, and
|
|
70
|
+
* therefore stays genuinely unset.
|
|
71
|
+
*/
|
|
72
|
+
export declare function writeEnvFile(existingText: string, values: ReadonlyMap<string, string>): string;
|
|
73
|
+
//# sourceMappingURL=env-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-file.d.ts","sourceRoot":"","sources":["../../src/inputs/env-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAuBH;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAYtE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAKD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,MAAM,CAyBR"}
|