@theholocron/cli 3.19.2 → 3.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +19 -19
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -2685,11 +2685,8 @@ var codeql_default$1 = "name: CodeQL\n\non: # yamllint disable-line rule:truthy\
|
|
|
2685
2685
|
//#region src/commands/workflows/dependencies.yml
|
|
2686
2686
|
var dependencies_default$1 = "name: Dependencies\n\non: # yamllint disable-line rule:truthy\n pull_request:\n\npermissions:\n contents: write\n pull-requests: write\n\njobs:\n dependencies:\n uses: theholocron/.github/.github/workflows/dependencies.yml@main\n secrets: inherit\n";
|
|
2687
2687
|
//#endregion
|
|
2688
|
-
//#region src/commands/workflows/deploy
|
|
2689
|
-
var
|
|
2690
|
-
//#endregion
|
|
2691
|
-
//#region src/commands/workflows/deploy-storybook.yml
|
|
2692
|
-
var deploy_storybook_default$1 = "name: Deploy Storybook\n\non: # yamllint disable-line rule:truthy\n push:\n branches: [main]\n paths:\n - src/**\n - .storybook/**\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-storybook:\n name: Deploy Storybook\n uses: theholocron/.github/.github/workflows/deploy-storybook.yml@main\n secrets: inherit\n";
|
|
2688
|
+
//#region src/commands/workflows/deploy.yml
|
|
2689
|
+
var deploy_default$1 = "name: Deploy\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/deploy.yml@main\n secrets: inherit\n";
|
|
2693
2690
|
//#endregion
|
|
2694
2691
|
//#region src/commands/workflows/greetings.yml
|
|
2695
2692
|
var greetings_default$1 = "name: Greetings\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 uses: theholocron/.github/.github/workflows/greetings.yml@main\n secrets: inherit\n";
|
|
@@ -2742,8 +2739,7 @@ const WORKFLOW_TEMPLATES = {
|
|
|
2742
2739
|
dependencies: dependencies_default$1,
|
|
2743
2740
|
bookkeeping: bookkeeping_default$1,
|
|
2744
2741
|
audit: audit_default$1,
|
|
2745
|
-
|
|
2746
|
-
"deploy-storybook": deploy_storybook_default$1
|
|
2742
|
+
deploy: deploy_default$1
|
|
2747
2743
|
};
|
|
2748
2744
|
const KNOWN_WORKFLOWS = new Set(Object.keys(WORKFLOW_TEMPLATES));
|
|
2749
2745
|
/**
|
|
@@ -2783,11 +2779,18 @@ function generateThinCallerContent(name, withOverrides, additionalPaths) {
|
|
|
2783
2779
|
};
|
|
2784
2780
|
const fmt = (k, v) => ` ${k}: ${yamlScalar(v)}`;
|
|
2785
2781
|
let result = base;
|
|
2786
|
-
if (additionalPaths && additionalPaths.length > 0)
|
|
2787
|
-
const
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2782
|
+
if (additionalPaths && additionalPaths.length > 0) {
|
|
2783
|
+
const pathsBlockRe = /( {4}paths:\n)((?:[ ]{6}- [^\n]+\n)+)/;
|
|
2784
|
+
if (pathsBlockRe.test(result)) result = result.replace(pathsBlockRe, (_, header, existing) => {
|
|
2785
|
+
const existingPaths = new Set([...existing.matchAll(/- (.+)/g)].map((m) => m[1]));
|
|
2786
|
+
const newEntries = additionalPaths.filter((p) => !existingPaths.has(p)).map((p) => ` - ${p}\n`).join("");
|
|
2787
|
+
return header + existing + newEntries;
|
|
2788
|
+
});
|
|
2789
|
+
else {
|
|
2790
|
+
const pathsBlock = ` paths:\n${additionalPaths.map((p) => ` - ${p}\n`).join("")}`;
|
|
2791
|
+
result = result.replace(/( {4}branches: \[main\]\n)/, `$1${pathsBlock}`);
|
|
2792
|
+
}
|
|
2793
|
+
}
|
|
2791
2794
|
if (!withOverrides || Object.keys(withOverrides).length === 0) return result;
|
|
2792
2795
|
const withBlockRe = /( {4}with:\n)((?:[ ]{6}[^\n]+\n)*)/;
|
|
2793
2796
|
const existingMatch = result.match(withBlockRe);
|
|
@@ -3272,6 +3275,7 @@ async function runSetup(input) {
|
|
|
3272
3275
|
}));
|
|
3273
3276
|
result["chromatic-projects"] = JSON.stringify(projects);
|
|
3274
3277
|
}
|
|
3278
|
+
for (const [k, v] of Object.entries(result)) if (Array.isArray(v)) result[k] = JSON.stringify(v);
|
|
3275
3279
|
return result;
|
|
3276
3280
|
}
|
|
3277
3281
|
const workflows = config.workflows;
|
|
@@ -4208,11 +4212,8 @@ var codeql_default = "name: CodeQL\n\non: # yamllint disable-line rule:truthy\n
|
|
|
4208
4212
|
//#region src/templates/workflows/dependencies.yml
|
|
4209
4213
|
var dependencies_default = "name: Dependencies\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n merge-token:\n description: >\n Optional privileged token for auto-merge. Falls back to GITHUB_TOKEN.\n Required when branch protection enforces required reviews — GITHUB_TOKEN\n cannot approve its own PRs.\n required: false\n\njobs:\n dependabot:\n name: Update the dependencies\n permissions:\n contents: write\n pull-requests: write\n runs-on: ubuntu-latest\n timeout-minutes: 5\n if: github.event.pull_request.user.login == 'dependabot[bot]'\n steps:\n - uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0\n name: Fetch Dependabot metadata\n id: metadata\n\n - run: gh pr merge --auto --squash \"$PR_URL\"\n # --squash is intentional: repo protection sets allow_merge_commit: false,\n # so --merge would fail on any repo using the standard preset.\n name: Enable auto-merge for Dependabot PRs\n if: steps.metadata.outputs.update-type == 'version-update:semver-patch'\n env:\n PR_URL: ${{ github.event.pull_request.html_url }}\n GH_TOKEN: ${{ secrets.merge-token || github.token }}\n";
|
|
4210
4214
|
//#endregion
|
|
4211
|
-
//#region src/templates/workflows/deploy
|
|
4212
|
-
var
|
|
4213
|
-
//#endregion
|
|
4214
|
-
//#region src/templates/workflows/deploy-storybook.yml
|
|
4215
|
-
var deploy_storybook_default = "name: Deploy Storybook\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n inputs:\n build-script:\n description: pnpm script that builds the Storybook static output\n type: string\n required: false\n default: build:storybook\n output-dir:\n description: Directory where Storybook writes its static output\n type: string\n required: false\n default: storybook-static\n\njobs:\n build:\n name: Build\n runs-on: ubuntu-latest\n permissions:\n contents: read\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - name: Build Storybook\n run: pnpm run \"$BUILD_SCRIPT\"\n env:\n BUILD_SCRIPT: ${{ inputs.build-script }}\n\n - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1\n name: Upload pages artifact\n with:\n path: ${{ inputs.output-dir }}\n\n deploy:\n name: Deploy\n needs: build\n runs-on: ubuntu-latest\n permissions:\n pages: write\n id-token: write\n environment:\n name: github-pages\n url: ${{ steps.deployment.outputs.page_url }}\n steps:\n - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5\n id: deployment\n name: Deploy to GitHub Pages\n";
|
|
4215
|
+
//#region src/templates/workflows/deploy.yml
|
|
4216
|
+
var deploy_default = "name: Deploy\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n inputs:\n type:\n description: \"Type of deployment: docs or storybook\"\n required: true\n type: string\n name:\n description: Repo name prefix used to filter the docs site package (<name>-site); omit to run pnpm -C docs build\n required: false\n type: string\n default: \"\"\n storybook-projects:\n description: >\n JSON array of { \"name\", \"workingDir\", \"outputDir\"? } objects for monorepo multi-storybook\n deploys. Each is built via `pnpm -C <workingDir> build:storybook` and assembled under\n `sandbox/<name>/` alongside docs in a single deployment.\n type: string\n required: false\n default: \"[]\"\n build-script:\n description: pnpm script that builds the Storybook static output (single storybook, type:storybook only)\n type: string\n required: false\n default: build:storybook\n output-dir:\n description: Directory where Storybook writes its static output (single storybook, type:storybook only)\n type: string\n required: false\n default: storybook-static\n\njobs:\n deploy:\n name: Deploy\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pages: write\n id-token: write\n environment:\n name: github-pages\n url: ${{ steps.deployment.outputs.page_url }}\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - name: Build docs site\n if: ${{ inputs.type == 'docs' && inputs.name != '' }}\n env:\n SITE_NAME: ${{ inputs.name }}\n run: pnpm --filter @theholocron/\"$SITE_NAME\"-site build\n\n - name: Build docs site\n if: ${{ inputs.type == 'docs' && inputs.name == '' }}\n run: pnpm -C docs build\n\n - name: Build Storybook projects\n if: ${{ inputs.storybook-projects != '[]' }}\n env:\n PROJECTS: ${{ inputs.storybook-projects }}\n run: |\n echo \"$PROJECTS\" | jq -c '.[]' | while IFS= read -r project; do\n workingDir=$(echo \"$project\" | jq -r '.workingDir')\n pnpm -C \"$workingDir\" build:storybook\n done\n\n - name: Build Storybook\n if: ${{ inputs.type == 'storybook' && inputs.storybook-projects == '[]' }}\n env:\n BUILD_SCRIPT: ${{ inputs.build-script }}\n run: pnpm run \"$BUILD_SCRIPT\"\n\n - name: Assemble site\n env:\n DEPLOY_TYPE: ${{ inputs.type }}\n PROJECTS: ${{ inputs.storybook-projects }}\n STORYBOOK_OUTPUT_DIR: ${{ inputs.output-dir }}\n run: |\n mkdir -p _site\n if [ \"$DEPLOY_TYPE\" = \"docs\" ]; then\n cp -r docs/dist/. _site/\n fi\n if [ \"$PROJECTS\" != \"[]\" ]; then\n echo \"$PROJECTS\" | jq -c '.[]' | while IFS= read -r project; do\n name=$(echo \"$project\" | jq -r '.name')\n workingDir=$(echo \"$project\" | jq -r '.workingDir')\n outputDir=$(echo \"$project\" | jq -r '.outputDir // \"storybook-static\"')\n mkdir -p \"_site/sandbox/${name}\"\n cp -r \"${workingDir}/${outputDir}/.\" \"_site/sandbox/${name}/\"\n done\n elif [ \"$DEPLOY_TYPE\" = \"storybook\" ]; then\n mkdir -p _site/sandbox\n cp -r \"${STORYBOOK_OUTPUT_DIR}/.\" _site/sandbox/\n fi\n\n - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1\n name: Upload pages artifact\n with:\n path: _site\n\n - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5\n id: deployment\n name: Deploy to GitHub Pages\n";
|
|
4216
4217
|
//#endregion
|
|
4217
4218
|
//#region src/templates/workflows/greetings.yml
|
|
4218
4219
|
var greetings_default = "name: Greetings\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n\njobs:\n greeting:\n name: Greet first-time contributors\n permissions:\n issues: write\n pull-requests: write\n runs-on: ubuntu-latest\n timeout-minutes: 5\n # Group by the issue/PR number so duplicate events don't race each other.\n steps:\n - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0\n name: Greet on first contribution\n with:\n script: |\n // Only greet on the initial open — ignore synchronize, reopened, etc.\n if (context.payload.action !== 'opened') return;\n\n const actor = context.actor;\n const { owner, repo } = context.repo;\n\n // Payload inspection is more reliable than context.eventName for detecting\n // whether this is an issue vs. PR event — works regardless of how GitHub\n // propagates event names through workflow_call chains.\n const isIssue = !!context.payload.issue && !context.payload.pull_request;\n // listForRepo returns both issues and PRs (GitHub treats PRs as issues),\n // sorted newest-first. Filter by type to track first-issue and first-PR\n // independently, and avoid search-index eventual-consistency lag.\n const { data: recent } = await github.rest.issues.listForRepo({\n owner, repo,\n creator: actor,\n state: 'all',\n per_page: 100\n });\n\n const sameType = recent.filter(item =>\n isIssue ? !item.pull_request : !!item.pull_request\n );\n\n if (sameType.length !== 1) return;\n const body = isIssue\n ? `Hey @${actor}!\\n\\nWe really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we are a limited number of volunteers, so it is possible that this will not be addressed as swiftly.\\n\\nYour patience is much appreciated and we will get back to you as quickly as possible.`\n : `Hey @${actor}!\\n\\nWe really appreciate you taking the time to help out with this PR. The collaborators on this project attempt to help as many people as possible, but we are a limited number of volunteers, so it is possible that this will not be addressed as swiftly.\\n\\nYour patience is much appreciated and we will get back to you as quickly as possible.`;\n\n await github.rest.issues.createComment({\n owner,\n repo,\n issue_number: context.issue.number,\n body\n });\n";
|
|
@@ -4257,8 +4258,7 @@ const REUSABLE_WORKFLOWS = {
|
|
|
4257
4258
|
bookkeeping: bookkeeping_default,
|
|
4258
4259
|
codeql: codeql_default,
|
|
4259
4260
|
dependencies: dependencies_default,
|
|
4260
|
-
|
|
4261
|
-
"deploy-storybook": deploy_storybook_default,
|
|
4261
|
+
deploy: deploy_default,
|
|
4262
4262
|
greetings: greetings_default,
|
|
4263
4263
|
lint: lint_default,
|
|
4264
4264
|
release: release_default,
|