pax_global_header00006660000000000000000000000064150764646270014533gustar00rootroot0000000000000052 comment=47c462e6e5adeeeedd3d834656b85c11e28f8df1 npm-promzard-47c462e/000077500000000000000000000000001507646462700145215ustar00rootroot00000000000000npm-promzard-47c462e/.commitlintrc.js000066400000000000000000000005661507646462700176500ustar00rootroot00000000000000/* This file is automatically added by @npmcli/template-oss. Do not edit. */ module.exports = { extends: ['@commitlint/config-conventional'], rules: { 'type-enum': [2, 'always', ['feat', 'fix', 'docs', 'deps', 'chore']], 'header-max-length': [2, 'always', 80], 'subject-case': [0], 'body-max-line-length': [0], 'footer-max-line-length': [0], }, } npm-promzard-47c462e/.eslintrc.js000066400000000000000000000006231507646462700167610ustar00rootroot00000000000000/* This file is automatically added by @npmcli/template-oss. Do not edit. */ 'use strict' const { readdirSync: readdir } = require('fs') const localConfigs = readdir(__dirname) .filter((file) => file.startsWith('.eslintrc.local.')) .map((file) => `./${file}`) module.exports = { root: true, ignorePatterns: [ 'tap-testdir*/', ], extends: [ '@npmcli', ...localConfigs, ], } npm-promzard-47c462e/.github/000077500000000000000000000000001507646462700160615ustar00rootroot00000000000000npm-promzard-47c462e/.github/CODEOWNERS000066400000000000000000000001321507646462700174500ustar00rootroot00000000000000# This file is automatically added by @npmcli/template-oss. Do not edit. * @npm/cli-team npm-promzard-47c462e/.github/ISSUE_TEMPLATE/000077500000000000000000000000001507646462700202445ustar00rootroot00000000000000npm-promzard-47c462e/.github/ISSUE_TEMPLATE/bug.yml000066400000000000000000000026551507646462700215540ustar00rootroot00000000000000# This file is automatically added by @npmcli/template-oss. Do not edit. name: Bug description: File a bug/issue title: "[BUG] " labels: [ Bug, Needs Triage ] body: - type: checkboxes attributes: label: Is there an existing issue for this? description: Please [search here](./issues) to see if an issue already exists for your problem. options: - label: I have searched the existing issues required: true - type: textarea attributes: label: Current Behavior description: A clear & concise description of what you're experiencing. validations: required: false - type: textarea attributes: label: Expected Behavior description: A clear & concise description of what you expected to happen. validations: required: false - type: textarea attributes: label: Steps To Reproduce description: Steps to reproduce the behavior. value: | 1. In this environment... 2. With this config... 3. Run '...' 4. See error... validations: required: false - type: textarea attributes: label: Environment description: | examples: - **npm**: 7.6.3 - **Node**: 13.14.0 - **OS**: Ubuntu 20.04 - **platform**: Macbook Pro value: | - npm: - Node: - OS: - platform: validations: required: false �����������������������������������������������������������������������������������npm-promzard-47c462e/.github/ISSUE_TEMPLATE/config.yml����������������������������������������������0000664�0000000�0000000�00000000145�15076464627�0022234�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. blank_issues_enabled: true ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/actions/���������������������������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0017521�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/actions/create-check/��������������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0022037�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/actions/create-check/action.yml����������������������������������������0000664�0000000�0000000�00000002720�15076464627�0024040�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: 'Create Check' inputs: name: required: true token: required: true sha: required: true check-name: default: '' outputs: check-id: value: ${{ steps.create-check.outputs.check_id }} runs: using: "composite" steps: - name: Get Workflow Job uses: actions/github-script@v7 id: workflow env: JOB_NAME: "${{ inputs.name }}" SHA: "${{ inputs.sha }}" with: result-encoding: string script: | const { repo: { owner, repo}, runId, serverUrl } = context const { JOB_NAME, SHA } = process.env const job = await github.rest.actions.listJobsForWorkflowRun({ owner, repo, run_id: runId, per_page: 100 }).then(r => r.data.jobs.find(j => j.name.endsWith(JOB_NAME))) return [ `This check is assosciated with ${serverUrl}/${owner}/${repo}/commit/${SHA}.`, 'Run logs:', job?.html_url || `could not be found for a job ending with: "${JOB_NAME}"`, ].join(' ') - name: Create Check uses: LouisBrunner/checks-action@v1.6.0 id: create-check with: token: ${{ inputs.token }} sha: ${{ inputs.sha }} status: in_progress name: ${{ inputs.check-name || inputs.name }} output: | {"summary":"${{ steps.workflow.outputs.result }}"} ������������������������������������������������npm-promzard-47c462e/.github/actions/install-latest-npm/��������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0023251�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/actions/install-latest-npm/action.yml����������������������������������0000664�0000000�0000000�00000003406�15076464627�0025254�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: 'Install Latest npm' description: 'Install the latest version of npm compatible with the Node version' inputs: node: description: 'Current Node version' required: true runs: using: "composite" steps: # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows - name: Update Windows npm if: | runner.os == 'Windows' && ( startsWith(inputs.node, 'v10.') || startsWith(inputs.node, 'v12.') || startsWith(inputs.node, 'v14.') ) shell: cmd run: | curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz tar xf npm-7.5.4.tgz cd package node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz cd .. rmdir /s /q package - name: Install Latest npm shell: bash env: NODE_VERSION: ${{ inputs.node }} working-directory: ${{ runner.temp }} run: | MATCH="" SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6") echo "node@$NODE_VERSION" for SPEC in ${SPECS[@]}; do ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node') echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)" if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then MATCH=$SPEC echo "Found compatible version: npm@$MATCH" break fi done if [ -z $MATCH ]; then echo "Could not find a compatible version of npm for node@$NODE_VERSION" exit 1 fi npm i --prefer-online --no-fund --no-audit -g npm@$MATCH - name: npm Version shell: bash run: npm -v ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/dependabot.yml���������������������������������������������������������0000664�0000000�0000000�00000000656�15076464627�0020720�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. version: 2 updates: - package-ecosystem: npm directory: / schedule: interval: daily target-branch: "main" allow: - dependency-type: direct versioning-strategy: increase-if-necessary commit-message: prefix: deps prefix-development: chore labels: - "Dependencies" open-pull-requests-limit: 10 ����������������������������������������������������������������������������������npm-promzard-47c462e/.github/matchers/��������������������������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0017667�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/matchers/tap.json������������������������������������������������������0000664�0000000�0000000�00000001204�15076464627�0021343�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ "//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.", "problemMatcher": [ { "owner": "tap", "pattern": [ { "regexp": "^\\s*not ok \\d+ - (.*)", "message": 1 }, { "regexp": "^\\s*---" }, { "regexp": "^\\s*at:" }, { "regexp": "^\\s*line:\\s*(\\d+)", "line": 1 }, { "regexp": "^\\s*column:\\s*(\\d+)", "column": 1 }, { "regexp": "^\\s*file:\\s*(.*)", "file": 1 } ] } ] } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/settings.yml�����������������������������������������������������������0000664�0000000�0000000�00000001377�15076464627�0020454�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. repository: allow_merge_commit: false allow_rebase_merge: true allow_squash_merge: true squash_merge_commit_title: PR_TITLE squash_merge_commit_message: PR_BODY delete_branch_on_merge: true enable_automated_security_fixes: true enable_vulnerability_alerts: true branches: - name: main protection: required_status_checks: null enforce_admins: true block_creations: true required_pull_request_reviews: required_approving_review_count: 1 require_code_owner_reviews: true require_last_push_approval: true dismiss_stale_reviews: true restrictions: apps: [] users: [] teams: [ "cli-team" ] �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/workflows/�������������������������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0020116�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/workflows/audit.yml����������������������������������������������������0000664�0000000�0000000�00000002275�15076464627�0021755�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: Audit on: workflow_dispatch: schedule: # "At 08:00 UTC (01:00 PT) on Monday" https://crontab.guru/#0_8_*_*_1 - cron: "0 8 * * 1" permissions: contents: read jobs: audit: name: Audit Dependencies if: github.repository_owner == 'npm' runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund --package-lock - name: Run Production Audit run: npm audit --omit=dev - name: Run Full Audit run: npm audit --audit-level=none �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/workflows/ci-release.yml�����������������������������������������������0000664�0000000�0000000�00000010707�15076464627�0022657�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: CI - Release on: workflow_dispatch: inputs: ref: required: true type: string default: main workflow_call: inputs: ref: required: true type: string check-sha: required: true type: string permissions: contents: read checks: write jobs: lint-all: name: Lint All if: github.repository_owner == 'npm' runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Create Check id: create-check if: ${{ inputs.check-sha }} uses: ./.github/actions/create-check with: name: "Lint All" token: ${{ secrets.GITHUB_TOKEN }} sha: ${{ inputs.check-sha }} - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Lint run: npm run lint --ignore-scripts - name: Post Lint run: npm run postlint --ignore-scripts - name: Conclude Check uses: LouisBrunner/checks-action@v1.6.0 if: steps.create-check.outputs.check-id && always() with: token: ${{ secrets.GITHUB_TOKEN }} conclusion: ${{ job.status }} check_id: ${{ steps.create-check.outputs.check-id }} test-all: name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }} if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: platform: - name: Linux os: ubuntu-latest shell: bash - name: macOS os: macos-latest shell: bash - name: macOS os: macos-13 shell: bash - name: Windows os: windows-latest shell: cmd node-version: - 20.17.0 - 20.x - 22.9.0 - 22.x exclude: - platform: { name: macOS, os: macos-13, shell: bash } node-version: 20.17.0 - platform: { name: macOS, os: macos-13, shell: bash } node-version: 20.x - platform: { name: macOS, os: macos-13, shell: bash } node-version: 22.9.0 - platform: { name: macOS, os: macos-13, shell: bash } node-version: 22.x runs-on: ${{ matrix.platform.os }} defaults: run: shell: ${{ matrix.platform.shell }} steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Create Check id: create-check if: ${{ inputs.check-sha }} uses: ./.github/actions/create-check with: name: "Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}" token: ${{ secrets.GITHUB_TOKEN }} sha: ${{ inputs.check-sha }} - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: ${{ matrix.node-version }} check-latest: contains(matrix.node-version, '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Add Problem Matcher run: echo "::add-matcher::.github/matchers/tap.json" - name: Test run: npm test --ignore-scripts - name: Conclude Check uses: LouisBrunner/checks-action@v1.6.0 if: steps.create-check.outputs.check-id && always() with: token: ${{ secrets.GITHUB_TOKEN }} conclusion: ${{ job.status }} check_id: ${{ steps.create-check.outputs.check-id }} ���������������������������������������������������������npm-promzard-47c462e/.github/workflows/ci.yml�������������������������������������������������������0000664�0000000�0000000�00000006141�15076464627�0021236�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: CI on: workflow_dispatch: pull_request: push: branches: - main schedule: # "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1 - cron: "0 9 * * 1" permissions: contents: read jobs: lint: name: Lint if: github.repository_owner == 'npm' runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Lint run: npm run lint --ignore-scripts - name: Post Lint run: npm run postlint --ignore-scripts test: name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }} if: github.repository_owner == 'npm' strategy: fail-fast: false matrix: platform: - name: Linux os: ubuntu-latest shell: bash - name: macOS os: macos-latest shell: bash - name: macOS os: macos-13 shell: bash - name: Windows os: windows-latest shell: cmd node-version: - 20.17.0 - 20.x - 22.9.0 - 22.x exclude: - platform: { name: macOS, os: macos-13, shell: bash } node-version: 20.17.0 - platform: { name: macOS, os: macos-13, shell: bash } node-version: 20.x - platform: { name: macOS, os: macos-13, shell: bash } node-version: 22.9.0 - platform: { name: macOS, os: macos-13, shell: bash } node-version: 22.x runs-on: ${{ matrix.platform.os }} defaults: run: shell: ${{ matrix.platform.shell }} steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: ${{ matrix.node-version }} check-latest: contains(matrix.node-version, '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Add Problem Matcher run: echo "::add-matcher::.github/matchers/tap.json" - name: Test run: npm test --ignore-scripts �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/workflows/codeql-analysis.yml������������������������������������������0000664�0000000�0000000�00000001606�15076464627�0023734�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: CodeQL on: push: branches: - main pull_request: branches: - main schedule: # "At 10:00 UTC (03:00 PT) on Monday" https://crontab.guru/#0_10_*_*_1 - cron: "0 10 * * 1" permissions: contents: read jobs: analyze: name: Analyze runs-on: ubuntu-latest permissions: actions: read contents: read security-events: write steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: languages: javascript - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 ��������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/workflows/post-dependabot.yml������������������������������������������0000664�0000000�0000000�00000012004�15076464627�0023726�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: Post Dependabot on: pull_request permissions: contents: write jobs: template-oss: name: template-oss if: github.repository_owner == 'npm' && github.actor == 'dependabot[bot]' runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref }} - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Fetch Dependabot Metadata id: metadata uses: dependabot/fetch-metadata@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} # Dependabot can update multiple directories so we output which directory # it is acting on so we can run the command for the correct root or workspace - name: Get Dependabot Directory if: contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss') id: flags run: | dependabot_dir="${{ steps.metadata.outputs.directory }}" if [[ "$dependabot_dir" == "/" || "$dependabot_dir" == "/main" ]]; then echo "workspace=-iwr" >> $GITHUB_OUTPUT else # strip leading slash from directory so it works as a # a path to the workspace flag echo "workspace=--workspace ${dependabot_dir#/}" >> $GITHUB_OUTPUT fi - name: Apply Changes if: steps.flags.outputs.workspace id: apply run: | npm run template-oss-apply ${{ steps.flags.outputs.workspace }} if [[ `git status --porcelain` ]]; then echo "changes=true" >> $GITHUB_OUTPUT fi # This only sets the conventional commit prefix. This workflow can't reliably determine # what the breaking change is though. If a BREAKING CHANGE message is required then # this PR check will fail and the commit will be amended with stafftools if [[ "${{ steps.metadata.outputs.update-type }}" == "version-update:semver-major" ]]; then prefix='feat!' else prefix='chore' fi echo "message=$prefix: postinstall for dependabot template-oss PR" >> $GITHUB_OUTPUT # This step will fail if template-oss has made any workflow updates. It is impossible # for a workflow to update other workflows. In the case it does fail, we continue # and then try to apply only a portion of the changes in the next step - name: Push All Changes if: steps.apply.outputs.changes id: push continue-on-error: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git commit -am "${{ steps.apply.outputs.message }}" git push # If the previous step failed, then reset the commit and remove any workflow changes # and attempt to commit and push again. This is helpful because we will have a commit # with the correct prefix that we can then --amend with @npmcli/stafftools later. - name: Push All Changes Except Workflows if: steps.apply.outputs.changes && steps.push.outcome == 'failure' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git reset HEAD~ git checkout HEAD -- .github/workflows/ git clean -fd .github/workflows/ git commit -am "${{ steps.apply.outputs.message }}" git push # Check if all the necessary template-oss changes were applied. Since we continued # on errors in one of the previous steps, this check will fail if our follow up # only applied a portion of the changes and we need to followup manually. # # Note that this used to run `lint` and `postlint` but that will fail this action # if we've also shipped any linting changes separate from template-oss. We do # linting in another action, so we want to fail this one only if there are # template-oss changes that could not be applied. - name: Check Changes if: steps.apply.outputs.changes run: | npm exec --offline ${{ steps.flags.outputs.workspace }} -- template-oss-check - name: Fail on Breaking Change if: steps.apply.outputs.changes && startsWith(steps.apply.outputs.message, 'feat!') run: | echo "This PR has a breaking change. Run 'npx -p @npmcli/stafftools gh template-oss-fix'" echo "for more information on how to fix this with a BREAKING CHANGE footer." exit 1 ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/workflows/pull-request.yml���������������������������������������������0000664�0000000�0000000�00000002737�15076464627�0023314�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: Pull Request on: pull_request: types: - opened - reopened - edited - synchronize permissions: contents: read jobs: commitlint: name: Lint Commits if: github.repository_owner == 'npm' runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Run Commitlint on Commits id: commit continue-on-error: true run: npx --offline commitlint -V --from 'origin/${{ github.base_ref }}' --to ${{ github.event.pull_request.head.sha }} - name: Run Commitlint on PR Title if: steps.commit.outcome == 'failure' env: PR_TITLE: ${{ github.event.pull_request.title }} run: echo "$PR_TITLE" | npx --offline commitlint -V ���������������������������������npm-promzard-47c462e/.github/workflows/release-integration.yml��������������������������������������0000664�0000000�0000000�00000004163�15076464627�0024606�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: Release Integration on: workflow_dispatch: inputs: releases: required: true type: string description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version' workflow_call: inputs: releases: required: true type: string description: 'A json array of releases. Required fields: publish: tagName, publishTag. publish check: pkgName, version' secrets: PUBLISH_TOKEN: required: true permissions: contents: read id-token: write jobs: publish: name: Publish runs-on: ubuntu-latest defaults: run: shell: bash permissions: id-token: write steps: - name: Checkout uses: actions/checkout@v4 with: ref: ${{ fromJSON(inputs.releases)[0].tagName }} - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Set npm authToken run: npm config set '//registry.npmjs.org/:_authToken'=\${PUBLISH_TOKEN} - name: Publish env: PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} RELEASES: ${{ inputs.releases }} run: | EXIT_CODE=0 for release in $(echo $RELEASES | jq -r '.[] | @base64'); do PUBLISH_TAG=$(echo "$release" | base64 --decode | jq -r .publishTag) npm publish --provenance --tag="$PUBLISH_TAG" STATUS=$? if [[ "$STATUS" -eq 1 ]]; then EXIT_CODE=$STATUS fi done exit $EXIT_CODE �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.github/workflows/release.yml��������������������������������������������������0000664�0000000�0000000�00000026106�15076464627�0022266�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. name: Release on: push: branches: - main permissions: contents: write pull-requests: write checks: write jobs: release: outputs: pr: ${{ steps.release.outputs.pr }} pr-branch: ${{ steps.release.outputs.pr-branch }} pr-number: ${{ steps.release.outputs.pr-number }} pr-sha: ${{ steps.release.outputs.pr-sha }} releases: ${{ steps.release.outputs.releases }} comment-id: ${{ steps.create-comment.outputs.comment-id || steps.update-comment.outputs.comment-id }} check-id: ${{ steps.create-check.outputs.check-id }} name: Release if: github.repository_owner == 'npm' runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Release Please id: release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npx --offline template-oss-release-please --branch="${{ github.ref_name }}" --backport="" --defaultTag="latest" - name: Create Release Manager Comment Text if: steps.release.outputs.pr-number uses: actions/github-script@v7 id: comment-text with: result-encoding: string script: | const { runId, repo: { owner, repo } } = context const { data: workflow } = await github.rest.actions.getWorkflowRun({ owner, repo, run_id: runId }) return['## Release Manager', `Release workflow run: ${workflow.html_url}`].join('\n\n') - name: Find Release Manager Comment uses: peter-evans/find-comment@v2 if: steps.release.outputs.pr-number id: found-comment with: issue-number: ${{ steps.release.outputs.pr-number }} comment-author: 'github-actions[bot]' body-includes: '## Release Manager' - name: Create Release Manager Comment id: create-comment if: steps.release.outputs.pr-number && !steps.found-comment.outputs.comment-id uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ steps.release.outputs.pr-number }} body: ${{ steps.comment-text.outputs.result }} - name: Update Release Manager Comment id: update-comment if: steps.release.outputs.pr-number && steps.found-comment.outputs.comment-id uses: peter-evans/create-or-update-comment@v3 with: comment-id: ${{ steps.found-comment.outputs.comment-id }} body: ${{ steps.comment-text.outputs.result }} edit-mode: 'replace' - name: Create Check id: create-check uses: ./.github/actions/create-check if: steps.release.outputs.pr-sha with: name: "Release" token: ${{ secrets.GITHUB_TOKEN }} sha: ${{ steps.release.outputs.pr-sha }} update: needs: release outputs: sha: ${{ steps.commit.outputs.sha }} check-id: ${{ steps.create-check.outputs.check-id }} name: Update - Release if: github.repository_owner == 'npm' && needs.release.outputs.pr runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ needs.release.outputs.pr-branch }} - name: Setup Git User run: | git config --global user.email "npm-cli+bot@github.com" git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v4 id: node with: node-version: 22.x check-latest: contains('22.x', '.x') - name: Install Latest npm uses: ./.github/actions/install-latest-npm with: node: ${{ steps.node.outputs.node-version }} - name: Install Dependencies run: npm i --ignore-scripts --no-audit --no-fund - name: Create Release Manager Checklist Text id: comment-text env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npm exec --offline -- template-oss-release-manager --pr="${{ needs.release.outputs.pr-number }}" --backport="" --defaultTag="latest" --publish - name: Append Release Manager Comment uses: peter-evans/create-or-update-comment@v3 with: comment-id: ${{ needs.release.outputs.comment-id }} body: ${{ steps.comment-text.outputs.result }} edit-mode: 'append' - name: Run Post Pull Request Actions env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: npm run rp-pull-request --ignore-scripts --if-present -- --pr="${{ needs.release.outputs.pr-number }}" --commentId="${{ needs.release.outputs.comment-id }}" - name: Commit id: commit env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git commit --all --amend --no-edit || true git push --force-with-lease echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Create Check id: create-check uses: ./.github/actions/create-check with: name: "Update - Release" check-name: "Release" token: ${{ secrets.GITHUB_TOKEN }} sha: ${{ steps.commit.outputs.sha }} - name: Conclude Check uses: LouisBrunner/checks-action@v1.6.0 with: token: ${{ secrets.GITHUB_TOKEN }} conclusion: ${{ job.status }} check_id: ${{ needs.release.outputs.check-id }} ci: name: CI - Release needs: [ release, update ] if: needs.release.outputs.pr uses: ./.github/workflows/ci-release.yml with: ref: ${{ needs.release.outputs.pr-branch }} check-sha: ${{ needs.update.outputs.sha }} post-ci: needs: [ release, update, ci ] name: Post CI - Release if: github.repository_owner == 'npm' && needs.release.outputs.pr && always() runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Get CI Conclusion id: conclusion run: | result="" if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then result="failure" elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then result="cancelled" else result="success" fi echo "result=$result" >> $GITHUB_OUTPUT - name: Conclude Check uses: LouisBrunner/checks-action@v1.6.0 with: token: ${{ secrets.GITHUB_TOKEN }} conclusion: ${{ steps.conclusion.outputs.result }} check_id: ${{ needs.update.outputs.check-id }} post-release: needs: release outputs: comment-id: ${{ steps.create-comment.outputs.comment-id }} name: Post Release - Release if: github.repository_owner == 'npm' && needs.release.outputs.releases runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Create Release PR Comment Text id: comment-text uses: actions/github-script@v7 env: RELEASES: ${{ needs.release.outputs.releases }} with: result-encoding: string script: | const releases = JSON.parse(process.env.RELEASES) const { runId, repo: { owner, repo } } = context const issue_number = releases[0].prNumber const runUrl = `https://github.com/${owner}/${repo}/actions/runs/${runId}` return [ '## Release Workflow\n', ...releases.map(r => `- \`${r.pkgName}@${r.version}\` ${r.url}`), `- Workflow run: :arrows_counterclockwise: ${runUrl}`, ].join('\n') - name: Create Release PR Comment id: create-comment uses: peter-evans/create-or-update-comment@v3 with: issue-number: ${{ fromJSON(needs.release.outputs.releases)[0].prNumber }} body: ${{ steps.comment-text.outputs.result }} release-integration: needs: release name: Release Integration if: needs.release.outputs.releases uses: ./.github/workflows/release-integration.yml permissions: contents: read id-token: write secrets: PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} with: releases: ${{ needs.release.outputs.releases }} post-release-integration: needs: [ release, release-integration, post-release ] name: Post Release Integration - Release if: github.repository_owner == 'npm' && needs.release.outputs.releases && always() runs-on: ubuntu-latest defaults: run: shell: bash steps: - name: Get Post Release Conclusion id: conclusion run: | if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then result="x" elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then result="heavy_multiplication_x" else result="white_check_mark" fi echo "result=$result" >> $GITHUB_OUTPUT - name: Find Release PR Comment uses: peter-evans/find-comment@v2 id: found-comment with: issue-number: ${{ fromJSON(needs.release.outputs.releases)[0].prNumber }} comment-author: 'github-actions[bot]' body-includes: '## Release Workflow' - name: Create Release PR Comment Text id: comment-text if: steps.found-comment.outputs.comment-id uses: actions/github-script@v7 env: RESULT: ${{ steps.conclusion.outputs.result }} BODY: ${{ steps.found-comment.outputs.comment-body }} with: result-encoding: string script: | const { RESULT, BODY } = process.env const body = [BODY.replace(/(Workflow run: :)[a-z_]+(:)/, `$1${RESULT}$2`)] if (RESULT !== 'white_check_mark') { body.push(':rotating_light::rotating_light::rotating_light:') body.push([ '@npm/cli-team: The post-release workflow failed for this release.', 'Manual steps may need to be taken after examining the workflow output.' ].join(' ')) body.push(':rotating_light::rotating_light::rotating_light:') } return body.join('\n\n').trim() - name: Update Release PR Comment if: steps.comment-text.outputs.result uses: peter-evans/create-or-update-comment@v3 with: comment-id: ${{ steps.found-comment.outputs.comment-id }} body: ${{ steps.comment-text.outputs.result }} edit-mode: 'replace' ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.gitignore���������������������������������������������������������������������0000664�0000000�0000000�00000001050�15076464627�0016505�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. # ignore everything in the root /* !**/.gitignore !/.commitlintrc.js !/.eslint.config.js !/.eslintrc.js !/.eslintrc.local.* !/.git-blame-ignore-revs !/.github/ !/.gitignore !/.npmrc !/.prettierignore !/.prettierrc.js !/.release-please-manifest.json !/bin/ !/CHANGELOG* !/CODE_OF_CONDUCT.md !/CONTRIBUTING.md !/docs/ !/lib/ !/LICENSE* !/map.js !/package.json !/README* !/release-please-config.json !/scripts/ !/SECURITY.md !/tap-snapshots/ !/test/ !/tsconfig.json tap-testdir*/ ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.npmrc�������������������������������������������������������������������������0000664�0000000�0000000�00000000135�15076464627�0015640�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������; This file is automatically added by @npmcli/template-oss. Do not edit. package-lock=false �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/.release-please-manifest.json��������������������������������������������������0000664�0000000�0000000�00000000023�15076464627�0022160�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ ".": "3.0.1" } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/CHANGELOG.md�������������������������������������������������������������������0000664�0000000�0000000�00000021745�15076464627�0016343�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Changelog ## [3.0.1](https://github.com/npm/promzard/compare/v3.0.0...v3.0.1) (2025-10-23) ### Dependencies * [`824b325`](https://github.com/npm/promzard/commit/824b3259843eca668b52c435e5ecb5cd61f64c74) [#104](https://github.com/npm/promzard/pull/104) bump read from 4.1.0 to 5.0.0 (#104) (@dependabot[bot]) ## [3.0.0](https://github.com/npm/promzard/compare/v2.0.0...v3.0.0) (2025-10-22) ### ⚠️ BREAKING CHANGES * `promzard` now supports node `^20.17.0 || >=22.9.0` ### Bug Fixes * [`8956092`](https://github.com/npm/promzard/commit/8956092e16abee697736a290deaa3f0cab642130) [#102](https://github.com/npm/promzard/pull/102) align to npm 11 node engine range (#102) (@owlstronaut) ### Chores * [`0b423cb`](https://github.com/npm/promzard/commit/0b423cbfd72ce5554846be750cdaf50fd204168b) [#95](https://github.com/npm/promzard/pull/95) postinstall workflow updates (#95) (@owlstronaut) * [`0975976`](https://github.com/npm/promzard/commit/0975976cc0f3851c270a76257ee2155a35480342) [#101](https://github.com/npm/promzard/pull/101) bump @npmcli/template-oss from 4.26.0 to 4.27.1 (#101) (@dependabot[bot], @npm-cli-bot) ## [2.0.0](https://github.com/npm/promzard/compare/v1.0.2...v2.0.0) (2024-09-25) ### ⚠️ BREAKING CHANGES * `promzard` now supports node `^18.17.0 || >=20.5.0` ### Bug Fixes * [`d679fa2`](https://github.com/npm/promzard/commit/d679fa22a5771001b22f489bf381e97d5f050351) [#91](https://github.com/npm/promzard/pull/91) align to npm 10 node engine range (@reggi) ### Dependencies * [`c389d6b`](https://github.com/npm/promzard/commit/c389d6bac7ddbe8d01aab36f1a65a3f68fc4369e) [#91](https://github.com/npm/promzard/pull/91) `read@4.0.0` ### Chores * [`df7ffed`](https://github.com/npm/promzard/commit/df7ffedea73d4c6395488517e83910174c943b74) [#91](https://github.com/npm/promzard/pull/91) run template-oss-apply (@reggi) * [`9a50db4`](https://github.com/npm/promzard/commit/9a50db4a0f3471dde91bec1d80ad885a41422725) [#89](https://github.com/npm/promzard/pull/89) bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot]) * [`ddb9e70`](https://github.com/npm/promzard/commit/ddb9e709c6ec30e3f3c3d25f712459ddd18b181f) [#90](https://github.com/npm/promzard/pull/90) postinstall for dependabot template-oss PR (@hashtagchris) * [`142f948`](https://github.com/npm/promzard/commit/142f948f18bec13a4211e889c0aaabcca3972c48) [#90](https://github.com/npm/promzard/pull/90) bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot]) ## [1.0.2](https://github.com/npm/promzard/compare/v1.0.1...v1.0.2) (2024-05-04) ### Bug Fixes * [`1c79729`](https://github.com/npm/promzard/commit/1c797292cf9584e98f7a957463d245add8125a95) [#79](https://github.com/npm/promzard/pull/79) linting: no-console (@lukekarrys) ### Chores * [`376bde4`](https://github.com/npm/promzard/commit/376bde43e1b74a727607d7372722e84ec79a33ba) [#79](https://github.com/npm/promzard/pull/79) bump @npmcli/template-oss to 4.22.0 (@lukekarrys) * [`8bcec44`](https://github.com/npm/promzard/commit/8bcec4442d2916cb120ef1bcb47361dcf1774bfb) [#79](https://github.com/npm/promzard/pull/79) postinstall for dependabot template-oss PR (@lukekarrys) * [`cba412d`](https://github.com/npm/promzard/commit/cba412d02e6b748e3be09dc6ba16fc51bc372688) [#77](https://github.com/npm/promzard/pull/77) bump @npmcli/template-oss from 4.21.3 to 4.21.4 (@dependabot[bot]) ## [1.0.1](https://github.com/npm/promzard/compare/v1.0.0...v1.0.1) (2024-04-01) ### Dependencies * [`445759b`](https://github.com/npm/promzard/commit/445759ba776c649436cd1f8ceed15765204a8f34) [#70](https://github.com/npm/promzard/pull/70) bump read from 2.1.0 to 3.0.1 (#70) (@dependabot[bot], @lukekarrys) ### Chores * [`47e194d`](https://github.com/npm/promzard/commit/47e194d58da2d2d8835931b1420b41dce42f411b) [#76](https://github.com/npm/promzard/pull/76) turn on autopublish (#76) (@lukekarrys) * [`70d4ae9`](https://github.com/npm/promzard/commit/70d4ae9fe75560c580597b5f601911f2d36adc86) [#72](https://github.com/npm/promzard/pull/72) postinstall for dependabot template-oss PR (@lukekarrys) * [`f21c0f6`](https://github.com/npm/promzard/commit/f21c0f69ddbcc18754322536bb799a8fdaaa0e38) [#72](https://github.com/npm/promzard/pull/72) bump @npmcli/template-oss from 4.21.1 to 4.21.3 (@dependabot[bot]) * [`5fb3f70`](https://github.com/npm/promzard/commit/5fb3f70f1a4224c81113593f8487cb566d9fa3ec) [#67](https://github.com/npm/promzard/pull/67) postinstall for dependabot template-oss PR (@lukekarrys) * [`d051eb5`](https://github.com/npm/promzard/commit/d051eb5c7f2c6d672281b7066a01972f5f95ed21) [#67](https://github.com/npm/promzard/pull/67) bump @npmcli/template-oss from 4.19.0 to 4.21.1 (@dependabot[bot]) * [`4ddf313`](https://github.com/npm/promzard/commit/4ddf313a261649c15ac86ce555c903d5e13454a3) [#48](https://github.com/npm/promzard/pull/48) postinstall for dependabot template-oss PR (@lukekarrys) * [`d11c8c1`](https://github.com/npm/promzard/commit/d11c8c12d266614ce9aee79c0357ca5d2c87940d) [#48](https://github.com/npm/promzard/pull/48) bump @npmcli/template-oss from 4.18.1 to 4.19.0 (@dependabot[bot]) * [`64c2ec8`](https://github.com/npm/promzard/commit/64c2ec8bee72d5dbc71e639de3c24074fbed0042) [#47](https://github.com/npm/promzard/pull/47) postinstall for dependabot template-oss PR (@lukekarrys) * [`d236976`](https://github.com/npm/promzard/commit/d236976a98fcbb14ae2c2d397acb958204156c8f) [#47](https://github.com/npm/promzard/pull/47) bump @npmcli/template-oss from 4.18.0 to 4.18.1 (@dependabot[bot]) * [`70f916a`](https://github.com/npm/promzard/commit/70f916aabd8960e1bc22561e10d618545de21c42) [#46](https://github.com/npm/promzard/pull/46) postinstall for dependabot template-oss PR (@lukekarrys) * [`66c0af6`](https://github.com/npm/promzard/commit/66c0af6f1e2ac5e25cafa5e6b9b7176ae3eae66b) [#46](https://github.com/npm/promzard/pull/46) bump @npmcli/template-oss from 4.17.0 to 4.18.0 (@dependabot[bot]) * [`3abd0eb`](https://github.com/npm/promzard/commit/3abd0eb9490b1cd2f0c2be100e6f262da3517d13) [#45](https://github.com/npm/promzard/pull/45) postinstall for dependabot template-oss PR (@lukekarrys) * [`9c481e7`](https://github.com/npm/promzard/commit/9c481e7e2d03a7a37eaa84d90682fd528d88793e) [#45](https://github.com/npm/promzard/pull/45) bump @npmcli/template-oss from 4.15.1 to 4.17.0 (@dependabot[bot]) * [`2167b18`](https://github.com/npm/promzard/commit/2167b182da6b80035eb60bf0c2638fd4fca85559) [#44](https://github.com/npm/promzard/pull/44) postinstall for dependabot template-oss PR (@lukekarrys) * [`a923fd4`](https://github.com/npm/promzard/commit/a923fd4d235920f5d95407c6699582a5a085b79b) [#44](https://github.com/npm/promzard/pull/44) bump @npmcli/template-oss from 4.14.1 to 4.15.1 (@dependabot[bot]) * [`fbb70ca`](https://github.com/npm/promzard/commit/fbb70ca952175184db7fb6c2e5e43d8e7c8cf464) [#43](https://github.com/npm/promzard/pull/43) bump @npmcli/template-oss from 4.12.1 to 4.14.1 (#43) (@dependabot[bot], @npm-cli-bot, @nlf) * [`95695cd`](https://github.com/npm/promzard/commit/95695cd2432a030efa5313682155d8eea36fe814) [#42](https://github.com/npm/promzard/pull/42) bump @npmcli/template-oss from 4.12.0 to 4.12.1 (#42) (@dependabot[bot], @npm-cli-bot) * [`be54ca0`](https://github.com/npm/promzard/commit/be54ca04b6661ffbd947f6ee029898bab1610f8f) [#41](https://github.com/npm/promzard/pull/41) postinstall for dependabot template-oss PR (@lukekarrys) * [`41e457b`](https://github.com/npm/promzard/commit/41e457b70a6d849cfa0b612e58afc50b89c127eb) [#41](https://github.com/npm/promzard/pull/41) bump @npmcli/template-oss from 4.11.4 to 4.12.0 (@dependabot[bot]) * [`e89243d`](https://github.com/npm/promzard/commit/e89243dfc2f9e6c483987eaf32acfdb3a2f5833b) [#40](https://github.com/npm/promzard/pull/40) postinstall for dependabot template-oss PR (@lukekarrys) * [`24f9830`](https://github.com/npm/promzard/commit/24f983072f2bfac4608735ce61204426296eed89) [#40](https://github.com/npm/promzard/pull/40) bump @npmcli/template-oss from 4.11.3 to 4.11.4 (@dependabot[bot]) * [`5413040`](https://github.com/npm/promzard/commit/5413040ee8c1d3c7caf089e499abbaee8aa50cbe) [#39](https://github.com/npm/promzard/pull/39) postinstall for dependabot template-oss PR (@lukekarrys) * [`0840251`](https://github.com/npm/promzard/commit/08402519c6f5dd47d548221f2b7f5a4f8982c6b3) [#39](https://github.com/npm/promzard/pull/39) bump @npmcli/template-oss from 4.11.0 to 4.11.3 (@dependabot[bot]) ## [1.0.0](https://github.com/npm/promzard/compare/v0.3.0...v1.0.0) (2022-12-15) ### ⚠️ BREAKING CHANGES * refactor module - all async interfaces are promise only and no longer accept a callback - the `PromZard` class is no longer an event emitter - the `load` method must be manually called after creating a class ### Features * [`d37e442`](https://github.com/npm/promzard/commit/d37e4422075eda27a3951e8ab2f3d9f4f265a122) refactor (@lukekarrys) ### Bug Fixes * [`3c113db`](https://github.com/npm/promzard/commit/3c113db7a1ce0f8787ec0bc98bc3b1353eeaf109) [#38](https://github.com/npm/promzard/pull/38) 100 test coverage (#38) (@lukekarrys) ### Dependencies * [`9f2b9aa`](https://github.com/npm/promzard/commit/9f2b9aaa058472b61e4538cb4e0866b3ebfd48ff) `read@2.0.0` ���������������������������npm-promzard-47c462e/CODE_OF_CONDUCT.md�������������������������������������������������������������0000664�0000000�0000000�00000000507�15076464627�0017322�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!-- This file is automatically added by @npmcli/template-oss. Do not edit. --> All interactions in this repo are covered by the [npm Code of Conduct](https://docs.npmjs.com/policies/conduct) The npm cli team may, at its own discretion, moderate, remove, or edit any interactions such as pull requests, issues, and comments. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/CONTRIBUTING.md����������������������������������������������������������������0000664�0000000�0000000�00000005133�15076464627�0016754�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!-- This file is automatically added by @npmcli/template-oss. Do not edit. --> # Contributing ## Code of Conduct All interactions in the **npm** organization on GitHub are considered to be covered by our standard [Code of Conduct](https://docs.npmjs.com/policies/conduct). ## Reporting Bugs Before submitting a new bug report please search for an existing or similar report. Use one of our existing issue templates if you believe you've come across a unique problem. Duplicate issues, or issues that don't use one of our templates may get closed without a response. ## Pull Request Conventions ### Commits We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). When opening a pull request please be sure that either the pull request title, or each commit in the pull request, has one of the following prefixes: - `feat`: For when introducing a new feature. The result will be a new semver minor version of the package when it is next published. - `fix`: For bug fixes. The result will be a new semver patch version of the package when it is next published. - `docs`: For documentation updates. The result will be a new semver patch version of the package when it is next published. - `chore`: For changes that do not affect the published module. Often these are changes to tests. The result will be *no* change to the version of the package when it is next published (as the commit does not affect the published version). ### Test Coverage Pull requests made against this repo will run `npm test` automatically. Please make sure tests pass locally before submitting a PR. Every new feature or bug fix should come with a corresponding test or tests that validate the solutions. Testing also reports on code coverage and will fail if code coverage drops. ### Linting Linting is also done automatically once tests pass. `npm run lintfix` will fix most linting errors automatically. Please make sure linting passes before submitting a PR. ## What _not_ to contribute? ### Dependencies It should be noted that our team does not accept third-party dependency updates/PRs. If you submit a PR trying to update our dependencies we will close it with or without a reference to these contribution guidelines. ### Tools/Automation Our core team is responsible for the maintenance of the tooling/automation in this project and we ask contributors to not make changes to these when contributing (e.g. `.github/*`, `.eslintrc.json`, `.licensee.json`). Most of those files also have a header at the top to remind folks they are automatically generated. Pull requests that alter these will not be accepted. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/LICENSE������������������������������������������������������������������������0000664�0000000�0000000�00000001354�15076464627�0015531�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������The ISC License Copyright (c) Isaac Z. Schlueter Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/README.md����������������������������������������������������������������������0000664�0000000�0000000�00000010456�15076464627�0016006�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# promzard A prompting wizard for building files from specialized PromZard modules. Used by `npm init`. A reimplementation of @SubStack's [prompter](https://github.com/substack/node-prompter), which does not use AST traversal. From another point of view, it's a reimplementation of [@Marak](https://github.com/marak)'s [wizard](https://github.com/Marak/wizard) which doesn't use schemas. The goal is a nice drop-in enhancement for `npm init`. ## Usage ```javascript const promzard = require('promzard') const data = await promzard(inputFile, optionalContextAdditions, options) ``` In the `inputFile` you can have something like this: ```javascript const fs = require('fs/promises') module.exports = { "greeting": prompt("Who shall you greet?", "world", (who) => `Hello, ${who}`), "filename": __filename, "directory": async () => { const entries = await fs.readdir(__dirname) return entries.map(e => `entry: ${e}`) } } ``` When run, promzard will display the prompts and resolve the async functions in order, and then either give you an error, or the resolved data, ready to be dropped into a JSON file or some other place. ### promzard(inputFile, ctx, options) The inputFile is just a node module. You can require() things, set module.exports, etc. Whatever that module exports is the result, and it is walked over to call any functions as described below. The only caveat is that you must give PromZard the full absolute path to the module (you can get this via Node's `require.resolve`.) Also, the `prompt` function is injected into the context object, so watch out. Whatever you put in that `ctx` will of course also be available in the module. You can get quite fancy with this, passing in existing configs and so on. #### options.backupFile Use the `backupFile` option as a fallback when `inputFile` fails to be read. ### Class: promzard.PromZard(file, ctx, options).load() Just like the `promzard` function, but the class that makes it all happen. The `load` method returns a promise which will resolve to the resolved data or throw with an error. ### prompt(...) In the promzard input module, you can call the `prompt` function. This prompts the user to input some data. The arguments are interpreted based on type: 1. `string` The first string encountered is the prompt. The second is the default value. 2. `function` A transformer function which receives the data and returns something else. More than meets the eye. 3. `object` The `prompt` member is the prompt, the `default` member is the default value, and the `transform` is the transformer. Whatever the final value is, that's what will be put on the resulting object. ### Functions If there are any functions on the promzard input module's exports, then promzard will await each of them. This way, your module can do asynchronous actions if necessary to validate or ascertain whatever needs verification. The functions are called in the context of the ctx object. In the async function, you can also call prompt() and return the result of the prompt. For example, this works fine in a promzard module: ```js exports.asyncPrompt = async function () { const st = await fs.stat(someFile) // if there's an error, no prompt, just error // otherwise prompt and use the actual file size as the default return prompt('file size', st.size) } ``` You can also return other async functions in the async function callback. Though that's a bit silly, it could be a handy way to reuse functionality in some cases. ### Sync vs Async The `prompt()` function is not synchronous, though it appears that way. It just returns a token that is swapped out when the data object is walked over asynchronously later, and returns a token. For that reason, prompt() calls whose results don't end up on the data object are never shown to the user. For example, this will only prompt once: ``` exports.promptThreeTimes = prompt('prompt me once', 'shame on you') exports.promptThreeTimes = prompt('prompt me twice', 'um....') exports.promptThreeTimes = prompt('you cant prompt me again') ``` ### Isn't this exactly the sort of 'looks sync' that you said was bad about other libraries? Yeah, sorta. I wouldn't use promzard for anything more complicated than a wizard that spits out prompts to set up a config file or something. Maybe there are other use cases I haven't considered. ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/SECURITY.md��������������������������������������������������������������������0000664�0000000�0000000�00000002320�15076464627�0016307�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������<!-- This file is automatically added by @npmcli/template-oss. Do not edit. --> GitHub takes the security of our software products and services seriously, including the open source code repositories managed through our GitHub organizations, such as [GitHub](https://github.com/GitHub). If you believe you have found a security vulnerability in this GitHub-owned open source repository, you can report it to us in one of two ways. If the vulnerability you have found is *not* [in scope for the GitHub Bug Bounty Program](https://bounty.github.com/#scope) or if you do not wish to be considered for a bounty reward, please report the issue to us directly through [opensource-security@github.com](mailto:opensource-security@github.com). If the vulnerability you have found is [in scope for the GitHub Bug Bounty Program](https://bounty.github.com/#scope) and you would like for your finding to be considered for a bounty reward, please submit the vulnerability to us through [HackerOne](https://hackerone.com/github) in order to be eligible to receive a bounty award. **Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** Thanks for helping make GitHub safe for everyone. ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/lib/���������������������������������������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0015267�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/lib/index.js�������������������������������������������������������������������0000664�0000000�0000000�00000011072�15076464627�0016735�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const fs = require('fs/promises') const { runInThisContext } = require('vm') const { promisify } = require('util') const { randomBytes } = require('crypto') const { Module } = require('module') const { dirname, basename } = require('path') const { read } = require('read') const files = {} class PromZard { #file = null #backupFile = null #ctx = null #unique = randomBytes(8).toString('hex') #prompts = [] constructor (file, ctx = {}, options = {}) { this.#file = file this.#ctx = ctx this.#backupFile = options.backupFile } static async promzard (file, ctx, options) { const pz = new PromZard(file, ctx, options) return pz.load() } static async fromBuffer (buf, ctx, options) { let filename = 0 do { filename = '\0' + Math.random() } while (files[filename]) files[filename] = buf const ret = await PromZard.promzard(filename, ctx, options) delete files[filename] return ret } async load () { if (files[this.#file]) { return this.#loaded() } try { files[this.#file] = await fs.readFile(this.#file, 'utf8') } catch (er) { if (er && this.#backupFile) { this.#file = this.#backupFile this.#backupFile = null return this.load() } throw er } return this.#loaded() } async #loaded () { const mod = new Module(this.#file, module) mod.loaded = true mod.filename = this.#file mod.id = this.#file mod.paths = Module._nodeModulePaths(dirname(this.#file)) this.#ctx.prompt = this.#makePrompt() this.#ctx.__filename = this.#file this.#ctx.__dirname = dirname(this.#file) this.#ctx.__basename = basename(this.#file) this.#ctx.module = mod this.#ctx.require = (p) => mod.require(p) this.#ctx.require.resolve = (p) => Module._resolveFilename(p, mod) this.#ctx.exports = mod.exports const body = `(function(${Object.keys(this.#ctx).join(', ')}) { ${files[this.#file]}\n })` runInThisContext(body, this.#file).apply(this.#ctx, Object.values(this.#ctx)) this.#ctx.res = mod.exports return this.#walk() } #makePrompt () { return (...args) => { let p, d, t for (let i = 0; i < args.length; i++) { const a = args[i] if (typeof a === 'string') { if (p) { d = a } else { p = a } } else if (typeof a === 'function') { t = a } else if (a && typeof a === 'object') { p = a.prompt || p d = a.default || d t = a.transform || t } } try { return `${this.#unique}-${this.#prompts.length}` } finally { this.#prompts.push([p, d, t]) } } } async #walk (o = this.#ctx.res) { const keys = Object.keys(o) const len = keys.length let i = 0 while (i < len) { const k = keys[i] const v = o[k] i++ if (v && typeof v === 'object') { o[k] = await this.#walk(v) continue } if (v && typeof v === 'string' && v.startsWith(this.#unique)) { const n = +v.slice(this.#unique.length + 1) // default to the key // default to the ctx value, if there is one const [prompt = k, def = this.#ctx[k], tx] = this.#prompts[n] try { o[k] = await this.#prompt(prompt, def, tx) } catch (er) { if (er.notValid) { // eslint-disable-next-line no-console console.log(er.message) i-- } else { throw er } } continue } if (typeof v === 'function') { // XXX: remove v.length check to remove cb from functions // would be a breaking change for `npm init` // XXX: if cb is no longer an argument then this.#ctx should // be passed in to allow arrow fns to be used and still access ctx const fn = v.length ? promisify(v) : v o[k] = await fn.call(this.#ctx) // back up so that we process this one again. // this is because it might return a prompt() call in the cb. i-- continue } } return o } async #prompt (prompt, def, tx) { const res = await read({ prompt: prompt + ':', default: def }).then((r) => tx ? tx(r) : r) // XXX: remove this to require throwing an error instead of // returning it. would be a breaking change for `npm init` if (res instanceof Error && res.notValid) { throw res } return res } } module.exports = PromZard.promzard module.exports.fromBuffer = PromZard.fromBuffer module.exports.PromZard = PromZard ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/package.json�������������������������������������������������������������������0000664�0000000�0000000�00000002174�15076464627�0017013�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ "author": "GitHub Inc.", "name": "promzard", "description": "prompting wizardly", "version": "3.0.1", "repository": { "url": "git+https://github.com/npm/promzard.git", "type": "git" }, "dependencies": { "read": "^5.0.0" }, "devDependencies": { "@npmcli/eslint-config": "^5.0.0", "@npmcli/template-oss": "4.27.1", "tap": "^16.3.0" }, "main": "lib/index.js", "scripts": { "test": "tap", "lint": "npm run eslint", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run eslint -- --fix", "snap": "tap", "posttest": "npm run lint", "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" }, "license": "ISC", "files": [ "bin/", "lib/" ], "engines": { "node": "^20.17.0 || >=22.9.0" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "version": "4.27.1", "publish": true }, "tap": { "jobs": 1, "test-ignore": "fixtures/", "nyc-arg": [ "--exclude", "tap-snapshots/**" ] } } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/release-please-config.json�����������������������������������������������������0000664�0000000�0000000�00000001277�15076464627�0021555�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ "group-pull-request-title-pattern": "chore: release ${version}", "pull-request-title-pattern": "chore: release${component} ${version}", "changelog-sections": [ { "type": "feat", "section": "Features", "hidden": false }, { "type": "fix", "section": "Bug Fixes", "hidden": false }, { "type": "docs", "section": "Documentation", "hidden": false }, { "type": "deps", "section": "Dependencies", "hidden": false }, { "type": "chore", "section": "Chores", "hidden": true } ], "packages": { ".": { "package-name": "" } }, "prerelease-type": "pre.0" } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/��������������������������������������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0015500�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/backup-file copy.js�������������������������������������������������������0000664�0000000�0000000�00000000702�15076464627�0021152�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const t = require('tap') const { setup, child, isChild, getFixture } = require('./fixtures/setup') if (isChild()) { return child('file does not exist', { tmpdir: '/tmp' }, { backupFile: getFixture('simple') }) } t.test('backup file', async (t) => { const output = await setup(__filename, ['', '55', 'no']) t.same(JSON.parse(output), { a: 3, b: '!2b', c: { x: 55, y: '/tmp/y/file.txt', }, error: 'no', }) }) ��������������������������������������������������������������npm-promzard-47c462e/test/basic.js������������������������������������������������������������������0000664�0000000�0000000�00000002162�15076464627�0017120�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const t = require('tap') const { setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child(__filename, { basename: 'node-example' }) } t.test('run the example', async (t) => { const output = await setup(__filename, [ 'testing description', 'test-entry.js', 'fugazi function waiting room', ]) t.same(JSON.parse(output), { name: 'example', version: '0.0.0', description: 'testing description', main: 'test-entry.js', resolved: 'index.js', directories: { example: 'example', test: 'test', }, dependencies: {}, devDependencies: { tap: '~0.2.5', }, scripts: { test: 'tap test/*.js', }, repository: { type: 'git', url: 'git://github.com/substack/node-example.git', }, homepage: 'https://github.com/substack/node-example', keywords: [ 'fugazi', 'function', 'waiting', 'room', ], author: { name: 'James Halliday', email: 'mail@substack.net', url: 'http://substack.net', }, license: 'MIT', engine: { node: '>=0.6', }, }) }) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/buffer.js�����������������������������������������������������������������0000664�0000000�0000000�00000002170�15076464627�0017307�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const t = require('tap') const { setup, childBuffer, isChild } = require('./fixtures/setup') if (isChild()) { return childBuffer('basic', { basename: 'node-example' }) } t.test('run the example', async (t) => { const output = await setup(__filename, [ 'testing description', 'test-entry.js', 'fugazi function waiting room', ]) t.same(JSON.parse(output), { name: 'example', version: '0.0.0', description: 'testing description', main: 'test-entry.js', resolved: 'error', directories: { example: 'example', test: 'test', }, dependencies: {}, devDependencies: { tap: '~0.2.5', }, scripts: { test: 'tap test/*.js', }, repository: { type: 'git', url: 'git://github.com/substack/node-example.git', }, homepage: 'https://github.com/substack/node-example', keywords: [ 'fugazi', 'function', 'waiting', 'room', ], author: { name: 'James Halliday', email: 'mail@substack.net', url: 'http://substack.net', }, license: 'MIT', engine: { node: '>=0.6', }, }) }) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/conditional.js������������������������������������������������������������0000664�0000000�0000000�00000001066�15076464627�0020344�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ const t = require('tap') const { setup: _setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child(__filename) } const setup = (...args) => _setup(__filename, args).then(JSON.parse) t.test('conditional', async (t) => { t.same(await setup(''), {}) t.same(await setup('a'), {}) t.same(await setup('git', ''), {}) t.same(await setup('git', 'http'), { repository: { type: 'git', url: 'http', }, }) t.same(await setup('svn', 'http'), { repository: { type: 'svn', url: 'http', }, }) }) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/error-file.js�������������������������������������������������������������0000664�0000000�0000000�00000000347�15076464627�0020110�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const t = require('tap') const { setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child('file does not exist') } t.test('backup file', async (t) => { t.match(await setup(__filename), 'ENOENT') }) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/exports.js����������������������������������������������������������������0000664�0000000�0000000�00000000552�15076464627�0017544�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const t = require('tap') const { setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child(__filename, { tmpdir: '/tmp' }) } t.test('exports', async (t) => { const output = await setup(__filename, ['', '55']) t.same(JSON.parse(output), { a: 3, b: '!2b', c: { x: 55, y: '/tmp/y/file.txt', }, }) }) ������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/�����������������������������������������������������������������0000775�0000000�0000000�00000000000�15076464627�0017351�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/basic.fixture.js�������������������������������������������������0000664�0000000�0000000�00000002676�15076464627�0022470�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* globals prompt, basename */ const fs = require('fs/promises') const path = require('path') module.exports = { name: basename.replace(/^node-/, ''), version: '0.0.0', description: async () => { const value = await fs.readFile('README.markdown', 'utf8') .then((src) => src.split('\n') .find((l) => /\s+/.test(l) && l.trim() !== basename.replace(/^node-/, '')) .trim() .replace(/^./, c => c.toLowerCase()) .replace(/\.$/, '')) .catch(() => null) return prompt('description', value) }, main: prompt('entry point', 'index.js'), resolved: () => { try { return path.basename(require.resolve('../../')) } catch { return 'error' } }, bin: async function () { const exists = await fs.stat('bin/cmd.js') .then(() => true) .catch(() => false) return exists ? { [basename.replace(/^node-/, '')]: 'bin/cmd.js', } : undefined }, directories: { example: 'example', test: 'test', }, dependencies: {}, devDependencies: { tap: '~0.2.5', }, scripts: { test: 'tap test/*.js', }, repository: { type: 'git', url: 'git://github.com/substack/' + basename + '.git', }, homepage: 'https://github.com/substack/' + basename, keywords: prompt((s) => s.split(/\s+/)), author: { name: 'James Halliday', email: 'mail@substack.net', url: 'http://substack.net', }, license: 'MIT', engine: { node: '>=0.6' }, } ������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/conditional.fixture.js�������������������������������������������0000664�0000000�0000000�00000000650�15076464627�0023700�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* globals prompt */ module.exports = { repository: { type: prompt('repo type'), url () { if (['git', 'svn'].includes(this.res.repository.type)) { return prompt(`${this.res.repository.type} url`) } }, }, // this name of this doesnt matter, just that it comes last '' () { if (!this.res.repository.type || !this.res.repository.url) { delete this.res.repository } }, } ����������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/exports.fixture.js�����������������������������������������������0000664�0000000�0000000�00000000254�15076464627�0023101�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* globals prompt, tmpdir */ exports.a = 1 + 2 exports.b = prompt('To be or not to be?', '!2b') exports.c = {} exports.c.x = prompt() exports.c.y = tmpdir + '/y/file.txt' ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/fn.fixture.js����������������������������������������������������0000664�0000000�0000000�00000001065�15076464627�0022001�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* globals prompt, tmpdir */ const fs = require('fs/promises') module.exports = { a: 1 + 2, b: prompt('To be or not to be?', '!2b', (s) => s.toUpperCase() + '...'), c: { x: prompt((x) => x * 100), y: tmpdir + '/y/file.txt', }, a_function: () => fs.readFile(__filename, 'utf8'), asyncPrompt: async () => { await new Promise(r => setTimeout(r, 100)) return prompt('a prompt at any other time would smell as sweet') }, cbPrompt: (cb) => { setTimeout(() => { cb(null, prompt('still works with callbacks')) }, 100) }, } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/prompts.fixture.js�����������������������������������������������0000664�0000000�0000000�00000000416�15076464627�0023101�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* globals prompt */ const transform = (a) => a module.exports = { a: prompt({ prompt: 'a', default: 'a', transform, }), b: prompt('b', 'b', () => 'b', { prompt: 'a', default: 'a', transform, }), c: prompt('c', 'c', transform, {}), } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/setup.js���������������������������������������������������������0000664�0000000�0000000�00000002507�15076464627�0021053�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const { spawn } = require('child_process') const { readFile } = require('fs/promises') const path = require('path') const promzard = require('../../') const CHILD = 'child' const isChild = () => process.argv[2] === CHILD const setup = async (file, writes = []) => { const proc = spawn(process.execPath, [file, CHILD]) const entries = Array.isArray(writes) ? writes : Object.entries(writes) let i = 0 let output = '' proc.stderr.on('data', (c) => output += c) proc.stdout.on('data', (c) => { let write = entries[i] if (Array.isArray(write)) { if (write[0].test(c.toString())) { write = write[1] } else { return } } i++ process.nextTick(() => proc.stdin[writes.length === i ? 'end' : 'write'](`${write}\n`)) }) await new Promise(res => proc.on('close', res)) return output } const getFixture = (f) => path.join(__dirname, path.basename(f, '.js') + '.fixture.js') async function child (f, ctx, options) { const output = await promzard(getFixture(f), ctx, options) console.error(JSON.stringify(output)) } async function childBuffer (f, ctx, options) { const buf = await readFile(getFixture(f)) const output = await promzard.fromBuffer(buf, ctx, options) console.error(JSON.stringify(output)) } module.exports = { setup, child, childBuffer, isChild, getFixture } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/simple.fixture.js������������������������������������������������0000664�0000000�0000000�00000000446�15076464627�0022671�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* globals prompt, tmpdir */ module.exports = { a: 1 + 2, b: prompt('To be or not to be?', '!2b'), c: { x: prompt(), y: tmpdir + '/y/file.txt', }, error: prompt('error', (v) => { if (v === 'throw') { throw new Error('this is unexpected') } return v }), } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fixtures/validate.fixture.js����������������������������������������������0000664�0000000�0000000�00000000624�15076464627�0023167�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* globals prompt */ module.exports = { name: prompt('name', (data) => { if (data === 'cool') { return data } return Object.assign(new Error('name must be cool'), { notValid: true, }) }), name2: prompt('name2', (data) => { if (data === 'cool') { return data } throw Object.assign(new Error('name must be cool'), { notValid: true, }) }), } ������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/fn.js���������������������������������������������������������������������0000664�0000000�0000000�00000001151�15076464627�0016437�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ const t = require('tap') const fs = require('fs') const path = require('path') const { setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child(__filename, { tmpdir: '/tmp' }) } t.test('prompt callback param', async (t) => { const output = await setup(__filename, ['', '55', 'async prompt', 'cb prompt']) t.same(JSON.parse(output), { a: 3, b: '!2B...', c: { x: 5500, y: '/tmp/y/file.txt', }, a_function: fs.readFileSync(path.resolve(__dirname, 'fixtures/fn.fixture.js'), 'utf8'), asyncPrompt: 'async prompt', cbPrompt: 'cb prompt', }) }) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/prompts.js����������������������������������������������������������������0000664�0000000�0000000�00000000453�15076464627�0017544�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const t = require('tap') const { setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child(__filename) } t.test('prompts', async (t) => { const output = await setup(__filename, ['', '', '']) t.same(JSON.parse(output), { a: 'a', b: 'a', c: 'c', }) }) ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-promzard-47c462e/test/simple.js�����������������������������������������������������������������0000664�0000000�0000000�00000000757�15076464627�0017340�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������const t = require('tap') const { setup: _setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child(__filename, { tmpdir: '/tmp' }) } const setup = (...args) => _setup(__filename, args) t.test('simple', async (t) => { t.same(await setup('', '55', 'no error').then(JSON.parse), { a: 3, b: '!2b', c: { x: 55, y: '/tmp/y/file.txt', }, error: 'no error', }) t.match(await setup('', '55', 'throw'), /Error: this is unexpected/) }) �����������������npm-promzard-47c462e/test/validate.js���������������������������������������������������������������0000664�0000000�0000000�00000000612�15076464627�0017626�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������ const t = require('tap') const { setup, child, isChild } = require('./fixtures/setup') if (isChild()) { return child(__filename) } t.test('validate', async (t) => { const output = await setup(__filename, [ [/name: $/, 'not cool'], [/name: $/, 'cool'], [/name2: $/, 'not cool'], [/name2: $/, 'cool'], ]) t.same(JSON.parse(output), { name: 'cool', name2: 'cool' }) }) ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������