@cbnventures/nova 0.38.0 → 0.40.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/build/package.json +1 -1
- package/build/scaffold-versions.json +10 -9
- package/build/src/api/app-store-connect.d.ts +17 -2
- package/build/src/api/app-store-connect.d.ts.map +1 -1
- package/build/src/api/app-store-connect.js +654 -171
- package/build/src/api/app-store-connect.js.map +1 -1
- package/build/src/api/docker-hub.d.ts +14 -0
- package/build/src/api/docker-hub.d.ts.map +1 -0
- package/build/src/api/docker-hub.js +275 -0
- package/build/src/api/docker-hub.js.map +1 -0
- package/build/src/api/github-runner-images.d.ts +13 -0
- package/build/src/api/github-runner-images.d.ts.map +1 -0
- package/build/src/api/github-runner-images.js +238 -0
- package/build/src/api/github-runner-images.js.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +2 -2
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint-validate.js +260 -50
- package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.d.ts +6 -4
- package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint.js +632 -74
- package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
- package/build/src/cli/generate/must-haves/agent-conventions.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/agent-conventions.js +1 -0
- package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
- package/build/src/cli/index.js +41 -1
- package/build/src/cli/index.js.map +1 -1
- package/build/src/cli/integration/app-store-connect.d.ts +10 -0
- package/build/src/cli/integration/app-store-connect.d.ts.map +1 -1
- package/build/src/cli/integration/app-store-connect.js +701 -80
- package/build/src/cli/integration/app-store-connect.js.map +1 -1
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.d.ts +3 -0
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.d.ts.map +1 -0
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.js +72 -0
- package/build/src/cli/recipe/docker-hub/docker-hub-precheck.js.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.d.ts +5 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.d.ts.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.js +124 -0
- package/build/src/cli/recipe/docker-hub/sync-identity.js.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.d.ts +5 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.d.ts.map +1 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.js +63 -0
- package/build/src/cli/recipe/docker-hub/sync-policies.js.map +1 -0
- package/build/src/cli/recipe/index.d.ts.map +1 -1
- package/build/src/cli/recipe/index.js +12 -0
- package/build/src/cli/recipe/index.js.map +1 -1
- package/build/src/cli/recipe/nova-config/normalize-order.js +3 -3
- package/build/src/cli/recipe/nova-config/normalize-order.js.map +1 -1
- package/build/src/cli/scaffold/package/pfsense.d.ts +3 -0
- package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
- package/build/src/cli/scaffold/package/pfsense.js +140 -6
- package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
- package/build/src/cli/scaffold/tool/serverless.d.ts +2 -0
- package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
- package/build/src/cli/scaffold/tool/serverless.js +35 -1
- package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
- package/build/src/cli/utility/changelog.d.ts +7 -0
- package/build/src/cli/utility/changelog.d.ts.map +1 -1
- package/build/src/cli/utility/changelog.js +800 -7
- package/build/src/cli/utility/changelog.js.map +1 -1
- package/build/src/cli/utility/configure.d.ts +4 -1
- package/build/src/cli/utility/configure.d.ts.map +1 -1
- package/build/src/cli/utility/configure.js +396 -24
- package/build/src/cli/utility/configure.js.map +1 -1
- package/build/src/lib/docker-packaging.d.ts +1 -0
- package/build/src/lib/docker-packaging.d.ts.map +1 -1
- package/build/src/lib/docker-packaging.js +39 -2
- package/build/src/lib/docker-packaging.js.map +1 -1
- package/build/src/lib/env-namespace.d.ts.map +1 -1
- package/build/src/lib/env-namespace.js +2 -1
- package/build/src/lib/env-namespace.js.map +1 -1
- 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 +23 -0
- package/build/src/lib/item.js.map +1 -1
- package/build/src/lib/nova-config-order.d.ts.map +1 -1
- package/build/src/lib/nova-config-order.js +35 -1
- package/build/src/lib/nova-config-order.js.map +1 -1
- package/build/src/lib/nova-config.d.ts +1 -0
- package/build/src/lib/nova-config.d.ts.map +1 -1
- package/build/src/lib/nova-config.js +178 -3
- package/build/src/lib/nova-config.js.map +1 -1
- package/build/src/lib/regex.d.ts +16 -0
- package/build/src/lib/regex.d.ts.map +1 -1
- package/build/src/lib/regex.js +16 -0
- package/build/src/lib/regex.js.map +1 -1
- package/build/src/lib/scaffold.d.ts +3 -3
- package/build/src/lib/scaffold.d.ts.map +1 -1
- package/build/src/lib/scaffold.js +111 -8
- package/build/src/lib/scaffold.js.map +1 -1
- package/build/src/lib/schema.d.ts +34 -0
- package/build/src/lib/schema.d.ts.map +1 -1
- package/build/src/lib/schema.js +31 -0
- package/build/src/lib/schema.js.map +1 -1
- package/build/src/lib/workflow-templates.d.ts +4 -1
- package/build/src/lib/workflow-templates.d.ts.map +1 -1
- package/build/src/lib/workflow-templates.js +46 -16
- package/build/src/lib/workflow-templates.js.map +1 -1
- package/build/src/types/api/app-store-connect.d.ts +476 -33
- package/build/src/types/api/docker-hub.d.ts +237 -0
- package/build/src/types/api/github-runner-images.d.ts +199 -0
- package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +79 -17
- package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +131 -9
- package/build/src/types/cli/index.d.ts +2 -0
- package/build/src/types/cli/integration/app-store-connect.d.ts +470 -6
- package/build/src/types/cli/recipe/docker-hub/docker-hub-precheck.d.ts +78 -0
- package/build/src/types/cli/recipe/docker-hub/sync-identity.d.ts +80 -0
- package/build/src/types/cli/recipe/docker-hub/sync-policies.d.ts +57 -0
- package/build/src/types/cli/recipe/index.d.ts +3 -1
- package/build/src/types/cli/scaffold/package/pfsense.d.ts +83 -0
- package/build/src/types/cli/scaffold/tool/serverless.d.ts +30 -0
- package/build/src/types/cli/utility/changelog.d.ts +327 -1
- package/build/src/types/cli/utility/configure.d.ts +199 -4
- package/build/src/types/lib/docker-packaging.d.ts +25 -1
- package/build/src/types/lib/env-namespace.d.ts +4 -1
- package/build/src/types/lib/item.d.ts +11 -0
- package/build/src/types/lib/nova-config-order.d.ts +34 -1
- package/build/src/types/lib/nova-config.d.ts +100 -0
- package/build/src/types/lib/regex.d.ts +91 -0
- package/build/src/types/lib/scaffold.d.ts +48 -4
- package/build/src/types/lib/workflow-templates.d.ts +26 -0
- package/build/src/types/shared.d.ts +353 -3
- package/build/src/types/tests/api/app-store-connect.test.d.ts +162 -0
- package/build/src/types/tests/api/docker-hub.test.d.ts +84 -0
- package/build/src/types/tests/api/github-runner-images.test.d.ts +113 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +19 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +0 -9
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +108 -25
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +139 -30
- package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +45 -0
- package/build/src/types/tests/cli/generate/github/workflows-version-contract.test.d.ts +2 -2
- package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +2 -0
- package/build/src/types/tests/cli/integration/app-store-connect.test.d.ts +876 -0
- package/build/src/types/tests/cli/recipe/nova-config/normalize-order.test.d.ts +4 -0
- package/build/src/types/tests/cli/scaffold/tool/serverless.test.d.ts +21 -0
- package/build/src/types/tests/cli/utility/changelog-android.test.d.ts +14 -0
- package/build/src/types/tests/cli/utility/changelog-apple.test.d.ts +21 -0
- package/build/src/types/tests/cli/utility/changelog-fold.test.d.ts +350 -0
- package/build/src/types/tests/cli/utility/changelog.test.d.ts +50 -0
- package/build/src/types/tests/cli/utility/configure.test.d.ts +90 -0
- package/build/src/types/tests/lib/nova-config.test.d.ts +29 -1
- package/build/src/types/tests/lib/scaffold.test.d.ts +59 -2
- package/build/src/types/tests/scaffold-output-contract.test.d.ts +136 -0
- package/build/templates/generators/must-haves/agent-conventions/AGENTS.md +1 -0
- package/build/templates/generators/must-haves/agent-conventions/CLAUDE.md +1 -0
- package/build/templates/generators/must-haves/agent-conventions/conventions/nova.md +6 -0
- package/build/templates/generators/must-haves/agent-conventions/conventions/pfsense.md +311 -0
- package/build/templates/scaffold/app/android/package.json +1 -1
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-1024.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32@2x.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512.png +0 -0
- package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512@2x.png +0 -0
- package/build/templates/scaffold/app/apple/package.json +1 -1
- package/build/templates/scaffold/app/astro/package.json +1 -1
- package/build/templates/scaffold/app/discord-bot/package.json +1 -1
- package/build/templates/scaffold/app/express/package.json +1 -1
- package/build/templates/scaffold/app/nextjs/package.json +1 -1
- package/build/templates/scaffold/app/vite/package.json +1 -1
- package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
- package/build/templates/scaffold/package/github-action/package.json +1 -1
- package/build/templates/scaffold/package/homebridge/package.json +1 -1
- package/build/templates/scaffold/package/pfsense/package.json +2 -2
- package/build/templates/scaffold/package/pfsense/port/Makefile.template +16 -1
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/FileLock.php +93 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/PackagePaths.php +40 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/UpdateManager.php +1667 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].inc +161 -13
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].xml +37 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/sbin/[__WORKSPACE_NAME__] +203 -8
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/logo.svg +12 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/release-signing.pub +9 -0
- package/build/templates/scaffold/package/pfsense/port/files/usr/local/www/[__WORKSPACE_NAME__]-about.php +437 -0
- package/build/templates/scaffold/package/pfsense/port/pkg-plist +6 -0
- package/build/templates/scaffold/package/pfsense/scripts/build-package.sh +61 -0
- package/build/templates/scaffold/package/pfsense/scripts/check-package.mjs +114 -1
- package/build/templates/scaffold/package/pfsense/scripts/regex.mjs +10 -0
- package/build/templates/scaffold/package/pfsense/scripts/stage-package.mjs +48 -2
- package/build/templates/scaffold/package/pfsense/tests/updates.php +695 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/ic_launcher_background.xml +1 -1
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
- package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
- package/build/templates/scaffold-options/docker-image/common/Dockerfile +7 -0
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/index.test.d.ts +40 -2
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/landing-page.d.ts +23 -0
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.test.ts +119 -4
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.ts +25 -3
- package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/landing-page.ts +278 -0
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.test.ts +121 -6
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.ts +49 -12
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +3 -1
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/function/landing-page.ts +278 -0
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.d.ts +17 -2
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.test.d.ts +40 -2
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/function/landing-page.d.ts +23 -0
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/tsconfig.functions.json +3 -1
- package/build/templates/scaffold-options/tool/serverless/vercel-functions/vercel.json +7 -1
- package/package.json +1 -1
- package/build/templates/scaffold/package/pfsense-root/.github/workflows/pfsense-[__WORKSPACE_NAME__].yml +0 -62
|
@@ -2,6 +2,8 @@ import { promises as fs } from 'node:fs';
|
|
|
2
2
|
import { join, relative, sep } from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import prompts from 'prompts';
|
|
5
|
+
import { Runner as DockerHub } from '../../api/docker-hub.js';
|
|
6
|
+
import { GITHUB_RUNNER_IMAGES_README_URL, Runner as GithubRunnerImages, } from '../../api/github-runner-images.js';
|
|
5
7
|
import { libEnvGithub } from '../../lib/env-github.js';
|
|
6
8
|
import { libEnvManagedSet } from '../../lib/env-managed-set.js';
|
|
7
9
|
import { libEnvNamespace } from '../../lib/env-namespace.js';
|
|
@@ -11,11 +13,11 @@ import { libEnvStatus } from '../../lib/env-status.js';
|
|
|
11
13
|
import { getSupportedIgnoreFileBundles, isSupportedIgnoreFileConfigPath, } from '../../lib/ignore-files.js';
|
|
12
14
|
import { libItemAllowedAgents, libItemAllowedPoliciesByRole, libItemAllowedRecipes, libItemOperatingSystemFilePatterns, libItemOperatingSystemFilesByPlatform, libItemRecipesByCategory, libItemSyncRoles, libItemValidEntityRoles, } from '../../lib/item.js';
|
|
13
15
|
import { Runner as LibNovaConfig } from '../../lib/nova-config.js';
|
|
14
|
-
import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_GITHUB_LABEL_COLOR, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
|
|
16
|
+
import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_DOCKER_IMAGE_COMPONENT, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_GITHUB_LABEL_COLOR, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
|
|
15
17
|
import { Runner as LibReleaseHistory } from '../../lib/release-history.js';
|
|
16
18
|
import { discoverPathsWithFile, isPlainObject, pathExists, resolveTemplatePath, } from '../../lib/utility.js';
|
|
17
19
|
import { Runner as LibVersionStrategyMigration } from '../../lib/version-strategy-migration.js';
|
|
18
|
-
import { libWorkflowTemplatesMetadata } from '../../lib/workflow-templates.js';
|
|
20
|
+
import { libWorkflowStepKinds, libWorkflowTemplatesMetadata, } from '../../lib/workflow-templates.js';
|
|
19
21
|
import { Logger } from '../../toolkit/index.js';
|
|
20
22
|
export class Runner {
|
|
21
23
|
static async run(options) {
|
|
@@ -184,6 +186,16 @@ export class Runner {
|
|
|
184
186
|
}
|
|
185
187
|
return true;
|
|
186
188
|
}
|
|
189
|
+
static isEnvironmentPrefixInput(value) {
|
|
190
|
+
if (typeof value !== 'string') {
|
|
191
|
+
return 'Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").';
|
|
192
|
+
}
|
|
193
|
+
const trimmed = value.trim();
|
|
194
|
+
if (libEnvNamespace.isValidPrefix(trimmed) === false) {
|
|
195
|
+
return 'Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").';
|
|
196
|
+
}
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
187
199
|
static isIgnoreFilePathInput(value) {
|
|
188
200
|
if (typeof value !== 'string') {
|
|
189
201
|
return 'Enter a project-relative ignore-file path.';
|
|
@@ -233,6 +245,41 @@ export class Runner {
|
|
|
233
245
|
}
|
|
234
246
|
return true;
|
|
235
247
|
}
|
|
248
|
+
static isWorkflowStepTimeoutInput(value) {
|
|
249
|
+
if (typeof value !== 'string') {
|
|
250
|
+
return 'Enter a JSON object keyed by a supported step kind, or leave the field blank.';
|
|
251
|
+
}
|
|
252
|
+
const trimmed = value.trim();
|
|
253
|
+
if (trimmed === '') {
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
const parsed = JSON.parse(trimmed);
|
|
258
|
+
if (isPlainObject(parsed) === false) {
|
|
259
|
+
return 'Enter a JSON object keyed by a supported step kind.';
|
|
260
|
+
}
|
|
261
|
+
const entries = Object.entries(parsed);
|
|
262
|
+
for (const entry of entries) {
|
|
263
|
+
const typedEntry = entry;
|
|
264
|
+
const entryKind = typedEntry[0];
|
|
265
|
+
const entryValue = typedEntry[1];
|
|
266
|
+
const isKnownKind = libWorkflowStepKinds.some((stepKind) => stepKind === entryKind);
|
|
267
|
+
if (isKnownKind === false) {
|
|
268
|
+
return `Unknown step kind "${entryKind}". Allowed kinds: ${libWorkflowStepKinds.join(', ')}.`;
|
|
269
|
+
}
|
|
270
|
+
if (typeof entryValue !== 'number'
|
|
271
|
+
|| Number.isInteger(entryValue) === false
|
|
272
|
+
|| entryValue < 1
|
|
273
|
+
|| entryValue > 360) {
|
|
274
|
+
return `Enter a whole number from 1 through 360 for "${entryKind}".`;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch {
|
|
279
|
+
return 'Enter valid JSON, for example {"install":10,"deploy":15}.';
|
|
280
|
+
}
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
236
283
|
static isPositiveIntegerRecordInput(value) {
|
|
237
284
|
if (typeof value !== 'string') {
|
|
238
285
|
return 'Enter a JSON object with positive integer values.';
|
|
@@ -361,6 +408,187 @@ export class Runner {
|
|
|
361
408
|
}
|
|
362
409
|
return 'back';
|
|
363
410
|
}
|
|
411
|
+
static async promptDockerHub(config) {
|
|
412
|
+
const liveCategories = await DockerHub.fetchCategories();
|
|
413
|
+
if (liveCategories === undefined) {
|
|
414
|
+
Logger.error('Unable to load Docker Hub categories. The Docker Hub section was cancelled.');
|
|
415
|
+
return 'back';
|
|
416
|
+
}
|
|
417
|
+
const existing = config['dockerHub'];
|
|
418
|
+
const existingRecipes = (config['recipes'] !== undefined) ? config['recipes']['docker-hub'] : undefined;
|
|
419
|
+
const categoryChoices = liveCategories.map((category) => ({
|
|
420
|
+
title: category['name'],
|
|
421
|
+
value: category['slug'],
|
|
422
|
+
selected: (existing !== undefined
|
|
423
|
+
&& existing['categories'] !== undefined
|
|
424
|
+
&& existing['categories'].includes(category['slug']) === true),
|
|
425
|
+
}));
|
|
426
|
+
const visibilityOrder = [
|
|
427
|
+
'public',
|
|
428
|
+
'private',
|
|
429
|
+
];
|
|
430
|
+
const visibilityInitial = (existing !== undefined && existing['visibility'] !== undefined) ? visibilityOrder.indexOf(existing['visibility']) + 1 : 0;
|
|
431
|
+
let immutableInitial = 0;
|
|
432
|
+
if (existing !== undefined && existing['immutableTags'] !== undefined) {
|
|
433
|
+
immutableInitial = (existing['immutableTags']['enabled'] === true) ? 1 : 2;
|
|
434
|
+
}
|
|
435
|
+
const validateDockerHubComponent = (dockerHubComponentValue) => {
|
|
436
|
+
const trimmed = (typeof dockerHubComponentValue === 'string') ? dockerHubComponentValue.trim() : '';
|
|
437
|
+
if (trimmed.length === 0) {
|
|
438
|
+
return 'This value is required.';
|
|
439
|
+
}
|
|
440
|
+
if (LIB_REGEX_PATTERN_DOCKER_IMAGE_COMPONENT.test(trimmed) === false) {
|
|
441
|
+
return 'Use one lowercase Docker image-name component without a registry, path, tag, or digest.';
|
|
442
|
+
}
|
|
443
|
+
return true;
|
|
444
|
+
};
|
|
445
|
+
const basicsOutput = await Runner.promptWithCancel([
|
|
446
|
+
{
|
|
447
|
+
type: 'text',
|
|
448
|
+
name: 'dockerHubNamespace',
|
|
449
|
+
message: 'Docker Hub namespace',
|
|
450
|
+
initial: (existing !== undefined) ? existing['namespace'] : '',
|
|
451
|
+
validate: validateDockerHubComponent,
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
type: 'text',
|
|
455
|
+
name: 'dockerHubRepository',
|
|
456
|
+
message: 'Docker Hub repository',
|
|
457
|
+
initial: (existing !== undefined) ? existing['repository'] : '',
|
|
458
|
+
validate: validateDockerHubComponent,
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
type: 'select',
|
|
462
|
+
name: 'dockerHubVisibility',
|
|
463
|
+
message: 'Repository visibility (sync this field?)',
|
|
464
|
+
choices: [
|
|
465
|
+
{
|
|
466
|
+
title: 'Skip (don\'t sync this field)',
|
|
467
|
+
value: 'skip',
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
title: 'Public',
|
|
471
|
+
value: 'public',
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
title: 'Private',
|
|
475
|
+
value: 'private',
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
initial: visibilityInitial,
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
type: 'multiselect',
|
|
482
|
+
name: 'dockerHubCategories',
|
|
483
|
+
message: 'Repository categories (maximum 3)',
|
|
484
|
+
choices: categoryChoices,
|
|
485
|
+
max: 3,
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
type: 'select',
|
|
489
|
+
name: 'dockerHubImmutableTags',
|
|
490
|
+
message: 'Immutable tags (sync this field?)',
|
|
491
|
+
choices: [
|
|
492
|
+
{
|
|
493
|
+
title: 'Skip (don\'t sync this field)',
|
|
494
|
+
value: 'skip',
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
title: 'Enable',
|
|
498
|
+
value: true,
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
title: 'Disable',
|
|
502
|
+
value: false,
|
|
503
|
+
},
|
|
504
|
+
],
|
|
505
|
+
initial: immutableInitial,
|
|
506
|
+
},
|
|
507
|
+
]);
|
|
508
|
+
if (basicsOutput['cancelled'] === true) {
|
|
509
|
+
return 'back';
|
|
510
|
+
}
|
|
511
|
+
const basicsOutputResult = basicsOutput['result'];
|
|
512
|
+
const namespaceInput = String(basicsOutputResult.dockerHubNamespace).trim();
|
|
513
|
+
const repositoryInput = String(basicsOutputResult.dockerHubRepository).trim();
|
|
514
|
+
const dockerHub = {
|
|
515
|
+
namespace: namespaceInput,
|
|
516
|
+
repository: repositoryInput,
|
|
517
|
+
};
|
|
518
|
+
const visibilityValue = basicsOutputResult.dockerHubVisibility;
|
|
519
|
+
const categorySlugs = (Array.isArray(basicsOutputResult.dockerHubCategories) === true) ? basicsOutputResult.dockerHubCategories : [];
|
|
520
|
+
const immutableValue = basicsOutputResult.dockerHubImmutableTags;
|
|
521
|
+
if (categorySlugs.length > 3) {
|
|
522
|
+
Logger.error('Docker Hub accepts at most 3 repository categories. The Docker Hub section was cancelled.');
|
|
523
|
+
return 'back';
|
|
524
|
+
}
|
|
525
|
+
if (visibilityValue !== 'skip') {
|
|
526
|
+
dockerHub.visibility = visibilityValue;
|
|
527
|
+
}
|
|
528
|
+
dockerHub.categories = categorySlugs;
|
|
529
|
+
let immutableRules = [];
|
|
530
|
+
if (immutableValue !== 'skip') {
|
|
531
|
+
const rulesOutput = await Runner.promptWithCancel({
|
|
532
|
+
type: 'text',
|
|
533
|
+
name: 'dockerHubImmutableTagsRules',
|
|
534
|
+
message: 'Immutable tag rules as a JSON string array',
|
|
535
|
+
initial: (existing !== undefined && existing['immutableTags'] !== undefined) ? JSON.stringify(existing['immutableTags']['rules']) : '[]',
|
|
536
|
+
validate: Runner['isStringArrayInput'],
|
|
537
|
+
});
|
|
538
|
+
if (rulesOutput['cancelled'] === true) {
|
|
539
|
+
return 'back';
|
|
540
|
+
}
|
|
541
|
+
const rulesOutputResult = rulesOutput['result'];
|
|
542
|
+
immutableRules = Runner.parseStringArrayInput(rulesOutputResult.dockerHubImmutableTagsRules);
|
|
543
|
+
dockerHub.immutableTags = {
|
|
544
|
+
enabled: immutableValue,
|
|
545
|
+
rules: immutableRules,
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
const syncIdentityInitial = (existingRecipes !== undefined
|
|
549
|
+
&& existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity']['enabled'] : true;
|
|
550
|
+
const syncPoliciesInitial = (existingRecipes !== undefined
|
|
551
|
+
&& existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies']['enabled'] : false;
|
|
552
|
+
const recipesOutput = await Runner.promptWithCancel([
|
|
553
|
+
{
|
|
554
|
+
type: 'confirm',
|
|
555
|
+
name: 'dockerHubRecipeSyncIdentity',
|
|
556
|
+
message: 'Enable sync-identity recipe?',
|
|
557
|
+
initial: syncIdentityInitial,
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
type: 'confirm',
|
|
561
|
+
name: 'dockerHubRecipeSyncPolicies',
|
|
562
|
+
message: 'Enable sync-policies recipe?',
|
|
563
|
+
initial: syncPoliciesInitial,
|
|
564
|
+
},
|
|
565
|
+
]);
|
|
566
|
+
if (recipesOutput['cancelled'] === true) {
|
|
567
|
+
return 'back';
|
|
568
|
+
}
|
|
569
|
+
const recipesOutputResult = recipesOutput['result'];
|
|
570
|
+
const dockerHubRecipesInput = {
|
|
571
|
+
'sync-identity': {
|
|
572
|
+
...((existingRecipes !== undefined && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity'] : {}),
|
|
573
|
+
enabled: recipesOutputResult.dockerHubRecipeSyncIdentity,
|
|
574
|
+
},
|
|
575
|
+
'sync-policies': {
|
|
576
|
+
...((existingRecipes !== undefined && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies'] : {}),
|
|
577
|
+
enabled: recipesOutputResult.dockerHubRecipeSyncPolicies,
|
|
578
|
+
},
|
|
579
|
+
};
|
|
580
|
+
const recipes = (config['recipes'] !== undefined) ? { ...config['recipes'] } : {};
|
|
581
|
+
Reflect.set(recipes, 'docker-hub', dockerHubRecipesInput);
|
|
582
|
+
Reflect.set(config, 'dockerHub', dockerHub);
|
|
583
|
+
Reflect.set(config, 'recipes', recipes);
|
|
584
|
+
Logger.customize({
|
|
585
|
+
name: 'Runner.promptDockerHub',
|
|
586
|
+
purpose: 'updated',
|
|
587
|
+
padTop: 1,
|
|
588
|
+
padBottom: 1,
|
|
589
|
+
}).info('Docker Hub repository settings updated.');
|
|
590
|
+
return 'back';
|
|
591
|
+
}
|
|
364
592
|
static async promptFlow(config) {
|
|
365
593
|
const category = {
|
|
366
594
|
project: {
|
|
@@ -383,6 +611,11 @@ export class Runner {
|
|
|
383
611
|
description: 'Configure GitHub repository settings, recipes, and policies.',
|
|
384
612
|
handler: Runner['promptGithubMenu'],
|
|
385
613
|
},
|
|
614
|
+
dockerHub: {
|
|
615
|
+
label: 'Docker Hub',
|
|
616
|
+
description: 'Configure Docker Hub repository settings, recipes, and policies.',
|
|
617
|
+
handler: Runner['promptDockerHub'],
|
|
618
|
+
},
|
|
386
619
|
workflows: {
|
|
387
620
|
label: 'Workflows',
|
|
388
621
|
description: 'Configure workflow templates and settings.',
|
|
@@ -487,6 +720,10 @@ export class Runner {
|
|
|
487
720
|
const projectName = (existingProjectName !== undefined) ? { ...existingProjectName } : {};
|
|
488
721
|
const projectDescription = (existingProjectDescription !== undefined) ? { ...existingProjectDescription } : {};
|
|
489
722
|
const projectKeywords = (existingProjectKeywords !== undefined) ? [...existingProjectKeywords] : [];
|
|
723
|
+
const hasDockerHub = config['dockerHub'] !== undefined;
|
|
724
|
+
const shortDescriptionLimit = (hasDockerHub === true) ? 100 : Infinity;
|
|
725
|
+
const shortDescriptionCount = (projectDescription['short'] !== undefined) ? projectDescription['short'].length : 0;
|
|
726
|
+
const shortDescriptionMessage = (hasDockerHub === true) ? `Short description (${shortDescriptionCount}/100)` : 'Short description';
|
|
490
727
|
const validateProjectNameTitle = (projectNameTitleValue) => {
|
|
491
728
|
return Runner.normalizeText(projectNameTitleValue, Infinity)['result'];
|
|
492
729
|
};
|
|
@@ -494,7 +731,12 @@ export class Runner {
|
|
|
494
731
|
return Runner.normalizeProjectSlug(projectNameSlugValue)['result'];
|
|
495
732
|
};
|
|
496
733
|
const validateProjectDescriptionShort = (projectDescriptionShortValue) => {
|
|
497
|
-
|
|
734
|
+
if (hasDockerHub === true
|
|
735
|
+
&& typeof projectDescriptionShortValue === 'string'
|
|
736
|
+
&& projectDescriptionShortValue.trim().length > 100) {
|
|
737
|
+
return 'Docker Hub\'s limit is 100 characters.';
|
|
738
|
+
}
|
|
739
|
+
return Runner.normalizeText(projectDescriptionShortValue, shortDescriptionLimit)['result'];
|
|
498
740
|
};
|
|
499
741
|
const validateProjectDescriptionLong = (projectDescriptionLongValue) => {
|
|
500
742
|
return Runner.normalizeText(projectDescriptionLongValue, Infinity)['result'];
|
|
@@ -520,7 +762,7 @@ export class Runner {
|
|
|
520
762
|
{
|
|
521
763
|
type: 'text',
|
|
522
764
|
name: 'projectDescriptionShort',
|
|
523
|
-
message:
|
|
765
|
+
message: shortDescriptionMessage,
|
|
524
766
|
initial: projectDescription['short'] ?? '',
|
|
525
767
|
validate: validateProjectDescriptionShort,
|
|
526
768
|
},
|
|
@@ -545,7 +787,7 @@ export class Runner {
|
|
|
545
787
|
const questionsOutputResultValue = questionsOutput['result'];
|
|
546
788
|
const projectNameTitleInput = Runner.normalizeText(questionsOutputResultValue.projectNameTitle, Infinity)['sanitized'];
|
|
547
789
|
const projectNameSlugInput = Runner.normalizeProjectSlug(questionsOutputResultValue.projectNameSlug)['sanitized'];
|
|
548
|
-
const projectDescriptionShortInput = Runner.normalizeText(questionsOutputResultValue.projectDescriptionShort,
|
|
790
|
+
const projectDescriptionShortInput = Runner.normalizeText(questionsOutputResultValue.projectDescriptionShort, shortDescriptionLimit)['sanitized'];
|
|
549
791
|
const projectDescriptionLongInput = Runner.normalizeText(questionsOutputResultValue.projectDescriptionLong, Infinity)['sanitized'];
|
|
550
792
|
const projectKeywordsInput = Runner.normalizeTextArray(questionsOutputResultValue.projectKeywords, 50)['sanitized'];
|
|
551
793
|
if (projectNameTitleInput !== undefined) {
|
|
@@ -3729,9 +3971,44 @@ export class Runner {
|
|
|
3729
3971
|
}
|
|
3730
3972
|
}
|
|
3731
3973
|
static async promptWorkflowsForm(workflow, mode, workflows, config) {
|
|
3974
|
+
const runnerImages = await GithubRunnerImages.fetchRunnerImages();
|
|
3975
|
+
if (runnerImages === undefined) {
|
|
3976
|
+
Logger.customize({
|
|
3977
|
+
name: 'Runner.promptWorkflowsForm',
|
|
3978
|
+
purpose: 'runners',
|
|
3979
|
+
}).error(`Could not read GitHub's runner list from ${GITHUB_RUNNER_IMAGES_README_URL}.`);
|
|
3980
|
+
return {
|
|
3981
|
+
action: 'back',
|
|
3982
|
+
};
|
|
3983
|
+
}
|
|
3984
|
+
const selectableRunnerLabels = GithubRunnerImages.selectableLabels(runnerImages);
|
|
3985
|
+
const existingRunsOn = (workflow !== undefined && typeof workflow['runsOn'] === 'string') ? workflow['runsOn'] : '';
|
|
3986
|
+
const runnerChoices = selectableRunnerLabels.map((entry) => {
|
|
3987
|
+
const paidSuffix = (entry['paid'] === true) ? ' (paid)' : '';
|
|
3988
|
+
return {
|
|
3989
|
+
title: `${entry['label']}${paidSuffix}`,
|
|
3990
|
+
description: `${entry['imageName']}, ${entry['architecture']}`,
|
|
3991
|
+
value: entry['label'],
|
|
3992
|
+
};
|
|
3993
|
+
});
|
|
3994
|
+
let runnerInitialIndex = selectableRunnerLabels.findIndex((entry) => entry['label'] === existingRunsOn);
|
|
3995
|
+
if (runnerInitialIndex === -1) {
|
|
3996
|
+
runnerInitialIndex = selectableRunnerLabels.findIndex((entry) => entry['label'].startsWith('ubuntu-') === true && entry['architecture'] === 'x64');
|
|
3997
|
+
}
|
|
3998
|
+
if (runnerInitialIndex === -1) {
|
|
3999
|
+
Logger.customize({
|
|
4000
|
+
name: 'Runner.promptWorkflowsForm',
|
|
4001
|
+
purpose: 'runners',
|
|
4002
|
+
}).error('GitHub\'s runner list does not contain an available pinned Ubuntu x64 label.');
|
|
4003
|
+
return {
|
|
4004
|
+
action: 'back',
|
|
4005
|
+
};
|
|
4006
|
+
}
|
|
3732
4007
|
const existingTemplate = (workflow !== undefined && typeof workflow['template'] === 'string') ? workflow['template'] : '';
|
|
3733
4008
|
const existingSuffix = (workflow !== undefined && typeof workflow['name'] === 'string') ? workflow['name'] : '';
|
|
3734
4009
|
const existingTimeoutMinutes = (workflow !== undefined && typeof workflow['timeoutMinutes'] === 'number') ? workflow['timeoutMinutes'] : undefined;
|
|
4010
|
+
const existingBuildTimeoutMinutes = (workflow !== undefined && typeof workflow['buildTimeoutMinutes'] === 'number') ? workflow['buildTimeoutMinutes'] : undefined;
|
|
4011
|
+
const existingStepTimeoutMinutes = (workflow !== undefined) ? workflow['stepTimeoutMinutes'] : undefined;
|
|
3735
4012
|
const existingEnvironmentSelection = (workflow !== undefined) ? workflow['environmentSelection'] : undefined;
|
|
3736
4013
|
const existingContainerPlatforms = (workflow !== undefined
|
|
3737
4014
|
&& Array.isArray(workflow['containerPlatforms']) === true
|
|
@@ -3813,11 +4090,8 @@ export class Runner {
|
|
|
3813
4090
|
type: 'select',
|
|
3814
4091
|
name: 'runsOn',
|
|
3815
4092
|
message: 'GitHub-hosted runner',
|
|
3816
|
-
choices:
|
|
3817
|
-
|
|
3818
|
-
value: 'ubuntu-latest',
|
|
3819
|
-
}],
|
|
3820
|
-
initial: 0,
|
|
4093
|
+
choices: runnerChoices,
|
|
4094
|
+
initial: runnerInitialIndex,
|
|
3821
4095
|
},
|
|
3822
4096
|
{
|
|
3823
4097
|
type: 'text',
|
|
@@ -3826,6 +4100,20 @@ export class Runner {
|
|
|
3826
4100
|
initial: (existingTimeoutMinutes === undefined) ? '' : `${existingTimeoutMinutes}`,
|
|
3827
4101
|
validate: Runner['isOptionalWorkflowTimeoutInput'],
|
|
3828
4102
|
},
|
|
4103
|
+
...((selectedTemplate === 'publish') ? [{
|
|
4104
|
+
type: 'text',
|
|
4105
|
+
name: 'buildTimeoutMinutes',
|
|
4106
|
+
message: 'Publish build job timeout in minutes (1-360; blank inherits the workflow timeout)',
|
|
4107
|
+
initial: (existingBuildTimeoutMinutes === undefined) ? '' : `${existingBuildTimeoutMinutes}`,
|
|
4108
|
+
validate: Runner['isOptionalWorkflowTimeoutInput'],
|
|
4109
|
+
}] : []),
|
|
4110
|
+
{
|
|
4111
|
+
type: 'text',
|
|
4112
|
+
name: 'stepTimeoutMinutes',
|
|
4113
|
+
message: `Step timeouts as JSON (${libWorkflowStepKinds.join(', ')}; blank keeps defaults)`,
|
|
4114
|
+
initial: (existingStepTimeoutMinutes === undefined) ? '' : JSON.stringify(existingStepTimeoutMinutes),
|
|
4115
|
+
validate: Runner['isWorkflowStepTimeoutInput'],
|
|
4116
|
+
},
|
|
3829
4117
|
]);
|
|
3830
4118
|
if (executionOutput['cancelled'] === true) {
|
|
3831
4119
|
return {
|
|
@@ -3833,9 +4121,13 @@ export class Runner {
|
|
|
3833
4121
|
};
|
|
3834
4122
|
}
|
|
3835
4123
|
const executionOutputResultValue = executionOutput['result'];
|
|
3836
|
-
const selectedRunsOn =
|
|
4124
|
+
const selectedRunsOn = executionOutputResultValue['runsOn'];
|
|
3837
4125
|
const timeoutMinutesRaw = (typeof executionOutputResultValue.timeoutMinutes === 'string') ? executionOutputResultValue.timeoutMinutes.trim() : '';
|
|
3838
4126
|
const selectedTimeoutMinutes = (timeoutMinutesRaw === '') ? undefined : Number.parseInt(timeoutMinutesRaw, 10);
|
|
4127
|
+
const buildTimeoutMinutesRaw = (typeof executionOutputResultValue.buildTimeoutMinutes === 'string') ? executionOutputResultValue.buildTimeoutMinutes.trim() : '';
|
|
4128
|
+
const selectedBuildTimeoutMinutes = (buildTimeoutMinutesRaw === '') ? undefined : Number.parseInt(buildTimeoutMinutesRaw, 10);
|
|
4129
|
+
const stepTimeoutMinutesRaw = (typeof executionOutputResultValue.stepTimeoutMinutes === 'string') ? executionOutputResultValue.stepTimeoutMinutes.trim() : '';
|
|
4130
|
+
const selectedStepTimeoutMinutes = (stepTimeoutMinutesRaw === '') ? undefined : JSON.parse(stepTimeoutMinutesRaw);
|
|
3839
4131
|
const triggersDir = join(resolveTemplatePath(import.meta.url, 'generators/github/workflows'), selectedTemplate, 'triggers');
|
|
3840
4132
|
const triggersDirExists = await pathExists(triggersDir);
|
|
3841
4133
|
const triggerChoices = [];
|
|
@@ -3976,7 +4268,22 @@ export class Runner {
|
|
|
3976
4268
|
if ((matchedMetadata !== undefined
|
|
3977
4269
|
&& matchedMetadata['supportsTargets'] === true)
|
|
3978
4270
|
|| selectedTargets.length > 0) {
|
|
3979
|
-
const availableTargetTypes = (matchedMetadata !== undefined) ? Object.keys(matchedMetadata['targets'] ?? {})
|
|
4271
|
+
const availableTargetTypes = (matchedMetadata !== undefined) ? Object.keys(matchedMetadata['targets'] ?? {}).filter((availableTargetType) => {
|
|
4272
|
+
const availableTargetMetadata = (matchedMetadata['targets'] !== undefined) ? matchedMetadata['targets'][availableTargetType] : undefined;
|
|
4273
|
+
if (availableTargetMetadata === undefined
|
|
4274
|
+
|| (availableTargetMetadata['workspaceRole'] === undefined
|
|
4275
|
+
&& availableTargetMetadata['workspaceNamePrefix'] === undefined)) {
|
|
4276
|
+
return true;
|
|
4277
|
+
}
|
|
4278
|
+
return workspaceKeys.some((workspaceKey) => {
|
|
4279
|
+
const availableTargetWorkspace = (config['workspaces'] !== undefined) ? config['workspaces'][workspaceKey] : undefined;
|
|
4280
|
+
return (availableTargetWorkspace !== undefined
|
|
4281
|
+
&& (availableTargetMetadata['workspaceRole'] === undefined
|
|
4282
|
+
|| availableTargetWorkspace['role'] === availableTargetMetadata['workspaceRole'])
|
|
4283
|
+
&& (availableTargetMetadata['workspaceNamePrefix'] === undefined
|
|
4284
|
+
|| availableTargetWorkspace['name'].startsWith(availableTargetMetadata['workspaceNamePrefix']) === true));
|
|
4285
|
+
});
|
|
4286
|
+
}) : [];
|
|
3980
4287
|
const existingTargetTypes = selectedTargets.map((target) => target['to']);
|
|
3981
4288
|
const hasContainerTargetInAnotherWorkflow = workflows.some((candidate) => {
|
|
3982
4289
|
if (candidate === workflow || Array.isArray(candidate['deploy']) === false) {
|
|
@@ -4100,8 +4407,20 @@ export class Runner {
|
|
|
4100
4407
|
const isContainerTarget = selectedTargetType === 'docker-hub' || selectedTargetType === 'ghcr';
|
|
4101
4408
|
let selectedTargetWorkingDir = './';
|
|
4102
4409
|
if (isContainerTarget === false) {
|
|
4103
|
-
const
|
|
4104
|
-
|
|
4410
|
+
const targetPathMetadata = (matchedMetadata !== undefined
|
|
4411
|
+
&& matchedMetadata['targets'] !== undefined) ? matchedMetadata['targets'][selectedTargetType] : undefined;
|
|
4412
|
+
const targetWorkspaceKeys = workspaceKeys.filter((workspaceKey) => {
|
|
4413
|
+
const targetPathWorkspace = (config['workspaces'] !== undefined) ? config['workspaces'][workspaceKey] : undefined;
|
|
4414
|
+
return (targetPathWorkspace !== undefined
|
|
4415
|
+
&& (targetPathMetadata === undefined
|
|
4416
|
+
|| targetPathMetadata['workspaceRole'] === undefined
|
|
4417
|
+
|| targetPathWorkspace['role'] === targetPathMetadata['workspaceRole'])
|
|
4418
|
+
&& (targetPathMetadata === undefined
|
|
4419
|
+
|| targetPathMetadata['workspaceNamePrefix'] === undefined
|
|
4420
|
+
|| targetPathWorkspace['name'].startsWith(targetPathMetadata['workspaceNamePrefix']) === true));
|
|
4421
|
+
});
|
|
4422
|
+
const targetWorkingDirInitial = (targetToEdit !== undefined) ? targetWorkspaceKeys.indexOf(targetToEdit['path']) : 0;
|
|
4423
|
+
const targetWorkingDirChoices = targetWorkspaceKeys.map((workspaceKey) => ({
|
|
4105
4424
|
title: workspaceKey,
|
|
4106
4425
|
value: workspaceKey,
|
|
4107
4426
|
}));
|
|
@@ -4165,16 +4484,27 @@ export class Runner {
|
|
|
4165
4484
|
const targetNeedsOutputResultValue = targetNeedsOutput['result'];
|
|
4166
4485
|
selectedTargetNeeds = (Array.isArray(targetNeedsOutputResultValue.targetNeeds) === true && targetNeedsOutputResultValue.targetNeeds.length > 0) ? targetNeedsOutputResultValue.targetNeeds : undefined;
|
|
4167
4486
|
}
|
|
4168
|
-
const targetSettingsOutput = await Runner.promptWithCancel(
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4487
|
+
const targetSettingsOutput = await Runner.promptWithCancel([
|
|
4488
|
+
{
|
|
4489
|
+
type: 'text',
|
|
4490
|
+
name: 'targetTimeoutMinutes',
|
|
4491
|
+
message: 'Target job timeout in minutes (1-360; blank inherits the workflow timeout)',
|
|
4492
|
+
initial: (targetToEdit !== undefined && targetToEdit['timeoutMinutes'] !== undefined) ? `${targetToEdit['timeoutMinutes']}` : '',
|
|
4493
|
+
validate: Runner['isOptionalWorkflowTimeoutInput'],
|
|
4494
|
+
},
|
|
4495
|
+
{
|
|
4496
|
+
type: 'text',
|
|
4497
|
+
name: 'targetSettings',
|
|
4498
|
+
message: 'Target settings as a JSON object (blank unsets)',
|
|
4499
|
+
initial: (targetToEdit !== undefined && targetToEdit['with'] !== undefined) ? JSON.stringify(targetToEdit['with']) : '',
|
|
4500
|
+
validate: Runner['isStringRecordInput'],
|
|
4501
|
+
},
|
|
4502
|
+
]);
|
|
4175
4503
|
if (targetSettingsOutput['cancelled'] === true) {
|
|
4176
4504
|
continue;
|
|
4177
4505
|
}
|
|
4506
|
+
const targetTimeoutMinutesRaw = (typeof targetSettingsOutput['result'].targetTimeoutMinutes === 'string') ? targetSettingsOutput['result'].targetTimeoutMinutes.trim() : '';
|
|
4507
|
+
const selectedTargetTimeoutMinutes = (targetTimeoutMinutesRaw === '') ? undefined : Number.parseInt(targetTimeoutMinutesRaw, 10);
|
|
4178
4508
|
const targetSettings = Runner.parseStringRecordInput(targetSettingsOutput['result'].targetSettings);
|
|
4179
4509
|
const selectedTargetMetadata = (matchedMetadata === undefined || matchedMetadata['targets'] === undefined) ? undefined : matchedMetadata['targets'][selectedTargetType];
|
|
4180
4510
|
const targetRequiredLiterals = (selectedTargetMetadata === undefined || selectedTargetMetadata['requiredLiterals'] === undefined) ? {} : selectedTargetMetadata['requiredLiterals'];
|
|
@@ -4209,6 +4539,9 @@ export class Runner {
|
|
|
4209
4539
|
to: selectedTargetType,
|
|
4210
4540
|
path: selectedTargetWorkingDir,
|
|
4211
4541
|
};
|
|
4542
|
+
if (selectedTargetTimeoutMinutes !== undefined) {
|
|
4543
|
+
Reflect.set(newTarget, 'timeoutMinutes', selectedTargetTimeoutMinutes);
|
|
4544
|
+
}
|
|
4212
4545
|
if (selectedTargetNeeds !== undefined) {
|
|
4213
4546
|
Reflect.set(newTarget, 'after', selectedTargetNeeds);
|
|
4214
4547
|
}
|
|
@@ -4481,6 +4814,12 @@ export class Runner {
|
|
|
4481
4814
|
if (selectedTimeoutMinutes !== undefined) {
|
|
4482
4815
|
Reflect.set(resolvedWorkflow, 'timeoutMinutes', selectedTimeoutMinutes);
|
|
4483
4816
|
}
|
|
4817
|
+
if (selectedBuildTimeoutMinutes !== undefined) {
|
|
4818
|
+
Reflect.set(resolvedWorkflow, 'buildTimeoutMinutes', selectedBuildTimeoutMinutes);
|
|
4819
|
+
}
|
|
4820
|
+
if (selectedStepTimeoutMinutes !== undefined) {
|
|
4821
|
+
Reflect.set(resolvedWorkflow, 'stepTimeoutMinutes', selectedStepTimeoutMinutes);
|
|
4822
|
+
}
|
|
4484
4823
|
if (selectedEnvironmentSelection !== undefined) {
|
|
4485
4824
|
Reflect.set(resolvedWorkflow, 'environmentSelection', selectedEnvironmentSelection);
|
|
4486
4825
|
}
|
|
@@ -5025,8 +5364,14 @@ export class Runner {
|
|
|
5025
5364
|
const prefixOutput = await Runner.promptWithCancel({
|
|
5026
5365
|
type: 'text',
|
|
5027
5366
|
name: 'prefix',
|
|
5028
|
-
message: `Prefix for workflow "${workflowName}" (blank removes it)
|
|
5367
|
+
message: `Prefix for workflow "${workflowName}" (e.g. "CBN_", blank removes it):`,
|
|
5029
5368
|
initial: (existing !== undefined) ? existing['prefix'] : '',
|
|
5369
|
+
validate: (value) => {
|
|
5370
|
+
if (typeof value === 'string' && value.trim() === '') {
|
|
5371
|
+
return true;
|
|
5372
|
+
}
|
|
5373
|
+
return Runner.isEnvironmentPrefixInput(value);
|
|
5374
|
+
},
|
|
5030
5375
|
});
|
|
5031
5376
|
if (prefixOutput['cancelled'] === true) {
|
|
5032
5377
|
return 'back';
|
|
@@ -5035,6 +5380,24 @@ export class Runner {
|
|
|
5035
5380
|
if (prefix === '') {
|
|
5036
5381
|
Reflect.deleteProperty(workflows, workflowName);
|
|
5037
5382
|
}
|
|
5383
|
+
else if (libEnvNamespace.isValidPrefix(prefix) === false) {
|
|
5384
|
+
Logger.customize({
|
|
5385
|
+
name: 'Runner.promptEnvironmentWorkflow',
|
|
5386
|
+
purpose: 'prefixFormat',
|
|
5387
|
+
padTop: 1,
|
|
5388
|
+
padBottom: 1,
|
|
5389
|
+
}).error('Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").');
|
|
5390
|
+
return 'back';
|
|
5391
|
+
}
|
|
5392
|
+
else if (libEnvNamespace.isReservedPrefix(prefix) === true) {
|
|
5393
|
+
Logger.customize({
|
|
5394
|
+
name: 'Runner.promptEnvironmentWorkflow',
|
|
5395
|
+
purpose: 'reservedPrefix',
|
|
5396
|
+
padTop: 1,
|
|
5397
|
+
padBottom: 1,
|
|
5398
|
+
}).error(`The prefix "${prefix}" is reserved by GitHub. Choose a prefix that does not start with "GITHUB_".`);
|
|
5399
|
+
return 'back';
|
|
5400
|
+
}
|
|
5038
5401
|
else {
|
|
5039
5402
|
Reflect.set(workflows, workflowName, { prefix });
|
|
5040
5403
|
}
|
|
@@ -5291,15 +5654,24 @@ export class Runner {
|
|
|
5291
5654
|
name: 'prefix',
|
|
5292
5655
|
message: 'GitHub name prefix (e.g. "CBN_"):',
|
|
5293
5656
|
initial: prefix,
|
|
5294
|
-
validate: Runner['
|
|
5657
|
+
validate: Runner['isEnvironmentPrefixInput'],
|
|
5295
5658
|
});
|
|
5296
5659
|
if (prefixOutput['cancelled'] === true) {
|
|
5297
5660
|
continue;
|
|
5298
5661
|
}
|
|
5299
|
-
const prefixInput = prefixOutput['result'].prefix.trim()
|
|
5662
|
+
const prefixInput = prefixOutput['result'].prefix.trim();
|
|
5300
5663
|
if (prefixInput === '') {
|
|
5301
5664
|
continue;
|
|
5302
5665
|
}
|
|
5666
|
+
if (libEnvNamespace.isValidPrefix(prefixInput) === false) {
|
|
5667
|
+
Logger.customize({
|
|
5668
|
+
name: 'Runner.promptEnvironmentScope',
|
|
5669
|
+
purpose: 'prefixFormat',
|
|
5670
|
+
padTop: 1,
|
|
5671
|
+
padBottom: 1,
|
|
5672
|
+
}).error('Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").');
|
|
5673
|
+
continue;
|
|
5674
|
+
}
|
|
5303
5675
|
if (libEnvNamespace.isReservedPrefix(prefixInput) === true) {
|
|
5304
5676
|
Logger.customize({
|
|
5305
5677
|
name: 'Runner.promptEnvironmentScope',
|