pax_global_header00006660000000000000000000000064150764656700014532gustar00rootroot0000000000000052 comment=361af07ea1e5dcffb99b4bd36f752c1110a97d01 npm-read-361af07/000077500000000000000000000000001507646567000135665ustar00rootroot00000000000000npm-read-361af07/.commitlintrc.cjs000066400000000000000000000005661507646567000170600ustar00rootroot00000000000000/* 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-read-361af07/.eslintrc.cjs000066400000000000000000000010201507646567000161610ustar00rootroot00000000000000/* 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*/', 'dist/', ], parser: '@typescript-eslint/parser', settings: { 'import/resolver': { typescript: {}, }, }, extends: [ '@npmcli', ...localConfigs, ], } npm-read-361af07/.github/000077500000000000000000000000001507646567000151265ustar00rootroot00000000000000npm-read-361af07/.github/CODEOWNERS000066400000000000000000000001321507646567000165150ustar00rootroot00000000000000# This file is automatically added by @npmcli/template-oss. Do not edit. * @npm/cli-team npm-read-361af07/.github/ISSUE_TEMPLATE/000077500000000000000000000000001507646567000173115ustar00rootroot00000000000000npm-read-361af07/.github/ISSUE_TEMPLATE/bug.yml000066400000000000000000000026551507646567000206210ustar00rootroot00000000000000# 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-read-361af07/.github/ISSUE_TEMPLATE/config.yml��������������������������������������������������0000664�0000000�0000000�00000000145�15076465670�0021301�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This file is automatically added by @npmcli/template-oss. Do not edit. blank_issues_enabled: true ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.github/actions/�������������������������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0016566�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.github/actions/create-check/������������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0021104�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.github/actions/create-check/action.yml��������������������������������������������0000664�0000000�0000000�00000002720�15076465670�0023105�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-read-361af07/.github/actions/install-latest-npm/������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0022316�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.github/actions/install-latest-npm/action.yml��������������������������������������0000664�0000000�0000000�00000003406�15076465670�0024321�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-read-361af07/.github/dependabot.yml�������������������������������������������������������������0000664�0000000�0000000�00000000656�15076465670�0017765�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-read-361af07/.github/matchers/������������������������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0016734�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.github/matchers/tap.json����������������������������������������������������������0000664�0000000�0000000�00000001204�15076465670�0020410�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-read-361af07/.github/settings.yml���������������������������������������������������������������0000664�0000000�0000000�00000001377�15076465670�0017521�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-read-361af07/.github/workflows/�����������������������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0017163�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.github/workflows/audit.yml��������������������������������������������������������0000664�0000000�0000000�00000002275�15076465670�0021022�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-read-361af07/.github/workflows/ci-release.yml���������������������������������������������������0000664�0000000�0000000�00000010707�15076465670�0021724�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-read-361af07/.github/workflows/ci.yml�����������������������������������������������������������0000664�0000000�0000000�00000006141�15076465670�0020303�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-read-361af07/.github/workflows/codeql-analysis.yml����������������������������������������������0000664�0000000�0000000�00000001606�15076465670�0023001�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-read-361af07/.github/workflows/post-dependabot.yml����������������������������������������������0000664�0000000�0000000�00000012004�15076465670�0022773�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-read-361af07/.github/workflows/pull-request.yml�������������������������������������������������0000664�0000000�0000000�00000002737�15076465670�0022361�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-read-361af07/.github/workflows/release-integration.yml������������������������������������������0000664�0000000�0000000�00000004163�15076465670�0023653�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-read-361af07/.github/workflows/release.yml������������������������������������������������������0000664�0000000�0000000�00000026106�15076465670�0021333�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-read-361af07/.gitignore�������������������������������������������������������������������������0000664�0000000�0000000�00000001044�15076465670�0015555�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.cjs !/.eslint.config.js !/.eslintrc.cjs !/.eslintrc.local.* !/.git-blame-ignore-revs !/.github/ !/.gitignore !/.npmrc !/.prettierignore !/.prettierrc.cjs !/.release-please-manifest.json !/CHANGELOG* !/CODE_OF_CONDUCT.md !/CONTRIBUTING.md !/docs/ !/LICENSE* !/map.js !/package.json !/README* !/release-please-config.json !/scripts/ !/SECURITY.md !/src/ !/tap-snapshots/ !/test/ !/tsconfig.json tap-testdir*/ ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.npmrc�����������������������������������������������������������������������������0000664�0000000�0000000�00000000135�15076465670�0014705�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������; This file is automatically added by @npmcli/template-oss. Do not edit. package-lock=false �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/.release-please-manifest.json������������������������������������������������������0000664�0000000�0000000�00000000023�15076465670�0021225�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ ".": "5.0.1" } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/CHANGELOG.md�����������������������������������������������������������������������0000664�0000000�0000000�00000014371�15076465670�0015405�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Changelog ## [5.0.1](https://github.com/npm/read/compare/v5.0.0...v5.0.1) (2025-10-22) ### Dependencies * [`fa485f3`](https://github.com/npm/read/commit/fa485f306690b6b64b62f84103f5e94ef7ec5dd6) [#139](https://github.com/npm/read/pull/139) bump mute-stream from 2.0.0 to 3.0.0 (#139) (@dependabot[bot]) ## [5.0.0](https://github.com/npm/read/compare/v4.1.0...v5.0.0) (2025-10-22) ### ⚠️ BREAKING CHANGES * `read` now supports node `^20.17.0 || >=22.9.0` ### Bug Fixes * [`daa8671`](https://github.com/npm/read/commit/daa86711d0c93a5b9067cdb2aa90a4e120dc8b51) [#136](https://github.com/npm/read/pull/136) align to npm 11 node engine range (#136) (@owlstronaut) ### Chores * [`2e118b7`](https://github.com/npm/read/commit/2e118b70a8d235afbc1d08102514ae850cdc8c46) [#130](https://github.com/npm/read/pull/130) bump eslint-import-resolver-typescript from 3.10.0 to 4.3.2 (#130) (@dependabot[bot]) * [`47193b3`](https://github.com/npm/read/commit/47193b3922b596a9172ef3ec2a70569f6ee7b4fc) [#137](https://github.com/npm/read/pull/137) bump @npmcli/template-oss from 4.27.0 to 4.27.1 (#137) (@dependabot[bot], @npm-cli-bot) ## [4.1.0](https://github.com/npm/read/compare/v4.0.0...v4.1.0) (2025-01-30) ### Features * [`980e75c`](https://github.com/npm/read/commit/980e75cad4aea099ff37ff445ddb1ae935bc43c8) [#127](https://github.com/npm/read/pull/127) add `history` parameter (#127) (@JupiterPi) ## [4.0.0](https://github.com/npm/read/compare/v3.0.1...v4.0.0) (2024-09-25) ### ⚠️ BREAKING CHANGES * `read` now supports node `^18.17.0 || >=20.5.0` ### Bug Fixes * [`eddeb02`](https://github.com/npm/read/commit/eddeb02b2a807a2e8112126c5c3aacccf134d9fc) [#124](https://github.com/npm/read/pull/124) align to npm 10 node engine range (@hashtagchris) ### Dependencies * [`0641d3a`](https://github.com/npm/read/commit/0641d3a4f022d0d779a8cbd8d18c4e27a4054afd) [#124](https://github.com/npm/read/pull/124) `mute-stream@2.0.0` ### Chores * [`1b07665`](https://github.com/npm/read/commit/1b076658be7170593a8796e2f0db2184c3a72831) [#109](https://github.com/npm/read/pull/109) bump c8 from 8.0.1 to 10.1.2 (#109) (@dependabot[bot]) * [`cdf4cd8`](https://github.com/npm/read/commit/cdf4cd81806f06062d0c106dc336c4d32ca725c4) [#122](https://github.com/npm/read/pull/122) bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (#122) (@dependabot[bot]) * [`104dc92`](https://github.com/npm/read/commit/104dc924fa08142f5de1fdfd84fa8f33a0cd7556) [#116](https://github.com/npm/read/pull/116) bump tshy from 1.18.0 to 3.0.2 (#116) (@dependabot[bot]) * [`8f24ce4`](https://github.com/npm/read/commit/8f24ce489125cf44bba5022bc0474a7c097bdb07) [#124](https://github.com/npm/read/pull/124) run template-oss-apply (@hashtagchris) * [`8a7ba09`](https://github.com/npm/read/commit/8a7ba0924f1850cb686de768ab83d7e65e1004e7) [#120](https://github.com/npm/read/pull/120) bump @typescript-eslint/parser from 7.18.0 to 8.0.1 (#120) (@dependabot[bot]) * [`d6beca8`](https://github.com/npm/read/commit/d6beca844bcc8c662ab2856c99a6312fd727e9e7) [#103](https://github.com/npm/read/pull/103) bump @npmcli/template-oss to 4.22.0 (@lukekarrys) * [`ff55321`](https://github.com/npm/read/commit/ff55321ffe74704ac8be59e1519773f79ce039cf) [#100](https://github.com/npm/read/pull/100) bump @typescript-eslint/parser from 6.21.0 to 7.2.0 (#100) (@dependabot[bot]) * [`d30350d`](https://github.com/npm/read/commit/d30350d8d7eafe7ac1b476d1232e68bb22209308) [#123](https://github.com/npm/read/pull/123) postinstall for dependabot template-oss PR (@hashtagchris) * [`8558668`](https://github.com/npm/read/commit/8558668dc1c9f02bd63360910389e04319980c1d) [#123](https://github.com/npm/read/pull/123) bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot]) ## [3.0.1](https://github.com/npm/read/compare/v3.0.0...v3.0.1) (2023-11-20) ### Bug Fixes * [`22cb8dc`](https://github.com/npm/read/commit/22cb8dc5c7b567cd2d890ca2d71fed1faaf52d29) [#84](https://github.com/npm/read/pull/84) only ship dist files (@lukekarrys) ## [3.0.0](https://github.com/npm/read/compare/v2.1.0...v3.0.0) (2023-11-16) ### ⚠️ BREAKING CHANGES * `read` is now written in TypeScript and types are now shipped as part of this package. ### Features * [`18cb7bd`](https://github.com/npm/read/commit/18cb7bd9f364a5cafabd9cb52942f048da7178af) [#77](https://github.com/npm/read/pull/77) convert to typescript and esm (#77) (@lukekarrys) ### Documentation * [`ada826d`](https://github.com/npm/read/commit/ada826d2ded4e35a1e60d9f50dc31fda083d2a5d) [#59](https://github.com/npm/read/pull/59) remove unnecessary callback param (#59) (@igrep) ## [2.1.0](https://github.com/npm/read/compare/v2.0.0...v2.1.0) (2023-04-13) ### Features * [`c149cf9`](https://github.com/npm/read/commit/c149cf998223e2ae45c013768038717bc4a1c543) [#51](https://github.com/npm/read/pull/51) add completer option to forward to readline (#51) (@wraithgar, @131) ### Bug Fixes * [`c5932e8`](https://github.com/npm/read/commit/c5932e8d223990dd65a46226f560768c430d1888) [#35](https://github.com/npm/read/pull/35) Support rare \r line break (#35) (@NikxDa, @wraithgar, @wraithgar) * [`f30fe66`](https://github.com/npm/read/commit/f30fe6640287cbd5a341b7a9f65a60e40558e389) [#52](https://github.com/npm/read/pull/52) extra newline on muted, replaced input (#52) (@wraithgar, @deed02392) ## [2.0.0](https://github.com/npm/read/compare/v1.0.7...v2.0.0) (2022-12-13) ### ⚠️ BREAKING CHANGES * this module has been refactored to use promises - the API is now promise only and no longer accepts a callback - the Promise is resolved to a string and no longer returns `isDefault` * this package is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0` ### Features * [`c5b56f6`](https://github.com/npm/read/commit/c5b56f6242493173ded23a97f4fd2ffb4017310f) use async/await (@lukekarrys) * [`5a7563b`](https://github.com/npm/read/commit/5a7563bf20ae1392ee0d0b29a4d0ac5c23df9a33) add template-oss (@lukekarrys) ### Documentation * [`711d7cd`](https://github.com/npm/read/commit/711d7cd6a3d58472b88c7db1ab2129f37304d72c) [#30](https://github.com/npm/read/pull/30) Fix typo "Writeable" => "Writable" in README.MD (#30) (@vitalymak, @vitalymak) ### Dependencies * [`6102578`](https://github.com/npm/read/commit/6102578bd1c9d192a1d6601564faa066af13b35d) [#42](https://github.com/npm/read/pull/42) bump mute-stream from 0.0.8 to 1.0.0 (#42) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/CODE_OF_CONDUCT.md�����������������������������������������������������������������0000664�0000000�0000000�00000000507�15076465670�0016367�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-read-361af07/CONTRIBUTING.md��������������������������������������������������������������������0000664�0000000�0000000�00000005133�15076465670�0016021�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-read-361af07/LICENSE����������������������������������������������������������������������������0000664�0000000�0000000�00000001375�15076465670�0014601�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������The ISC License Copyright (c) Isaac Z. Schlueter and Contributors 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-read-361af07/README.md��������������������������������������������������������������������������0000664�0000000�0000000�00000002375�15076465670�0015054�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������## read For reading user input from stdin. Similar to the `readline` builtin's `question()` method, but with a few more features. ## Usage ```javascript const { read } = require('read') // or with ESM: import { read } from 'read' try { const result = await read(options) } catch (er) { console.error(er) } ``` ## Options Every option is optional. * `prompt` What to write to stdout before reading input. * `silent` Don't echo the output as the user types it. * `replace` Replace silenced characters with the supplied character value. * `timeout` Number of ms to wait for user input before giving up. * `default` The default value if the user enters nothing. * `edit` Allow the user to edit the default value. * `terminal` Treat the output as a TTY, whether it is or not. * `input` Readable stream to get input data from. (default `process.stdin`) * `output` Writable stream to write prompts to. (default: `process.stdout`) * `completer` Autocomplete callback (see [official api](https://nodejs.org/api/readline.html#readline_readline_createinterface_options) for details * `history` History array, which will be appended to. If silent is true, and the input is a TTY, then read will set raw mode, and read character by character. ## Contributing Patches welcome. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/SECURITY.md������������������������������������������������������������������������0000664�0000000�0000000�00000002320�15076465670�0015354�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-read-361af07/package.json�����������������������������������������������������������������������0000664�0000000�0000000�00000004105�15076465670�0016054�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ "name": "read", "version": "5.0.1", "exports": { "./package.json": "./package.json", ".": { "import": { "types": "./dist/esm/read.d.ts", "default": "./dist/esm/read.js" }, "require": { "types": "./dist/commonjs/read.d.ts", "default": "./dist/commonjs/read.js" } } }, "type": "module", "tshy": { "exports": { "./package.json": "./package.json", ".": "./src/read.ts" } }, "dependencies": { "mute-stream": "^3.0.0" }, "devDependencies": { "@npmcli/eslint-config": "^5.0.0", "@npmcli/template-oss": "4.27.1", "@types/mute-stream": "^0.0.4", "@types/tap": "^15.0.11", "@typescript-eslint/parser": "^8.0.1", "c8": "^10.1.2", "eslint-import-resolver-typescript": "^4.3.2", "tap": "^16.3.9", "ts-node": "^10.9.1", "tshy": "^3.0.2", "typescript": "^5.2.2" }, "engines": { "node": "^20.17.0 || >=22.9.0" }, "author": "GitHub Inc.", "description": "read(1) for node programs", "repository": { "type": "git", "url": "git+https://github.com/npm/read.git" }, "license": "ISC", "scripts": { "prepare": "tshy", "pretest": "npm run prepare", "presnap": "npm run prepare", "test": "c8 tap", "lint": "npm run eslint", "postlint": "template-oss-check", "template-oss-apply": "template-oss-apply --force", "lintfix": "npm run eslint -- --fix", "snap": "c8 tap", "posttest": "npm run lint", "eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"" }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", "version": "4.27.1", "publish": true, "typescript": true }, "main": "./dist/commonjs/read.js", "types": "./dist/commonjs/read.d.ts", "tap": { "coverage": false, "node-arg": [ "--no-warnings", "--loader", "ts-node/esm" ], "ts": false, "nyc-arg": [ "--exclude", "tap-snapshots/**" ] }, "files": [ "dist/" ], "module": "./dist/esm/read.js" } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/release-please-config.json���������������������������������������������������������0000664�0000000�0000000�00000001277�15076465670�0020622�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-read-361af07/src/�������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0014355�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/src/read.ts������������������������������������������������������������������������0000664�0000000�0000000�00000006043�15076465670�0015643�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import Mute from 'mute-stream' import { Completer, AsyncCompleter, createInterface, ReadLineOptions } from 'readline' export interface Options<T extends string | number = string> { default?: T input?: ReadLineOptions['input'] & { isTTY?: boolean } output?: ReadLineOptions['output'] & { isTTY?: boolean } prompt?: string silent?: boolean timeout?: number edit?: boolean terminal?: boolean replace?: string, completer?: Completer | AsyncCompleter, history?: string[], } export async function read<T extends string | number = string> ({ default: def, input = process.stdin, output = process.stdout, completer, prompt = '', silent, timeout, edit, terminal, replace, history, }: Options<T>): Promise<T | string> { if ( typeof def !== 'undefined' && typeof def !== 'string' && typeof def !== 'number' ) { throw new Error('default value must be string or number') } let editDef = false const defString = def?.toString() prompt = prompt.trim() + ' ' terminal = !!(terminal || output.isTTY) if (defString) { if (silent) { prompt += '(<default hidden>) ' // TODO: add tests for edit /* c8 ignore start */ } else if (edit) { editDef = true /* c8 ignore stop */ } else { prompt += '(' + defString + ') ' } } const m = new Mute({ replace, prompt }) m.pipe(output, { end: false }) output = m return new Promise<string | T>((resolve, reject) => { const rl = createInterface({ input, output, terminal, completer, history }) // TODO: add tests for timeout /* c8 ignore start */ const timer = timeout && setTimeout(() => onError(new Error('timed out')), timeout) /* c8 ignore stop */ m.unmute() rl.setPrompt(prompt) rl.prompt() if (silent) { m.mute() // TODO: add tests for edit + default /* c8 ignore start */ } else if (editDef && defString) { const rlEdit = rl as typeof rl & { line: string, cursor: number, _refreshLine: () => void, } rlEdit.line = defString rlEdit.cursor = defString.length rlEdit._refreshLine() } /* c8 ignore stop */ const done = () => { rl.close() clearTimeout(timer) m.mute() m.end() } // TODO: add tests for rejecting /* c8 ignore start */ const onError = (er: Error) => { done() reject(er) } /* c8 ignore stop */ rl.on('error', onError) rl.on('line', line => { // TODO: add tests for silent /* c8 ignore start */ if (silent && terminal) { m.unmute() } /* c8 ignore stop */ done() // TODO: add tests for default /* c8 ignore start */ // truncate the \n at the end. return resolve(line.replace(/\r?\n?$/, '') || defString || '') /* c8 ignore stop */ }) // TODO: add tests for sigint /* c8 ignore start */ rl.on('SIGINT', () => { rl.close() onError(new Error('canceled')) }) /* c8 ignore stop */ }) } ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/test/������������������������������������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0014545�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/test/basic.ts����������������������������������������������������������������������0000664�0000000�0000000�00000003447�15076465670�0016206�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import t from 'tap' import { read } from '../src/read.js' import spawnRead from './fixtures/setup.js' async function child () { const user = await read({ prompt: 'Username: ', default: 'test-user' }) const pass = await read({ prompt: 'Password: ', default: 'test-pass', silent: true, }) const verify = await read({ prompt: 'Password again: ', default: 'test-pass', silent: true, }) console.error( JSON.stringify({ user, pass, verify, passMatch: pass === verify, }) ) if (process.stdin.unref) { process.stdin.unref() } } const main = () => { t.test('basic', async t => { const { stdout, stderr } = await spawnRead(import.meta.url, { 'Username: (test-user)': 'a user', 'Password: (<default hidden>)': 'a password', 'Password again: (<default hidden>)': 'a password', }) t.same(JSON.parse(stderr), { user: 'a user', pass: 'a password', verify: 'a password', passMatch: true, }) t.equal( stdout, 'Username: (test-user) Password: (<default hidden>) Password again: (<default hidden>) ' ) }) t.test('defaults', async t => { const { stdout, stderr } = await spawnRead(import.meta.url, { 'Username: (test-user)': '', 'Password: (<default hidden>)': '', 'Password again: (<default hidden>)': '', }) t.same(JSON.parse(stderr), { user: 'test-user', pass: 'test-pass', verify: 'test-pass', passMatch: true, }) t.equal( stdout, 'Username: (test-user) Password: (<default hidden>) Password again: (<default hidden>) ' ) }) t.test('errors', async t => { // @ts-expect-error t.rejects(() => read({ default: {} })) }) } if (process.argv[2] === 'child') { child() } else { main() } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/test/fixtures/���������������������������������������������������������������������0000775�0000000�0000000�00000000000�15076465670�0016416�5����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/test/fixtures/setup.ts�������������������������������������������������������������0000664�0000000�0000000�00000002016�15076465670�0020125�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import { spawn } from 'child_process' import { fileURLToPath } from 'url' const esc = (str: string) => str.replace(/([()])/g, '\\$1') const spawnRead = async ( url: string, writes: { [k: string]: string } ): Promise<{ stdout: string; stderr: string }> => { const filename = fileURLToPath(url) const proc = spawn(process.execPath, [ ...process.execArgv, filename, 'child', ]) return new Promise((resolve, reject) => { let stdout = '' let stderr = '' proc.stdout.on('data', c => { stdout += c for (const [prompt, write] of Object.entries(writes)) { if (stdout.match(new RegExp(`${esc(prompt)} $`))) { return process.nextTick(() => proc.stdin.write(`${write}\n`)) } } reject( new Error(`unknown prompt:\n${stdout}\n${JSON.stringify(writes)}`) ) }) proc.stderr.on('data', c => { stderr += c }) proc.on('close', () => resolve({ stdout, stderr, }) ) }) } export default spawnRead ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/test/many.ts�����������������������������������������������������������������������0000664�0000000�0000000�00000001513�15076465670�0016061�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������import t from 'tap' import spawnRead from './fixtures/setup.js' import { read } from '../src/read.js' const times = new Array(18).fill(null).map((_, i) => (i + 1).toString()) async function child () { const res: string[] = [] for (const t of times) { const r = await read({ prompt: `num ${t}` }) res.push(r) } console.error(...res) if (process.stdin.unref) { process.stdin.unref() } } const main = () => { t.test('many reads', async t => { const writes = times.reduce((acc: { [k: string]: string }, k) => { acc[`num ${k}`] = k return acc }, {}) const { stdout, stderr } = await spawnRead(import.meta.url, writes) t.equal(stdout, Object.keys(writes).join(' ') + ' ') t.equal(stderr, times.join(' ') + '\n') }) } if (process.argv[2] === 'child') { child() } else { main() } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������npm-read-361af07/tsconfig.json����������������������������������������������������������������������0000664�0000000�0000000�00000000607�15076465670�0016300�0����������������������������������������������������������������������������������������������������ustar�00root����������������������������root����������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������{ "compilerOptions": { "jsx": "react", "declaration": true, "declarationMap": true, "inlineSources": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "moduleResolution": "nodenext", "resolveJsonModule": true, "skipLibCheck": true, "sourceMap": true, "strict": true, "target": "es2022", "module": "nodenext" } } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������