@cbnventures/nova 0.20.0 → 0.22.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 +10 -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 +2285 -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 +38 -11
- 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 +19 -11
- 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 +74 -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 +99 -21
- 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 +737 -130
- 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 +16 -8
- package/build/src/cli/utility/run-scripts.js.map +1 -1
- package/build/src/cli/utility/transpile.d.ts.map +1 -1
- package/build/src/cli/utility/transpile.js +2 -1
- package/build/src/cli/utility/transpile.js.map +1 -1
- package/build/src/cli/utility/type-check.d.ts.map +1 -1
- package/build/src/cli/utility/type-check.js +2 -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 +5 -0
- package/build/src/lib/env-github.d.ts.map +1 -0
- package/build/src/lib/env-github.js +77 -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 +108 -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 +116 -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 +13 -4
- package/build/src/lib/nova-config.d.ts.map +1 -1
- package/build/src/lib/nova-config.js +514 -162
- 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 +21 -0
- package/build/src/toolkit/nova-identity.d.ts.map +1 -0
- package/build/src/toolkit/nova-identity.js +160 -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 +1192 -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 +50 -13
- 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 +58 -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 +106 -74
- package/build/src/types/cli/utility/initialize.d.ts +842 -384
- package/build/src/types/cli/utility/run-scripts.d.ts +3 -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 +100 -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 +100 -0
- package/build/src/types/lib/item.d.ts +23 -0
- package/build/src/types/lib/nova-config.d.ts +478 -142
- 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 +796 -52
- package/build/src/types/tests/bin-git-tracked.test.d.ts +52 -0
- 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 +123 -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 +185 -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 +163 -111
- package/build/src/types/tests/lib/nova-config.test.d.ts +391 -208
- 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 +220 -0
- package/build/src/types/tests/type-declarations.test.d.ts +14 -0
- package/build/src/types/toolkit/nova-identity.d.ts +355 -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/typescript.md +12 -12
- 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 +10 -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,856 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { parse as parseYaml, stringify as stringifyYaml, } from 'yaml';
|
|
5
|
-
import { Runner as LibNovaConfig } from '../../../lib/nova-config.js';
|
|
6
|
-
import { LIB_REGEX_PATTERN_LEADING_DOT_SLASH, LIB_REGEX_PATTERN_TRAILING_NEWLINES, LIB_REGEX_PATTERN_TRAILING_NEWLINES_OR_NONE, LIB_REGEX_PATTERN_TRAILING_SLASH, LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_EXPRESSION, LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_SEPARATOR, LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_WRAPPER_END, LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_WRAPPER_START, LIB_REGEX_PATTERN_WORKFLOW_NAME, LIB_REGEX_PATTERN_WORKFLOW_RUN_NAME_CAPTURE, } from '../../../lib/regex.js';
|
|
7
|
-
import { isProjectRoot, pathExists, renameFileWithDate, resolveTemplatePath, saveGeneratedFile, } from '../../../lib/utility.js';
|
|
8
|
-
import { libWorkflowTemplatesMetadata } from '../../../lib/workflow-templates.js';
|
|
9
|
-
import { Logger } from '../../../toolkit/index.js';
|
|
10
|
-
export class Runner {
|
|
11
|
-
static async run(options) {
|
|
12
|
-
const currentDirectory = process.cwd();
|
|
13
|
-
const isAtProjectRoot = await isProjectRoot(currentDirectory);
|
|
14
|
-
if (isAtProjectRoot !== true) {
|
|
15
|
-
process.exitCode = 1;
|
|
16
|
-
return 'cancelled';
|
|
17
|
-
}
|
|
18
|
-
const isDryRun = options['dryRun'] === true;
|
|
19
|
-
const isReplaceFile = options['replaceFile'] === true;
|
|
20
|
-
if (isDryRun === true) {
|
|
21
|
-
Logger.customize({
|
|
22
|
-
name: 'Runner.run',
|
|
23
|
-
purpose: 'options',
|
|
24
|
-
}).warn('Dry run enabled. File changes will not be made in this session.');
|
|
25
|
-
}
|
|
26
|
-
if (isReplaceFile === true) {
|
|
27
|
-
const replaceFileNotice = (isDryRun === true) ? 'This option has no effect during a dry run session.' : 'Backup file will not be created.';
|
|
28
|
-
Logger.customize({
|
|
29
|
-
name: 'Runner.run',
|
|
30
|
-
purpose: 'options',
|
|
31
|
-
}).warn(`Replace file enabled. ${replaceFileNotice}`);
|
|
32
|
-
}
|
|
33
|
-
const config = await new LibNovaConfig().load();
|
|
34
|
-
const workflows = config['workflows'];
|
|
35
|
-
if (workflows === undefined || workflows.length === 0) {
|
|
36
|
-
Logger.customize({
|
|
37
|
-
name: 'Runner.run',
|
|
38
|
-
purpose: 'skip',
|
|
39
|
-
}).info('No workflows configured.');
|
|
40
|
-
return 'completed';
|
|
41
|
-
}
|
|
42
|
-
const templateDirectory = resolveTemplatePath(import.meta.url, 'generators/github/workflows');
|
|
43
|
-
const workflowsDirectory = join(currentDirectory, '.github', 'workflows');
|
|
44
|
-
const duplicateSet = new Set();
|
|
45
|
-
let hasDuplicateError = false;
|
|
46
|
-
for (const entry of workflows) {
|
|
47
|
-
const duplicateKey = (entry['suffix'] !== undefined) ? `${entry['template']}-${entry['suffix']}` : entry['template'];
|
|
48
|
-
if (duplicateSet.has(duplicateKey) === true) {
|
|
49
|
-
Logger.customize({
|
|
50
|
-
name: 'Runner.run',
|
|
51
|
-
purpose: 'validate',
|
|
52
|
-
}).error(`Duplicate workflow ${chalk.cyan(`"${duplicateKey}"`)}. Each template must have a unique suffix when used multiple times.`);
|
|
53
|
-
hasDuplicateError = true;
|
|
54
|
-
}
|
|
55
|
-
duplicateSet.add(duplicateKey);
|
|
56
|
-
}
|
|
57
|
-
if (hasDuplicateError === true) {
|
|
58
|
-
process.exitCode = 1;
|
|
59
|
-
return 'cancelled';
|
|
60
|
-
}
|
|
61
|
-
if (Runner.detectCircularDependsOn(workflows) === true) {
|
|
62
|
-
Logger.customize({
|
|
63
|
-
name: 'Runner.run',
|
|
64
|
-
purpose: 'validate',
|
|
65
|
-
}).error('Circular depends-on references detected. Aborting.');
|
|
66
|
-
process.exitCode = 1;
|
|
67
|
-
return 'cancelled';
|
|
68
|
-
}
|
|
69
|
-
const skippedWorkflowKeys = new Set();
|
|
70
|
-
for (const literalWorkflowEntry of workflows) {
|
|
71
|
-
const literalEntry = literalWorkflowEntry;
|
|
72
|
-
const literalTemplateName = literalEntry['template'];
|
|
73
|
-
const literalSuffix = literalEntry['suffix'];
|
|
74
|
-
const literalWorkflowKey = (literalSuffix !== undefined) ? `${literalTemplateName}-${literalSuffix}` : literalTemplateName;
|
|
75
|
-
const literalMetadataEntry = libWorkflowTemplatesMetadata.find((m) => m['name'] === literalTemplateName);
|
|
76
|
-
if (literalMetadataEntry === undefined) {
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
const missingLiterals = [];
|
|
80
|
-
for (const variableEntry of Object.entries(literalMetadataEntry['variables'])) {
|
|
81
|
-
const templateVariableName = variableEntry[0];
|
|
82
|
-
const templateVariableMeta = variableEntry[1];
|
|
83
|
-
if (templateVariableMeta['format'] === 'literal') {
|
|
84
|
-
const templateLiteralValue = (literalEntry['settings'] !== undefined) ? literalEntry['settings'][templateVariableName] : undefined;
|
|
85
|
-
if (typeof templateLiteralValue !== 'string' || templateLiteralValue.trim() === '') {
|
|
86
|
-
missingLiterals.push(templateVariableName);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const targetsMetadataForValidation = literalMetadataEntry['targets'] ?? {};
|
|
91
|
-
const entryTargetsForValidation = literalEntry['targets'] ?? [];
|
|
92
|
-
for (const entryTargetForValidation of entryTargetsForValidation) {
|
|
93
|
-
const targetTypeForValidation = entryTargetForValidation['type'];
|
|
94
|
-
const targetMetadataForValidation = targetsMetadataForValidation[targetTypeForValidation];
|
|
95
|
-
if (targetMetadataForValidation === undefined) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
for (const variableEntry of Object.entries(targetMetadataForValidation['variables'])) {
|
|
99
|
-
const validationVariableName = variableEntry[0];
|
|
100
|
-
const validationVariableMeta = variableEntry[1];
|
|
101
|
-
if (validationVariableMeta['format'] === 'literal') {
|
|
102
|
-
const validationLiteralValue = (literalEntry['settings'] !== undefined) ? literalEntry['settings'][validationVariableName] : undefined;
|
|
103
|
-
if (typeof validationLiteralValue !== 'string' || validationLiteralValue.trim() === '') {
|
|
104
|
-
if (missingLiterals.includes(validationVariableName) === false) {
|
|
105
|
-
missingLiterals.push(validationVariableName);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
if (missingLiterals.length > 0) {
|
|
112
|
-
Logger.customize({
|
|
113
|
-
name: 'Runner.run',
|
|
114
|
-
purpose: 'validate',
|
|
115
|
-
}).error(`Workflow ${chalk.cyan(`"${literalWorkflowKey}"`)} is missing required literal settings: ${missingLiterals.join(', ')}. Skipping.`);
|
|
116
|
-
skippedWorkflowKeys.add(literalWorkflowKey);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
const globalUniquenessMap = new Map();
|
|
120
|
-
const uniquenessErrors = [];
|
|
121
|
-
for (const uniquenessWorkflowEntry of workflows) {
|
|
122
|
-
const uniquenessEntry = uniquenessWorkflowEntry;
|
|
123
|
-
const uniquenessTemplateName = uniquenessEntry['template'];
|
|
124
|
-
const uniquenessSuffix = uniquenessEntry['suffix'];
|
|
125
|
-
const uniquenessWorkflowKey = (uniquenessSuffix !== undefined) ? `${uniquenessTemplateName}-${uniquenessSuffix}` : uniquenessTemplateName;
|
|
126
|
-
if (skippedWorkflowKeys.has(uniquenessWorkflowKey) === true) {
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
const uniquenessMetadataEntry = libWorkflowTemplatesMetadata.find((m) => m['name'] === uniquenessTemplateName);
|
|
130
|
-
if (uniquenessMetadataEntry === undefined) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
const uniquenessTargetsMetadata = uniquenessMetadataEntry['targets'] ?? {};
|
|
134
|
-
const uniquenessEntryTargets = uniquenessEntry['targets'] ?? [];
|
|
135
|
-
for (const uniquenessTarget of uniquenessEntryTargets) {
|
|
136
|
-
const entryTargetForUniqueness = uniquenessTarget;
|
|
137
|
-
const targetTypeForUniqueness = entryTargetForUniqueness['type'];
|
|
138
|
-
const targetMetadataForUniqueness = uniquenessTargetsMetadata[targetTypeForUniqueness];
|
|
139
|
-
if (targetMetadataForUniqueness === undefined) {
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
const uniquenessKeyForTarget = targetMetadataForUniqueness['uniquenessKey'];
|
|
143
|
-
if (uniquenessKeyForTarget === undefined) {
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
const uniquenessKeyResolvedValues = [];
|
|
147
|
-
const uniquenessKeyDetailEntries = [];
|
|
148
|
-
for (const uniquenessKeyVariableName of uniquenessKeyForTarget) {
|
|
149
|
-
const variableName = uniquenessKeyVariableName;
|
|
150
|
-
const variableMeta = targetMetadataForUniqueness['variables'][variableName];
|
|
151
|
-
const settingValue = (uniquenessEntry['settings'] !== undefined) ? uniquenessEntry['settings'][variableName] : undefined;
|
|
152
|
-
const resolvedValue = settingValue
|
|
153
|
-
?? (variableMeta !== undefined ? variableMeta['default'] : undefined)
|
|
154
|
-
?? variableName;
|
|
155
|
-
const uniquenessKeyDetailEntry = `${variableName}=${resolvedValue}`;
|
|
156
|
-
uniquenessKeyResolvedValues.push(resolvedValue);
|
|
157
|
-
uniquenessKeyDetailEntries.push(uniquenessKeyDetailEntry);
|
|
158
|
-
}
|
|
159
|
-
const uniquenessKeyComposite = [
|
|
160
|
-
targetTypeForUniqueness,
|
|
161
|
-
...uniquenessKeyResolvedValues,
|
|
162
|
-
].join('::');
|
|
163
|
-
const uniquenessKeyExisting = globalUniquenessMap.get(uniquenessKeyComposite);
|
|
164
|
-
if (uniquenessKeyExisting !== undefined) {
|
|
165
|
-
skippedWorkflowKeys.add(uniquenessKeyExisting['workflowKey']);
|
|
166
|
-
skippedWorkflowKeys.add(uniquenessWorkflowKey);
|
|
167
|
-
const isSameWorkflow = uniquenessKeyExisting['workflowKey'] === uniquenessWorkflowKey;
|
|
168
|
-
if (uniquenessKeyDetailEntries.length === 0) {
|
|
169
|
-
if (isSameWorkflow === true) {
|
|
170
|
-
uniquenessErrors.push(`Singleton target violation: workflow "${uniquenessWorkflowKey}" declares multiple "${targetTypeForUniqueness}" targets, but only one is allowed.`);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
uniquenessErrors.push(`Singleton target collision: only one "${targetTypeForUniqueness}" target may be declared across all workflows. Found in workflow "${uniquenessKeyExisting['workflowKey']}" and again in workflow "${uniquenessWorkflowKey}".`);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
else if (isSameWorkflow === true) {
|
|
177
|
-
uniquenessErrors.push(`Destination collision in workflow "${uniquenessWorkflowKey}": multiple "${targetTypeForUniqueness}" targets declare the same destination (${uniquenessKeyDetailEntries.join(', ')}). Each destination must be declared in only one target.`);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
uniquenessErrors.push(`Cross-workflow destination collision: target "${targetTypeForUniqueness}" with destination (${uniquenessKeyDetailEntries.join(', ')}) is declared in workflow "${uniquenessKeyExisting['workflowKey']}" and again in workflow "${uniquenessWorkflowKey}". Each destination must be declared in only one workflow.`);
|
|
181
|
-
}
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
const uniquenessKeyMapValue = {
|
|
185
|
-
workflowKey: uniquenessWorkflowKey,
|
|
186
|
-
targetType: targetTypeForUniqueness,
|
|
187
|
-
detailEntries: uniquenessKeyDetailEntries,
|
|
188
|
-
};
|
|
189
|
-
globalUniquenessMap.set(uniquenessKeyComposite, uniquenessKeyMapValue);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (uniquenessErrors.length > 0) {
|
|
193
|
-
for (const uniquenessError of uniquenessErrors) {
|
|
194
|
-
Logger.customize({
|
|
195
|
-
name: 'Runner.run',
|
|
196
|
-
purpose: 'validate',
|
|
197
|
-
}).error(uniquenessError);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const generatedSet = new Set();
|
|
201
|
-
const outputFileNames = new Set();
|
|
202
|
-
const setupLines = [];
|
|
203
|
-
for (const workflowEntry of workflows) {
|
|
204
|
-
const entry = workflowEntry;
|
|
205
|
-
const templateName = entry['template'];
|
|
206
|
-
const workflowSuffix = entry['suffix'];
|
|
207
|
-
const entryWorkflowKey = (workflowSuffix !== undefined) ? `${templateName}-${workflowSuffix}` : templateName;
|
|
208
|
-
if (skippedWorkflowKeys.has(entryWorkflowKey) === true) {
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
const metadataEntry = libWorkflowTemplatesMetadata.find((m) => m['name'] === templateName);
|
|
212
|
-
if (metadataEntry === undefined) {
|
|
213
|
-
Logger.customize({
|
|
214
|
-
name: 'Runner.run',
|
|
215
|
-
purpose: 'validate',
|
|
216
|
-
}).error(`Unknown template ${chalk.cyan(`"${templateName}"`)}. Skipping.`);
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
const templateDirPath = join(templateDirectory, templateName);
|
|
220
|
-
const templateDirExists = await pathExists(templateDirPath);
|
|
221
|
-
if (templateDirExists !== true) {
|
|
222
|
-
Logger.customize({
|
|
223
|
-
name: 'Runner.run',
|
|
224
|
-
purpose: 'validate',
|
|
225
|
-
}).error(`Template directory ${chalk.cyan(`"${templateName}"`)} not found. Skipping.`);
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
const outputFileName = (workflowSuffix !== undefined) ? `nova-${templateName}-${workflowSuffix}.yml` : `nova-${templateName}.yml`;
|
|
229
|
-
if (outputFileNames.has(outputFileName) === true) {
|
|
230
|
-
Logger.customize({
|
|
231
|
-
name: 'Runner.run',
|
|
232
|
-
purpose: 'validate',
|
|
233
|
-
}).error(`Duplicate output filename ${chalk.cyan(`"${outputFileName}"`)}. Skipping.`);
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
outputFileNames.add(outputFileName);
|
|
237
|
-
const basePath = join(templateDirPath, 'base.yml');
|
|
238
|
-
let baseContent = undefined;
|
|
239
|
-
try {
|
|
240
|
-
baseContent = await fs.readFile(basePath, 'utf-8');
|
|
241
|
-
}
|
|
242
|
-
catch {
|
|
243
|
-
Logger.customize({
|
|
244
|
-
name: 'Runner.run',
|
|
245
|
-
purpose: 'read',
|
|
246
|
-
}).error(`Failed to read base template ${chalk.cyan(`"${templateName}/base.yml"`)}. Skipping.`);
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
const hasTriggers = entry['triggers'].length > 0;
|
|
250
|
-
let content = baseContent;
|
|
251
|
-
if (hasTriggers === true) {
|
|
252
|
-
const triggers = entry['triggers'];
|
|
253
|
-
let hasTriggerError = false;
|
|
254
|
-
const triggerDataList = [];
|
|
255
|
-
for (const trigger of triggers) {
|
|
256
|
-
const triggerFileName = `${trigger}.yml`;
|
|
257
|
-
const triggerFilePath = join(templateDirPath, 'triggers', triggerFileName);
|
|
258
|
-
const triggerFileExists = await pathExists(triggerFilePath);
|
|
259
|
-
if (triggerFileExists !== true) {
|
|
260
|
-
Logger.customize({
|
|
261
|
-
name: 'Runner.run',
|
|
262
|
-
purpose: 'validate',
|
|
263
|
-
}).error(`Trigger file ${chalk.cyan(`"${triggerFileName}"`)} not found for template ${chalk.cyan(`"${templateName}"`)}. Skipping workflow.`);
|
|
264
|
-
hasTriggerError = true;
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
let triggerRawContent = '';
|
|
268
|
-
try {
|
|
269
|
-
triggerRawContent = await fs.readFile(triggerFilePath, 'utf-8');
|
|
270
|
-
}
|
|
271
|
-
catch {
|
|
272
|
-
Logger.customize({
|
|
273
|
-
name: 'Runner.run',
|
|
274
|
-
purpose: 'read',
|
|
275
|
-
}).error(`Failed to read trigger file ${chalk.cyan(`"${triggerFileName}"`)}. Skipping workflow.`);
|
|
276
|
-
hasTriggerError = true;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
const triggerParsed = parseYaml(triggerRawContent);
|
|
280
|
-
const triggerParsedRunName = triggerParsed['run-name'];
|
|
281
|
-
const triggerParsedPublishCondition = triggerParsed['publish-condition'];
|
|
282
|
-
const triggerParsedTriggerBlock = triggerParsed['trigger'];
|
|
283
|
-
const triggerParsedDependsOn = triggerParsed['depends-on'];
|
|
284
|
-
const triggerParsedJobsCondition = triggerParsed['jobs-condition'];
|
|
285
|
-
const triggerData = {
|
|
286
|
-
runName: triggerParsedRunName,
|
|
287
|
-
publishCondition: triggerParsedPublishCondition,
|
|
288
|
-
triggerBlock: triggerParsedTriggerBlock,
|
|
289
|
-
dependsOn: triggerParsedDependsOn,
|
|
290
|
-
jobsCondition: triggerParsedJobsCondition,
|
|
291
|
-
};
|
|
292
|
-
triggerDataList.push(triggerData);
|
|
293
|
-
}
|
|
294
|
-
if (hasTriggerError === true) {
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
const needsDependsOn = triggerDataList.some((triggerData) => triggerData['dependsOn'] === true);
|
|
298
|
-
if (needsDependsOn === true) {
|
|
299
|
-
const dependsOnEntries = entry['depends-on'] ?? [];
|
|
300
|
-
const entryLabel = (workflowSuffix !== undefined) ? `${templateName}-${workflowSuffix}` : templateName;
|
|
301
|
-
if (dependsOnEntries.length === 0) {
|
|
302
|
-
Logger.customize({
|
|
303
|
-
name: 'Runner.run',
|
|
304
|
-
purpose: 'validate',
|
|
305
|
-
}).error(`Workflow ${chalk.cyan(`"${entryLabel}"`)} uses a trigger that requires depends-on, but no depends-on value is configured. Skipping.`);
|
|
306
|
-
continue;
|
|
307
|
-
}
|
|
308
|
-
const dependsOnResolvedNames = [];
|
|
309
|
-
let hasDependsOnError = false;
|
|
310
|
-
for (const dependsOnEntry of dependsOnEntries) {
|
|
311
|
-
const entry2 = dependsOnEntry;
|
|
312
|
-
const dependsOnTarget = workflows.find((w) => {
|
|
313
|
-
const targetKey = (w['suffix'] !== undefined) ? `${w['template']}-${w['suffix']}` : w['template'];
|
|
314
|
-
return targetKey === entry2;
|
|
315
|
-
});
|
|
316
|
-
if (dependsOnTarget === undefined) {
|
|
317
|
-
Logger.customize({
|
|
318
|
-
name: 'Runner.run',
|
|
319
|
-
purpose: 'validate',
|
|
320
|
-
}).error(`Workflow ${chalk.cyan(`"${entryLabel}"`)} depends on ${chalk.cyan(`"${entry2}"`)} which does not exist. Skipping.`);
|
|
321
|
-
hasDependsOnError = true;
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
const dependsOnBasePath = join(templateDirectory, dependsOnTarget['template'], 'base.yml');
|
|
325
|
-
let dependsOnWorkflowName = '';
|
|
326
|
-
try {
|
|
327
|
-
const dependsOnBaseContent = await fs.readFile(dependsOnBasePath, 'utf-8');
|
|
328
|
-
const dependsOnNameMatch = new RegExp(LIB_REGEX_PATTERN_WORKFLOW_NAME.source, 'm').exec(dependsOnBaseContent);
|
|
329
|
-
if (dependsOnNameMatch === null || dependsOnNameMatch[1] === undefined) {
|
|
330
|
-
throw new Error('No name field found');
|
|
331
|
-
}
|
|
332
|
-
const targetSuffix = dependsOnTarget['suffix'];
|
|
333
|
-
dependsOnWorkflowName = dependsOnNameMatch[1].replaceAll('[__WORKFLOW_ID__]', (targetSuffix !== undefined) ? ` (${targetSuffix})` : '');
|
|
334
|
-
}
|
|
335
|
-
catch {
|
|
336
|
-
Logger.customize({
|
|
337
|
-
name: 'Runner.run',
|
|
338
|
-
purpose: 'read',
|
|
339
|
-
}).error(`Failed to resolve depends-on workflow name for ${chalk.cyan(`"${entry2}"`)}. Skipping.`);
|
|
340
|
-
hasDependsOnError = true;
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
dependsOnResolvedNames.push(dependsOnWorkflowName);
|
|
344
|
-
}
|
|
345
|
-
if (hasDependsOnError === true) {
|
|
346
|
-
continue;
|
|
347
|
-
}
|
|
348
|
-
const dependsOnYamlArray = dependsOnResolvedNames.map((name) => `"${name}"`).join(', ');
|
|
349
|
-
for (const triggerData of triggerDataList) {
|
|
350
|
-
if (triggerData['dependsOn'] === true) {
|
|
351
|
-
const triggerBlockString = JSON.stringify(triggerData['triggerBlock']);
|
|
352
|
-
const resolvedTriggerBlock = JSON.parse(triggerBlockString.replaceAll('"[__DEPENDS_ON__]"', dependsOnYamlArray));
|
|
353
|
-
Reflect.set(triggerData, 'triggerBlock', resolvedTriggerBlock);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
const mergedTriggerBlock = {};
|
|
358
|
-
for (const triggerData of triggerDataList) {
|
|
359
|
-
for (const triggerEntry of Object.entries(triggerData['triggerBlock'])) {
|
|
360
|
-
Reflect.set(mergedTriggerBlock, triggerEntry[0], triggerEntry[1]);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
const triggerYaml = stringifyYaml(mergedTriggerBlock, {
|
|
364
|
-
lineWidth: 0,
|
|
365
|
-
defaultKeyType: 'PLAIN',
|
|
366
|
-
defaultStringType: 'QUOTE_DOUBLE',
|
|
367
|
-
});
|
|
368
|
-
const indentedTriggerLines = triggerYaml.split('\n').map((line) => (line.trim() === '') ? '' : ` ${line}`);
|
|
369
|
-
const indentedTriggerYaml = indentedTriggerLines.join('\n').replace(LIB_REGEX_PATTERN_TRAILING_NEWLINES, '');
|
|
370
|
-
const needsManuallyFallback = metadataEntry['needsManuallyFallback'] ?? true;
|
|
371
|
-
const mergedRunName = Runner.buildMergedRunName(triggerDataList, needsManuallyFallback);
|
|
372
|
-
const mergedPublishCondition = Runner.buildMergedPublishCondition(triggerDataList);
|
|
373
|
-
const mergedJobsCondition = Runner.buildMergedJobsCondition(triggerDataList);
|
|
374
|
-
const jobsConditionLine = (mergedJobsCondition !== '') ? ` if: "${mergedJobsCondition}"\n` : '';
|
|
375
|
-
content = content.replace('[__RUN_NAME__]', mergedRunName);
|
|
376
|
-
content = content.replace('[__TRIGGERS__]', indentedTriggerYaml);
|
|
377
|
-
content = content.replace('[__PUBLISH_CONDITION__]', mergedPublishCondition);
|
|
378
|
-
content = content.replace('[__JOBS_CONDITION__]\n', jobsConditionLine);
|
|
379
|
-
const supportsScopes = metadataEntry['supportsScopes'];
|
|
380
|
-
const supportsTargets = metadataEntry['supportsTargets'];
|
|
381
|
-
const entryScopes = entry['scopes'] ?? [];
|
|
382
|
-
const entryTargets = entry['targets'] ?? [];
|
|
383
|
-
let hasPublishValidationError = false;
|
|
384
|
-
if (supportsTargets !== true && entryTargets.length > 0) {
|
|
385
|
-
Logger.customize({
|
|
386
|
-
name: 'Runner.run',
|
|
387
|
-
purpose: 'validate',
|
|
388
|
-
}).error(`Template ${chalk.cyan(`"${templateName}"`)} does not support targets but the workflow entry declares targets. Skipping.`);
|
|
389
|
-
hasPublishValidationError = true;
|
|
390
|
-
}
|
|
391
|
-
if (supportsScopes !== true && entryScopes.length > 0) {
|
|
392
|
-
Logger.customize({
|
|
393
|
-
name: 'Runner.run',
|
|
394
|
-
purpose: 'validate',
|
|
395
|
-
}).error(`Template ${chalk.cyan(`"${templateName}"`)} does not support scopes but the workflow entry declares scopes. Skipping.`);
|
|
396
|
-
hasPublishValidationError = true;
|
|
397
|
-
}
|
|
398
|
-
if (hasPublishValidationError === true) {
|
|
399
|
-
continue;
|
|
400
|
-
}
|
|
401
|
-
const configWorkspaces = (config['workspaces'] ?? {});
|
|
402
|
-
const targetsMetadata = metadataEntry['targets'] ?? {};
|
|
403
|
-
if (supportsTargets === true && entryTargets.length > 0) {
|
|
404
|
-
const targetTupleSet = new Set();
|
|
405
|
-
for (const entryTarget of entryTargets) {
|
|
406
|
-
const targetType = entryTarget['type'];
|
|
407
|
-
const targetWorkingDir = entryTarget['workingDir'];
|
|
408
|
-
if (targetsMetadata[targetType] === undefined) {
|
|
409
|
-
Logger.customize({
|
|
410
|
-
name: 'Runner.run',
|
|
411
|
-
purpose: 'validate',
|
|
412
|
-
}).error(`Target type ${chalk.cyan(`"${targetType}"`)} is not supported by template ${chalk.cyan(`"${templateName}"`)}. Skipping.`);
|
|
413
|
-
hasPublishValidationError = true;
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
const targetTupleKey = `${targetType}::${targetWorkingDir}`;
|
|
417
|
-
if (targetTupleSet.has(targetTupleKey) === true) {
|
|
418
|
-
Logger.customize({
|
|
419
|
-
name: 'Runner.run',
|
|
420
|
-
purpose: 'validate',
|
|
421
|
-
}).error(`Duplicate target ${chalk.cyan(`"${targetType}"`)} at ${chalk.cyan(`"${targetWorkingDir}"`)}. Each target type and working directory pair must be unique. Skipping.`);
|
|
422
|
-
hasPublishValidationError = true;
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
targetTupleSet.add(targetTupleKey);
|
|
426
|
-
if (configWorkspaces[targetWorkingDir] === undefined) {
|
|
427
|
-
Logger.customize({
|
|
428
|
-
name: 'Runner.run',
|
|
429
|
-
purpose: 'validate',
|
|
430
|
-
}).error(`Target working directory ${chalk.cyan(`"${targetWorkingDir}"`)} is not a registered workspace. Skipping.`);
|
|
431
|
-
hasPublishValidationError = true;
|
|
432
|
-
break;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
if (hasPublishValidationError === true) {
|
|
437
|
-
continue;
|
|
438
|
-
}
|
|
439
|
-
const resolvedWorkspaceNames = [];
|
|
440
|
-
if (supportsScopes === true && entryScopes.length > 0) {
|
|
441
|
-
for (const entryScope of entryScopes) {
|
|
442
|
-
const scopePath = entryScope;
|
|
443
|
-
const resolvedWorkspaceName = Runner.resolveWorkspaceName(configWorkspaces, scopePath);
|
|
444
|
-
if (resolvedWorkspaceName === undefined) {
|
|
445
|
-
Logger.customize({
|
|
446
|
-
name: 'Runner.run',
|
|
447
|
-
purpose: 'validate',
|
|
448
|
-
}).error(`Scope ${chalk.cyan(`"${scopePath}"`)} is not a registered workspace. Skipping.`);
|
|
449
|
-
hasPublishValidationError = true;
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
const resolvedName = resolvedWorkspaceName;
|
|
453
|
-
resolvedWorkspaceNames.push(resolvedName);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
if (hasPublishValidationError === true) {
|
|
457
|
-
continue;
|
|
458
|
-
}
|
|
459
|
-
if (supportsTargets === true) {
|
|
460
|
-
const useTurbo = await Runner.detectTurbo(currentDirectory);
|
|
461
|
-
const checkCommand = Runner.buildCommand('check', resolvedWorkspaceNames, useTurbo);
|
|
462
|
-
const buildCommand = Runner.buildCommand('build', resolvedWorkspaceNames, useTurbo);
|
|
463
|
-
content = content.replace('[__CHECK_COMMAND__]', checkCommand);
|
|
464
|
-
content = content.replace('[__BUILD_COMMAND__]', buildCommand);
|
|
465
|
-
const uploadArtifactStep = Runner.renderUploadArtifactSteps(entryTargets, targetsMetadata);
|
|
466
|
-
content = content.replace('[__UPLOAD_ARTIFACT_STEP__]', uploadArtifactStep);
|
|
467
|
-
const resolvedTargetFragments = [];
|
|
468
|
-
let hasTargetFragmentError = false;
|
|
469
|
-
for (const entryTarget of entryTargets) {
|
|
470
|
-
const currentEntryTarget = entryTarget;
|
|
471
|
-
const fragmentTargetType = currentEntryTarget['type'];
|
|
472
|
-
const fragmentTargetWorkingDir = currentEntryTarget['workingDir'];
|
|
473
|
-
const targetFragmentPath = join(templateDirPath, 'targets', `${fragmentTargetType}.yml`);
|
|
474
|
-
const targetFragmentExists = await pathExists(targetFragmentPath);
|
|
475
|
-
if (targetFragmentExists !== true) {
|
|
476
|
-
Logger.customize({
|
|
477
|
-
name: 'Runner.run',
|
|
478
|
-
purpose: 'validate',
|
|
479
|
-
}).error(`Target fragment ${chalk.cyan(`"${fragmentTargetType}.yml"`)} not found for template ${chalk.cyan(`"${templateName}"`)}. Skipping.`);
|
|
480
|
-
hasTargetFragmentError = true;
|
|
481
|
-
break;
|
|
482
|
-
}
|
|
483
|
-
let targetFragmentRawContent = '';
|
|
484
|
-
try {
|
|
485
|
-
targetFragmentRawContent = await fs.readFile(targetFragmentPath, 'utf-8');
|
|
486
|
-
}
|
|
487
|
-
catch {
|
|
488
|
-
Logger.customize({
|
|
489
|
-
name: 'Runner.run',
|
|
490
|
-
purpose: 'read',
|
|
491
|
-
}).error(`Failed to read target fragment ${chalk.cyan(`"${fragmentTargetType}.yml"`)}. Skipping.`);
|
|
492
|
-
hasTargetFragmentError = true;
|
|
493
|
-
break;
|
|
494
|
-
}
|
|
495
|
-
const targetId = Runner.slugifyWorkingDir(fragmentTargetWorkingDir);
|
|
496
|
-
let targetFragmentResolvedContent = targetFragmentRawContent;
|
|
497
|
-
targetFragmentResolvedContent = targetFragmentResolvedContent.replaceAll('[__TARGET_ID__]', targetId);
|
|
498
|
-
targetFragmentResolvedContent = targetFragmentResolvedContent.replaceAll('[__WORKING_DIR__]', fragmentTargetWorkingDir);
|
|
499
|
-
const artifactName = Runner.buildArtifactName(fragmentTargetType, targetId);
|
|
500
|
-
targetFragmentResolvedContent = targetFragmentResolvedContent.replaceAll('[__ARTIFACT_NAME__]', artifactName);
|
|
501
|
-
const targetNeeds = currentEntryTarget['needs'] ?? [];
|
|
502
|
-
const targetNeedsJobIds = targetNeeds.map((targetNeedWorkingDir) => `publish-${fragmentTargetType}-${Runner.slugifyWorkingDir(targetNeedWorkingDir)}`);
|
|
503
|
-
const targetNeedsValue = (targetNeedsJobIds.length === 0) ? '"build"' : `["build", ${targetNeedsJobIds.map((targetNeedsJobId) => `"${targetNeedsJobId}"`).join(', ')}]`;
|
|
504
|
-
targetFragmentResolvedContent = targetFragmentResolvedContent.replace('[__NEEDS__]', targetNeedsValue);
|
|
505
|
-
const targetJobsConditionLine = (mergedJobsCondition !== '') ? ` if: "${mergedJobsCondition}"\n` : '';
|
|
506
|
-
targetFragmentResolvedContent = targetFragmentResolvedContent.replace('[__JOBS_CONDITION__]\n', targetJobsConditionLine);
|
|
507
|
-
const targetMetadata = targetsMetadata[fragmentTargetType];
|
|
508
|
-
const mergedVariables = {
|
|
509
|
-
...metadataEntry['variables'],
|
|
510
|
-
...(targetMetadata !== undefined) ? targetMetadata['variables'] : {},
|
|
511
|
-
};
|
|
512
|
-
targetFragmentResolvedContent = Runner.substituteVariables(targetFragmentResolvedContent, mergedVariables, entry['settings']);
|
|
513
|
-
try {
|
|
514
|
-
parseYaml(targetFragmentResolvedContent);
|
|
515
|
-
}
|
|
516
|
-
catch {
|
|
517
|
-
Logger.customize({
|
|
518
|
-
name: 'Runner.run',
|
|
519
|
-
purpose: 'validate',
|
|
520
|
-
}).error(`Target fragment ${chalk.cyan(`"${fragmentTargetType}.yml"`)} produced invalid YAML. Skipping.`);
|
|
521
|
-
hasTargetFragmentError = true;
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
const indentedLines = targetFragmentResolvedContent.split('\n').map((line) => (line === '') ? '' : ` ${line}`);
|
|
525
|
-
const indentedFragment = indentedLines.join('\n');
|
|
526
|
-
resolvedTargetFragments.push(indentedFragment);
|
|
527
|
-
}
|
|
528
|
-
if (hasTargetFragmentError === true) {
|
|
529
|
-
continue;
|
|
530
|
-
}
|
|
531
|
-
if (resolvedTargetFragments.length > 0) {
|
|
532
|
-
const appendedFragments = resolvedTargetFragments.join('\n');
|
|
533
|
-
content = [
|
|
534
|
-
content.replace(LIB_REGEX_PATTERN_TRAILING_NEWLINES_OR_NONE, ''),
|
|
535
|
-
'',
|
|
536
|
-
appendedFragments,
|
|
537
|
-
].join('\n');
|
|
538
|
-
try {
|
|
539
|
-
parseYaml(content);
|
|
540
|
-
}
|
|
541
|
-
catch {
|
|
542
|
-
Logger.customize({
|
|
543
|
-
name: 'Runner.run',
|
|
544
|
-
purpose: 'validate',
|
|
545
|
-
}).error(`Base template for ${chalk.cyan(`"${templateName}"`)} produced invalid YAML after target injection. Skipping.`);
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
content = content.replaceAll('[__WORKFLOW_ID__]', (workflowSuffix !== undefined) ? ` (${workflowSuffix})` : '');
|
|
552
|
-
const substituted = Runner.substituteVariables(content, metadataEntry['variables'], entry['settings']);
|
|
553
|
-
try {
|
|
554
|
-
parseYaml(substituted);
|
|
555
|
-
}
|
|
556
|
-
catch {
|
|
557
|
-
Logger.customize({
|
|
558
|
-
name: 'Runner.run',
|
|
559
|
-
purpose: 'validate',
|
|
560
|
-
}).error(`Generated YAML for ${chalk.cyan(`"${outputFileName}"`)} is invalid. Skipping.`);
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
generatedSet.add(outputFileName);
|
|
564
|
-
const entrySetupLines = Runner.buildEntrySetupLines(entry, metadataEntry, outputFileName);
|
|
565
|
-
setupLines.push(...entrySetupLines);
|
|
566
|
-
if (isDryRun === true) {
|
|
567
|
-
const displayPath = `.github/workflows/${outputFileName}`;
|
|
568
|
-
Logger.customize({
|
|
569
|
-
name: 'Runner.run',
|
|
570
|
-
purpose: 'dry-run',
|
|
571
|
-
}).info(`Would generate ${chalk.cyan(`"${displayPath}"`)}.`);
|
|
572
|
-
continue;
|
|
573
|
-
}
|
|
574
|
-
const targetPath = join(workflowsDirectory, outputFileName);
|
|
575
|
-
await saveGeneratedFile(targetPath, substituted, isReplaceFile, {
|
|
576
|
-
command: 'nova generate github workflows',
|
|
577
|
-
docsSlug: 'cli/generators/github/workflows',
|
|
578
|
-
mode: 'strict',
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
if (isDryRun !== true && await pathExists(workflowsDirectory) === true) {
|
|
582
|
-
let existingEntries = [];
|
|
583
|
-
try {
|
|
584
|
-
existingEntries = await fs.readdir(workflowsDirectory, { withFileTypes: true });
|
|
585
|
-
}
|
|
586
|
-
catch {
|
|
587
|
-
}
|
|
588
|
-
for (const existingEntry of existingEntries) {
|
|
589
|
-
const existingDirent = existingEntry;
|
|
590
|
-
if (existingDirent.isFile() !== true) {
|
|
591
|
-
continue;
|
|
592
|
-
}
|
|
593
|
-
const isOrphan = existingDirent.name.startsWith('nova-') === true
|
|
594
|
-
&& existingDirent.name.endsWith('.yml') === true
|
|
595
|
-
&& generatedSet.has(existingDirent.name) === false;
|
|
596
|
-
const isBackup = existingDirent.name.includes('.nova-backup.') === true;
|
|
597
|
-
if (isOrphan !== true || isBackup === true) {
|
|
598
|
-
continue;
|
|
599
|
-
}
|
|
600
|
-
const orphanPath = join(workflowsDirectory, existingDirent.name);
|
|
601
|
-
if (isReplaceFile === true) {
|
|
602
|
-
await fs.unlink(orphanPath);
|
|
603
|
-
Logger.customize({
|
|
604
|
-
name: 'Runner.run',
|
|
605
|
-
purpose: 'cleanup',
|
|
606
|
-
}).info(`Deleted orphan ${chalk.cyan(`"${existingDirent.name}"`)}.`);
|
|
607
|
-
}
|
|
608
|
-
else {
|
|
609
|
-
await renameFileWithDate(orphanPath);
|
|
610
|
-
Logger.customize({
|
|
611
|
-
name: 'Runner.run',
|
|
612
|
-
purpose: 'cleanup',
|
|
613
|
-
}).info(`Backed up orphan ${chalk.cyan(`"${existingDirent.name}"`)}.`);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
if (setupLines.length > 0) {
|
|
618
|
-
const setupMessage = [
|
|
619
|
-
'Setup:',
|
|
620
|
-
setupLines.join('\n'),
|
|
621
|
-
].join('\n');
|
|
622
|
-
Logger.customize({
|
|
623
|
-
name: 'Runner.run',
|
|
624
|
-
purpose: 'setup',
|
|
625
|
-
padTop: 1,
|
|
626
|
-
}).info(setupMessage);
|
|
627
|
-
}
|
|
628
|
-
return 'completed';
|
|
629
|
-
}
|
|
630
|
-
static buildMergedRunName(triggerDataList, needsManuallyFallback) {
|
|
631
|
-
const contextExpressions = [];
|
|
632
|
-
for (const triggerData of triggerDataList) {
|
|
633
|
-
const contextMatch = triggerData['runName'].match(LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_EXPRESSION);
|
|
634
|
-
if (contextMatch === null) {
|
|
635
|
-
continue;
|
|
636
|
-
}
|
|
637
|
-
const contextInner = contextMatch[1] ?? '';
|
|
638
|
-
const contextParts = contextInner.split('||').map((part) => part.trim());
|
|
639
|
-
for (const part of contextParts) {
|
|
640
|
-
if (part === '\'manually\'' || contextExpressions.includes(part) === true) {
|
|
641
|
-
continue;
|
|
642
|
-
}
|
|
643
|
-
contextExpressions.push(part);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
const runNameMatch = (triggerDataList[0] ?? { runName: '' })['runName'].match(LIB_REGEX_PATTERN_WORKFLOW_RUN_NAME_CAPTURE);
|
|
647
|
-
const runNamePrefix = (runNameMatch !== null && runNameMatch[1] !== undefined) ? runNameMatch[1] : '';
|
|
648
|
-
const runNameSuffix = (runNameMatch !== null && runNameMatch[2] !== undefined) ? runNameMatch[2] : '';
|
|
649
|
-
const hasEmptyFallback = contextExpressions.includes('\'\'') || contextExpressions.includes('""');
|
|
650
|
-
const shouldAppendFallback = needsManuallyFallback === true && hasEmptyFallback === false;
|
|
651
|
-
const contextExpressionsWithFallback = (shouldAppendFallback === true) ? [
|
|
652
|
-
...contextExpressions,
|
|
653
|
-
'\'manually\'',
|
|
654
|
-
] : contextExpressions;
|
|
655
|
-
const mergedContextExpression = contextExpressionsWithFallback.join(' || ');
|
|
656
|
-
return `${runNamePrefix}\${{ ${mergedContextExpression} }}${runNameSuffix}`;
|
|
657
|
-
}
|
|
658
|
-
static buildMergedPublishCondition(triggerDataList) {
|
|
659
|
-
const nonDispatchParts = [];
|
|
660
|
-
let dispatchPart = '';
|
|
661
|
-
for (const triggerData of triggerDataList) {
|
|
662
|
-
const publishInner = triggerData['publishCondition'].replace(LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_WRAPPER_START, '').replace(LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_WRAPPER_END, '');
|
|
663
|
-
const publishParts = publishInner.split(LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_SEPARATOR);
|
|
664
|
-
for (const part of publishParts) {
|
|
665
|
-
if (part.includes('workflow_dispatch') === true) {
|
|
666
|
-
if (dispatchPart === '') {
|
|
667
|
-
dispatchPart = part;
|
|
668
|
-
}
|
|
669
|
-
continue;
|
|
670
|
-
}
|
|
671
|
-
if (nonDispatchParts.includes(part) === false) {
|
|
672
|
-
nonDispatchParts.push(part);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
const allParts = [...nonDispatchParts];
|
|
677
|
-
if (dispatchPart !== '') {
|
|
678
|
-
allParts.push(dispatchPart);
|
|
679
|
-
}
|
|
680
|
-
return `\${{ ${allParts.join(' || ')} }}`;
|
|
681
|
-
}
|
|
682
|
-
static buildMergedJobsCondition(triggerDataList) {
|
|
683
|
-
for (const triggerData of triggerDataList) {
|
|
684
|
-
if (triggerData['jobsCondition'] !== undefined) {
|
|
685
|
-
const jobsConditionLine = triggerData['jobsCondition'].replace(LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_WRAPPER_START, '').replace(LIB_REGEX_PATTERN_WORKFLOW_CONTEXT_WRAPPER_END, '');
|
|
686
|
-
return `\${{ ${jobsConditionLine} }}`;
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
return '';
|
|
690
|
-
}
|
|
691
|
-
static detectCircularDependsOn(workflows) {
|
|
692
|
-
for (const entry of workflows) {
|
|
693
|
-
if (entry['depends-on'] === undefined || entry['depends-on'].length === 0) {
|
|
694
|
-
continue;
|
|
695
|
-
}
|
|
696
|
-
const entryKey = (entry['suffix'] !== undefined) ? `${entry['template']}-${entry['suffix']}` : entry['template'];
|
|
697
|
-
const visited = new Set();
|
|
698
|
-
visited.add(entryKey);
|
|
699
|
-
const queue = [...entry['depends-on']];
|
|
700
|
-
while (queue.length > 0) {
|
|
701
|
-
const currentId = queue.shift();
|
|
702
|
-
if (visited.has(currentId) === true) {
|
|
703
|
-
return true;
|
|
704
|
-
}
|
|
705
|
-
visited.add(currentId);
|
|
706
|
-
const currentEntry = workflows.find((w) => {
|
|
707
|
-
const key = (w['suffix'] !== undefined) ? `${w['template']}-${w['suffix']}` : w['template'];
|
|
708
|
-
return key === currentId;
|
|
709
|
-
});
|
|
710
|
-
if (currentEntry !== undefined && currentEntry['depends-on'] !== undefined) {
|
|
711
|
-
for (const dep of currentEntry['depends-on']) {
|
|
712
|
-
queue.push(dep);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
return false;
|
|
718
|
-
}
|
|
719
|
-
static buildEntrySetupLines(entry, metadataEntry, outputFileName) {
|
|
720
|
-
const lines = [];
|
|
721
|
-
if (metadataEntry === undefined) {
|
|
722
|
-
return lines;
|
|
723
|
-
}
|
|
724
|
-
for (const variableEntry of Object.entries(metadataEntry['variables'])) {
|
|
725
|
-
const variableName = variableEntry[0];
|
|
726
|
-
const variableMeta = variableEntry[1];
|
|
727
|
-
if (variableMeta['auto'] === true) {
|
|
728
|
-
continue;
|
|
729
|
-
}
|
|
730
|
-
if (variableMeta['format'] === 'secret') {
|
|
731
|
-
const secretResolvedName = (entry['settings'] !== undefined && entry['settings'][variableName] !== undefined) ? entry['settings'][variableName] : (variableMeta['default'] ?? variableName);
|
|
732
|
-
lines.push(` - ${chalk.cyan(outputFileName)}: Secret ${chalk.yellow(secretResolvedName)}`);
|
|
733
|
-
}
|
|
734
|
-
if (variableMeta['format'] === 'var') {
|
|
735
|
-
const varResolvedName = (entry['settings'] !== undefined && entry['settings'][variableName] !== undefined) ? entry['settings'][variableName] : (variableMeta['default'] ?? variableName);
|
|
736
|
-
lines.push(` - ${chalk.cyan(outputFileName)}: Variable ${chalk.yellow(varResolvedName)}`);
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
if (entry['targets'] !== undefined && metadataEntry['targets'] !== undefined) {
|
|
740
|
-
const entryTargetsMetadata = metadataEntry['targets'];
|
|
741
|
-
for (const setupTarget of entry['targets']) {
|
|
742
|
-
const setupTargetType = setupTarget['type'];
|
|
743
|
-
const setupTargetMetadata = entryTargetsMetadata[setupTargetType];
|
|
744
|
-
if (setupTargetMetadata === undefined) {
|
|
745
|
-
continue;
|
|
746
|
-
}
|
|
747
|
-
for (const targetVariableEntry of Object.entries(setupTargetMetadata['variables'])) {
|
|
748
|
-
const targetVariableName = targetVariableEntry[0];
|
|
749
|
-
const targetVariableMeta = targetVariableEntry[1];
|
|
750
|
-
if (targetVariableMeta['auto'] === true) {
|
|
751
|
-
continue;
|
|
752
|
-
}
|
|
753
|
-
if (targetVariableMeta['format'] === 'secret') {
|
|
754
|
-
const targetSecretResolvedName = (entry['settings'] !== undefined && entry['settings'][targetVariableName] !== undefined) ? entry['settings'][targetVariableName] : (targetVariableMeta['default'] ?? targetVariableName);
|
|
755
|
-
lines.push(` - ${chalk.cyan(outputFileName)}: Secret ${chalk.yellow(targetSecretResolvedName)}`);
|
|
756
|
-
}
|
|
757
|
-
if (targetVariableMeta['format'] === 'var') {
|
|
758
|
-
const targetVarResolvedName = (entry['settings'] !== undefined && entry['settings'][targetVariableName] !== undefined) ? entry['settings'][targetVariableName] : (targetVariableMeta['default'] ?? targetVariableName);
|
|
759
|
-
lines.push(` - ${chalk.cyan(outputFileName)}: Variable ${chalk.yellow(targetVarResolvedName)}`);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
return lines;
|
|
765
|
-
}
|
|
766
|
-
static substituteVariables(content, variables, settings) {
|
|
767
|
-
let result = content;
|
|
768
|
-
for (const variableEntry of Object.entries(variables)) {
|
|
769
|
-
const variableName = variableEntry[0];
|
|
770
|
-
const variableMeta = variableEntry[1];
|
|
771
|
-
const regex = new RegExp(`\\$\\{\\{\\s*(?:secrets|vars)\\.${variableName}\\s*\\}\\}`, 'g');
|
|
772
|
-
const settingValue = (settings !== undefined && settings[variableName] !== undefined) ? settings[variableName] : undefined;
|
|
773
|
-
if (variableMeta['format'] === 'secret') {
|
|
774
|
-
const secretResolvedName = settingValue
|
|
775
|
-
?? variableMeta['default']
|
|
776
|
-
?? variableName;
|
|
777
|
-
const secretReplacement = `\${{ secrets.${secretResolvedName} }}`;
|
|
778
|
-
result = result.replace(regex, secretReplacement);
|
|
779
|
-
}
|
|
780
|
-
if (variableMeta['format'] === 'var') {
|
|
781
|
-
const varResolvedName = settingValue
|
|
782
|
-
?? variableMeta['default']
|
|
783
|
-
?? variableName;
|
|
784
|
-
const varReplacement = `\${{ vars.${varResolvedName} }}`;
|
|
785
|
-
result = result.replace(regex, varReplacement);
|
|
786
|
-
}
|
|
787
|
-
if (variableMeta['format'] === 'literal') {
|
|
788
|
-
const literalReplacement = (settingValue ?? '').replaceAll('\n', '\\n');
|
|
789
|
-
result = result.replace(regex, () => literalReplacement);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
return result;
|
|
793
|
-
}
|
|
794
|
-
static buildArtifactName(targetType, targetId) {
|
|
795
|
-
return `build-${targetType}-${targetId}`;
|
|
796
|
-
}
|
|
797
|
-
static slugifyWorkingDir(input) {
|
|
798
|
-
const trimmed = input
|
|
799
|
-
.replace(LIB_REGEX_PATTERN_LEADING_DOT_SLASH, '')
|
|
800
|
-
.replace(LIB_REGEX_PATTERN_TRAILING_SLASH, '');
|
|
801
|
-
if (trimmed === '') {
|
|
802
|
-
return 'root';
|
|
803
|
-
}
|
|
804
|
-
return trimmed.replaceAll('/', '-');
|
|
805
|
-
}
|
|
806
|
-
static resolveWorkspaceName(workspaces, path) {
|
|
807
|
-
const entry = workspaces[path];
|
|
808
|
-
if (entry === undefined) {
|
|
809
|
-
return undefined;
|
|
810
|
-
}
|
|
811
|
-
return entry['name'];
|
|
812
|
-
}
|
|
813
|
-
static async detectTurbo(projectDirectory) {
|
|
814
|
-
const turboConfigPath = join(projectDirectory, 'turbo.json');
|
|
815
|
-
return pathExists(turboConfigPath);
|
|
816
|
-
}
|
|
817
|
-
static buildCommand(scriptName, workspaceNames, useTurbo) {
|
|
818
|
-
if (useTurbo === true) {
|
|
819
|
-
const turboFlags = workspaceNames.map((name) => `--filter=${name}`);
|
|
820
|
-
return `npx turbo run ${scriptName} ${turboFlags.join(' ')} --concurrency=2`;
|
|
821
|
-
}
|
|
822
|
-
const npmFlags = workspaceNames.map((name) => `-w ${name}`);
|
|
823
|
-
return `npm run ${scriptName} ${npmFlags.join(' ')}`;
|
|
824
|
-
}
|
|
825
|
-
static renderUploadArtifactSteps(targets, targetsMetadata) {
|
|
826
|
-
const steps = [];
|
|
827
|
-
for (const target of targets) {
|
|
828
|
-
const metadata = targetsMetadata[target['type']];
|
|
829
|
-
if (metadata === undefined) {
|
|
830
|
-
continue;
|
|
831
|
-
}
|
|
832
|
-
if (metadata['artifactPaths'].length === 0) {
|
|
833
|
-
continue;
|
|
834
|
-
}
|
|
835
|
-
const strippedDir = target['workingDir'].replace(LIB_REGEX_PATTERN_LEADING_DOT_SLASH, '');
|
|
836
|
-
const targetId = Runner.slugifyWorkingDir(target['workingDir']);
|
|
837
|
-
const artifactName = Runner.buildArtifactName(target['type'], targetId);
|
|
838
|
-
const pathLines = metadata['artifactPaths'].map((template) => ` ${template.replaceAll('{workingDir}', strippedDir)}`);
|
|
839
|
-
const stepLines = [
|
|
840
|
-
` - name: "Upload build artifacts (${target['type']}/${targetId})"`,
|
|
841
|
-
' uses: "actions/upload-artifact@v7"',
|
|
842
|
-
' with:',
|
|
843
|
-
` name: "${artifactName}"`,
|
|
844
|
-
' retention-days: 1',
|
|
845
|
-
' path: |',
|
|
846
|
-
...pathLines,
|
|
847
|
-
];
|
|
848
|
-
steps.push(stepLines.join('\n'));
|
|
849
|
-
}
|
|
850
|
-
if (steps.length === 0) {
|
|
851
|
-
return '';
|
|
852
|
-
}
|
|
853
|
-
return steps.join('\n\n');
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
//# sourceMappingURL=workflows.js.map
|