@theholocron/astromech 5.0.0-alpha.243 → 5.0.0-alpha.244
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/dist/config/index.mjs +2 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.mjs +282 -38
- package/dist/{load-DdHEVFlG.mjs → load-Bk9SYAfX.mjs} +1 -19
- package/dist/release/index.d.mts +50 -3
- package/dist/release/index.mjs +95 -14
- package/dist/schema-Djtv0sLM.mjs +19 -0
- package/package.json +2 -2
package/dist/config/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as normalizeTaskEntry } from "../schema-Djtv0sLM.mjs";
|
|
2
|
+
import { n as coerceTasks, t as loadTasksConfig } from "../load-Bk9SYAfX.mjs";
|
|
2
3
|
import { createDefineConfig, mergeLayers } from "@theholocron/datapad";
|
|
3
4
|
//#region src/config/define/define.ts
|
|
4
5
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -848,6 +848,12 @@ interface DiscoverWorkspacePackagesOptions extends Pick<ListWorkspacePackagesOpt
|
|
|
848
848
|
* `observability`). A package belongs when it is that folder or sits under it.
|
|
849
849
|
*/
|
|
850
850
|
group?: string;
|
|
851
|
+
/**
|
|
852
|
+
* Leave out the packages of these version groups. A repo that releases some folders on
|
|
853
|
+
* their own line releases everything else together, and that release must not sweep the
|
|
854
|
+
* independent groups in.
|
|
855
|
+
*/
|
|
856
|
+
excludeGroups?: readonly string[];
|
|
851
857
|
}
|
|
852
858
|
/**
|
|
853
859
|
* Every package the repo's `pnpm-workspace.yaml` declares, as
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as normalizeTaskEntry } from "./schema-Djtv0sLM.mjs";
|
|
2
|
+
import { t as loadTasksConfig } from "./load-Bk9SYAfX.mjs";
|
|
2
3
|
import { n as alexrc_default, t as editorconfig_checker_default } from "./editorconfig-checker-DPejtR5z.mjs";
|
|
3
4
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
4
5
|
import { isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
@@ -82,8 +83,8 @@ function discoverWorkspacePackages(repoRoot, options = {}) {
|
|
|
82
83
|
listDirs: options.listDirs
|
|
83
84
|
})) if (!exclude.some((pattern) => matches(entry.relativeDir, pattern))) entries.set(entry.relativeDir, entry);
|
|
84
85
|
}
|
|
85
|
-
const
|
|
86
|
-
return
|
|
86
|
+
const { group, excludeGroups = [] } = options;
|
|
87
|
+
return [...entries.values()].filter(({ relativeDir }) => (group === void 0 || inGroup(relativeDir, group)) && !excludeGroups.some((excluded) => inGroup(relativeDir, excluded)));
|
|
87
88
|
}
|
|
88
89
|
/** `relativeDir` is the group's folder, or is under it. `clients` holds `clients/http`, not `clients-old/x`. */
|
|
89
90
|
function inGroup(relativeDir, group) {
|
|
@@ -366,6 +367,251 @@ var verification_unitTests_default$1 = "name: Test\n\non: # yamllint disable-lin
|
|
|
366
367
|
//#region src/templates/reusable/verification.visualRegression.yml
|
|
367
368
|
var verification_visualRegression_default$1 = "name: Visual Regression\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n inputs:\n chromatic-projects:\n description: >\n JSON array of Chromatic projects to build, one matrix job per entry.\n Each entry: { \"tokenName\": \"WEB\", \"workingDir\": \"apps/web\", \"buildScript\": \"build:storybook\" }.\n tokenName maps to secret CHROMATIC_PROJECT_TOKEN_<TOKENNAME>; use \"default\"\n (or omit for the legacy empty-string form) to use the bare CHROMATIC_PROJECT_TOKEN\n secret for single-project repos.\n buildScript defaults to \"build:storybook\" when omitted.\n Required -- this task only exists in a repo's workflow list when it\n opts into Chromatic at all (holocron#394/#1062): GitHub evaluates a\n job's `if:` before expanding its `strategy.matrix`, so no default\n here (empty or otherwise) can make a *disabled* Chromatic job\n disappear from PR checks -- only not generating this job's thin\n caller in the first place can. A repo that doesn't want Chromatic\n simply omits `verification.visualRegression` from its `tasks:`.\n type: string\n required: true\n secrets:\n CHROMATIC_PROJECT_TOKEN:\n required: false\n\njobs:\n visual-and-composition:\n name: Run visual and composition tests\n strategy:\n fail-fast: false\n matrix:\n project: ${{ fromJSON(inputs.chromatic-projects) }}\n permissions:\n contents: read\n statuses: write\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - uses: chromaui/action@14cfaef73576e69f95f47f60058063f46ca38719 # v18\n name: Publish to Chromatic\n with:\n projectToken: ${{ (matrix.project.tokenName == 'default' || matrix.project.tokenName == '') && secrets.CHROMATIC_PROJECT_TOKEN || secrets[format('CHROMATIC_PROJECT_TOKEN_{0}', matrix.project.tokenName)] }}\n token: ${{ github.token }}\n buildScriptName: ${{ matrix.project.buildScript || 'build:storybook' }}\n workingDir: ${{ matrix.project.workingDir || '.' }}\n storybookBaseDir: ${{ matrix.project.storybookBaseDir || '' }}\n untraced: ${{ matrix.project.untraced || '' }}\n onlyStoryFiles: ${{ matrix.project.onlyStoryFiles || '' }}\n exitZeroOnChanges: ${{ matrix.project.exitZeroOnChanges || false }}\n";
|
|
368
369
|
//#endregion
|
|
370
|
+
//#region src/templates/workflows/bookkeeping.yml
|
|
371
|
+
var bookkeeping_default = "name: Platform\n\non: # yamllint disable-line rule:truthy\n pull_request:\n types:\n - opened\n - edited\n\npermissions:\n contents: read\n issues: write\n pull-requests: write\n\njobs:\n bookkeeping:\n name: Bookkeeping\n uses: theholocron/.github/.github/workflows/bookkeeping.yml@main\n secrets: inherit\n";
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/templates/workflows/delivery.build.yml
|
|
374
|
+
var delivery_build_default = "name: Delivery\n\non: # yamllint disable-line rule:truthy\n push:\n branches-ignore:\n - main # delivery.publish builds before publishing\n pull_request:\n branches:\n - main\n\nconcurrency:\n group: delivery.build-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n\njobs:\n build:\n name: Build\n uses: theholocron/.github/.github/workflows/delivery.build.yml@main\n secrets: inherit\n";
|
|
375
|
+
//#endregion
|
|
376
|
+
//#region src/templates/workflows/delivery.bundleSize.yml
|
|
377
|
+
var delivery_bundleSize_default = "name: Delivery\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\npermissions:\n contents: read\n\njobs:\n bundle-size:\n name: Audit the Bundle Size\n uses: theholocron/.github/.github/workflows/delivery.bundleSize.yml@main\n secrets: inherit\n";
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/templates/workflows/delivery.deploy.yml
|
|
380
|
+
var delivery_deploy_default = "name: Delivery\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main]\n workflow_dispatch:\n\nconcurrency:\n group: pages\n cancel-in-progress: false\n\npermissions:\n contents: read\n pages: write\n id-token: write\n\njobs:\n deploy:\n name: Deploy\n uses: theholocron/.github/.github/workflows/delivery.deploy.yml@main\n secrets: inherit\n";
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/templates/workflows/delivery.previewCheck.yml
|
|
383
|
+
var delivery_previewCheck_default = "name: Delivery\n\non: # yamllint disable-line rule:truthy\n deployment_status:\n\npermissions:\n contents: read\n # Must be a superset of what the reusable workflow's own job\n # requests (holocron#1058) -- GitHub hard-fails the whole run at\n # startup, zero jobs dispatched, if the callee asks for more than\n # the caller grants. Needed for the author-trust step's\n # commits/{sha}/pulls lookup.\n pull-requests: read\n\njobs:\n preview-check:\n name: Preview Check\n # environment_url is the only field documented to point at the live\n # app — target_url can point at a deployment-details page instead,\n # so there's no safe fallback to it. No environment_url means\n # nothing to check; skip the job entirely rather than hit the wrong\n # page.\n if: >-\n github.event.deployment_status.state == 'success' &&\n github.event.deployment.environment == 'Preview' &&\n github.event.deployment_status.environment_url != ''\n uses: theholocron/.github/.github/workflows/delivery.previewCheck.yml@main\n with:\n preview-url: ${{ github.event.deployment_status.environment_url }}\n # GitHub evaluates which version of this workflow file to run\n # from the default branch for a deployment_status event (unlike\n # push/pull_request) -- without this, the reusable workflow's\n # checkout would default to that same ref instead of the PR's\n # actual deployed commit.\n sha: ${{ github.event.deployment.sha }}\n secrets:\n # Named explicitly, not `secrets: inherit` -- this job needs only\n # these two secrets (holocron#1030/#1032), not every secret this\n # workflow's caller context has access to (e.g.\n # HOLOCRON_DEPLOYMENTS_TOKEN). VERCEL_TOKEN here is read-only use\n # (verifying deployment ownership), never a write/deploy\n # credential.\n VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}\n VERCEL_PROTECTION_BYPASS_SECRET: ${{ secrets.VERCEL_PROTECTION_BYPASS_SECRET }}\n";
|
|
384
|
+
//#endregion
|
|
385
|
+
//#region src/templates/workflows/delivery.previewDeploy.yml
|
|
386
|
+
var delivery_previewDeploy_default = "name: Delivery\n\non: # yamllint disable-line rule:truthy\n pull_request: {}\n\nconcurrency:\n group: preview-deploy-${{ github.event.pull_request.number }}\n # Not true: a cancelled run could land between Vercel accepting the\n # upload and the report job posting a status, leaving a real preview\n # deployment with no corresponding GitHub check — worse than letting an\n # overlapping run for the same PR simply queue.\n cancel-in-progress: false\n\npermissions:\n contents: read\n deployments: write\n # Must be a superset of what the reusable workflow's own job requests\n # (holocron#1058) -- its new path-relevance check lists the PR's\n # changed files via the API (holocron#1023).\n pull-requests: read\n\njobs:\n preview-deploy:\n name: Preview Deploy\n uses: theholocron/.github/.github/workflows/delivery.previewDeploy.yml@main\n with:\n cwd: \".\"\n secrets: inherit\n";
|
|
387
|
+
//#endregion
|
|
388
|
+
//#region src/templates/workflows/delivery.publish.yml
|
|
389
|
+
var delivery_publish_default = "name: Delivery\n\non: # yamllint disable-line rule:truthy\n push:\n branches:\n - main\n - alpha\n workflow_dispatch:\n inputs:\n dry_run:\n description: >\n Dry run — analyze commits and preview the release without git writes\n or publish. Push-triggered runs always run fully; this only applies\n to manual workflow_dispatch triggers.\n required: false\n default: true\n type: boolean\n\npermissions:\n contents: write\n id-token: write\n issues: write\n pull-requests: write\n\nconcurrency:\n group: ${{ github.workflow }}-${{ github.ref }}\n cancel-in-progress: false\n\njobs:\n release:\n name: Release\n uses: theholocron/.github/.github/workflows/delivery.publish.yml@main\n with:\n dry-run: ${{ inputs.dry_run == true }}\n secrets: inherit\n";
|
|
390
|
+
//#endregion
|
|
391
|
+
//#region src/templates/workflows/dependencies.yml
|
|
392
|
+
var dependencies_default = "name: Platform\n\non: # yamllint disable-line rule:truthy\n pull_request:\n\npermissions:\n contents: write\n pull-requests: write\n\njobs:\n dependencies:\n name: Dependencies\n uses: theholocron/.github/.github/workflows/dependencies.yml@main\n secrets: inherit\n";
|
|
393
|
+
//#endregion
|
|
394
|
+
//#region src/templates/workflows/greetings.yml
|
|
395
|
+
var greetings_default = "name: Platform\n\non: # yamllint disable-line rule:truthy\n pull_request:\n issues:\n\npermissions:\n issues: write\n pull-requests: write\n\njobs:\n greetings:\n name: Greetings\n uses: theholocron/.github/.github/workflows/greetings.yml@main\n secrets: inherit\n";
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region src/templates/workflows/knowledge.wiki.yml
|
|
398
|
+
var knowledge_wiki_default = "name: Knowledge\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main]\n pull_request:\n branches: [main]\n\nconcurrency:\n group: ${{ github.event_name == 'pull_request' && format('wiki-preview-{0}', github.event.pull_request.number) || 'wiki' }}\n cancel-in-progress: ${{ github.event_name == 'pull_request' }}\n\npermissions:\n contents: read\n deployments: write\n\njobs:\n publish:\n name: Publish\n if: ${{ github.event_name != 'pull_request' }}\n uses: theholocron/.github/.github/workflows/knowledge.wiki.yml@main\n secrets: inherit\n\n preview:\n name: Preview\n if: ${{ github.event_name == 'pull_request' }}\n uses: theholocron/.github/.github/workflows/knowledge.wiki.yml@main\n with:\n preview: true\n preview-id: pr-${{ github.event.pull_request.number }}\n secrets: inherit\n";
|
|
399
|
+
//#endregion
|
|
400
|
+
//#region src/templates/workflows/platform.commitStandards.yml
|
|
401
|
+
var platform_commitStandards_default = "name: Platform\n\non: # yamllint disable-line rule:truthy\n pull_request:\n\nconcurrency:\n group: platform-commit-standards-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n\njobs:\n commit-standards:\n name: Commit Standards\n uses: theholocron/.github/.github/workflows/platform.commitStandards.yml@main\n secrets: inherit\n";
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/templates/workflows/platform.notifyCheck.yml
|
|
404
|
+
var platform_notifyCheck_default = "name: Platform\n\non: # yamllint disable-line rule:truthy\n workflow_dispatch: {}\n\npermissions: {}\n\njobs:\n notify-check:\n name: Notify Check\n uses: theholocron/.github/.github/workflows/platform.notifyCheck.yml@main\n secrets: inherit\n";
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region src/templates/workflows/platform.repoSync.yml
|
|
407
|
+
var platform_repoSync_default = "name: Platform\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main]\n paths:\n - holocron.config.ts\n - package.json\n - pnpm-workspace.yaml\n workflow_dispatch:\n inputs:\n steps:\n description: \"Sync steps to run (default: all)\"\n type: string\n required: false\n\nconcurrency:\n group: sync-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: write\n pull-requests: write\n\njobs:\n sync:\n name: Sync\n uses: theholocron/.github/.github/workflows/platform.repoSync.yml@main\n with:\n steps: ${{ inputs.steps }}\n secrets: inherit\n";
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region src/templates/workflows/platform.repoValidation.yml
|
|
410
|
+
var platform_repoValidation_default = "name: Platform\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\npermissions:\n contents: read\n\njobs:\n repo-validation:\n name: Repo Validation\n uses: theholocron/.github/.github/workflows/platform.repoValidation.yml@main\n secrets: inherit\n";
|
|
411
|
+
//#endregion
|
|
412
|
+
//#region src/templates/workflows/platform.syncTemplates.yml
|
|
413
|
+
var platform_syncTemplates_default = "name: Platform\n\n# Bootstrap note: this `uses:` a reusable workflow that must already exist\n# on theholocron/.github's main branch to resolve at all — a brand-new\n# reusable workflow here needs ONE manual `holocron sync github` run\n# (pushing directly to theholocron/.github) before this thin caller can\n# ever successfully trigger it, since GitHub resolves `uses:` at run time,\n# not at merge time. Same deadlock every reusable workflow added here hits\n# on its first introduction.\non: # yamllint disable-line rule:truthy\n push:\n # main only — this publishes to theholocron/.github, consumed by every\n # other repo's CI. alpha is the prerelease channel; publishing from it\n # would let unreleased/unstable template changes overwrite what main\n # just published, the same stable-vs-prerelease split this org already\n # enforces for npm's dist-tags and Sentinel's own deploy trigger.\n branches: [main]\n paths:\n - cli/astromech/src/templates/**\n - cli/astromech/src/generators/**\n - cli/astromech/src/registry/**\n - cli/cli/src/templates/**\n workflow_dispatch: {}\n\nconcurrency:\n group: sync-templates\n cancel-in-progress: false\n\npermissions:\n contents: read\n\njobs:\n sync-templates:\n name: Sync Templates\n # workflow_dispatch can target ANY ref, not only main — without this,\n # anyone able to dispatch this workflow (a broader group than who can\n # push to main) could run it against an arbitrary branch, checking out\n # and building that ref's own code with the sync token present, then\n # publishing that ref's templates to theholocron/.github.\n if: github.ref == 'refs/heads/main'\n uses: theholocron/.github/.github/workflows/platform.syncTemplates.yml@main\n secrets: inherit\n";
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/templates/workflows/preview.yml
|
|
416
|
+
var preview_default = "name: Preview\n\non: # yamllint disable-line rule:truthy\n pull_request:\n branches: [main]\n\nconcurrency:\n group: preview-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n deployments: write\n pull-requests: write\n\njobs:\n preview:\n name: Preview\n uses: theholocron/.github/.github/workflows/preview.yml@main\n secrets: inherit\n";
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/templates/workflows/review.yml
|
|
419
|
+
var review_default = "name: Source Quality\n\non: # yamllint disable-line rule:truthy\n pull_request:\n\nconcurrency:\n group: review-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n checks: write\n pull-requests: write\n\njobs:\n review:\n name: Annotations\n uses: theholocron/.github/.github/workflows/review.yml@main\n secrets: inherit\n";
|
|
420
|
+
//#endregion
|
|
421
|
+
//#region src/templates/workflows/security.codeScanning.yml
|
|
422
|
+
var security_codeScanning_default = "name: Security\n\non: # yamllint disable-line rule:truthy\n push:\n branches:\n - main\n pull_request:\n branches:\n - main\n schedule:\n - cron: \"0 0 * * 1\"\n\npermissions:\n actions: read\n contents: read\n security-events: write\n\njobs:\n security:\n name: Code Scanning\n uses: theholocron/.github/.github/workflows/security.codeScanning.yml@main\n secrets: inherit\n";
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/templates/workflows/security.secretDetection.yml
|
|
425
|
+
var security_secretDetection_default = "name: Security\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\nconcurrency:\n group: security-secret-detection-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n\njobs:\n secret-detection:\n name: Secret Detection\n uses: theholocron/.github/.github/workflows/security.secretDetection.yml@main\n secrets: inherit\n";
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/templates/workflows/sourceQuality.deadCodeAnalysis.yml
|
|
428
|
+
var sourceQuality_deadCodeAnalysis_default = "name: Source Quality\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\npermissions:\n contents: read\n\njobs:\n dead-code-analysis:\n name: Dead Code Analysis\n uses: theholocron/.github/.github/workflows/sourceQuality.deadCodeAnalysis.yml@main\n secrets: inherit\n";
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/templates/workflows/sourceQuality.formatting.yml
|
|
431
|
+
var sourceQuality_formatting_default = "name: Source Quality\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\nconcurrency:\n group: source-quality-formatting-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: write\n statuses: write\n\njobs:\n formatting:\n name: Formatting\n uses: theholocron/.github/.github/workflows/sourceQuality.formatting.yml@main\n secrets: inherit\n";
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/templates/workflows/sourceQuality.staticAnalysis.yml
|
|
434
|
+
var sourceQuality_staticAnalysis_default = "name: Source Quality\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\nconcurrency:\n group: source-quality-static-analysis-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: write\n statuses: write\n\njobs:\n static-analysis:\n name: Static Analysis\n uses: theholocron/.github/.github/workflows/sourceQuality.staticAnalysis.yml@main\n secrets: inherit\n";
|
|
435
|
+
//#endregion
|
|
436
|
+
//#region src/templates/workflows/sourceQuality.structuredDataValidation.yml
|
|
437
|
+
var sourceQuality_structuredDataValidation_default = "name: Source Quality\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\nconcurrency:\n group: source-quality-structured-data-validation-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n\njobs:\n structured-data-validation:\n name: Structured Data Validation\n uses: theholocron/.github/.github/workflows/sourceQuality.structuredDataValidation.yml@main\n secrets: inherit\n";
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/templates/workflows/stale.yml
|
|
440
|
+
var stale_default = "name: Stale\n\non: # yamllint disable-line rule:truthy\n schedule:\n - cron: \"30 1 * * *\"\n\npermissions:\n contents: write\n issues: write\n pull-requests: write\n\njobs:\n stale:\n uses: theholocron/.github/.github/workflows/stale.yml@main\n with:\n exempt-issue-labels: \"in-progress,wip\"\n exempt-all-issue-milestones: true\n exempt-all-issue-projects: true\n exempt-all-pr-projects: true\n secrets: inherit\n";
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/templates/workflows/verification.performance.yml
|
|
443
|
+
var verification_performance_default = "name: Verification\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\npermissions:\n contents: read\n\njobs:\n performance:\n name: Audit the Performance\n uses: theholocron/.github/.github/workflows/verification.performance.yml@main\n secrets: inherit\n";
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/templates/workflows/verification.typeSafety.yml
|
|
446
|
+
var verification_typeSafety_default = "name: Verification\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\nconcurrency:\n group: typecheck-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n\njobs:\n typecheck:\n name: Typecheck\n uses: theholocron/.github/.github/workflows/verification.typeSafety.yml@main\n secrets: inherit\n";
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/templates/workflows/verification.unitTests.yml
|
|
449
|
+
var verification_unitTests_default = "name: Verification\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\nconcurrency:\n group: test-${{ github.ref }}\n cancel-in-progress: true\n\npermissions:\n contents: read\n id-token: write\n statuses: write\n\njobs:\n test:\n name: Test\n uses: theholocron/.github/.github/workflows/verification.unitTests.yml@main\n with:\n run-unit: true\n secrets: inherit\n";
|
|
450
|
+
//#endregion
|
|
451
|
+
//#region src/templates/workflows/verification.visualRegression.yml
|
|
452
|
+
var verification_visualRegression_default = "name: Visual Regression\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main, alpha]\n pull_request:\n\npermissions:\n contents: read\n statuses: write\n\njobs:\n visual-and-composition:\n name: Visual Regression\n uses: theholocron/.github/.github/workflows/verification.visualRegression.yml@main\n secrets: inherit\n";
|
|
453
|
+
//#endregion
|
|
454
|
+
//#region src/generators/github-action-thin-callers/grouped-publish/yaml-scalar.ts
|
|
455
|
+
/**
|
|
456
|
+
* A value as a YAML scalar for a `with:` entry. Bare `[` and `{` would parse as
|
|
457
|
+
* sequence and mapping nodes, so values that start with one (JSON) are single-quoted
|
|
458
|
+
* and stay strings.
|
|
459
|
+
*/
|
|
460
|
+
function yamlScalar(value) {
|
|
461
|
+
if (value === true) return "true";
|
|
462
|
+
if (value === false) return "false";
|
|
463
|
+
const text = String(value);
|
|
464
|
+
return text.startsWith("[") || text.startsWith("{") ? `'${text}'` : text;
|
|
465
|
+
}
|
|
466
|
+
//#endregion
|
|
467
|
+
//#region src/generators/github-action-thin-callers/grouped-publish/grouped-publish.ts
|
|
468
|
+
/** The reusable's inputs a group may set for itself; everything else is shared by all releases. */
|
|
469
|
+
const GROUP_INPUTS = [
|
|
470
|
+
"deploy-on-release",
|
|
471
|
+
"post-release",
|
|
472
|
+
"run-build",
|
|
473
|
+
"sentry-project"
|
|
474
|
+
];
|
|
475
|
+
/** Same rule as `groupReleaseConfig()`: the name is a tag prefix and a folder. */
|
|
476
|
+
const GROUP_NAME = /^[a-z][a-z0-9-]*$/;
|
|
477
|
+
/** Names the `group` choice already uses. */
|
|
478
|
+
const RESERVED = ["all", "ungrouped"];
|
|
479
|
+
/** Validate a group's (or the ungrouped release's) own inputs. */
|
|
480
|
+
function parseInputs(label, inputs) {
|
|
481
|
+
for (const [key, value] of Object.entries(inputs)) {
|
|
482
|
+
if (!GROUP_INPUTS.includes(key)) throw new TypeError(`delivery.publish: ${label} sets "${key}", which is not per-release; use one of ${GROUP_INPUTS.join(", ")}`);
|
|
483
|
+
if (typeof value !== "string" && typeof value !== "boolean") throw new TypeError(`delivery.publish: ${label} input "${key}" must be a string or a boolean`);
|
|
484
|
+
}
|
|
485
|
+
return inputs;
|
|
486
|
+
}
|
|
487
|
+
/**
|
|
488
|
+
* Validate a `delivery.publish` `groups` list and flatten it to matrix entries.
|
|
489
|
+
* A group is its folder name, or `{ name, ...inputs }` to set some of the reusable's
|
|
490
|
+
* inputs for that group alone (`sentry-project` and `deploy-on-release` belong to one
|
|
491
|
+
* release, not to every release in the matrix).
|
|
492
|
+
*/
|
|
493
|
+
function parseGroups(groups) {
|
|
494
|
+
if (!Array.isArray(groups) || groups.length === 0) throw new TypeError("delivery.publish: `groups` must be a non-empty list of version-group folders");
|
|
495
|
+
const seen = /* @__PURE__ */ new Set();
|
|
496
|
+
return groups.map((raw) => {
|
|
497
|
+
const { name, ...inputs } = typeof raw === "string" ? { name: raw } : raw ?? {};
|
|
498
|
+
if (typeof name !== "string" || !GROUP_NAME.test(name) || RESERVED.includes(name)) throw new TypeError(`delivery.publish: a group is a lowercase folder name like "clients" (not ${RESERVED.map((r) => `"${r}"`).join(" or ")}), got ${JSON.stringify(name)}`);
|
|
499
|
+
if (seen.has(name)) throw new TypeError(`delivery.publish: group "${name}" is listed twice`);
|
|
500
|
+
seen.add(name);
|
|
501
|
+
return {
|
|
502
|
+
group: name,
|
|
503
|
+
...parseInputs(`group "${name}"`, inputs)
|
|
504
|
+
};
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* The `delivery.publish` thin caller for a repo that releases several version groups:
|
|
509
|
+
* a `plan` job picks the groups, and a matrix job calls the reusable workflow once per
|
|
510
|
+
* group. `base` is the plain caller template; its triggers, permissions and concurrency
|
|
511
|
+
* are kept, and its `jobs:` replaced.
|
|
512
|
+
*
|
|
513
|
+
* - Groups release **one at a time** (`max-parallel: 1`): each release pushes a commit to
|
|
514
|
+
* the branch, and the next group's run checks out the branch tip (see the reusable's
|
|
515
|
+
* `group` input). `fail-fast` is off so one group's failure does not skip the rest.
|
|
516
|
+
* - A push releases every group; a manual run can pick one (and dry-run it) with the
|
|
517
|
+
* `group` input. A job's `if:` cannot see `matrix`, so the choice is made in `plan`.
|
|
518
|
+
* - `ungrouped` also releases everything that is in **no** group, together and under the
|
|
519
|
+
* repo's plain tags, as the single release did before; it runs first. It takes the same
|
|
520
|
+
* per-release inputs as a group (`true` for none). A repo with groups and packages in no
|
|
521
|
+
* group needs it, or those packages would stop releasing.
|
|
522
|
+
* - `shared` entries (and the template's own `dry-run`) go to every release; the
|
|
523
|
+
* per-group inputs come from the matrix entry.
|
|
524
|
+
*/
|
|
525
|
+
function groupedPublishCaller(base, groups, shared, ungrouped = false) {
|
|
526
|
+
const entries = parseGroups(groups);
|
|
527
|
+
const ungroupedInputs = ungrouped === true ? {} : ungrouped && typeof ungrouped === "object" && !Array.isArray(ungrouped) ? parseInputs("`ungrouped`", ungrouped) : void 0;
|
|
528
|
+
if (ungrouped !== false && ungrouped !== void 0 && ungroupedInputs === void 0) throw new TypeError("delivery.publish: `ungrouped` must be true, or an object of per-release inputs");
|
|
529
|
+
const perGroup = GROUP_INPUTS.filter((key) => entries.some((entry) => key in entry));
|
|
530
|
+
const clash = [...perGroup, ...Object.keys(ungroupedInputs ?? {})].filter((key) => key in shared);
|
|
531
|
+
if (clash.length > 0) throw new TypeError(`delivery.publish: ${[...new Set(clash)].join(", ")} is set both for every release and for one`);
|
|
532
|
+
const groupInput = [
|
|
533
|
+
" group:",
|
|
534
|
+
" description: >",
|
|
535
|
+
" Release one version group instead of all of them. Push-triggered",
|
|
536
|
+
" runs always release everything.",
|
|
537
|
+
" required: false",
|
|
538
|
+
" default: all",
|
|
539
|
+
" type: choice",
|
|
540
|
+
" options:",
|
|
541
|
+
" - all",
|
|
542
|
+
...ungroupedInputs ? [" - ungrouped"] : [],
|
|
543
|
+
...entries.map((entry) => ` - ${entry.group}`),
|
|
544
|
+
""
|
|
545
|
+
].join("\n");
|
|
546
|
+
const head = base.slice(0, base.indexOf("jobs:\n")).replace(/( {8}type: boolean\n)/, `$1${groupInput}`);
|
|
547
|
+
const templateWith = base.match(/ {4}with:\n((?: {6}[^\n]+\n)*)/)[1].split("\n").filter(Boolean);
|
|
548
|
+
const sharedWith = Object.entries(shared).map(([key, value]) => ` ${key}: ${yamlScalar(value)}`);
|
|
549
|
+
const matrixWith = [
|
|
550
|
+
...templateWith,
|
|
551
|
+
" group: ${{ matrix.group }}",
|
|
552
|
+
...sharedWith,
|
|
553
|
+
...perGroup.map((key) => {
|
|
554
|
+
return ` ${key}: \${{ matrix.${key}${entries.every((entry) => !(key in entry) || typeof entry[key] === "boolean") ? " == true" : ""} }}`;
|
|
555
|
+
})
|
|
556
|
+
];
|
|
557
|
+
const matrixJson = JSON.stringify(entries).replaceAll("'", "''");
|
|
558
|
+
const uses = " uses: theholocron/.github/.github/workflows/delivery.publish.yml@main";
|
|
559
|
+
const ungroupedJob = ungroupedInputs ? [
|
|
560
|
+
" release:",
|
|
561
|
+
" name: Release",
|
|
562
|
+
" if: ${{ inputs.group == '' || inputs.group == 'all' || inputs.group == 'ungrouped' }}",
|
|
563
|
+
uses,
|
|
564
|
+
" with:",
|
|
565
|
+
...templateWith,
|
|
566
|
+
...sharedWith,
|
|
567
|
+
...Object.entries(ungroupedInputs).map(([key, value]) => ` ${key}: ${yamlScalar(value)}`),
|
|
568
|
+
" secrets: inherit",
|
|
569
|
+
""
|
|
570
|
+
] : [];
|
|
571
|
+
return [
|
|
572
|
+
`${head}jobs:`,
|
|
573
|
+
...ungroupedJob,
|
|
574
|
+
" plan:",
|
|
575
|
+
" name: Plan",
|
|
576
|
+
" runs-on: ubuntu-latest",
|
|
577
|
+
" permissions: {}",
|
|
578
|
+
" outputs:",
|
|
579
|
+
" groups: ${{ steps.plan.outputs.groups }}",
|
|
580
|
+
" steps:",
|
|
581
|
+
" - id: plan",
|
|
582
|
+
" name: Choose the groups to release",
|
|
583
|
+
" env:",
|
|
584
|
+
" GROUP: ${{ inputs.group }}",
|
|
585
|
+
` ALL_GROUPS: '${matrixJson}'`,
|
|
586
|
+
" run: |",
|
|
587
|
+
" if [ -n \"$GROUP\" ] && [ \"$GROUP\" != \"all\" ]; then",
|
|
588
|
+
` groups=$(jq -c --arg group "$GROUP" '[.[] | select(.group == $group)]' <<<"$ALL_GROUPS")`,
|
|
589
|
+
" else",
|
|
590
|
+
" groups=$ALL_GROUPS",
|
|
591
|
+
" fi",
|
|
592
|
+
" echo \"groups=$groups\" >> \"$GITHUB_OUTPUT\"",
|
|
593
|
+
"",
|
|
594
|
+
` ${ungroupedInputs ? "release-groups" : "release"}:`,
|
|
595
|
+
" name: Release ${{ matrix.group }}",
|
|
596
|
+
...ungroupedInputs ? [
|
|
597
|
+
" # after the ungrouped release, which pushes its own commit first; still run if it failed or was skipped.",
|
|
598
|
+
" # Choosing `ungrouped` by hand leaves the plan empty, and a matrix with no entries fails the run.",
|
|
599
|
+
" needs: [plan, release]",
|
|
600
|
+
" if: ${{ !cancelled() && needs.plan.result == 'success' && needs.plan.outputs.groups != '[]' }}"
|
|
601
|
+
] : [" needs: plan"],
|
|
602
|
+
" strategy:",
|
|
603
|
+
" fail-fast: false",
|
|
604
|
+
" max-parallel: 1",
|
|
605
|
+
" matrix:",
|
|
606
|
+
" include: ${{ fromJSON(needs.plan.outputs.groups) }}",
|
|
607
|
+
uses,
|
|
608
|
+
" with:",
|
|
609
|
+
...matrixWith,
|
|
610
|
+
" secrets: inherit",
|
|
611
|
+
""
|
|
612
|
+
].join("\n");
|
|
613
|
+
}
|
|
614
|
+
//#endregion
|
|
369
615
|
//#region src/generators/github-action-thin-callers/github-action-thin-callers.ts
|
|
370
616
|
/**
|
|
371
617
|
* Workflow templates + thin-caller generation.
|
|
@@ -375,34 +621,34 @@ var verification_visualRegression_default$1 = "name: Visual Regression\n\non: #
|
|
|
375
621
|
* into the thin caller `holocron repo setup` / `holocron repo sync` write locally.
|
|
376
622
|
*/
|
|
377
623
|
const WORKFLOW_TEMPLATES = {
|
|
378
|
-
"verification.unitTests":
|
|
379
|
-
"verification.visualRegression":
|
|
380
|
-
"verification.typeSafety":
|
|
381
|
-
"verification.performance":
|
|
382
|
-
"sourceQuality.staticAnalysis":
|
|
383
|
-
"sourceQuality.formatting":
|
|
384
|
-
"sourceQuality.structuredDataValidation":
|
|
385
|
-
"sourceQuality.deadCodeAnalysis":
|
|
386
|
-
"security.secretDetection":
|
|
387
|
-
"security.codeScanning":
|
|
388
|
-
"delivery.build":
|
|
389
|
-
"delivery.publish":
|
|
390
|
-
"delivery.deploy":
|
|
391
|
-
"delivery.bundleSize":
|
|
392
|
-
"delivery.previewCheck":
|
|
393
|
-
"delivery.previewDeploy":
|
|
394
|
-
"platform.repoSync":
|
|
395
|
-
"platform.notifyCheck":
|
|
396
|
-
"platform.commitStandards":
|
|
397
|
-
"platform.repoValidation":
|
|
398
|
-
"platform.syncTemplates":
|
|
399
|
-
"knowledge.wiki":
|
|
400
|
-
preview:
|
|
401
|
-
review:
|
|
402
|
-
stale:
|
|
403
|
-
greetings:
|
|
404
|
-
dependencies:
|
|
405
|
-
bookkeeping:
|
|
624
|
+
"verification.unitTests": verification_unitTests_default,
|
|
625
|
+
"verification.visualRegression": verification_visualRegression_default,
|
|
626
|
+
"verification.typeSafety": verification_typeSafety_default,
|
|
627
|
+
"verification.performance": verification_performance_default,
|
|
628
|
+
"sourceQuality.staticAnalysis": sourceQuality_staticAnalysis_default,
|
|
629
|
+
"sourceQuality.formatting": sourceQuality_formatting_default,
|
|
630
|
+
"sourceQuality.structuredDataValidation": sourceQuality_structuredDataValidation_default,
|
|
631
|
+
"sourceQuality.deadCodeAnalysis": sourceQuality_deadCodeAnalysis_default,
|
|
632
|
+
"security.secretDetection": security_secretDetection_default,
|
|
633
|
+
"security.codeScanning": security_codeScanning_default,
|
|
634
|
+
"delivery.build": delivery_build_default,
|
|
635
|
+
"delivery.publish": delivery_publish_default,
|
|
636
|
+
"delivery.deploy": delivery_deploy_default,
|
|
637
|
+
"delivery.bundleSize": delivery_bundleSize_default,
|
|
638
|
+
"delivery.previewCheck": delivery_previewCheck_default,
|
|
639
|
+
"delivery.previewDeploy": delivery_previewDeploy_default,
|
|
640
|
+
"platform.repoSync": platform_repoSync_default,
|
|
641
|
+
"platform.notifyCheck": platform_notifyCheck_default,
|
|
642
|
+
"platform.commitStandards": platform_commitStandards_default,
|
|
643
|
+
"platform.repoValidation": platform_repoValidation_default,
|
|
644
|
+
"platform.syncTemplates": platform_syncTemplates_default,
|
|
645
|
+
"knowledge.wiki": knowledge_wiki_default,
|
|
646
|
+
preview: preview_default,
|
|
647
|
+
review: review_default,
|
|
648
|
+
stale: stale_default,
|
|
649
|
+
greetings: greetings_default,
|
|
650
|
+
dependencies: dependencies_default,
|
|
651
|
+
bookkeeping: bookkeeping_default
|
|
406
652
|
};
|
|
407
653
|
const KNOWN_WORKFLOWS = new Set(Object.keys(WORKFLOW_TEMPLATES));
|
|
408
654
|
/**
|
|
@@ -451,12 +697,10 @@ const WORKFLOW_CHECK_CONTEXTS = {
|
|
|
451
697
|
function generateThinCallerContent(name, withOverrides, additionalPaths, logger, comments) {
|
|
452
698
|
const base = WORKFLOW_TEMPLATES[name];
|
|
453
699
|
if (!base) return "";
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
return s.startsWith("[") || s.startsWith("{") ? `'${s}'` : s;
|
|
459
|
-
};
|
|
700
|
+
if (name === "delivery.publish" && withOverrides && "groups" in withOverrides) {
|
|
701
|
+
const { groups, ungrouped, ...shared } = withOverrides;
|
|
702
|
+
return groupedPublishCaller(base, groups, shared, ungrouped);
|
|
703
|
+
}
|
|
460
704
|
const fmt = (k, v) => {
|
|
461
705
|
const line = ` ${k}: ${yamlScalar(v)}`;
|
|
462
706
|
return comments?.[k] ? ` # ${comments[k]}\n${line}` : line;
|
|
@@ -621,7 +865,7 @@ function normalizeWorkflowWith(raw) {
|
|
|
621
865
|
...p,
|
|
622
866
|
...Array.isArray(p.untraced) ? { untraced: p.untraced.join("\n") } : {}
|
|
623
867
|
}));
|
|
624
|
-
for (const [k, v] of Object.entries(result)) if (Array.isArray(v)) result[k] = JSON.stringify(v);
|
|
868
|
+
for (const [k, v] of Object.entries(result)) if (Array.isArray(v) && k !== "groups") result[k] = JSON.stringify(v);
|
|
625
869
|
return result;
|
|
626
870
|
}
|
|
627
871
|
/**
|
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
import { loadLayered } from "@theholocron/datapad";
|
|
2
|
-
//#region src/config/schema/schema.ts
|
|
3
|
-
/**
|
|
4
|
-
* The `tasks` config shape — the single manifest of what a repo runs.
|
|
5
|
-
* Read from a dedicated `astromech.config.*` file or the `tasks` key of
|
|
6
|
-
* `holocron.config.*` (see {@link loadTasksConfig}).
|
|
7
|
-
*
|
|
8
|
-
* Runtime validation is the loader's job, not this type's — the type only
|
|
9
|
-
* describes what an author writes.
|
|
10
|
-
*/
|
|
11
|
-
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
12
|
-
function normalizeTaskEntry(item) {
|
|
13
|
-
return {
|
|
14
|
-
ci: true,
|
|
15
|
-
local: true,
|
|
16
|
-
...typeof item === "string" ? { name: item } : item
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
2
|
//#region src/config/coerce-tasks/coerce-tasks.ts
|
|
21
3
|
/** A bare item array is shorthand for `{ tasks: [...] }`. */
|
|
22
4
|
function coerceTasks(value) {
|
|
@@ -52,4 +34,4 @@ async function loadTasksConfig(cwd, options = {}) {
|
|
|
52
34
|
}))?.config ?? {};
|
|
53
35
|
}
|
|
54
36
|
//#endregion
|
|
55
|
-
export { coerceTasks as n,
|
|
37
|
+
export { coerceTasks as n, loadTasksConfig as t };
|
package/dist/release/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { r as TasksConfig } from "../schema.type-eVRlTGL1.mjs";
|
|
1
2
|
import { defineConfig } from "@theholocron/semantic-release-config";
|
|
2
3
|
//#region src/release/commit-files/commit-files.d.ts
|
|
3
4
|
/** Runs `git` with `args` in `cwd`, feeding it `input` on stdin, and returns stdout. */
|
|
@@ -24,7 +25,7 @@ interface ReleaseContext {
|
|
|
24
25
|
[key: string]: unknown;
|
|
25
26
|
}
|
|
26
27
|
/** A semantic-release plugin step that looks at commits. */
|
|
27
|
-
type CommitStep = "analyzeCommits" | "generateNotes";
|
|
28
|
+
type CommitStep = "analyzeCommits" | "generateNotes" | "success";
|
|
28
29
|
type StepFn = (pluginConfig: unknown, context: ReleaseContext) => unknown;
|
|
29
30
|
/** A plugin module that implements `Step`. */
|
|
30
31
|
type StepPlugin<Step extends CommitStep> = Partial<Record<Step, StepFn>>;
|
|
@@ -50,7 +51,22 @@ interface FolderScopedDeps {
|
|
|
50
51
|
* where a release actually runs. Commits are listed with one `git diff-tree`
|
|
51
52
|
* call, in `context.cwd`.
|
|
52
53
|
*/
|
|
53
|
-
declare function folderScoped<Step extends CommitStep>(step: Step, paths: readonly string[],
|
|
54
|
+
declare function folderScoped<Step extends CommitStep>(step: Step, paths: readonly string[], deps?: FolderScopedDeps): StepPlugin<Step>;
|
|
55
|
+
/**
|
|
56
|
+
* The mirror of {@link folderScoped}, for the release of everything that is in **no**
|
|
57
|
+
* version group: it sees only commits that changed a file outside every group folder. A commit
|
|
58
|
+
* confined to a group (and the group's imported history) belongs to that group's release; letting the
|
|
59
|
+
* repo-wide one analyze it would release the repo for a change that is not in it, and write the
|
|
60
|
+
* group's commits into the repo's changelog.
|
|
61
|
+
*/
|
|
62
|
+
declare function ungroupedScoped<Step extends CommitStep>(step: Step, groups: readonly string[], deps?: FolderScopedDeps): StepPlugin<Step>;
|
|
63
|
+
/**
|
|
64
|
+
* Splits the GitHub plugin's entry so its "released in…" comments and labels go only to the PRs and
|
|
65
|
+
* issues of the commits `scoped` keeps. The entry stays as it was, so it still publishes the GitHub
|
|
66
|
+
* release, but with the commenting turned off; `scoped` (a {@link folderScoped} or
|
|
67
|
+
* {@link ungroupedScoped} `success` step) then does the commenting with the entry's own config.
|
|
68
|
+
*/
|
|
69
|
+
declare function commentOnlyFor(entry: string | [string, Record<string, unknown> | undefined], scoped: StepPlugin<"success">): ((string | [string, Record<string, unknown> | undefined]) | [object, unknown])[];
|
|
54
70
|
//#endregion
|
|
55
71
|
//#region src/release/group-release-config/group-release-config.type.d.ts
|
|
56
72
|
/** What `defineConfig()` from `@theholocron/semantic-release-config` accepts. */
|
|
@@ -90,5 +106,36 @@ declare function groupReleaseConfig(options: GroupReleaseOptions): object;
|
|
|
90
106
|
* not `clients-old/x.ts`.
|
|
91
107
|
*/
|
|
92
108
|
declare function inScope(files: readonly string[], paths: readonly string[]): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Whether any of `files` sits **outside** every one of `folders`: the mirror of
|
|
111
|
+
* {@link inScope}. A commit that only touches the version groups' folders is out;
|
|
112
|
+
* one that touches anything else, even beside a group's files, is in.
|
|
113
|
+
*/
|
|
114
|
+
declare function outsideFolders(files: readonly string[], folders: readonly string[]): boolean;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/release/release-groups/release-groups.d.ts
|
|
117
|
+
/**
|
|
118
|
+
* The version groups a repo releases on their own: the folder names listed under `groups`
|
|
119
|
+
* in its `delivery.publish` task. This is what the generated publish workflow reads, so a
|
|
120
|
+
* release config that asks here stays in step with it instead of keeping a second list.
|
|
121
|
+
* `[]` for a repo that releases as one.
|
|
122
|
+
*/
|
|
123
|
+
declare function releaseGroups(config: Pick<TasksConfig, "tasks">): string[];
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/release/ungrouped-release-config/ungrouped-release-config.type.d.ts
|
|
126
|
+
interface UngroupedReleaseOptions extends DefineConfigOptions {
|
|
127
|
+
/** The version groups released on their own: folders of the repo whose commits this release ignores. */
|
|
128
|
+
groups: readonly string[];
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region src/release/ungrouped-release-config/ungrouped-release-config.d.ts
|
|
132
|
+
/**
|
|
133
|
+
* The semantic-release config for everything that is in no version group, built on the org's
|
|
134
|
+
* `defineConfig()`: tags, changelog and release commit are the repo's own, as before. The commit
|
|
135
|
+
* analyzer and notes generator skip commits confined to the `groups` folders, because those
|
|
136
|
+
* belong to the groups' releases ({@link ungroupedScoped}). With no groups it is `defineConfig()`
|
|
137
|
+
* unchanged.
|
|
138
|
+
*/
|
|
139
|
+
declare function ungroupedReleaseConfig({ groups, ...options }: UngroupedReleaseOptions): object;
|
|
93
140
|
//#endregion
|
|
94
|
-
export { type CommitStep, type DefineConfigOptions, type FolderScopedDeps, GitRun, type GroupReleaseOptions, type ReleaseCommit, type ReleaseContext, type StepPlugin, commitFiles, folderScoped, groupReleaseConfig, inScope };
|
|
141
|
+
export { type CommitStep, type DefineConfigOptions, type FolderScopedDeps, GitRun, type GroupReleaseOptions, type ReleaseCommit, type ReleaseContext, type StepPlugin, type UngroupedReleaseOptions, commentOnlyFor, commitFiles, folderScoped, groupReleaseConfig, inScope, outsideFolders, releaseGroups, ungroupedReleaseConfig, ungroupedScoped };
|
package/dist/release/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as normalizeTaskEntry } from "../schema-Djtv0sLM.mjs";
|
|
1
2
|
import { execFileSync } from "node:child_process";
|
|
2
3
|
import { defineConfig } from "@theholocron/semantic-release-config";
|
|
3
4
|
//#region src/release/commit-files/commit-files.ts
|
|
@@ -45,12 +46,22 @@ function inScope(files, paths) {
|
|
|
45
46
|
const folders = paths.map((path) => path.replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
46
47
|
return files.some((file) => folders.some((folder) => file === folder || file.startsWith(`${folder}/`)));
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether any of `files` sits **outside** every one of `folders`: the mirror of
|
|
51
|
+
* {@link inScope}. A commit that only touches the version groups' folders is out;
|
|
52
|
+
* one that touches anything else, even beside a group's files, is in.
|
|
53
|
+
*/
|
|
54
|
+
function outsideFolders(files, folders) {
|
|
55
|
+
const normalized = folders.map((folder) => folder.replace(/^\.\//, "").replace(/\/+$/, ""));
|
|
56
|
+
return files.some((file) => !normalized.some((folder) => file === folder || file.startsWith(`${folder}/`)));
|
|
57
|
+
}
|
|
48
58
|
//#endregion
|
|
49
59
|
//#region src/release/folder-scoped/folder-scoped.ts
|
|
50
|
-
/** The semantic-release plugin that implements each commit-reading step. */
|
|
60
|
+
/** The semantic-release plugin that implements each commit-reading step. `success` is the GitHub plugin's "released in…" comments. */
|
|
51
61
|
const MODULES = {
|
|
52
62
|
analyzeCommits: "@semantic-release/commit-analyzer",
|
|
53
|
-
generateNotes: "@semantic-release/release-notes-generator"
|
|
63
|
+
generateNotes: "@semantic-release/release-notes-generator",
|
|
64
|
+
success: "@semantic-release/github"
|
|
54
65
|
};
|
|
55
66
|
/**
|
|
56
67
|
* An inline semantic-release plugin that runs `step` of the stock plugin
|
|
@@ -64,19 +75,46 @@ const MODULES = {
|
|
|
64
75
|
* where a release actually runs. Commits are listed with one `git diff-tree`
|
|
65
76
|
* call, in `context.cwd`.
|
|
66
77
|
*/
|
|
67
|
-
function folderScoped(step, paths,
|
|
78
|
+
function folderScoped(step, paths, deps = {}) {
|
|
79
|
+
return scopedBy(step, (files) => inScope(files, paths), deps);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The mirror of {@link folderScoped}, for the release of everything that is in **no**
|
|
83
|
+
* version group: it sees only commits that changed a file outside every group folder. A commit
|
|
84
|
+
* confined to a group (and the group's imported history) belongs to that group's release; letting the
|
|
85
|
+
* repo-wide one analyze it would release the repo for a change that is not in it, and write the
|
|
86
|
+
* group's commits into the repo's changelog.
|
|
87
|
+
*/
|
|
88
|
+
function ungroupedScoped(step, groups, deps = {}) {
|
|
89
|
+
return scopedBy(step, (files) => outsideFolders(files, groups), deps);
|
|
90
|
+
}
|
|
91
|
+
function scopedBy(step, keep, { load = (specifier) => import(specifier), listFiles = commitFiles }) {
|
|
68
92
|
const scoped = async (pluginConfig, context) => {
|
|
69
93
|
const inner = await load(MODULES[step]);
|
|
70
94
|
const { commits = [], cwd = process.cwd() } = context;
|
|
71
95
|
const files = listFiles(cwd, commits.map((commit) => commit.hash));
|
|
72
|
-
const
|
|
96
|
+
const kept = commits.filter((commit) => keep(files.get(commit.hash) ?? []));
|
|
73
97
|
return inner[step]?.(pluginConfig, {
|
|
74
98
|
...context,
|
|
75
|
-
commits:
|
|
99
|
+
commits: kept
|
|
76
100
|
});
|
|
77
101
|
};
|
|
78
102
|
return { [step]: scoped };
|
|
79
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Splits the GitHub plugin's entry so its "released in…" comments and labels go only to the PRs and
|
|
106
|
+
* issues of the commits `scoped` keeps. The entry stays as it was, so it still publishes the GitHub
|
|
107
|
+
* release, but with the commenting turned off; `scoped` (a {@link folderScoped} or
|
|
108
|
+
* {@link ungroupedScoped} `success` step) then does the commenting with the entry's own config.
|
|
109
|
+
*/
|
|
110
|
+
function commentOnlyFor(entry, scoped) {
|
|
111
|
+
const [name, config] = Array.isArray(entry) ? entry : [entry, void 0];
|
|
112
|
+
return [[name, {
|
|
113
|
+
...config,
|
|
114
|
+
successComment: false,
|
|
115
|
+
releasedLabels: false
|
|
116
|
+
}], [scoped, config]];
|
|
117
|
+
}
|
|
80
118
|
//#endregion
|
|
81
119
|
//#region src/release/group-release-config/group-release-config.ts
|
|
82
120
|
const GROUP = /^[a-z][a-z0-9-]*$/;
|
|
@@ -108,23 +146,24 @@ function groupReleaseConfig(options) {
|
|
|
108
146
|
const scope = (entry) => {
|
|
109
147
|
const [name, config] = Array.isArray(entry) ? entry : [entry, void 0];
|
|
110
148
|
switch (name) {
|
|
111
|
-
case "@semantic-release/commit-analyzer": return [folderScoped("analyzeCommits", paths), config];
|
|
112
|
-
case "@semantic-release/release-notes-generator": return [folderScoped("generateNotes", paths), config];
|
|
113
|
-
case "@semantic-release/changelog": return [name, {
|
|
149
|
+
case "@semantic-release/commit-analyzer": return [[folderScoped("analyzeCommits", paths), config]];
|
|
150
|
+
case "@semantic-release/release-notes-generator": return [[folderScoped("generateNotes", paths), config]];
|
|
151
|
+
case "@semantic-release/changelog": return [[name, {
|
|
114
152
|
...config,
|
|
115
153
|
changelogFile
|
|
116
|
-
}];
|
|
117
|
-
case "@semantic-release/git": return [name, {
|
|
154
|
+
}]];
|
|
155
|
+
case "@semantic-release/git": return [[name, {
|
|
118
156
|
...config,
|
|
119
157
|
message: groupMessage(config?.["message"], group)
|
|
120
|
-
}];
|
|
121
|
-
|
|
158
|
+
}]];
|
|
159
|
+
case "@semantic-release/github": return commentOnlyFor(entry, folderScoped("success", paths));
|
|
160
|
+
default: return [entry];
|
|
122
161
|
}
|
|
123
162
|
};
|
|
124
163
|
return {
|
|
125
164
|
...base,
|
|
126
165
|
tagFormat: `${group}-v\${version}`,
|
|
127
|
-
plugins: base.plugins.
|
|
166
|
+
plugins: base.plugins.flatMap(scope)
|
|
128
167
|
};
|
|
129
168
|
}
|
|
130
169
|
/** `chore(release): <version> …` becomes `chore(release): <group> <version> …`. */
|
|
@@ -132,4 +171,46 @@ function groupMessage(message, group) {
|
|
|
132
171
|
return message.replace(/^chore\(release\): /, `chore(release): ${group} `);
|
|
133
172
|
}
|
|
134
173
|
//#endregion
|
|
135
|
-
|
|
174
|
+
//#region src/release/release-groups/release-groups.ts
|
|
175
|
+
/**
|
|
176
|
+
* The version groups a repo releases on their own: the folder names listed under `groups`
|
|
177
|
+
* in its `delivery.publish` task. This is what the generated publish workflow reads, so a
|
|
178
|
+
* release config that asks here stays in step with it instead of keeping a second list.
|
|
179
|
+
* `[]` for a repo that releases as one.
|
|
180
|
+
*/
|
|
181
|
+
function releaseGroups(config) {
|
|
182
|
+
const groups = (config.tasks ?? []).map(normalizeTaskEntry).find((entry) => entry.name === "delivery.publish")?.with?.["groups"];
|
|
183
|
+
if (!Array.isArray(groups)) return [];
|
|
184
|
+
return groups.flatMap((group) => {
|
|
185
|
+
const name = typeof group === "string" ? group : group?.name;
|
|
186
|
+
return typeof name === "string" ? [name] : [];
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/release/ungrouped-release-config/ungrouped-release-config.ts
|
|
191
|
+
/**
|
|
192
|
+
* The semantic-release config for everything that is in no version group, built on the org's
|
|
193
|
+
* `defineConfig()`: tags, changelog and release commit are the repo's own, as before. The commit
|
|
194
|
+
* analyzer and notes generator skip commits confined to the `groups` folders, because those
|
|
195
|
+
* belong to the groups' releases ({@link ungroupedScoped}). With no groups it is `defineConfig()`
|
|
196
|
+
* unchanged.
|
|
197
|
+
*/
|
|
198
|
+
function ungroupedReleaseConfig({ groups, ...options }) {
|
|
199
|
+
const base = defineConfig(options);
|
|
200
|
+
if (groups.length === 0) return base;
|
|
201
|
+
const scope = (entry) => {
|
|
202
|
+
const [name, config] = Array.isArray(entry) ? entry : [entry, void 0];
|
|
203
|
+
switch (name) {
|
|
204
|
+
case "@semantic-release/commit-analyzer": return [[ungroupedScoped("analyzeCommits", groups), config]];
|
|
205
|
+
case "@semantic-release/release-notes-generator": return [[ungroupedScoped("generateNotes", groups), config]];
|
|
206
|
+
case "@semantic-release/github": return commentOnlyFor(entry, ungroupedScoped("success", groups));
|
|
207
|
+
default: return [entry];
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
return {
|
|
211
|
+
...base,
|
|
212
|
+
plugins: base.plugins.flatMap(scope)
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
export { commentOnlyFor, commitFiles, folderScoped, groupReleaseConfig, inScope, outsideFolders, releaseGroups, ungroupedReleaseConfig, ungroupedScoped };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/config/schema/schema.ts
|
|
2
|
+
/**
|
|
3
|
+
* The `tasks` config shape — the single manifest of what a repo runs.
|
|
4
|
+
* Read from a dedicated `astromech.config.*` file or the `tasks` key of
|
|
5
|
+
* `holocron.config.*` (see {@link loadTasksConfig}).
|
|
6
|
+
*
|
|
7
|
+
* Runtime validation is the loader's job, not this type's — the type only
|
|
8
|
+
* describes what an author writes.
|
|
9
|
+
*/
|
|
10
|
+
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
11
|
+
function normalizeTaskEntry(item) {
|
|
12
|
+
return {
|
|
13
|
+
ci: true,
|
|
14
|
+
local: true,
|
|
15
|
+
...typeof item === "string" ? { name: item } : item
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { normalizeTaskEntry as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/astromech",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.244",
|
|
4
4
|
"description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@theholocron/fs-utils": "^1.16.0",
|
|
54
54
|
"@theholocron/json-utils": "^1.16.0",
|
|
55
55
|
"@theholocron/pkg-utils": "^1.16.0",
|
|
56
|
-
"@theholocron/datapad": "5.0.0-alpha.
|
|
56
|
+
"@theholocron/datapad": "5.0.0-alpha.244"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@commitlint/config-conventional": "^21.2.3",
|