@cbnventures/nova 0.20.0 → 0.21.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/README.md +10 -0
- package/bin/nova.mjs +3 -3
- package/build/package.json +9 -8
- package/build/src/cli/generate/github/funding.js +2 -2
- package/build/src/cli/generate/github/funding.js.map +1 -1
- package/build/src/cli/generate/github/issue-template.js +2 -2
- package/build/src/cli/generate/github/issue-template.js.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +12 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.js +535 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts +9 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.js +117 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.js.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint.d.ts +60 -0
- package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint.js +2251 -0
- package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -0
- package/build/src/cli/generate/must-haves/agent-conventions.js +2 -2
- package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.d.ts +1 -0
- package/build/src/cli/generate/must-haves/dotenv.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.js +41 -15
- package/build/src/cli/generate/must-haves/dotenv.js.map +1 -1
- package/build/src/cli/generate/must-haves/editorconfig.js +2 -2
- package/build/src/cli/generate/must-haves/editorconfig.js.map +1 -1
- package/build/src/cli/generate/must-haves/gitignore.js +2 -2
- package/build/src/cli/generate/must-haves/gitignore.js.map +1 -1
- package/build/src/cli/generate/must-haves/license.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/license.js +4 -4
- package/build/src/cli/generate/must-haves/license.js.map +1 -1
- package/build/src/cli/generate/must-haves/read-me.d.ts +6 -2
- package/build/src/cli/generate/must-haves/read-me.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/read-me.js +103 -63
- package/build/src/cli/generate/must-haves/read-me.js.map +1 -1
- package/build/src/cli/index.js +108 -2
- package/build/src/cli/index.js.map +1 -1
- package/build/src/cli/recipe/github/sync-features.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-features.js +5 -3
- package/build/src/cli/recipe/github/sync-features.js.map +1 -1
- package/build/src/cli/recipe/github/sync-identity.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-identity.js +5 -3
- package/build/src/cli/recipe/github/sync-identity.js.map +1 -1
- package/build/src/cli/recipe/github/sync-policies.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-policies.js +5 -3
- package/build/src/cli/recipe/github/sync-policies.js.map +1 -1
- package/build/src/cli/recipe/index.d.ts.map +1 -1
- package/build/src/cli/recipe/index.js +32 -0
- package/build/src/cli/recipe/index.js.map +1 -1
- package/build/src/cli/recipe/license/update-copyright.d.ts +7 -0
- package/build/src/cli/recipe/license/update-copyright.d.ts.map +1 -0
- package/build/src/cli/recipe/license/update-copyright.js +191 -0
- package/build/src/cli/recipe/license/update-copyright.js.map +1 -0
- package/build/src/cli/recipe/package-json/cleanup.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/cleanup.js +14 -13
- package/build/src/cli/recipe/package-json/cleanup.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-artifacts.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-artifacts.js +11 -6
- package/build/src/cli/recipe/package-json/normalize-artifacts.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-bundler.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-bundler.js +11 -6
- package/build/src/cli/recipe/package-json/normalize-bundler.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-dependencies.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-dependencies.js +18 -10
- package/build/src/cli/recipe/package-json/normalize-dependencies.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-modules.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-modules.js +11 -6
- package/build/src/cli/recipe/package-json/normalize-modules.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-tooling.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-tooling.js +12 -7
- package/build/src/cli/recipe/package-json/normalize-tooling.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-environment.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-environment.js +46 -14
- package/build/src/cli/recipe/package-json/sync-environment.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-identity.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-identity.js +29 -16
- package/build/src/cli/recipe/package-json/sync-identity.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-ownership.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-ownership.js +18 -11
- package/build/src/cli/recipe/package-json/sync-ownership.js.map +1 -1
- package/build/src/cli/recipe/read-me/update-badges.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-badges.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-badges.js +115 -0
- package/build/src/cli/recipe/read-me/update-badges.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-credits.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-credits.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-credits.js +115 -0
- package/build/src/cli/recipe/read-me/update-credits.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-documentation.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-documentation.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-documentation.js +115 -0
- package/build/src/cli/recipe/read-me/update-documentation.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-header.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-header.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-header.js +115 -0
- package/build/src/cli/recipe/read-me/update-header.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-introduction.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-introduction.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-introduction.js +115 -0
- package/build/src/cli/recipe/read-me/update-introduction.js.map +1 -0
- package/build/src/cli/scaffold/starter/base.js +1 -1
- package/build/src/cli/scaffold/starter/base.js.map +1 -1
- package/build/src/cli/utility/changelog.d.ts.map +1 -1
- package/build/src/cli/utility/changelog.js +6 -2
- package/build/src/cli/utility/changelog.js.map +1 -1
- package/build/src/cli/utility/initialize.d.ts +6 -0
- package/build/src/cli/utility/initialize.d.ts.map +1 -1
- package/build/src/cli/utility/initialize.js +676 -113
- package/build/src/cli/utility/initialize.js.map +1 -1
- package/build/src/cli/utility/run-scripts.d.ts.map +1 -1
- package/build/src/cli/utility/run-scripts.js +4 -4
- package/build/src/cli/utility/run-scripts.js.map +1 -1
- package/build/src/cli/utility/transpile.js +1 -1
- package/build/src/cli/utility/transpile.js.map +1 -1
- package/build/src/cli/utility/type-check.js +1 -1
- package/build/src/cli/utility/type-check.js.map +1 -1
- package/build/src/cli/utility/version.js +1 -1
- package/build/src/cli/utility/version.js.map +1 -1
- package/build/src/lib/env-github.d.ts +4 -0
- package/build/src/lib/env-github.d.ts.map +1 -0
- package/build/src/lib/env-github.js +57 -0
- package/build/src/lib/env-github.js.map +1 -0
- package/build/src/lib/env-managed-set.d.ts +3 -0
- package/build/src/lib/env-managed-set.d.ts.map +1 -0
- package/build/src/lib/env-managed-set.js +102 -0
- package/build/src/lib/env-managed-set.js.map +1 -0
- package/build/src/lib/env-namespace.d.ts +3 -0
- package/build/src/lib/env-namespace.d.ts.map +1 -0
- package/build/src/lib/env-namespace.js +11 -0
- package/build/src/lib/env-namespace.js.map +1 -0
- package/build/src/lib/env-reconcile.d.ts +3 -0
- package/build/src/lib/env-reconcile.d.ts.map +1 -0
- package/build/src/lib/env-reconcile.js +109 -0
- package/build/src/lib/env-reconcile.js.map +1 -0
- package/build/src/lib/env-status.d.ts +3 -0
- package/build/src/lib/env-status.d.ts.map +1 -0
- package/build/src/lib/env-status.js +113 -0
- package/build/src/lib/env-status.js.map +1 -0
- package/build/src/lib/item.d.ts +2 -1
- package/build/src/lib/item.d.ts.map +1 -1
- package/build/src/lib/item.js +26 -0
- package/build/src/lib/item.js.map +1 -1
- package/build/src/lib/markdown-slug.js +1 -1
- package/build/src/lib/markdown-slug.js.map +1 -1
- package/build/src/lib/nova-config.d.ts +11 -4
- package/build/src/lib/nova-config.d.ts.map +1 -1
- package/build/src/lib/nova-config.js +425 -118
- package/build/src/lib/nova-config.js.map +1 -1
- package/build/src/lib/read-me-regions.d.ts +4 -0
- package/build/src/lib/read-me-regions.d.ts.map +1 -0
- package/build/src/lib/read-me-regions.js +33 -0
- package/build/src/lib/read-me-regions.js.map +1 -0
- package/build/src/lib/regex.d.ts +5 -0
- package/build/src/lib/regex.d.ts.map +1 -1
- package/build/src/lib/regex.js +5 -0
- package/build/src/lib/regex.js.map +1 -1
- package/build/src/lib/scaffold.d.ts.map +1 -1
- package/build/src/lib/scaffold.js +33 -14
- package/build/src/lib/scaffold.js.map +1 -1
- package/build/src/lib/type-declaration-engine.d.ts +2 -2
- package/build/src/lib/type-declaration-engine.d.ts.map +1 -1
- package/build/src/lib/type-declaration-engine.js +32 -6
- package/build/src/lib/type-declaration-engine.js.map +1 -1
- package/build/src/lib/utility.d.ts +2 -1
- package/build/src/lib/utility.d.ts.map +1 -1
- package/build/src/lib/utility.js +39 -7
- package/build/src/lib/utility.js.map +1 -1
- package/build/src/lib/workflow-templates.d.ts.map +1 -1
- package/build/src/lib/workflow-templates.js +86 -60
- package/build/src/lib/workflow-templates.js.map +1 -1
- package/build/src/presets/eslint/dx-code-style.d.ts.map +1 -1
- package/build/src/presets/eslint/dx-code-style.js +6 -0
- package/build/src/presets/eslint/dx-code-style.js.map +1 -1
- package/build/src/presets/eslint/fw-astro.d.ts +4 -0
- package/build/src/presets/eslint/fw-astro.d.ts.map +1 -0
- package/build/src/presets/eslint/fw-astro.js +13 -0
- package/build/src/presets/eslint/fw-astro.js.map +1 -0
- package/build/src/presets/eslint/index.d.ts +1 -0
- package/build/src/presets/eslint/index.d.ts.map +1 -1
- package/build/src/presets/eslint/index.js +1 -0
- package/build/src/presets/eslint/index.js.map +1 -1
- package/build/src/presets/tsconfig/fw-astro.json +15 -0
- package/build/src/rules/eslint/conventions/no-implicit-boolean.d.ts.map +1 -1
- package/build/src/rules/eslint/conventions/no-implicit-boolean.js +3 -2
- package/build/src/rules/eslint/conventions/no-implicit-boolean.js.map +1 -1
- package/build/src/rules/eslint/conventions/require-hash-private.js +1 -1
- package/build/src/rules/eslint/conventions/require-hash-private.js.map +1 -1
- package/build/src/rules/eslint/conventions/require-kebab-case-filename.d.ts.map +1 -1
- package/build/src/rules/eslint/conventions/require-kebab-case-filename.js +4 -1
- package/build/src/rules/eslint/conventions/require-kebab-case-filename.js.map +1 -1
- package/build/src/rules/eslint/conventions/require-node-protocol.d.ts +11 -0
- package/build/src/rules/eslint/conventions/require-node-protocol.d.ts.map +1 -0
- package/build/src/rules/eslint/conventions/require-node-protocol.js +76 -0
- package/build/src/rules/eslint/conventions/require-node-protocol.js.map +1 -0
- package/build/src/rules/eslint/formatting/no-raw-text-in-code.d.ts.map +1 -1
- package/build/src/rules/eslint/formatting/no-raw-text-in-code.js +2 -1
- package/build/src/rules/eslint/formatting/no-raw-text-in-code.js.map +1 -1
- package/build/src/rules/eslint/formatting/require-padding-lines.d.ts.map +1 -1
- package/build/src/rules/eslint/formatting/require-padding-lines.js +7 -3
- package/build/src/rules/eslint/formatting/require-padding-lines.js.map +1 -1
- package/build/src/rules/eslint/formatting/require-ternary-parens.d.ts.map +1 -1
- package/build/src/rules/eslint/formatting/require-ternary-parens.js +7 -17
- package/build/src/rules/eslint/formatting/require-ternary-parens.js.map +1 -1
- package/build/src/rules/eslint/index.d.ts +4 -0
- package/build/src/rules/eslint/index.d.ts.map +1 -1
- package/build/src/rules/eslint/index.js +4 -0
- package/build/src/rules/eslint/index.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.d.ts +3 -2
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.d.ts.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js +22 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts +2 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js +16 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.d.ts.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.js +8 -4
- package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.d.ts +12 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.d.ts.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js +169 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +11 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js +80 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-since.js +2 -2
- package/build/src/rules/eslint/jsdoc/require-jsdoc-since.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts +15 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.js +290 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.js.map +1 -0
- package/build/src/rules/eslint/patterns/no-await-in-loop.js +1 -1
- package/build/src/rules/eslint/patterns/no-await-in-loop.js.map +1 -1
- package/build/src/rules/eslint/patterns/no-bracket-method-call.d.ts.map +1 -1
- package/build/src/rules/eslint/patterns/no-bracket-method-call.js +4 -0
- package/build/src/rules/eslint/patterns/no-bracket-method-call.js.map +1 -1
- package/build/src/rules/eslint/typescript/no-inline-type-annotation.d.ts.map +1 -1
- package/build/src/rules/eslint/typescript/no-inline-type-annotation.js +4 -1
- package/build/src/rules/eslint/typescript/no-inline-type-annotation.js.map +1 -1
- package/build/src/rules/eslint/typescript/require-bracket-property-access.d.ts.map +1 -1
- package/build/src/rules/eslint/typescript/require-bracket-property-access.js +8 -1
- package/build/src/rules/eslint/typescript/require-bracket-property-access.js.map +1 -1
- package/build/src/rules/vitest/active-vitest.d.ts +5 -0
- package/build/src/rules/vitest/active-vitest.d.ts.map +1 -0
- package/build/src/rules/vitest/active-vitest.js +19 -0
- package/build/src/rules/vitest/active-vitest.js.map +1 -0
- package/build/src/rules/vitest/dotenv/register.d.ts.map +1 -1
- package/build/src/rules/vitest/dotenv/register.js +3 -2
- package/build/src/rules/vitest/dotenv/register.js.map +1 -1
- package/build/src/rules/vitest/dotenv/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/dotenv/rules.js +2 -2
- package/build/src/rules/vitest/dotenv/rules.js.map +1 -1
- package/build/src/rules/vitest/frontmatter/register.d.ts.map +1 -1
- package/build/src/rules/vitest/frontmatter/register.js +3 -2
- package/build/src/rules/vitest/frontmatter/register.js.map +1 -1
- package/build/src/rules/vitest/frontmatter/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/frontmatter/rules.js +13 -13
- package/build/src/rules/vitest/frontmatter/rules.js.map +1 -1
- package/build/src/rules/vitest/link/register.d.ts.map +1 -1
- package/build/src/rules/vitest/link/register.js +3 -2
- package/build/src/rules/vitest/link/register.js.map +1 -1
- package/build/src/rules/vitest/link/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/link/rules.js +8 -8
- package/build/src/rules/vitest/link/rules.js.map +1 -1
- package/build/src/rules/vitest/markdown-table/register.d.ts.map +1 -1
- package/build/src/rules/vitest/markdown-table/register.js +3 -2
- package/build/src/rules/vitest/markdown-table/register.js.map +1 -1
- package/build/src/rules/vitest/markdown-table/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/markdown-table/rules.js +3 -3
- package/build/src/rules/vitest/markdown-table/rules.js.map +1 -1
- package/build/src/rules/vitest/terminology/register.d.ts.map +1 -1
- package/build/src/rules/vitest/terminology/register.js +3 -2
- package/build/src/rules/vitest/terminology/register.js.map +1 -1
- package/build/src/rules/vitest/terminology/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/terminology/rules.js +8 -8
- package/build/src/rules/vitest/terminology/rules.js.map +1 -1
- package/build/src/rules/vitest/type-declarations/register.d.ts.map +1 -1
- package/build/src/rules/vitest/type-declarations/register.js +6 -3
- package/build/src/rules/vitest/type-declarations/register.js.map +1 -1
- package/build/src/rules/vitest/type-declarations/rules.d.ts +3 -1
- package/build/src/rules/vitest/type-declarations/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/type-declarations/rules.js +82 -12
- package/build/src/rules/vitest/type-declarations/rules.js.map +1 -1
- package/build/src/toolkit/index.d.ts +1 -0
- package/build/src/toolkit/index.d.ts.map +1 -1
- package/build/src/toolkit/index.js +1 -0
- package/build/src/toolkit/index.js.map +1 -1
- package/build/src/toolkit/markdown-table.js +1 -1
- package/build/src/toolkit/markdown-table.js.map +1 -1
- package/build/src/toolkit/nova-identity.d.ts +19 -0
- package/build/src/toolkit/nova-identity.d.ts.map +1 -0
- package/build/src/toolkit/nova-identity.js +141 -0
- package/build/src/toolkit/nova-identity.js.map +1 -0
- package/build/src/types/cli/generate/github/funding.d.ts +4 -4
- package/build/src/types/cli/generate/github/issue-template.d.ts +11 -11
- package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +351 -0
- package/build/src/types/cli/generate/github/workflows-blueprint-variables.d.ts +131 -0
- package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +1180 -0
- package/build/src/types/cli/generate/must-haves/agent-conventions.d.ts +4 -4
- package/build/src/types/cli/generate/must-haves/dotenv.d.ts +49 -14
- package/build/src/types/cli/generate/must-haves/editorconfig.d.ts +2 -2
- package/build/src/types/cli/generate/must-haves/gitignore.d.ts +8 -8
- package/build/src/types/cli/generate/must-haves/license.d.ts +5 -5
- package/build/src/types/cli/generate/must-haves/read-me.d.ts +136 -88
- package/build/src/types/cli/index.d.ts +14 -0
- package/build/src/types/cli/recipe/github/handle-gh-failure.d.ts +2 -2
- package/build/src/types/cli/recipe/github/sync-features.d.ts +19 -12
- package/build/src/types/cli/recipe/github/sync-identity.d.ts +18 -11
- package/build/src/types/cli/recipe/github/sync-policies.d.ts +22 -15
- package/build/src/types/cli/recipe/index.d.ts +7 -3
- package/build/src/types/cli/recipe/license/update-copyright.d.ts +142 -0
- package/build/src/types/cli/recipe/package-json/cleanup.d.ts +26 -22
- package/build/src/types/cli/recipe/package-json/normalize-artifacts.d.ts +22 -16
- package/build/src/types/cli/recipe/package-json/normalize-bundler.d.ts +20 -14
- package/build/src/types/cli/recipe/package-json/normalize-dependencies.d.ts +31 -19
- package/build/src/types/cli/recipe/package-json/normalize-modules.d.ts +20 -14
- package/build/src/types/cli/recipe/package-json/normalize-tooling.d.ts +20 -14
- package/build/src/types/cli/recipe/package-json/sync-environment.d.ts +46 -22
- package/build/src/types/cli/recipe/package-json/sync-identity.d.ts +36 -19
- package/build/src/types/cli/recipe/package-json/sync-ownership.d.ts +33 -23
- package/build/src/types/cli/recipe/read-me/update-badges.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-credits.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-documentation.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-header.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-introduction.d.ts +77 -0
- package/build/src/types/cli/scaffold/starter/base.d.ts +2 -2
- package/build/src/types/cli/utility/changelog.d.ts +74 -74
- package/build/src/types/cli/utility/initialize.d.ts +836 -374
- package/build/src/types/cli/utility/run-scripts.d.ts +1 -1
- package/build/src/types/cli/utility/transpile.d.ts +8 -3
- package/build/src/types/cli/utility/type-check.d.ts +9 -3
- package/build/src/types/cli/utility/version.d.ts +32 -32
- package/build/src/types/lib/env-github.d.ts +67 -0
- package/build/src/types/lib/env-managed-set.d.ts +90 -0
- package/build/src/types/lib/env-namespace.d.ts +22 -0
- package/build/src/types/lib/env-reconcile.d.ts +71 -0
- package/build/src/types/lib/env-status.d.ts +102 -0
- package/build/src/types/lib/item.d.ts +23 -0
- package/build/src/types/lib/nova-config.d.ts +397 -102
- package/build/src/types/lib/read-me-regions.d.ts +51 -0
- package/build/src/types/lib/scaffold.d.ts +43 -23
- package/build/src/types/lib/type-declaration-engine.d.ts +18 -2
- package/build/src/types/lib/utility.d.ts +38 -4
- package/build/src/types/lib/workflow-templates.d.ts +10 -74
- package/build/src/types/presets/eslint/fw-astro.d.ts +8 -0
- package/build/src/types/rules/eslint/conventions/no-implicit-boolean.d.ts +7 -0
- package/build/src/types/rules/eslint/conventions/require-naming-convention.d.ts +8 -4
- package/build/src/types/rules/eslint/conventions/require-node-protocol.d.ts +56 -0
- package/build/src/types/rules/eslint/formatting/require-padding-lines.d.ts +2 -0
- package/build/src/types/rules/eslint/formatting/require-ternary-parens.d.ts +8 -3
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-body.d.ts +16 -0
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts +17 -13
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-param-name.d.ts +3 -1
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-presence.d.ts +125 -0
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +48 -0
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts +204 -0
- package/build/src/types/rules/eslint/patterns/no-await-in-loop.d.ts +1 -1
- package/build/src/types/rules/eslint/patterns/no-bracket-method-call.d.ts +1 -1
- package/build/src/types/rules/eslint/typescript/require-bracket-property-access.d.ts +19 -7
- package/build/src/types/rules/vitest/active-vitest.d.ts +31 -0
- package/build/src/types/rules/vitest/index.d.ts +21 -1
- package/build/src/types/rules/vitest/markdown-table/rules.d.ts +2 -2
- package/build/src/types/rules/vitest/type-declarations/rules.d.ts +74 -0
- package/build/src/types/shared.d.ts +666 -32
- package/build/src/types/tests/cli/generate/github/funding.test.d.ts +14 -10
- package/build/src/types/tests/cli/generate/github/issue-template.test.d.ts +20 -16
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +199 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +75 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +295 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +901 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-variables.test.d.ts +144 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +332 -0
- package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +11 -7
- package/build/src/types/tests/cli/generate/must-haves/dotenv.test.d.ts +83 -43
- package/build/src/types/tests/cli/generate/must-haves/editorconfig.test.d.ts +12 -8
- package/build/src/types/tests/cli/generate/must-haves/gitignore.test.d.ts +11 -7
- package/build/src/types/tests/cli/generate/must-haves/read-me.test.d.ts +33 -10
- package/build/src/types/tests/cli/recipe/github/handle-gh-failure.test.d.ts +25 -21
- package/build/src/types/tests/cli/recipe/github/sync-features.test.d.ts +98 -94
- package/build/src/types/tests/cli/recipe/github/sync-identity.test.d.ts +133 -129
- package/build/src/types/tests/cli/recipe/github/sync-policies.test.d.ts +125 -121
- package/build/src/types/tests/cli/recipe/license/update-copyright.test.d.ts +617 -0
- package/build/src/types/tests/cli/recipe/package-json/normalize-dependencies.test.d.ts +27 -0
- package/build/src/types/tests/cli/recipe/package-json/sync-environment.test.d.ts +21 -0
- package/build/src/types/tests/cli/recipe/package-json/sync-identity.test.d.ts +52 -0
- package/build/src/types/tests/cli/recipe/read-me/update-badges.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-credits.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-documentation.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-header.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-introduction.test.d.ts +258 -0
- package/build/src/types/tests/cli/utility/changelog.test.d.ts +31 -0
- package/build/src/types/tests/cli/utility/initialize.test.d.ts +148 -32
- package/build/src/types/tests/lib/nova-config.test.d.ts +330 -173
- package/build/src/types/tests/lib/read-me-regions.test.d.ts +43 -0
- package/build/src/types/tests/lib/utility.test.d.ts +35 -0
- package/build/src/types/tests/lib/workflow-templates.test.d.ts +18 -2
- package/build/src/types/tests/rules/eslint/conventions/require-node-protocol.test.d.ts +8 -0
- package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-presence.test.d.ts +8 -0
- package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-returns.test.d.ts +8 -0
- package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-tag-order.test.d.ts +8 -0
- package/build/src/types/tests/rules/vitest/active-vitest.test.d.ts +56 -0
- package/build/src/types/tests/rules/vitest/frontmatter.test.d.ts +14 -0
- package/build/src/types/tests/rules/vitest/terminology.test.d.ts +4 -0
- package/build/src/types/tests/toolkit/logger.test.d.ts +25 -5
- package/build/src/types/tests/toolkit/nova-identity.test.d.ts +118 -0
- package/build/src/types/tests/type-declarations.test.d.ts +14 -0
- package/build/src/types/toolkit/nova-identity.d.ts +313 -0
- package/build/templates/generators/github/workflows/publish/base.yml +2 -0
- package/build/templates/generators/github/workflows/publish/targets/cloudflare-workers.yml +36 -0
- package/build/templates/generators/must-haves/agent-conventions/conventions/universal.md +2 -0
- package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +9 -3
- package/build/templates/scaffold/docs/docusaurus/package.json +5 -2
- package/build/templates/scaffold/docs/docusaurus/src/tests/frontmatter.test.ts +4 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/link.test.ts +2 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/markdown-table.test.ts +2 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/terminology.test.ts +2 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/type-declarations.test.ts +17 -0
- package/package.json +9 -8
- package/build/src/cli/generate/github/workflows.d.ts +0 -17
- package/build/src/cli/generate/github/workflows.d.ts.map +0 -1
- package/build/src/cli/generate/github/workflows.js +0 -856
- package/build/src/cli/generate/github/workflows.js.map +0 -1
- package/build/src/types/cli/generate/github/workflows.d.ts +0 -596
- package/build/src/types/tests/cli/generate/github/workflows-helpers.test.d.ts +0 -239
- package/build/src/types/tests/cli/generate/github/workflows.test.d.ts +0 -587
- package/build/templates/generators/github/workflows/publish/targets/aws-amplify-nextjs.yml +0 -32
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import { join, relative, sep } from 'path';
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import { join, relative, sep } from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import prompts from 'prompts';
|
|
5
|
+
import { libEnvGithub } from '../../lib/env-github.js';
|
|
6
|
+
import { libEnvManagedSet } from '../../lib/env-managed-set.js';
|
|
7
|
+
import { libEnvNamespace } from '../../lib/env-namespace.js';
|
|
8
|
+
import { libEnvReconcile } from '../../lib/env-reconcile.js';
|
|
9
|
+
import { libEnvStatus } from '../../lib/env-status.js';
|
|
5
10
|
import { libItemAllowedAgents, libItemAllowedPoliciesByRole, libItemAllowedRecipes, libItemSyncRoles, libItemValidEntityRoles, } from '../../lib/item.js';
|
|
6
11
|
import { Runner as LibNovaConfig } from '../../lib/nova-config.js';
|
|
7
|
-
import { LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
|
|
12
|
+
import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
|
|
8
13
|
import { discoverPathsWithFile, pathExists, resolveTemplatePath } from '../../lib/utility.js';
|
|
9
14
|
import { libWorkflowTemplatesMetadata } from '../../lib/workflow-templates.js';
|
|
10
15
|
import { Logger } from '../../toolkit/index.js';
|
|
@@ -33,6 +38,10 @@ export class Runner {
|
|
|
33
38
|
}
|
|
34
39
|
const novaConfig = new LibNovaConfig();
|
|
35
40
|
const workingFile = await novaConfig.load();
|
|
41
|
+
if (options['status'] === true) {
|
|
42
|
+
await Runner.promptEnvironmentReconcile(workingFile, false);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
36
45
|
const promptFlowResult = await Runner.promptFlow(workingFile);
|
|
37
46
|
if (promptFlowResult === 'cancel') {
|
|
38
47
|
Logger.customize({
|
|
@@ -105,6 +114,11 @@ export class Runner {
|
|
|
105
114
|
description: 'Select the AI tools (Claude Code, Codex) to generate conventions for.',
|
|
106
115
|
handler: Runner['promptAgents'],
|
|
107
116
|
},
|
|
117
|
+
environment: {
|
|
118
|
+
label: 'Environment',
|
|
119
|
+
description: 'Manage environment variables and secrets, prefixes, and GitHub provisioning.',
|
|
120
|
+
handler: Runner['promptEnvironment'],
|
|
121
|
+
},
|
|
108
122
|
};
|
|
109
123
|
while (true) {
|
|
110
124
|
const categoryKeys = Object.keys(category);
|
|
@@ -898,10 +912,10 @@ export class Runner {
|
|
|
898
912
|
}
|
|
899
913
|
const repoOutputResult = repoOutput['result'];
|
|
900
914
|
const githubRepoInput = repoOutputResult.githubRepo.trim();
|
|
901
|
-
const existingRecipes =
|
|
902
|
-
const syncIdentityInitial = (existingRecipes !== undefined && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity'] : true;
|
|
903
|
-
const syncFeaturesInitial = (existingRecipes !== undefined && existingRecipes['sync-features'] !== undefined) ? existingRecipes['sync-features'] : false;
|
|
904
|
-
const syncPoliciesInitial = (existingRecipes !== undefined && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies'] : false;
|
|
915
|
+
const existingRecipes = (config['recipes'] !== undefined) ? config['recipes']['github'] : undefined;
|
|
916
|
+
const syncIdentityInitial = (existingRecipes !== undefined && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity']['enabled'] : true;
|
|
917
|
+
const syncFeaturesInitial = (existingRecipes !== undefined && existingRecipes['sync-features'] !== undefined) ? existingRecipes['sync-features']['enabled'] : false;
|
|
918
|
+
const syncPoliciesInitial = (existingRecipes !== undefined && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies']['enabled'] : false;
|
|
905
919
|
const recipesOutput = await Runner.promptWithCancel([
|
|
906
920
|
{
|
|
907
921
|
type: 'confirm',
|
|
@@ -927,9 +941,15 @@ export class Runner {
|
|
|
927
941
|
}
|
|
928
942
|
const recipesOutputResult = recipesOutput['result'];
|
|
929
943
|
const githubRecipesInput = {
|
|
930
|
-
'sync-identity':
|
|
931
|
-
|
|
932
|
-
|
|
944
|
+
'sync-identity': {
|
|
945
|
+
enabled: recipesOutputResult.githubRecipeSyncIdentity,
|
|
946
|
+
},
|
|
947
|
+
'sync-features': {
|
|
948
|
+
enabled: recipesOutputResult.githubRecipeSyncFeatures,
|
|
949
|
+
},
|
|
950
|
+
'sync-policies': {
|
|
951
|
+
enabled: recipesOutputResult.githubRecipeSyncPolicies,
|
|
952
|
+
},
|
|
933
953
|
};
|
|
934
954
|
const existingTopics = github['topics'];
|
|
935
955
|
const topicsHasExisting = (existingTopics !== undefined) && existingTopics.length > 0;
|
|
@@ -1303,7 +1323,7 @@ export class Runner {
|
|
|
1303
1323
|
githubPoliciesInput = {
|
|
1304
1324
|
...((githubPoliciesVisibilityValue !== 'skip') ? { visibility: githubPoliciesVisibilityValue } : {}),
|
|
1305
1325
|
...((githubPoliciesDefaultBranchValue !== 'skip') ? { defaultBranch: githubPoliciesDefaultBranchValue } : {}),
|
|
1306
|
-
...(githubPoliciesMergeMethodsInput !== undefined ? { mergeMethods: githubPoliciesMergeMethodsInput } : {}),
|
|
1326
|
+
...((githubPoliciesMergeMethodsInput !== undefined) ? { mergeMethods: githubPoliciesMergeMethodsInput } : {}),
|
|
1307
1327
|
...((githubPoliciesAutoDeleteValue !== 'skip') ? { autoDeleteHeadBranch: githubPoliciesAutoDeleteValue } : {}),
|
|
1308
1328
|
};
|
|
1309
1329
|
}
|
|
@@ -1385,13 +1405,15 @@ export class Runner {
|
|
|
1385
1405
|
const githubConfig = {
|
|
1386
1406
|
owner: githubOwnerInput,
|
|
1387
1407
|
repo: githubRepoInput,
|
|
1388
|
-
|
|
1389
|
-
...(
|
|
1390
|
-
...(
|
|
1391
|
-
...(
|
|
1392
|
-
...(issueTemplateInput !== undefined ? { issueTemplate: issueTemplateInput } : {}),
|
|
1408
|
+
...((githubTopicsInput !== undefined) ? { topics: githubTopicsInput } : {}),
|
|
1409
|
+
...((githubFeaturesInput !== undefined) ? { features: githubFeaturesInput } : {}),
|
|
1410
|
+
...((githubPoliciesInput !== undefined) ? { policies: githubPoliciesInput } : {}),
|
|
1411
|
+
...((issueTemplateInput !== undefined) ? { issueTemplate: issueTemplateInput } : {}),
|
|
1393
1412
|
};
|
|
1394
1413
|
Object.assign(config, { github: githubConfig });
|
|
1414
|
+
const recipesConfig = (config['recipes'] !== undefined) ? { ...(config['recipes']) } : {};
|
|
1415
|
+
recipesConfig.github = githubRecipesInput;
|
|
1416
|
+
Object.assign(config, { recipes: recipesConfig });
|
|
1395
1417
|
Logger.customize({
|
|
1396
1418
|
name: 'Runner.promptGithub',
|
|
1397
1419
|
purpose: 'updated',
|
|
@@ -1613,16 +1635,17 @@ export class Runner {
|
|
|
1613
1635
|
static async promptWorkflows(config) {
|
|
1614
1636
|
const workflows = [];
|
|
1615
1637
|
if (Array.isArray(config['workflows']) === true) {
|
|
1616
|
-
|
|
1638
|
+
const configWorkflows = config['workflows'];
|
|
1639
|
+
for (const configWorkflow of configWorkflows) {
|
|
1617
1640
|
const clonedWorkflow = { ...configWorkflow };
|
|
1618
1641
|
if (Array.isArray(configWorkflow['triggers']) === true) {
|
|
1619
1642
|
clonedWorkflow.triggers = [...configWorkflow['triggers']];
|
|
1620
1643
|
}
|
|
1621
|
-
if (configWorkflow['
|
|
1622
|
-
clonedWorkflow.
|
|
1644
|
+
if (configWorkflow['with'] !== undefined) {
|
|
1645
|
+
clonedWorkflow.with = { ...configWorkflow['with'] };
|
|
1623
1646
|
}
|
|
1624
1647
|
else {
|
|
1625
|
-
Reflect.deleteProperty(clonedWorkflow, '
|
|
1648
|
+
Reflect.deleteProperty(clonedWorkflow, 'with');
|
|
1626
1649
|
}
|
|
1627
1650
|
workflows.push(clonedWorkflow);
|
|
1628
1651
|
}
|
|
@@ -1634,17 +1657,11 @@ export class Runner {
|
|
|
1634
1657
|
if (Array.isArray(workflow['triggers']) === true && workflow['triggers'].length > 0) {
|
|
1635
1658
|
normalizedWorkflow.triggers = [...workflow['triggers']];
|
|
1636
1659
|
}
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1660
|
+
if (workflow['with'] !== undefined && Object.keys(workflow['with']).length > 0) {
|
|
1661
|
+
normalizedWorkflow.with = { ...workflow['with'] };
|
|
1639
1662
|
}
|
|
1640
1663
|
else {
|
|
1641
|
-
Reflect.deleteProperty(normalizedWorkflow, '
|
|
1642
|
-
}
|
|
1643
|
-
if (workflow['settings'] !== undefined && Object.keys(workflow['settings']).length > 0) {
|
|
1644
|
-
normalizedWorkflow.settings = { ...workflow['settings'] };
|
|
1645
|
-
}
|
|
1646
|
-
else {
|
|
1647
|
-
Reflect.deleteProperty(normalizedWorkflow, 'settings');
|
|
1664
|
+
Reflect.deleteProperty(normalizedWorkflow, 'with');
|
|
1648
1665
|
}
|
|
1649
1666
|
return normalizedWorkflow;
|
|
1650
1667
|
});
|
|
@@ -1663,8 +1680,8 @@ export class Runner {
|
|
|
1663
1680
|
if (templateCompare !== 0) {
|
|
1664
1681
|
return templateCompare;
|
|
1665
1682
|
}
|
|
1666
|
-
const suffixA = (a !== undefined && typeof a['
|
|
1667
|
-
const suffixB = (b !== undefined && typeof b['
|
|
1683
|
+
const suffixA = (a !== undefined && typeof a['name'] === 'string') ? a['name'] : '';
|
|
1684
|
+
const suffixB = (b !== undefined && typeof b['name'] === 'string') ? b['name'] : '';
|
|
1668
1685
|
return suffixA.localeCompare(suffixB);
|
|
1669
1686
|
});
|
|
1670
1687
|
const choices = [];
|
|
@@ -1674,8 +1691,9 @@ export class Runner {
|
|
|
1674
1691
|
continue;
|
|
1675
1692
|
}
|
|
1676
1693
|
const template = (typeof workflow['template'] === 'string') ? workflow['template'].trim() : '';
|
|
1677
|
-
const suffix = (typeof workflow['
|
|
1694
|
+
const suffix = (typeof workflow['name'] === 'string') ? workflow['name'].trim() : '';
|
|
1678
1695
|
const triggers = (Array.isArray(workflow['triggers']) === true) ? workflow['triggers'] : [];
|
|
1696
|
+
const triggerNames = triggers.map((trigger) => (typeof trigger === 'string') ? trigger : trigger['name']);
|
|
1679
1697
|
let label = `Workflow ${i + 1}`;
|
|
1680
1698
|
if (template !== '' && suffix !== '') {
|
|
1681
1699
|
label = `${template}-${suffix}`;
|
|
@@ -1683,7 +1701,7 @@ export class Runner {
|
|
|
1683
1701
|
else if (template !== '') {
|
|
1684
1702
|
label = template;
|
|
1685
1703
|
}
|
|
1686
|
-
const triggersLabel = (
|
|
1704
|
+
const triggersLabel = (triggerNames.length > 0) ? ` [${triggerNames.join(', ')}]` : '';
|
|
1687
1705
|
const outputFileName = (suffix !== '') ? `nova-${template}-${suffix}.yml` : `nova-${template}.yml`;
|
|
1688
1706
|
const description = (template !== '') ? `${outputFileName}${triggersLabel}` : 'Update this workflow.';
|
|
1689
1707
|
choices.push({
|
|
@@ -1777,7 +1795,7 @@ export class Runner {
|
|
|
1777
1795
|
continue;
|
|
1778
1796
|
}
|
|
1779
1797
|
const removeTemplate = (typeof workflowToRemove['template'] === 'string') ? workflowToRemove['template'].trim() : '';
|
|
1780
|
-
const removeSuffix = (typeof workflowToRemove['
|
|
1798
|
+
const removeSuffix = (typeof workflowToRemove['name'] === 'string') ? workflowToRemove['name'].trim() : '';
|
|
1781
1799
|
let workflowLabel = `Workflow ${removeWorkflowIndex + 1}`;
|
|
1782
1800
|
if (removeTemplate !== '' && removeSuffix !== '') {
|
|
1783
1801
|
workflowLabel = `${removeTemplate}-${removeSuffix}`;
|
|
@@ -1802,11 +1820,21 @@ export class Runner {
|
|
|
1802
1820
|
}
|
|
1803
1821
|
static async promptWorkflowsForm(workflow, mode, workflows, config) {
|
|
1804
1822
|
const existingTemplate = (workflow !== undefined && typeof workflow['template'] === 'string') ? workflow['template'] : '';
|
|
1805
|
-
const existingSuffix = (workflow !== undefined && typeof workflow['
|
|
1823
|
+
const existingSuffix = (workflow !== undefined && typeof workflow['name'] === 'string') ? workflow['name'] : '';
|
|
1806
1824
|
const existingTriggers = (workflow !== undefined && Array.isArray(workflow['triggers']) === true) ? workflow['triggers'] : [];
|
|
1807
|
-
const
|
|
1808
|
-
const
|
|
1809
|
-
|
|
1825
|
+
const existingTriggerNames = existingTriggers.map((trigger) => (typeof trigger === 'string') ? trigger : trigger['name']);
|
|
1826
|
+
const existingDependsOn = [];
|
|
1827
|
+
for (const trigger of existingTriggers) {
|
|
1828
|
+
if (typeof trigger !== 'string' && Array.isArray(trigger['workflows']) === true) {
|
|
1829
|
+
for (const upstream of trigger['workflows']) {
|
|
1830
|
+
if (existingDependsOn.includes(upstream) === false) {
|
|
1831
|
+
existingDependsOn.push(upstream);
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
const existingTargets = (workflow !== undefined && Array.isArray(workflow['deploy']) === true) ? workflow['deploy'] : [];
|
|
1837
|
+
const existingScopes = (workflow !== undefined && Array.isArray(workflow['build']) === true) ? workflow['build'] : [];
|
|
1810
1838
|
const templateChoices = libWorkflowTemplatesMetadata.map((entry) => ({
|
|
1811
1839
|
title: entry['name'],
|
|
1812
1840
|
description: entry['description'],
|
|
@@ -1836,12 +1864,12 @@ export class Runner {
|
|
|
1836
1864
|
const suffixOutput = await Runner.promptWithCancel({
|
|
1837
1865
|
type: 'text',
|
|
1838
1866
|
name: 'suffix',
|
|
1839
|
-
message: 'Workflow
|
|
1867
|
+
message: 'Workflow name (used in filename and workflow name)',
|
|
1840
1868
|
initial: existingSuffix,
|
|
1841
1869
|
validate: (value) => {
|
|
1842
1870
|
const trimmed = (typeof value === 'string') ? value.trim() : '';
|
|
1843
1871
|
if (trimmed === '') {
|
|
1844
|
-
return '
|
|
1872
|
+
return 'Name is required.';
|
|
1845
1873
|
}
|
|
1846
1874
|
const compositeKey = `${selectedTemplate}-${trimmed}`;
|
|
1847
1875
|
const editIndex = (workflow !== undefined) ? workflows.indexOf(workflow) : -1;
|
|
@@ -1849,11 +1877,11 @@ export class Runner {
|
|
|
1849
1877
|
if (i === editIndex) {
|
|
1850
1878
|
return false;
|
|
1851
1879
|
}
|
|
1852
|
-
const existingKey = `${w['template']}-${w['
|
|
1880
|
+
const existingKey = `${w['template']}-${w['name'] ?? ''}`;
|
|
1853
1881
|
return existingKey === compositeKey;
|
|
1854
1882
|
});
|
|
1855
1883
|
if (isDuplicate === true) {
|
|
1856
|
-
return 'A workflow with this template and
|
|
1884
|
+
return 'A workflow with this template and name already exists.';
|
|
1857
1885
|
}
|
|
1858
1886
|
return true;
|
|
1859
1887
|
},
|
|
@@ -1875,7 +1903,7 @@ export class Runner {
|
|
|
1875
1903
|
return {
|
|
1876
1904
|
title: triggerName,
|
|
1877
1905
|
value: triggerName,
|
|
1878
|
-
selected:
|
|
1906
|
+
selected: existingTriggerNames.includes(triggerName),
|
|
1879
1907
|
};
|
|
1880
1908
|
});
|
|
1881
1909
|
const triggersOutput = await Runner.promptWithCancel({
|
|
@@ -1911,7 +1939,7 @@ export class Runner {
|
|
|
1911
1939
|
&& typeof w['template'] === 'string'
|
|
1912
1940
|
&& w['template'].trim() !== '')
|
|
1913
1941
|
.map((w) => {
|
|
1914
|
-
const dependsOnKey = (typeof w['
|
|
1942
|
+
const dependsOnKey = (typeof w['name'] === 'string' && w['name'].trim() !== '') ? `${w['template']}-${w['name']}` : w['template'];
|
|
1915
1943
|
return {
|
|
1916
1944
|
title: dependsOnKey,
|
|
1917
1945
|
value: dependsOnKey,
|
|
@@ -1938,8 +1966,7 @@ export class Runner {
|
|
|
1938
1966
|
const workspaceKeys = Object.keys(config['workspaces'] ?? {});
|
|
1939
1967
|
const selectedTargets = [...existingTargets];
|
|
1940
1968
|
if (matchedMetadata !== undefined && matchedMetadata['supportsTargets'] === true) {
|
|
1941
|
-
const
|
|
1942
|
-
const availableTargetTypes = Object.keys(targetsMetadata);
|
|
1969
|
+
const availableTargetTypes = Object.keys(matchedMetadata['targets'] ?? {});
|
|
1943
1970
|
while (true) {
|
|
1944
1971
|
const targetMenuChoices = [];
|
|
1945
1972
|
for (let i = 0; i < selectedTargets.length; i += 1) {
|
|
@@ -1947,8 +1974,8 @@ export class Runner {
|
|
|
1947
1974
|
if (currentTarget === undefined) {
|
|
1948
1975
|
continue;
|
|
1949
1976
|
}
|
|
1950
|
-
const currentTargetType = currentTarget['
|
|
1951
|
-
const currentTargetWorkingDir = currentTarget['
|
|
1977
|
+
const currentTargetType = currentTarget['to'];
|
|
1978
|
+
const currentTargetWorkingDir = currentTarget['path'];
|
|
1952
1979
|
targetMenuChoices.push({
|
|
1953
1980
|
title: `${chalk.yellow.bold('[EDIT]')} ${currentTargetType} → ${currentTargetWorkingDir}`,
|
|
1954
1981
|
value: {
|
|
@@ -2002,7 +2029,7 @@ export class Runner {
|
|
|
2002
2029
|
if (targetMenuAction['kind'] === 'add' || targetMenuAction['kind'] === 'edit') {
|
|
2003
2030
|
const targetEditIndex = (targetMenuAction['kind'] === 'edit') ? targetMenuAction['index'] : -1;
|
|
2004
2031
|
const targetToEdit = (targetEditIndex >= 0) ? selectedTargets[targetEditIndex] : undefined;
|
|
2005
|
-
const targetTypeInitial = (targetToEdit !== undefined) ? availableTargetTypes.indexOf(targetToEdit['
|
|
2032
|
+
const targetTypeInitial = (targetToEdit !== undefined) ? availableTargetTypes.indexOf(targetToEdit['to']) : 0;
|
|
2006
2033
|
const targetTypeChoices = availableTargetTypes.map((availableTargetType) => ({
|
|
2007
2034
|
title: availableTargetType,
|
|
2008
2035
|
value: availableTargetType,
|
|
@@ -2019,7 +2046,7 @@ export class Runner {
|
|
|
2019
2046
|
}
|
|
2020
2047
|
const targetTypeOutputResultValue = targetTypeOutput['result'];
|
|
2021
2048
|
const selectedTargetType = targetTypeOutputResultValue.targetType;
|
|
2022
|
-
const targetWorkingDirInitial = (targetToEdit !== undefined) ? workspaceKeys.indexOf(targetToEdit['
|
|
2049
|
+
const targetWorkingDirInitial = (targetToEdit !== undefined) ? workspaceKeys.indexOf(targetToEdit['path']) : 0;
|
|
2023
2050
|
const targetWorkingDirChoices = workspaceKeys.map((workspaceKey) => ({
|
|
2024
2051
|
title: workspaceKey,
|
|
2025
2052
|
value: workspaceKey,
|
|
@@ -2040,7 +2067,7 @@ export class Runner {
|
|
|
2040
2067
|
if (selectedTargetIndex === targetEditIndex) {
|
|
2041
2068
|
return false;
|
|
2042
2069
|
}
|
|
2043
|
-
return selectedTarget['
|
|
2070
|
+
return selectedTarget['to'] === selectedTargetType && selectedTarget['path'] === selectedTargetWorkingDir;
|
|
2044
2071
|
});
|
|
2045
2072
|
if (targetIsDuplicate === true) {
|
|
2046
2073
|
Logger.customize({
|
|
@@ -2052,17 +2079,17 @@ export class Runner {
|
|
|
2052
2079
|
continue;
|
|
2053
2080
|
}
|
|
2054
2081
|
let selectedTargetNeeds = undefined;
|
|
2055
|
-
const targetToEditExistingNeeds = (targetToEdit !== undefined && Array.isArray(targetToEdit['
|
|
2082
|
+
const targetToEditExistingNeeds = (targetToEdit !== undefined && Array.isArray(targetToEdit['after']) === true) ? targetToEdit['after'] : [];
|
|
2056
2083
|
const targetNeedsChoices = selectedTargets
|
|
2057
2084
|
.filter((candidate, candidateIndex) => {
|
|
2058
|
-
return candidate['
|
|
2085
|
+
return candidate['to'] === selectedTargetType
|
|
2059
2086
|
&& candidateIndex !== targetEditIndex
|
|
2060
|
-
&& candidate['
|
|
2087
|
+
&& candidate['path'] !== selectedTargetWorkingDir;
|
|
2061
2088
|
})
|
|
2062
2089
|
.map((candidate) => ({
|
|
2063
|
-
title: candidate['
|
|
2064
|
-
value: candidate['
|
|
2065
|
-
selected: targetToEditExistingNeeds.includes(candidate['
|
|
2090
|
+
title: candidate['path'],
|
|
2091
|
+
value: candidate['path'],
|
|
2092
|
+
selected: targetToEditExistingNeeds.includes(candidate['path']),
|
|
2066
2093
|
}));
|
|
2067
2094
|
if (targetNeedsChoices.length > 0) {
|
|
2068
2095
|
const targetNeedsOutput = await Runner.promptWithCancel({
|
|
@@ -2078,11 +2105,11 @@ export class Runner {
|
|
|
2078
2105
|
selectedTargetNeeds = (Array.isArray(targetNeedsOutputResultValue.targetNeeds) === true && targetNeedsOutputResultValue.targetNeeds.length > 0) ? targetNeedsOutputResultValue.targetNeeds : undefined;
|
|
2079
2106
|
}
|
|
2080
2107
|
const newTarget = {
|
|
2081
|
-
|
|
2082
|
-
|
|
2108
|
+
to: selectedTargetType,
|
|
2109
|
+
path: selectedTargetWorkingDir,
|
|
2083
2110
|
};
|
|
2084
2111
|
if (selectedTargetNeeds !== undefined) {
|
|
2085
|
-
Reflect.set(newTarget, '
|
|
2112
|
+
Reflect.set(newTarget, 'after', selectedTargetNeeds);
|
|
2086
2113
|
}
|
|
2087
2114
|
if (targetEditIndex >= 0) {
|
|
2088
2115
|
Reflect.set(selectedTargets, targetEditIndex, newTarget);
|
|
@@ -2096,7 +2123,7 @@ export class Runner {
|
|
|
2096
2123
|
}
|
|
2097
2124
|
let selectedScopes = [];
|
|
2098
2125
|
if (matchedMetadata !== undefined && matchedMetadata['supportsScopes'] === true) {
|
|
2099
|
-
const lockedPaths = new Set(selectedTargets.map((selectedTarget) => selectedTarget['
|
|
2126
|
+
const lockedPaths = new Set(selectedTargets.map((selectedTarget) => selectedTarget['path']));
|
|
2100
2127
|
const extraWorkspaceKeys = workspaceKeys.filter((workspaceKey) => lockedPaths.has(workspaceKey) === false);
|
|
2101
2128
|
selectedScopes = [...lockedPaths];
|
|
2102
2129
|
if (extraWorkspaceKeys.length > 0) {
|
|
@@ -2130,8 +2157,8 @@ export class Runner {
|
|
|
2130
2157
|
const mergedVariables = { ...matchedMetadata['variables'] };
|
|
2131
2158
|
const variableNameToTargetWorkingDir = {};
|
|
2132
2159
|
for (const selectedTarget of selectedTargets) {
|
|
2133
|
-
const targetType = selectedTarget['
|
|
2134
|
-
const targetWorkingDir = selectedTarget['
|
|
2160
|
+
const targetType = selectedTarget['to'];
|
|
2161
|
+
const targetWorkingDir = selectedTarget['path'];
|
|
2135
2162
|
const targetMetadata = matchedMetadata['targets'] ?? {};
|
|
2136
2163
|
const targetVariables = (targetMetadata[targetType] !== undefined) ? targetMetadata[targetType]['variables'] : {};
|
|
2137
2164
|
const targetVarEntries = Object.entries(targetVariables);
|
|
@@ -2167,6 +2194,9 @@ export class Runner {
|
|
|
2167
2194
|
promptMessage = `Variable: ${variableName}`;
|
|
2168
2195
|
initialValue = (typeof variableConfig['default'] === 'string') ? variableConfig['default'] : '';
|
|
2169
2196
|
}
|
|
2197
|
+
if (variableName === 'ROOT_WORKING_DIR' && initialValue === '') {
|
|
2198
|
+
initialValue = './';
|
|
2199
|
+
}
|
|
2170
2200
|
const parts = [];
|
|
2171
2201
|
if (typeof variableConfig['description'] === 'string') {
|
|
2172
2202
|
parts.push(variableConfig['description']);
|
|
@@ -2184,9 +2214,9 @@ export class Runner {
|
|
|
2184
2214
|
promptMessage = `${promptMessage} (${parts.join(', ')})`;
|
|
2185
2215
|
}
|
|
2186
2216
|
if (workflow !== undefined
|
|
2187
|
-
&& workflow['
|
|
2188
|
-
&& typeof workflow['
|
|
2189
|
-
initialValue = workflow['
|
|
2217
|
+
&& workflow['with'] !== undefined
|
|
2218
|
+
&& typeof workflow['with'][variableName] === 'string') {
|
|
2219
|
+
initialValue = workflow['with'][variableName];
|
|
2190
2220
|
}
|
|
2191
2221
|
const settingsOutput = await Runner.promptWithCancel({
|
|
2192
2222
|
type: 'text',
|
|
@@ -2202,27 +2232,34 @@ export class Runner {
|
|
|
2202
2232
|
}
|
|
2203
2233
|
const settingsOutputResultValue = settingsOutput['result'];
|
|
2204
2234
|
const settingValue = (typeof settingsOutputResultValue.settingValue === 'string') ? settingsOutputResultValue.settingValue.trim().replaceAll('\\n', '\n') : '';
|
|
2205
|
-
|
|
2235
|
+
const isDefaultRootWorkingDir = variableName === 'ROOT_WORKING_DIR' && settingValue === './';
|
|
2236
|
+
if (settingValue !== '' && isDefaultRootWorkingDir === false) {
|
|
2206
2237
|
Reflect.set(settings, variableName, settingValue);
|
|
2207
2238
|
}
|
|
2208
2239
|
}
|
|
2209
2240
|
}
|
|
2241
|
+
const resolvedTriggers = selectedTriggers.map((trigger) => {
|
|
2242
|
+
if (trigger.startsWith('workflow-run') === true && selectedDependsOn !== undefined) {
|
|
2243
|
+
return {
|
|
2244
|
+
name: trigger,
|
|
2245
|
+
workflows: selectedDependsOn,
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
return trigger;
|
|
2249
|
+
});
|
|
2210
2250
|
const resolvedWorkflow = {
|
|
2211
2251
|
template: selectedTemplate,
|
|
2212
|
-
|
|
2213
|
-
triggers:
|
|
2252
|
+
name: selectedSuffix,
|
|
2253
|
+
triggers: resolvedTriggers,
|
|
2214
2254
|
};
|
|
2215
|
-
if (
|
|
2216
|
-
Reflect.set(resolvedWorkflow, '
|
|
2255
|
+
if (selectedScopes.length > 0) {
|
|
2256
|
+
Reflect.set(resolvedWorkflow, 'build', selectedScopes);
|
|
2217
2257
|
}
|
|
2218
2258
|
if (selectedTargets.length > 0) {
|
|
2219
|
-
Reflect.set(resolvedWorkflow, '
|
|
2220
|
-
}
|
|
2221
|
-
if (selectedScopes.length > 0) {
|
|
2222
|
-
Reflect.set(resolvedWorkflow, 'scopes', selectedScopes);
|
|
2259
|
+
Reflect.set(resolvedWorkflow, 'deploy', selectedTargets);
|
|
2223
2260
|
}
|
|
2224
2261
|
if (Object.keys(settings).length > 0) {
|
|
2225
|
-
resolvedWorkflow.
|
|
2262
|
+
resolvedWorkflow.with = settings;
|
|
2226
2263
|
}
|
|
2227
2264
|
if (mode === 'create' && selectedTemplate.trim() === '') {
|
|
2228
2265
|
return {
|
|
@@ -2463,8 +2500,512 @@ export class Runner {
|
|
|
2463
2500
|
}
|
|
2464
2501
|
return result;
|
|
2465
2502
|
}
|
|
2503
|
+
static async promptEnvironment(config) {
|
|
2504
|
+
while (true) {
|
|
2505
|
+
const environment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2506
|
+
const globalScope = environment['global'];
|
|
2507
|
+
const apps = (environment['apps'] !== undefined) ? environment['apps'] : {};
|
|
2508
|
+
const workspaces = (config['workspaces'] !== undefined) ? config['workspaces'] : {};
|
|
2509
|
+
const appPaths = [];
|
|
2510
|
+
for (const workspaceEntry of Object.entries(workspaces)) {
|
|
2511
|
+
if (workspaceEntry[1]['role'] === 'app' && appPaths.includes(workspaceEntry[0]) === false) {
|
|
2512
|
+
appPaths.push(workspaceEntry[0]);
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
for (const appPath of Object.keys(apps)) {
|
|
2516
|
+
if (appPaths.includes(appPath) === false) {
|
|
2517
|
+
appPaths.push(appPath);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
const choices = [];
|
|
2521
|
+
const globalVariables = (globalScope !== undefined && globalScope['variables'] !== undefined) ? globalScope['variables'] : [];
|
|
2522
|
+
const globalSummary = (globalScope !== undefined) ? `${globalScope['prefix']} · ${globalVariables.length} value(s)` : 'Not configured yet.';
|
|
2523
|
+
choices.push({
|
|
2524
|
+
title: 'Global keys',
|
|
2525
|
+
description: globalSummary,
|
|
2526
|
+
value: {
|
|
2527
|
+
kind: 'scope',
|
|
2528
|
+
scope: 'global',
|
|
2529
|
+
},
|
|
2530
|
+
});
|
|
2531
|
+
for (const appPath of appPaths) {
|
|
2532
|
+
const appScope = apps[appPath];
|
|
2533
|
+
const appVariables = (appScope !== undefined && appScope['variables'] !== undefined) ? appScope['variables'] : [];
|
|
2534
|
+
const appSummary = (appScope !== undefined) ? `${appScope['prefix']} · ${appVariables.length} value(s)` : 'Not configured yet.';
|
|
2535
|
+
choices.push({
|
|
2536
|
+
title: appPath,
|
|
2537
|
+
description: appSummary,
|
|
2538
|
+
value: {
|
|
2539
|
+
kind: 'scope',
|
|
2540
|
+
scope: 'app',
|
|
2541
|
+
appPath,
|
|
2542
|
+
},
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
choices.push({
|
|
2546
|
+
title: 'View GitHub status',
|
|
2547
|
+
description: 'Read-only classification of every managed key on GitHub.',
|
|
2548
|
+
value: {
|
|
2549
|
+
kind: 'status',
|
|
2550
|
+
},
|
|
2551
|
+
});
|
|
2552
|
+
choices.push({
|
|
2553
|
+
title: 'Provision & reconcile on GitHub',
|
|
2554
|
+
description: 'Create missing, delete stale, and restore mismatched key names.',
|
|
2555
|
+
value: {
|
|
2556
|
+
kind: 'reconcile',
|
|
2557
|
+
},
|
|
2558
|
+
});
|
|
2559
|
+
choices.push({
|
|
2560
|
+
title: 'Back',
|
|
2561
|
+
description: 'Return to the category selection.',
|
|
2562
|
+
value: {
|
|
2563
|
+
kind: 'back',
|
|
2564
|
+
},
|
|
2565
|
+
});
|
|
2566
|
+
const menuOutput = await Runner.promptWithCancel({
|
|
2567
|
+
type: 'select',
|
|
2568
|
+
name: 'action',
|
|
2569
|
+
message: 'Select an environment namespace or action.',
|
|
2570
|
+
choices,
|
|
2571
|
+
});
|
|
2572
|
+
if (menuOutput['cancelled'] === true) {
|
|
2573
|
+
return 'back';
|
|
2574
|
+
}
|
|
2575
|
+
const menuOutputResultValue = menuOutput['result'];
|
|
2576
|
+
if (menuOutputResultValue.action === undefined
|
|
2577
|
+
|| menuOutputResultValue.action['kind'] === 'back') {
|
|
2578
|
+
return 'back';
|
|
2579
|
+
}
|
|
2580
|
+
if (menuOutputResultValue.action['kind'] === 'status') {
|
|
2581
|
+
await Runner.promptEnvironmentReconcile(config, false);
|
|
2582
|
+
continue;
|
|
2583
|
+
}
|
|
2584
|
+
if (menuOutputResultValue.action['kind'] === 'reconcile') {
|
|
2585
|
+
await Runner.promptEnvironmentReconcile(config, true);
|
|
2586
|
+
continue;
|
|
2587
|
+
}
|
|
2588
|
+
if (menuOutputResultValue.action['kind'] === 'scope') {
|
|
2589
|
+
await Runner.promptEnvironmentScope(config, {
|
|
2590
|
+
scope: menuOutputResultValue.action['scope'],
|
|
2591
|
+
appPath: menuOutputResultValue.action['appPath'],
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
static async readLocalFilledKeys(config) {
|
|
2597
|
+
const environment = config['environment'] ?? {};
|
|
2598
|
+
const apps = environment['apps'] ?? {};
|
|
2599
|
+
const result = {};
|
|
2600
|
+
for (const appPath of Object.keys(apps)) {
|
|
2601
|
+
const filled = [];
|
|
2602
|
+
const envPath = join(process.cwd(), appPath, '.env');
|
|
2603
|
+
try {
|
|
2604
|
+
const raw = await fs.readFile(envPath, 'utf-8');
|
|
2605
|
+
for (const line of raw.split(LIB_REGEX_LINEBREAK_CRLF_OR_LF)) {
|
|
2606
|
+
const keyMatch = line.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
|
|
2607
|
+
if (keyMatch === null) {
|
|
2608
|
+
continue;
|
|
2609
|
+
}
|
|
2610
|
+
const separatorIndex = line.indexOf('=');
|
|
2611
|
+
const rawValue = line.slice(separatorIndex + 1).trim();
|
|
2612
|
+
let inner = rawValue;
|
|
2613
|
+
if ((inner.startsWith('"') === true
|
|
2614
|
+
&& inner.endsWith('"') === true)
|
|
2615
|
+
|| (inner.startsWith('\'') === true
|
|
2616
|
+
&& inner.endsWith('\'') === true)) {
|
|
2617
|
+
inner = inner.slice(1, -1);
|
|
2618
|
+
}
|
|
2619
|
+
if (inner.trim() !== '') {
|
|
2620
|
+
filled.push(keyMatch[1] ?? '');
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
catch {
|
|
2625
|
+
}
|
|
2626
|
+
Reflect.set(result, appPath, filled);
|
|
2627
|
+
}
|
|
2628
|
+
return result;
|
|
2629
|
+
}
|
|
2630
|
+
static async promptEnvironmentReconcile(config, mutate) {
|
|
2631
|
+
const environment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2632
|
+
const managedSet = libEnvManagedSet.compute(config);
|
|
2633
|
+
const githubState = await libEnvGithub.read();
|
|
2634
|
+
if (githubState['available'] === false) {
|
|
2635
|
+
Logger.customize({
|
|
2636
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2637
|
+
purpose: 'unavailable',
|
|
2638
|
+
padTop: 1,
|
|
2639
|
+
padBottom: 1,
|
|
2640
|
+
}).warn('The "gh" CLI is not installed or not authenticated. Install and run "gh auth login" to view or reconcile GitHub keys.');
|
|
2641
|
+
return;
|
|
2642
|
+
}
|
|
2643
|
+
const status = libEnvStatus.classify(managedSet, githubState, environment);
|
|
2644
|
+
const statusLines = status.map((entry) => `${entry['name']}: ${entry['state']}`);
|
|
2645
|
+
const localEnv = await Runner.readLocalFilledKeys(config);
|
|
2646
|
+
const localOrphanEntries = libEnvStatus.localOrphans(environment, localEnv);
|
|
2647
|
+
const localOrphanLines = localOrphanEntries.map((entry) => `${entry['name']}: ${entry['state']}`);
|
|
2648
|
+
const combinedLines = [
|
|
2649
|
+
...statusLines,
|
|
2650
|
+
...localOrphanLines,
|
|
2651
|
+
];
|
|
2652
|
+
const statusMessage = (combinedLines.length > 0) ? combinedLines.join('\n') : 'No managed keys were found on GitHub.';
|
|
2653
|
+
Logger.customize({
|
|
2654
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2655
|
+
purpose: 'status',
|
|
2656
|
+
padTop: 1,
|
|
2657
|
+
padBottom: 1,
|
|
2658
|
+
}).info(statusMessage);
|
|
2659
|
+
if (mutate === false) {
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
const plan = libEnvReconcile.plan(status);
|
|
2663
|
+
const secretByName = {};
|
|
2664
|
+
for (const managed of managedSet) {
|
|
2665
|
+
Reflect.set(secretByName, managed['name'], managed['secret']);
|
|
2666
|
+
}
|
|
2667
|
+
const applyResult = await libEnvReconcile.apply(plan, secretByName, Runner['promptEnvironmentReconcileConfirm']);
|
|
2668
|
+
if (applyResult['available'] === false) {
|
|
2669
|
+
Logger.customize({
|
|
2670
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2671
|
+
purpose: 'unavailable',
|
|
2672
|
+
padTop: 1,
|
|
2673
|
+
padBottom: 1,
|
|
2674
|
+
}).warn('The "gh" CLI became unavailable before changes could be applied.');
|
|
2675
|
+
return;
|
|
2676
|
+
}
|
|
2677
|
+
const resultMessage = `Reconcile complete. Applied ${applyResult['done'].length}, remaining ${applyResult['remaining'].length}.`;
|
|
2678
|
+
Logger.customize({
|
|
2679
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2680
|
+
purpose: 'applied',
|
|
2681
|
+
padTop: 1,
|
|
2682
|
+
padBottom: 1,
|
|
2683
|
+
}).info(resultMessage);
|
|
2684
|
+
const createdStubs = plan['create'].filter((createName) => applyResult['done'].includes(createName) === true);
|
|
2685
|
+
if (createdStubs.length > 0) {
|
|
2686
|
+
const stubNotice = [
|
|
2687
|
+
`Created placeholder stubs on GitHub: ${createdStubs.join(', ')}.`,
|
|
2688
|
+
'Set their real values in GitHub before deploying.',
|
|
2689
|
+
].join('\n');
|
|
2690
|
+
Logger.customize({
|
|
2691
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2692
|
+
purpose: 'stub-notice',
|
|
2693
|
+
padTop: 1,
|
|
2694
|
+
padBottom: 1,
|
|
2695
|
+
}).warn(stubNotice);
|
|
2696
|
+
}
|
|
2697
|
+
return;
|
|
2698
|
+
}
|
|
2699
|
+
static async promptEnvironmentReconcileConfirm(pendingPlan) {
|
|
2700
|
+
const summary = `create ${pendingPlan['create'].length}, delete ${pendingPlan['delete'].length}, restore ${pendingPlan['restore'].length}`;
|
|
2701
|
+
const confirmOutput = await Runner.promptWithCancel({
|
|
2702
|
+
type: 'confirm',
|
|
2703
|
+
name: 'confirm',
|
|
2704
|
+
message: `Apply these GitHub changes (${summary})?`,
|
|
2705
|
+
initial: false,
|
|
2706
|
+
});
|
|
2707
|
+
if (confirmOutput['cancelled'] === true) {
|
|
2708
|
+
return false;
|
|
2709
|
+
}
|
|
2710
|
+
return confirmOutput['result'].confirm === true;
|
|
2711
|
+
}
|
|
2712
|
+
static async promptEnvironmentScope(config, options) {
|
|
2713
|
+
const isApp = options['scope'] === 'app';
|
|
2714
|
+
const appPath = options['appPath'];
|
|
2715
|
+
const environment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2716
|
+
const existingApps = (environment['apps'] !== undefined) ? environment['apps'] : {};
|
|
2717
|
+
const existingBlock = (isApp === true && appPath !== undefined) ? existingApps[appPath] : environment['global'];
|
|
2718
|
+
let prefix = (existingBlock !== undefined) ? existingBlock['prefix'] : '';
|
|
2719
|
+
const variables = (existingBlock !== undefined && existingBlock['variables'] !== undefined) ? [...existingBlock['variables']] : [];
|
|
2720
|
+
const sync = () => {
|
|
2721
|
+
const hasContent = prefix !== '' || variables.length > 0;
|
|
2722
|
+
const nextEnvironment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2723
|
+
if (isApp === true && appPath !== undefined) {
|
|
2724
|
+
const nextApps = (nextEnvironment['apps'] !== undefined) ? nextEnvironment['apps'] : {};
|
|
2725
|
+
if (hasContent === true) {
|
|
2726
|
+
const appBlock = { prefix };
|
|
2727
|
+
if (variables.length > 0) {
|
|
2728
|
+
Object.assign(appBlock, { variables: [...variables] });
|
|
2729
|
+
}
|
|
2730
|
+
Reflect.set(nextApps, appPath, appBlock);
|
|
2731
|
+
}
|
|
2732
|
+
else {
|
|
2733
|
+
Reflect.deleteProperty(nextApps, appPath);
|
|
2734
|
+
}
|
|
2735
|
+
if (Object.keys(nextApps).length > 0) {
|
|
2736
|
+
Object.assign(nextEnvironment, { apps: nextApps });
|
|
2737
|
+
}
|
|
2738
|
+
else {
|
|
2739
|
+
Reflect.deleteProperty(nextEnvironment, 'apps');
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
else if (hasContent === true) {
|
|
2743
|
+
const globalBlock = { prefix };
|
|
2744
|
+
if (variables.length > 0) {
|
|
2745
|
+
Object.assign(globalBlock, { variables: [...variables] });
|
|
2746
|
+
}
|
|
2747
|
+
Object.assign(nextEnvironment, { global: globalBlock });
|
|
2748
|
+
}
|
|
2749
|
+
else {
|
|
2750
|
+
Reflect.deleteProperty(nextEnvironment, 'global');
|
|
2751
|
+
}
|
|
2752
|
+
if (Object.keys(nextEnvironment).length > 0) {
|
|
2753
|
+
Object.assign(config, { environment: nextEnvironment });
|
|
2754
|
+
}
|
|
2755
|
+
else {
|
|
2756
|
+
Reflect.deleteProperty(config, 'environment');
|
|
2757
|
+
}
|
|
2758
|
+
return;
|
|
2759
|
+
};
|
|
2760
|
+
while (true) {
|
|
2761
|
+
const choices = [];
|
|
2762
|
+
const prefixDisplay = (prefix !== '') ? prefix : '(unset)';
|
|
2763
|
+
choices.push({
|
|
2764
|
+
title: `${chalk.cyan.bold('[PREFIX]')} ${prefixDisplay}`,
|
|
2765
|
+
description: 'Set the GitHub name prefix for this namespace.',
|
|
2766
|
+
value: {
|
|
2767
|
+
kind: 'prefix',
|
|
2768
|
+
},
|
|
2769
|
+
});
|
|
2770
|
+
for (let i = 0; i < variables.length; i += 1) {
|
|
2771
|
+
const variable = variables[i];
|
|
2772
|
+
if (variable === undefined) {
|
|
2773
|
+
continue;
|
|
2774
|
+
}
|
|
2775
|
+
const variableKind = (variable['secret'] === true) ? 'secret' : 'variable';
|
|
2776
|
+
const variableLabel = `${variable['key']} (${variableKind})`;
|
|
2777
|
+
choices.push({
|
|
2778
|
+
title: `${chalk.yellow.bold('[EDIT]')} ${variableLabel}`,
|
|
2779
|
+
description: 'Update this value.',
|
|
2780
|
+
value: {
|
|
2781
|
+
kind: 'edit',
|
|
2782
|
+
index: i,
|
|
2783
|
+
},
|
|
2784
|
+
});
|
|
2785
|
+
choices.push({
|
|
2786
|
+
title: `${chalk.red.bold('[REMOVE]')} ${variableLabel}`,
|
|
2787
|
+
description: 'Delete this value.',
|
|
2788
|
+
value: {
|
|
2789
|
+
kind: 'remove',
|
|
2790
|
+
index: i,
|
|
2791
|
+
},
|
|
2792
|
+
});
|
|
2793
|
+
}
|
|
2794
|
+
choices.push({
|
|
2795
|
+
title: 'Add a value',
|
|
2796
|
+
description: 'Add a new environment value to this namespace.',
|
|
2797
|
+
value: {
|
|
2798
|
+
kind: 'add',
|
|
2799
|
+
},
|
|
2800
|
+
});
|
|
2801
|
+
choices.push({
|
|
2802
|
+
title: 'Back',
|
|
2803
|
+
description: 'Return to the environment menu.',
|
|
2804
|
+
value: {
|
|
2805
|
+
kind: 'back',
|
|
2806
|
+
},
|
|
2807
|
+
});
|
|
2808
|
+
const menuOutput = await Runner.promptWithCancel({
|
|
2809
|
+
type: 'select',
|
|
2810
|
+
name: 'action',
|
|
2811
|
+
message: (isApp === true && appPath !== undefined) ? `Manage environment for "${appPath}".` : 'Manage the global environment namespace.',
|
|
2812
|
+
choices,
|
|
2813
|
+
});
|
|
2814
|
+
if (menuOutput['cancelled'] === true) {
|
|
2815
|
+
sync();
|
|
2816
|
+
return 'back';
|
|
2817
|
+
}
|
|
2818
|
+
const menuOutputResultValue = menuOutput['result'];
|
|
2819
|
+
if (menuOutputResultValue.action === undefined
|
|
2820
|
+
|| menuOutputResultValue.action['kind'] === 'back') {
|
|
2821
|
+
sync();
|
|
2822
|
+
return 'back';
|
|
2823
|
+
}
|
|
2824
|
+
if (menuOutputResultValue.action['kind'] === 'prefix') {
|
|
2825
|
+
const prefixOutput = await Runner.promptWithCancel({
|
|
2826
|
+
type: 'text',
|
|
2827
|
+
name: 'prefix',
|
|
2828
|
+
message: 'GitHub name prefix (e.g. "CBN_"):',
|
|
2829
|
+
initial: prefix,
|
|
2830
|
+
validate: Runner['isNonEmptyLiteralInput'],
|
|
2831
|
+
});
|
|
2832
|
+
if (prefixOutput['cancelled'] === true) {
|
|
2833
|
+
continue;
|
|
2834
|
+
}
|
|
2835
|
+
const prefixInput = prefixOutput['result'].prefix.trim().toUpperCase();
|
|
2836
|
+
if (prefixInput === '') {
|
|
2837
|
+
continue;
|
|
2838
|
+
}
|
|
2839
|
+
if (libEnvNamespace.isReservedPrefix(prefixInput) === true) {
|
|
2840
|
+
Logger.customize({
|
|
2841
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2842
|
+
purpose: 'reservedPrefix',
|
|
2843
|
+
padTop: 1,
|
|
2844
|
+
padBottom: 1,
|
|
2845
|
+
}).error(`The prefix "${prefixInput}" is reserved by GitHub. Choose a prefix that does not start with "GITHUB_".`);
|
|
2846
|
+
continue;
|
|
2847
|
+
}
|
|
2848
|
+
prefix = prefixInput;
|
|
2849
|
+
sync();
|
|
2850
|
+
Logger.customize({
|
|
2851
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2852
|
+
purpose: 'prefix',
|
|
2853
|
+
padTop: 1,
|
|
2854
|
+
padBottom: 1,
|
|
2855
|
+
}).info(`Set prefix to "${prefix}".`);
|
|
2856
|
+
continue;
|
|
2857
|
+
}
|
|
2858
|
+
if (menuOutputResultValue.action['kind'] === 'add') {
|
|
2859
|
+
const addValue = await Runner.promptEnvironmentValueForm(undefined, isApp);
|
|
2860
|
+
if (addValue === undefined) {
|
|
2861
|
+
continue;
|
|
2862
|
+
}
|
|
2863
|
+
variables.push(addValue);
|
|
2864
|
+
sync();
|
|
2865
|
+
Logger.customize({
|
|
2866
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2867
|
+
purpose: 'add',
|
|
2868
|
+
padTop: 1,
|
|
2869
|
+
padBottom: 1,
|
|
2870
|
+
}).info(`Added value "${addValue['key']}".`);
|
|
2871
|
+
continue;
|
|
2872
|
+
}
|
|
2873
|
+
if (menuOutputResultValue.action['kind'] === 'edit') {
|
|
2874
|
+
const editIndex = menuOutputResultValue.action['index'];
|
|
2875
|
+
if (editIndex < 0 || editIndex >= variables.length) {
|
|
2876
|
+
continue;
|
|
2877
|
+
}
|
|
2878
|
+
const editValue = await Runner.promptEnvironmentValueForm(variables[editIndex], isApp);
|
|
2879
|
+
if (editValue === undefined) {
|
|
2880
|
+
continue;
|
|
2881
|
+
}
|
|
2882
|
+
Reflect.set(variables, editIndex, editValue);
|
|
2883
|
+
sync();
|
|
2884
|
+
Logger.customize({
|
|
2885
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2886
|
+
purpose: 'edit',
|
|
2887
|
+
padTop: 1,
|
|
2888
|
+
padBottom: 1,
|
|
2889
|
+
}).info(`Updated value "${editValue['key']}".`);
|
|
2890
|
+
continue;
|
|
2891
|
+
}
|
|
2892
|
+
if (menuOutputResultValue.action['kind'] === 'remove') {
|
|
2893
|
+
const removeIndex = menuOutputResultValue.action['index'];
|
|
2894
|
+
if (removeIndex < 0 || removeIndex >= variables.length) {
|
|
2895
|
+
continue;
|
|
2896
|
+
}
|
|
2897
|
+
const variableToRemove = variables[removeIndex];
|
|
2898
|
+
if (variableToRemove === undefined) {
|
|
2899
|
+
continue;
|
|
2900
|
+
}
|
|
2901
|
+
const removeOutput = await Runner.promptWithCancel({
|
|
2902
|
+
type: 'confirm',
|
|
2903
|
+
name: 'confirm',
|
|
2904
|
+
message: `Remove value "${variableToRemove['key']}"?`,
|
|
2905
|
+
initial: false,
|
|
2906
|
+
});
|
|
2907
|
+
if (removeOutput['cancelled'] === true) {
|
|
2908
|
+
continue;
|
|
2909
|
+
}
|
|
2910
|
+
if (removeOutput['result'].confirm !== true) {
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
const dropLocalOutput = await Runner.promptWithCancel({
|
|
2914
|
+
type: 'confirm',
|
|
2915
|
+
name: 'dropLocal',
|
|
2916
|
+
message: `Also remove "${variableToRemove['key']}" from your local ".env" on the next dotenv run?`,
|
|
2917
|
+
initial: false,
|
|
2918
|
+
});
|
|
2919
|
+
if (dropLocalOutput['cancelled'] === false && dropLocalOutput['result'].dropLocal === true) {
|
|
2920
|
+
Logger.customize({
|
|
2921
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2922
|
+
purpose: 'dropLocal',
|
|
2923
|
+
padTop: 1,
|
|
2924
|
+
padBottom: 1,
|
|
2925
|
+
}).info(`To also drop "${variableToRemove['key']}" from your local ".env", run "generate must-haves dotenv --prune".`);
|
|
2926
|
+
}
|
|
2927
|
+
variables.splice(removeIndex, 1);
|
|
2928
|
+
sync();
|
|
2929
|
+
Logger.customize({
|
|
2930
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2931
|
+
purpose: 'remove',
|
|
2932
|
+
padTop: 1,
|
|
2933
|
+
padBottom: 1,
|
|
2934
|
+
}).info(`Removed value "${variableToRemove['key']}".`);
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
static async promptEnvironmentValueForm(existing, isApp) {
|
|
2939
|
+
const keyOutput = await Runner.promptWithCancel({
|
|
2940
|
+
type: 'text',
|
|
2941
|
+
name: 'key',
|
|
2942
|
+
message: 'Value key (SCREAMING_SNAKE_CASE, without the prefix):',
|
|
2943
|
+
initial: (existing !== undefined) ? existing['key'] : '',
|
|
2944
|
+
validate: Runner['isNonEmptyLiteralInput'],
|
|
2945
|
+
});
|
|
2946
|
+
if (keyOutput['cancelled'] === true) {
|
|
2947
|
+
return undefined;
|
|
2948
|
+
}
|
|
2949
|
+
const key = keyOutput['result'].key.trim().toUpperCase();
|
|
2950
|
+
if (libEnvNamespace.isGithubLegalName(key) === false) {
|
|
2951
|
+
Logger.customize({
|
|
2952
|
+
name: 'Runner.promptEnvironmentValueForm',
|
|
2953
|
+
purpose: 'illegalKey',
|
|
2954
|
+
padTop: 1,
|
|
2955
|
+
padBottom: 1,
|
|
2956
|
+
}).error(`The key "${key}" is not a legal GitHub name. Use letters, digits, and underscores, and do not start with a digit or "GITHUB_".`);
|
|
2957
|
+
return undefined;
|
|
2958
|
+
}
|
|
2959
|
+
const secretOutput = await Runner.promptWithCancel({
|
|
2960
|
+
type: 'confirm',
|
|
2961
|
+
name: 'secret',
|
|
2962
|
+
message: 'Store as a GitHub Secret (encrypted)? Choose no for a Variable (plaintext).',
|
|
2963
|
+
initial: (existing !== undefined) ? existing['secret'] : true,
|
|
2964
|
+
});
|
|
2965
|
+
if (secretOutput['cancelled'] === true) {
|
|
2966
|
+
return undefined;
|
|
2967
|
+
}
|
|
2968
|
+
const secret = secretOutput['result'].secret === true;
|
|
2969
|
+
const value = {
|
|
2970
|
+
key,
|
|
2971
|
+
secret,
|
|
2972
|
+
};
|
|
2973
|
+
if (isApp === true) {
|
|
2974
|
+
const buildOnlyOutput = await Runner.promptWithCancel({
|
|
2975
|
+
type: 'confirm',
|
|
2976
|
+
name: 'buildOnly',
|
|
2977
|
+
message: 'Deliver only to the build (.env)? Choose no to sync it to the running server.',
|
|
2978
|
+
initial: (existing !== undefined && existing['buildOnly'] !== undefined) ? existing['buildOnly'] : true,
|
|
2979
|
+
});
|
|
2980
|
+
if (buildOnlyOutput['cancelled'] === true) {
|
|
2981
|
+
return undefined;
|
|
2982
|
+
}
|
|
2983
|
+
Object.assign(value, {
|
|
2984
|
+
buildOnly: buildOnlyOutput['result'].buildOnly === true,
|
|
2985
|
+
});
|
|
2986
|
+
}
|
|
2987
|
+
if (secret === false) {
|
|
2988
|
+
const defaultValueOutput = await Runner.promptWithCancel({
|
|
2989
|
+
type: 'text',
|
|
2990
|
+
name: 'defaultValue',
|
|
2991
|
+
message: 'Default value for the committed ".env.sample" (optional):',
|
|
2992
|
+
initial: (existing !== undefined && existing['defaultValue'] !== undefined) ? existing['defaultValue'] : '',
|
|
2993
|
+
});
|
|
2994
|
+
if (defaultValueOutput['cancelled'] === false) {
|
|
2995
|
+
const defaultValue = defaultValueOutput['result'].defaultValue.trim();
|
|
2996
|
+
if (defaultValue !== '') {
|
|
2997
|
+
Object.assign(value, {
|
|
2998
|
+
defaultValue,
|
|
2999
|
+
});
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
return value;
|
|
3004
|
+
}
|
|
2466
3005
|
static async promptWorkspaces(config) {
|
|
2467
3006
|
const workspaces = (config['workspaces'] !== undefined) ? { ...(config['workspaces']) } : {};
|
|
3007
|
+
const recipes = (config['recipes'] !== undefined) ? { ...(config['recipes']) } : {};
|
|
3008
|
+
const packageJsonRecipes = (recipes['package-json'] !== undefined) ? { ...(recipes['package-json']) } : {};
|
|
2468
3009
|
const rawWorkspacePaths = await discoverPathsWithFile('package.json', 'forward');
|
|
2469
3010
|
const workspacePaths = rawWorkspacePaths.map((rawWorkspacePath) => {
|
|
2470
3011
|
const currentWorkingDirectory = process.cwd();
|
|
@@ -2520,6 +3061,7 @@ export class Runner {
|
|
|
2520
3061
|
const formResult = await Runner.promptWorkspacesForm({
|
|
2521
3062
|
workspacePath,
|
|
2522
3063
|
existingWorkspace: workspaces[workspacePath],
|
|
3064
|
+
existingPackageJsonRecipes: packageJsonRecipes[workspacePath],
|
|
2523
3065
|
projectSlug: (config['project'] !== undefined && config['project']['name'] !== undefined) ? config['project']['name']['slug'] : undefined,
|
|
2524
3066
|
});
|
|
2525
3067
|
if (formResult['action'] === 'back') {
|
|
@@ -2527,6 +3069,19 @@ export class Runner {
|
|
|
2527
3069
|
}
|
|
2528
3070
|
Reflect.set(workspaces, workspacePath, formResult['workspace']);
|
|
2529
3071
|
Object.assign(config, { workspaces });
|
|
3072
|
+
if (Object.keys(formResult['packageJsonRecipes']).length > 0) {
|
|
3073
|
+
Reflect.set(packageJsonRecipes, workspacePath, formResult['packageJsonRecipes']);
|
|
3074
|
+
}
|
|
3075
|
+
else {
|
|
3076
|
+
Reflect.deleteProperty(packageJsonRecipes, workspacePath);
|
|
3077
|
+
}
|
|
3078
|
+
if (Object.keys(packageJsonRecipes).length > 0) {
|
|
3079
|
+
Reflect.set(recipes, 'package-json', packageJsonRecipes);
|
|
3080
|
+
}
|
|
3081
|
+
else {
|
|
3082
|
+
Reflect.deleteProperty(recipes, 'package-json');
|
|
3083
|
+
}
|
|
3084
|
+
Object.assign(config, { recipes });
|
|
2530
3085
|
Logger.customize({
|
|
2531
3086
|
name: 'Runner.promptWorkspaces',
|
|
2532
3087
|
purpose: 'updated',
|
|
@@ -2674,17 +3229,15 @@ export class Runner {
|
|
|
2674
3229
|
};
|
|
2675
3230
|
}
|
|
2676
3231
|
const workspaceDisplayNameInput = Runner.normalizeText(displayNamePrompt['result'].workspaceDisplayName, Infinity)['sanitized'];
|
|
2677
|
-
const existingRecipes =
|
|
2678
|
-
const existingDotenv = (options['existingWorkspace'] !== undefined && options['existingWorkspace']['dotenv'] !== undefined) ? options['existingWorkspace']['dotenv'] : undefined;
|
|
3232
|
+
const existingRecipes = options['existingPackageJsonRecipes'];
|
|
2679
3233
|
const recipesPrompt = await Runner.promptWithCancel({
|
|
2680
3234
|
type: 'multiselect',
|
|
2681
3235
|
name: 'workspaceRecipes',
|
|
2682
3236
|
message: 'Select recipes to enable',
|
|
2683
3237
|
choices: libItemAllowedRecipes.map((recipe) => {
|
|
2684
|
-
const
|
|
2685
|
-
const recipeSelected = (
|
|
2686
|
-
&&
|
|
2687
|
-
&& recipeTuple[0] === true);
|
|
3238
|
+
const recipeEntry = (existingRecipes !== undefined) ? Reflect.get(existingRecipes, recipe) : undefined;
|
|
3239
|
+
const recipeSelected = (recipeEntry !== undefined
|
|
3240
|
+
&& recipeEntry['enabled'] === true);
|
|
2688
3241
|
return {
|
|
2689
3242
|
title: recipe,
|
|
2690
3243
|
value: recipe,
|
|
@@ -2700,9 +3253,8 @@ export class Runner {
|
|
|
2700
3253
|
const selectedRecipes = recipesPrompt['result'].workspaceRecipes;
|
|
2701
3254
|
const recipes = {};
|
|
2702
3255
|
for (const recipe of selectedRecipes) {
|
|
2703
|
-
const
|
|
2704
|
-
const
|
|
2705
|
-
const existingSettings = (existingTuple !== undefined && existingTuple.length > 1) ? existingTuple[1] : undefined;
|
|
3256
|
+
const existingEntry = (existingRecipes !== undefined) ? Reflect.get(existingRecipes, recipe) : undefined;
|
|
3257
|
+
const existingSettings = (existingEntry !== undefined) ? existingEntry['settings'] : undefined;
|
|
2706
3258
|
if (recipe === 'sync-identity' && selectedPolicy === 'distributable') {
|
|
2707
3259
|
const identitySettingsPrompt = await Runner.promptWithCancel({
|
|
2708
3260
|
type: 'multiselect',
|
|
@@ -2732,13 +3284,15 @@ export class Runner {
|
|
|
2732
3284
|
for (const setting of identitySelectedSettings) {
|
|
2733
3285
|
Reflect.set(identitySettings, setting, true);
|
|
2734
3286
|
}
|
|
2735
|
-
Reflect.set(recipes, recipe,
|
|
2736
|
-
true,
|
|
2737
|
-
identitySettings,
|
|
2738
|
-
|
|
3287
|
+
Reflect.set(recipes, recipe, {
|
|
3288
|
+
enabled: true,
|
|
3289
|
+
settings: identitySettings,
|
|
3290
|
+
});
|
|
2739
3291
|
}
|
|
2740
3292
|
else {
|
|
2741
|
-
Reflect.set(recipes, recipe,
|
|
3293
|
+
Reflect.set(recipes, recipe, {
|
|
3294
|
+
enabled: true,
|
|
3295
|
+
});
|
|
2742
3296
|
}
|
|
2743
3297
|
}
|
|
2744
3298
|
else if (recipe === 'sync-ownership' && selectedPolicy === 'distributable') {
|
|
@@ -2790,13 +3344,15 @@ export class Runner {
|
|
|
2790
3344
|
for (const setting of ownershipSelectedSettings) {
|
|
2791
3345
|
Reflect.set(ownershipSettings, setting, true);
|
|
2792
3346
|
}
|
|
2793
|
-
Reflect.set(recipes, recipe,
|
|
2794
|
-
true,
|
|
2795
|
-
ownershipSettings,
|
|
2796
|
-
|
|
3347
|
+
Reflect.set(recipes, recipe, {
|
|
3348
|
+
enabled: true,
|
|
3349
|
+
settings: ownershipSettings,
|
|
3350
|
+
});
|
|
2797
3351
|
}
|
|
2798
3352
|
else {
|
|
2799
|
-
Reflect.set(recipes, recipe,
|
|
3353
|
+
Reflect.set(recipes, recipe, {
|
|
3354
|
+
enabled: true,
|
|
3355
|
+
});
|
|
2800
3356
|
}
|
|
2801
3357
|
}
|
|
2802
3358
|
else if (recipe === 'sync-environment') {
|
|
@@ -2821,13 +3377,15 @@ export class Runner {
|
|
|
2821
3377
|
for (const setting of environmentSelectedSettings) {
|
|
2822
3378
|
Reflect.set(environmentSettings, setting, true);
|
|
2823
3379
|
}
|
|
2824
|
-
Reflect.set(recipes, recipe,
|
|
2825
|
-
true,
|
|
2826
|
-
environmentSettings,
|
|
2827
|
-
|
|
3380
|
+
Reflect.set(recipes, recipe, {
|
|
3381
|
+
enabled: true,
|
|
3382
|
+
settings: environmentSettings,
|
|
3383
|
+
});
|
|
2828
3384
|
}
|
|
2829
3385
|
else {
|
|
2830
|
-
Reflect.set(recipes, recipe,
|
|
3386
|
+
Reflect.set(recipes, recipe, {
|
|
3387
|
+
enabled: true,
|
|
3388
|
+
});
|
|
2831
3389
|
}
|
|
2832
3390
|
}
|
|
2833
3391
|
else if (recipe === 'cleanup') {
|
|
@@ -2859,13 +3417,15 @@ export class Runner {
|
|
|
2859
3417
|
for (const setting of cleanupSelectedSettings) {
|
|
2860
3418
|
Reflect.set(cleanupSettings, setting, true);
|
|
2861
3419
|
}
|
|
2862
|
-
Reflect.set(recipes, recipe,
|
|
2863
|
-
true,
|
|
2864
|
-
cleanupSettings,
|
|
2865
|
-
|
|
3420
|
+
Reflect.set(recipes, recipe, {
|
|
3421
|
+
enabled: true,
|
|
3422
|
+
settings: cleanupSettings,
|
|
3423
|
+
});
|
|
2866
3424
|
}
|
|
2867
3425
|
else {
|
|
2868
|
-
Reflect.set(recipes, recipe,
|
|
3426
|
+
Reflect.set(recipes, recipe, {
|
|
3427
|
+
enabled: true,
|
|
3428
|
+
});
|
|
2869
3429
|
}
|
|
2870
3430
|
}
|
|
2871
3431
|
else if (recipe === 'normalize-dependencies') {
|
|
@@ -2897,17 +3457,21 @@ export class Runner {
|
|
|
2897
3457
|
for (const setting of dependenciesSelectedSettings) {
|
|
2898
3458
|
Reflect.set(dependenciesSettings, setting, true);
|
|
2899
3459
|
}
|
|
2900
|
-
Reflect.set(recipes, recipe,
|
|
2901
|
-
true,
|
|
2902
|
-
dependenciesSettings,
|
|
2903
|
-
|
|
3460
|
+
Reflect.set(recipes, recipe, {
|
|
3461
|
+
enabled: true,
|
|
3462
|
+
settings: dependenciesSettings,
|
|
3463
|
+
});
|
|
2904
3464
|
}
|
|
2905
3465
|
else {
|
|
2906
|
-
Reflect.set(recipes, recipe,
|
|
3466
|
+
Reflect.set(recipes, recipe, {
|
|
3467
|
+
enabled: true,
|
|
3468
|
+
});
|
|
2907
3469
|
}
|
|
2908
3470
|
}
|
|
2909
3471
|
else {
|
|
2910
|
-
Reflect.set(recipes, recipe,
|
|
3472
|
+
Reflect.set(recipes, recipe, {
|
|
3473
|
+
enabled: true,
|
|
3474
|
+
});
|
|
2911
3475
|
}
|
|
2912
3476
|
}
|
|
2913
3477
|
return {
|
|
@@ -2917,9 +3481,8 @@ export class Runner {
|
|
|
2917
3481
|
...(workspaceDisplayNameInput !== undefined) ? { displayName: workspaceDisplayNameInput } : {},
|
|
2918
3482
|
role: selectedRole,
|
|
2919
3483
|
policy: selectedPolicy,
|
|
2920
|
-
...(Object.keys(recipes).length > 0) ? { recipes } : {},
|
|
2921
|
-
...(existingDotenv !== undefined) ? { dotenv: existingDotenv } : {},
|
|
2922
3484
|
},
|
|
3485
|
+
packageJsonRecipes: recipes,
|
|
2923
3486
|
};
|
|
2924
3487
|
}
|
|
2925
3488
|
static async promptWithCancel(questions) {
|