pax_global_header 0000666 0000000 0000000 00000000064 14666174421 0014525 g ustar 00root root 0000000 0000000 52 comment=8105dea8ca31296f5826e62683e63539401d6a8e
proc-log-5.0.0/ 0000775 0000000 0000000 00000000000 14666174421 0013251 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.commitlintrc.js 0000664 0000000 0000000 00000000566 14666174421 0016400 0 ustar 00root root 0000000 0000000 /* 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],
},
}
proc-log-5.0.0/.eslintrc.js 0000664 0000000 0000000 00000000623 14666174421 0015511 0 ustar 00root root 0000000 0000000 /* 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,
],
}
proc-log-5.0.0/.github/ 0000775 0000000 0000000 00000000000 14666174421 0014611 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.github/CODEOWNERS 0000664 0000000 0000000 00000000132 14666174421 0016200 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
* @npm/cli-team
proc-log-5.0.0/.github/ISSUE_TEMPLATE/ 0000775 0000000 0000000 00000000000 14666174421 0016774 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.github/ISSUE_TEMPLATE/bug.yml 0000664 0000000 0000000 00000002655 14666174421 0020304 0 ustar 00root root 0000000 0000000 # 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
proc-log-5.0.0/.github/ISSUE_TEMPLATE/config.yml 0000664 0000000 0000000 00000000145 14666174421 0020764 0 ustar 00root root 0000000 0000000 # This file is automatically added by @npmcli/template-oss. Do not edit.
blank_issues_enabled: true
proc-log-5.0.0/.github/actions/ 0000775 0000000 0000000 00000000000 14666174421 0016251 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.github/actions/create-check/ 0000775 0000000 0000000 00000000000 14666174421 0020567 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.github/actions/create-check/action.yml 0000664 0000000 0000000 00000002720 14666174421 0022570 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 }}"}
proc-log-5.0.0/.github/actions/install-latest-npm/ 0000775 0000000 0000000 00000000000 14666174421 0022001 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.github/actions/install-latest-npm/action.yml 0000664 0000000 0000000 00000003406 14666174421 0024004 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
proc-log-5.0.0/.github/dependabot.yml 0000664 0000000 0000000 00000000656 14666174421 0017450 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
proc-log-5.0.0/.github/matchers/ 0000775 0000000 0000000 00000000000 14666174421 0016417 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.github/matchers/tap.json 0000664 0000000 0000000 00000001204 14666174421 0020073 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
}
]
}
]
}
proc-log-5.0.0/.github/settings.yml 0000664 0000000 0000000 00000001377 14666174421 0017204 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" ]
proc-log-5.0.0/.github/workflows/ 0000775 0000000 0000000 00000000000 14666174421 0016646 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/.github/workflows/audit.yml 0000664 0000000 0000000 00000002236 14666174421 0020502 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"
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
proc-log-5.0.0/.github/workflows/ci-release.yml 0000664 0000000 0000000 00000011011 14666174421 0021374 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
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:
- 18.17.0
- 18.x
- 20.5.0
- 20.x
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.5.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- 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 }}
proc-log-5.0.0/.github/workflows/ci.yml 0000664 0000000 0000000 00000006263 14666174421 0017773 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"
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:
- 18.17.0
- 18.x
- 20.5.0
- 20.x
- 22.x
exclude:
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.17.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 18.x
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.5.0
- platform: { name: macOS, os: macos-13, shell: bash }
node-version: 20.x
- 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
proc-log-5.0.0/.github/workflows/codeql-analysis.yml 0000664 0000000 0000000 00000001547 14666174421 0022470 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"
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
proc-log-5.0.0/.github/workflows/post-dependabot.yml 0000664 0000000 0000000 00000011773 14666174421 0022472 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=-w ${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
proc-log-5.0.0/.github/workflows/pull-request.yml 0000664 0000000 0000000 00000002700 14666174421 0022032 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
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
proc-log-5.0.0/.github/workflows/release-integration.yml 0000664 0000000 0000000 00000004102 14666174421 0023327 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
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
proc-log-5.0.0/.github/workflows/release.yml 0000664 0000000 0000000 00000026061 14666174421 0021016 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:
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'
proc-log-5.0.0/.gitignore 0000664 0000000 0000000 00000001024 14666174421 0015236 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
!/.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*/
proc-log-5.0.0/.npmrc 0000664 0000000 0000000 00000000135 14666174421 0014370 0 ustar 00root root 0000000 0000000 ; This file is automatically added by @npmcli/template-oss. Do not edit.
package-lock=false
proc-log-5.0.0/.release-please-manifest.json 0000664 0000000 0000000 00000000023 14666174421 0020710 0 ustar 00root root 0000000 0000000 {
".": "5.0.0"
}
proc-log-5.0.0/CHANGELOG.md 0000664 0000000 0000000 00000027560 14666174421 0015074 0 ustar 00root root 0000000 0000000 # Changelog
## [5.0.0](https://github.com/npm/proc-log/compare/v4.2.0...v5.0.0) (2024-09-03)
### ⚠️ BREAKING CHANGES
* `proc-log` now supports node `^18.17.0 || >=20.5.0`
### Bug Fixes
* [`aa3a1f6`](https://github.com/npm/proc-log/commit/aa3a1f65bf38bfd3305a73bdf4b432af12393012) [#101](https://github.com/npm/proc-log/pull/101) align to npm 10 node engine range (@hashtagchris)
### Chores
* [`2697148`](https://github.com/npm/proc-log/commit/2697148878a32af8c56745486dd0ed44b0e403aa) [#101](https://github.com/npm/proc-log/pull/101) run template-oss-apply (@hashtagchris)
* [`4e025d2`](https://github.com/npm/proc-log/commit/4e025d25c53cd85b767fc9e735f756b9f51a7b57) [#99](https://github.com/npm/proc-log/pull/99) bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])
* [`3d6ab24`](https://github.com/npm/proc-log/commit/3d6ab248c75c9bca053755da4fe9c74e894f0066) [#88](https://github.com/npm/proc-log/pull/88) bump @npmcli/template-oss to 4.22.0 (@lukekarrys)
* [`e12dd15`](https://github.com/npm/proc-log/commit/e12dd15f94483daf7237468a6f4c9df96a4b523d) [#83](https://github.com/npm/proc-log/pull/83) chore: chore: postinstall for dependabot template-oss PR (@lukekarrys)
* [`3cfe857`](https://github.com/npm/proc-log/commit/3cfe8571050f83fe0452a107a0696cafe1af1a51) [#100](https://github.com/npm/proc-log/pull/100) postinstall for dependabot template-oss PR (@hashtagchris)
* [`2b4320c`](https://github.com/npm/proc-log/commit/2b4320c544a0e42fc784d5f75d042908a7227cf6) [#100](https://github.com/npm/proc-log/pull/100) bump @npmcli/template-oss from 4.23.1 to 4.23.3 (@dependabot[bot])
## [4.2.0](https://github.com/npm/proc-log/compare/v4.1.0...v4.2.0) (2024-04-16)
### Features
* [`4c0d3cf`](https://github.com/npm/proc-log/commit/4c0d3cfde92e639e81a76655df74e0204a56eec8) [#85](https://github.com/npm/proc-log/pull/85) add flush method to output (#85) (@lukekarrys)
## [4.1.0](https://github.com/npm/proc-log/compare/v4.0.0...v4.1.0) (2024-04-15)
### Features
* [`e00086e`](https://github.com/npm/proc-log/commit/e00086ea425a9cb6a849e3853bd3ae79910b3d44) [#80](https://github.com/npm/proc-log/pull/80) add timers and read (@lukekarrys)
### Bug Fixes
* [`4832b21`](https://github.com/npm/proc-log/commit/4832b21f33513ceb0482ba1757594e9776cff408) [#80](https://github.com/npm/proc-log/pull/80) remove args from log pause/resume (@lukekarrys)
## [4.0.0](https://github.com/npm/proc-log/compare/v3.0.0...v4.0.0) (2024-04-12)
### ⚠️ BREAKING CHANGES
* the exports on this package have changed. The current functionality has moved to a `log` function in the exports.
### Features
* [`39db1e1`](https://github.com/npm/proc-log/commit/39db1e10e0f10acab4bf02ded5c8b9e6598a6c70) [#77](https://github.com/npm/proc-log/pull/77) add output methods (@wraithgar)
* [`12f35fe`](https://github.com/npm/proc-log/commit/12f35fe4c95caab14966acece3e8fa06ed5e3613) [#77](https://github.com/npm/proc-log/pull/77) log: add timing log level (@wraithgar)
* [`8e90af0`](https://github.com/npm/proc-log/commit/8e90af02d49bed669f9b42d7a31d51d3849aaef1) [#77](https://github.com/npm/proc-log/pull/77) change current exported function "log" (@wraithgar)
### Bug Fixes
* [`ac543c4`](https://github.com/npm/proc-log/commit/ac543c4456443bfa6f044edcfbff2f214e04996b) [#77](https://github.com/npm/proc-log/pull/77) switch to traditional functions (@wraithgar)
* [`978fbf9`](https://github.com/npm/proc-log/commit/978fbf9fbe47a2ec71a61e0adfe61a17c14bce48) [#77](https://github.com/npm/proc-log/pull/77) refactor: don't loop through levels to generate log export (@wraithgar)
### Chores
* [`a393ac6`](https://github.com/npm/proc-log/commit/a393ac604a160c60b677daf2f12658abd25c5f65) [#78](https://github.com/npm/proc-log/pull/78) enable auto publish (#78) (@wraithgar)
* [`3caba0e`](https://github.com/npm/proc-log/commit/3caba0e5209359104e4ae386eb3092bf0a1361be) [#77](https://github.com/npm/proc-log/pull/77) add test plan count for current methods (@wraithgar)
* [`6442a36`](https://github.com/npm/proc-log/commit/6442a3672143060f20cb015808019adbc4378c9f) [#73](https://github.com/npm/proc-log/pull/73) postinstall for dependabot template-oss PR (@lukekarrys)
* [`f8df624`](https://github.com/npm/proc-log/commit/f8df6247c56daf90fe6a9f9042f610cc97662a24) [#73](https://github.com/npm/proc-log/pull/73) bump @npmcli/template-oss from 4.21.1 to 4.21.3 (@dependabot[bot])
* [`31491ca`](https://github.com/npm/proc-log/commit/31491cacfc995dc2811a03ed8718d91520ded2d0) [#70](https://github.com/npm/proc-log/pull/70) postinstall for dependabot template-oss PR (@lukekarrys)
* [`be382b7`](https://github.com/npm/proc-log/commit/be382b7a6eea91f2f59dda5a40f48ac5bf296561) [#70](https://github.com/npm/proc-log/pull/70) bump @npmcli/template-oss from 4.19.0 to 4.21.1 (@dependabot[bot])
* [`de668d7`](https://github.com/npm/proc-log/commit/de668d7d9efdc09c5909c3deb8b7f9b3c7bbb73b) [#51](https://github.com/npm/proc-log/pull/51) postinstall for dependabot template-oss PR (@lukekarrys)
* [`4b8abd0`](https://github.com/npm/proc-log/commit/4b8abd062c223d39842ca1a979341e707847ba39) [#51](https://github.com/npm/proc-log/pull/51) bump @npmcli/template-oss from 4.18.1 to 4.19.0 (@dependabot[bot])
* [`ed8c220`](https://github.com/npm/proc-log/commit/ed8c220a93331069a9d3b5d7e8b1e5d186b54304) [#50](https://github.com/npm/proc-log/pull/50) postinstall for dependabot template-oss PR (@lukekarrys)
* [`36b1d1e`](https://github.com/npm/proc-log/commit/36b1d1ef1be51f7996e0ed0f5645e627d994c14b) [#50](https://github.com/npm/proc-log/pull/50) bump @npmcli/template-oss from 4.18.0 to 4.18.1 (@dependabot[bot])
* [`dfda484`](https://github.com/npm/proc-log/commit/dfda484f3f3f18ddc2e7c0e244d3ab5d2a095f21) [#49](https://github.com/npm/proc-log/pull/49) postinstall for dependabot template-oss PR (@lukekarrys)
* [`f9a8d6d`](https://github.com/npm/proc-log/commit/f9a8d6d954ba383f3a64d291c635b5445ea4bbff) [#49](https://github.com/npm/proc-log/pull/49) bump @npmcli/template-oss from 4.17.0 to 4.18.0 (@dependabot[bot])
* [`857d35e`](https://github.com/npm/proc-log/commit/857d35e1f1023f3ac252743827da42621ce5c30e) [#48](https://github.com/npm/proc-log/pull/48) postinstall for dependabot template-oss PR (@lukekarrys)
* [`6e51a61`](https://github.com/npm/proc-log/commit/6e51a614ed41fd5b50926c0e427282ff65c31acd) [#48](https://github.com/npm/proc-log/pull/48) bump @npmcli/template-oss from 4.15.1 to 4.17.0 (@dependabot[bot])
* [`e668ec7`](https://github.com/npm/proc-log/commit/e668ec7214698b8ce3b2c7c246ea0decafc46a30) [#47](https://github.com/npm/proc-log/pull/47) postinstall for dependabot template-oss PR (@lukekarrys)
* [`eea3f85`](https://github.com/npm/proc-log/commit/eea3f85f3c4c6dc0f39d591d5545b5e982d8812c) [#47](https://github.com/npm/proc-log/pull/47) bump @npmcli/template-oss from 4.14.1 to 4.15.1 (@dependabot[bot])
* [`bc05709`](https://github.com/npm/proc-log/commit/bc05709f98f5f49fd4fa8e16a48ba37da6651157) [#46](https://github.com/npm/proc-log/pull/46) bump @npmcli/template-oss from 4.13.0 to 4.14.1 (#46) (@dependabot[bot], @npm-cli-bot)
* [`98c7267`](https://github.com/npm/proc-log/commit/98c72673600345b4846a4152a316c47e5da10ea2) [#45](https://github.com/npm/proc-log/pull/45) bump @npmcli/template-oss from 4.12.1 to 4.13.0 (#45) (@dependabot[bot], @npm-cli-bot, @nlf)
* [`3500db4`](https://github.com/npm/proc-log/commit/3500db4720fb737430e4dc607a348d457bfaf513) [#44](https://github.com/npm/proc-log/pull/44) bump @npmcli/template-oss from 4.12.0 to 4.12.1 (#44) (@dependabot[bot], @npm-cli-bot)
* [`7636af5`](https://github.com/npm/proc-log/commit/7636af52b117d8083f4d97e4b90ce532c8de1b63) [#43](https://github.com/npm/proc-log/pull/43) postinstall for dependabot template-oss PR (@lukekarrys)
* [`3dc1ca0`](https://github.com/npm/proc-log/commit/3dc1ca0ad5ea12a989be95aad319cde36b4d95f9) [#43](https://github.com/npm/proc-log/pull/43) bump @npmcli/template-oss from 4.11.4 to 4.12.0 (@dependabot[bot])
* [`b62ca21`](https://github.com/npm/proc-log/commit/b62ca21b75b6e878e3f95ccd8e2b84d7ebf38a3f) [#42](https://github.com/npm/proc-log/pull/42) postinstall for dependabot template-oss PR (@lukekarrys)
* [`cef0e0d`](https://github.com/npm/proc-log/commit/cef0e0d8a27e6879ef7d41fc5644ef520c7b92fd) [#42](https://github.com/npm/proc-log/pull/42) bump @npmcli/template-oss from 4.11.3 to 4.11.4 (@dependabot[bot])
* [`cabc576`](https://github.com/npm/proc-log/commit/cabc576873b8081e6440ba6a49406828d5a8b53a) [#41](https://github.com/npm/proc-log/pull/41) postinstall for dependabot template-oss PR (@lukekarrys)
* [`f34b6c7`](https://github.com/npm/proc-log/commit/f34b6c7d0535db65782e3fa993522a1f5df6622e) [#41](https://github.com/npm/proc-log/pull/41) bump @npmcli/template-oss from 4.11.0 to 4.11.3 (@dependabot[bot])
* [`2533092`](https://github.com/npm/proc-log/commit/2533092409fd9a05165aa67a429f20e02a4eb092) [#40](https://github.com/npm/proc-log/pull/40) postinstall for dependabot template-oss PR (@lukekarrys)
* [`bca92ea`](https://github.com/npm/proc-log/commit/bca92eac1f7dcf6a194df132471df7eb60f69ac8) [#40](https://github.com/npm/proc-log/pull/40) bump @npmcli/template-oss from 4.10.0 to 4.11.0 (@dependabot[bot])
* [`3721aed`](https://github.com/npm/proc-log/commit/3721aedec49426d70fff5465425c4a968f790512) [#39](https://github.com/npm/proc-log/pull/39) postinstall for dependabot template-oss PR (@lukekarrys)
* [`94b7ef3`](https://github.com/npm/proc-log/commit/94b7ef3eb362dbd7855737567814e20eaabe507c) [#39](https://github.com/npm/proc-log/pull/39) bump @npmcli/template-oss from 4.8.0 to 4.10.0 (@dependabot[bot])
* [`d4db1ab`](https://github.com/npm/proc-log/commit/d4db1abaddb1754ffc4220f68444388b9c88d7a6) [#37](https://github.com/npm/proc-log/pull/37) postinstall for dependabot template-oss PR (@lukekarrys)
* [`5b16b3a`](https://github.com/npm/proc-log/commit/5b16b3a145b1f238387363e3e87b332ed457673a) [#37](https://github.com/npm/proc-log/pull/37) bump @npmcli/template-oss from 4.6.2 to 4.8.0 (@dependabot[bot])
* [`35fbba3`](https://github.com/npm/proc-log/commit/35fbba37a1aeb96b99737eda9f0ff9f5af192df7) [#36](https://github.com/npm/proc-log/pull/36) postinstall for dependabot template-oss PR (@lukekarrys)
* [`1c0da10`](https://github.com/npm/proc-log/commit/1c0da10c5ec740c6d40fb310f60e91f084827e05) [#36](https://github.com/npm/proc-log/pull/36) bump @npmcli/template-oss from 4.6.1 to 4.6.2 (@dependabot[bot])
* [`487cfeb`](https://github.com/npm/proc-log/commit/487cfeb5ea1780212beacde6ad9505b10f92c432) [#35](https://github.com/npm/proc-log/pull/35) postinstall for dependabot template-oss PR (@lukekarrys)
* [`70dbd12`](https://github.com/npm/proc-log/commit/70dbd124444825c81c897987e3a6c6550225da64) [#35](https://github.com/npm/proc-log/pull/35) bump @npmcli/template-oss from 4.5.1 to 4.6.1 (@dependabot[bot])
* [`d299887`](https://github.com/npm/proc-log/commit/d299887e3d0355ae50fa1e72671c179dbf2efc46) [#34](https://github.com/npm/proc-log/pull/34) bump @npmcli/eslint-config from 3.1.0 to 4.0.0 (@dependabot[bot])
## [3.0.0](https://github.com/npm/proc-log/compare/v2.0.1...v3.0.0) (2022-10-10)
### ⚠️ BREAKING CHANGES
* `proc-log` is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0`
### Features
* [`54c85c1`](https://github.com/npm/proc-log/commit/54c85c1d4c0ed59c48d6765b15e8918e2eaf8c3a) [#27](https://github.com/npm/proc-log/pull/27) postinstall for dependabot template-oss PR (@lukekarrys)
### [2.0.1](https://github.com/npm/proc-log/compare/v2.0.0...v2.0.1) (2022-03-28)
### Documentation
* fix pause/resume signatures ([adccecc](https://github.com/npm/proc-log/commit/adccecc2bf5e77427e3fefe826a8e5a1a57640d7))
## [2.0.0](https://www.github.com/npm/proc-log/compare/v1.0.0...v2.0.0) (2022-02-10)
### ⚠ BREAKING CHANGES
* this drops support for node10 and non-LTS versions of node12 and node14
* @npmcli/template-oss ([#1](https://www.github.com/npm/proc-log/issues/1)) ([d340d8b](https://www.github.com/npm/proc-log/commit/d340d8b90c5612223d456a6d33d36ed83ab1ba41))
### Documentation
* add example usage ([33ef65c](https://www.github.com/npm/proc-log/commit/33ef65c4dc3cdba2a2555ec1c32f6bd5d281ff6a))
proc-log-5.0.0/CODE_OF_CONDUCT.md 0000664 0000000 0000000 00000000507 14666174421 0016052 0 ustar 00root root 0000000 0000000
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.
proc-log-5.0.0/CONTRIBUTING.md 0000664 0000000 0000000 00000005133 14666174421 0015504 0 ustar 00root root 0000000 0000000
# 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.
proc-log-5.0.0/LICENSE 0000664 0000000 0000000 00000001346 14666174421 0014262 0 ustar 00root root 0000000 0000000 The ISC License
Copyright (c) GitHub, Inc.
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.
proc-log-5.0.0/README.md 0000664 0000000 0000000 00000015571 14666174421 0014541 0 ustar 00root root 0000000 0000000 # proc-log
Emits events on the process object which a listener can consume and print to the terminal or log file.
This is used by various modules within the npm CLI stack in order to send log events that can be consumed by a listener on the process object.
Currently emits `log`, `output`, `input`, and `time` events.
## API
```js
const { log, output, input, time } = require('proc-log')
```
#### output
* `output.standard(...args)` calls `process.emit('output', 'standard', ...args)`
This is for general standard output. Consumers will typically show this on stdout (after optionally formatting or filtering it).
* `output.error(...args)` calls `process.emit('output', 'error', ...args)`
This is for general error output. Consumers will typically show this on stderr (after optionally formatting or filtering it).
* `output.buffer(...args)` calls `process.emit('output', 'buffer', ...args)`
This is for buffered output. Consumers will typically buffer this until they are ready to display.
* `output.flush(...args)` calls `process.emit('output', 'flush', ...args)`
This is to indicate that the output buffer should be flushed.
* `output.LEVELS` an array of strings of all output method names
#### log
* `log.error(...args)` calls `process.emit('log', 'error', ...args)`
The highest log level. For printing extremely serious errors that indicate something went wrong.
* `log.warn(...args)` calls `process.emit('log', 'warn', ...args)`
A fairly high log level. Things that the user needs to be aware of, but which won't necessarily cause improper functioning of the system.
* `log.notice(...args)` calls `process.emit('log', 'notice', ...args)`
Notices which are important, but not necessarily dangerous or a cause for excess concern.
* `log.info(...args)` calls `process.emit('log', 'info', ...args)`
Informative messages that may benefit the user, but aren't particularly important.
* `log.verbose(...args)` calls `process.emit('log', 'verbose', ...args)`
Noisy output that is more detail that most users will care about.
* `log.silly(...args)` calls `process.emit('log', 'silly', ...args)`
Extremely noisy excessive logging messages that are typically only useful for debugging.
* `log.http(...args)` calls `process.emit('log', 'http', ...args)`
Information about HTTP requests made and/or completed.
* `log.timing(...args)` calls `process.emit('log', 'timing', ...args)`
Timing information.
* `log.pause()` calls `process.emit('log', 'pause')`
Used to tell the consumer to stop printing messages.
* `log.resume()` calls `process.emit('log', 'resume')`
Used to tell the consumer that it is ok to print messages again.
* `log.LEVELS` an array of strings of all log method names
#### input
* `input.start(fn?)` calls `process.emit('input', 'start')`
Used to tell the consumer that the terminal is going to begin reading user input. Returns a function that will call `input.end()` for convenience.
This also takes an optional callback which will run `input.end()` on its completion. If the callback returns a `Promise` then `input.end()` will be run during `finally()`.
* `input.end()` calls `process.emit('input', 'end')`
Used to tell the consumer that the terminal has stopped reading user input.
* `input.read(...args): Promise` calls `process.emit('input', 'read', resolve, reject, ...args)`
Used to tell the consumer that the terminal is reading user input and returns a `Promise` that the producer can `await` until the consumer has finished its async action.
This emits `resolve` and `reject` functions (in addition to all passed in arguments) which the consumer must use to resolve the returned `Promise`.
#### time
* `time.start(timerName, fn?)` calls `process.emit('time', 'start', 'timerName')`
Used to start a timer with the specified name. Returns a function that will call `time.end()` for convenience.
This also takes an optional callback which will run `time.end()` on its completion. If the callback returns a `Promise` then `time.end()` will be run during `finally()`.
* `time.end(timerName)` calls `process.emit('time', 'end', timeName)`
Used to tell the consumer to stop a timer with the specified name.
## Examples
### log
Every `log` method calls `process.emit('log', level, ...otherArgs)` internally. So in order to consume those events you need to do `process.on('log', fn)`.
#### Colorize based on level
Here's an example of how to consume `proc-log` log events and colorize them based on level:
```js
const chalk = require('chalk')
process.on('log', (level, ...args) => {
if (level === 'error') {
console.log(chalk.red(level), ...args)
} else {
console.log(chalk.blue(level), ...args)
}
})
```
#### Pause and resume
`log.pause` and `log.resume` are included so you have the ability to tell your consumer that you want to pause or resume your display of logs. In the npm CLI we use this to buffer all logs on init until we know the correct loglevel to display. But we also setup a second handler that writes everything to a file even if paused.
```js
let paused = true
const buffer = []
// this handler will buffer and replay logs only after `procLog.resume()` is called
process.on('log', (level, ...args) => {
if (level === 'resume') {
buffer.forEach((item) => console.log(...item))
paused = false
return
}
if (paused) {
buffer.push([level, ...args])
} else {
console.log(level, ...args)
}
})
// this handler will write everything to a file
process.on('log', (...args) => {
fs.appendFileSync('debug.log', args.join(' '))
})
```
### input
### `start` and `end`
**producer.js**
```js
const { output, input } = require('proc-log')
const { readFromUserInput } = require('./my-read')
// Using callback passed to `start`
try {
const res = await input.start(
readFromUserInput({ prompt: 'OK?', default: 'y' })
)
output.standard(`User said ${res}`)
} catch (err) {
output.error(`User cancelled: ${err}`)
}
// Manually calling `start` and `end`
try {
input.start()
const res = await readFromUserInput({ prompt: 'OK?', default: 'y' })
output.standard(`User said ${res}`)
} catch (err) {
output.error(`User cancelled: ${err}`)
} finally {
input.end()
}
```
**consumer.js**
```js
const { read } = require('read')
process.on('input', (level) => {
if (level === 'start') {
// Hide UI to make room for user input being read
} else if (level === 'end') {
// Restore UI now that reading is ended
}
})
```
### Using `read` to call `read()`
**producer.js**
```js
const { output, input } = require('proc-log')
try {
const res = await input.read({ prompt: 'OK?', default: 'y' })
output.standard(`User said ${res}`)
} catch (err) {
output.error(`User cancelled: ${err}`)
}
```
**consumer.js**
```js
const { read } = require('read')
process.on('input', (level, ...args) => {
if (level === 'read') {
const [res, rej, opts] = args
read(opts).then(res).catch(rej)
}
})
``` proc-log-5.0.0/SECURITY.md 0000664 0000000 0000000 00000002320 14666174421 0015037 0 ustar 00root root 0000000 0000000
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.
proc-log-5.0.0/lib/ 0000775 0000000 0000000 00000000000 14666174421 0014017 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/lib/index.js 0000664 0000000 0000000 00000006464 14666174421 0015476 0 ustar 00root root 0000000 0000000 const META = Symbol('proc-log.meta')
module.exports = {
META: META,
output: {
LEVELS: [
'standard',
'error',
'buffer',
'flush',
],
KEYS: {
standard: 'standard',
error: 'error',
buffer: 'buffer',
flush: 'flush',
},
standard: function (...args) {
return process.emit('output', 'standard', ...args)
},
error: function (...args) {
return process.emit('output', 'error', ...args)
},
buffer: function (...args) {
return process.emit('output', 'buffer', ...args)
},
flush: function (...args) {
return process.emit('output', 'flush', ...args)
},
},
log: {
LEVELS: [
'notice',
'error',
'warn',
'info',
'verbose',
'http',
'silly',
'timing',
'pause',
'resume',
],
KEYS: {
notice: 'notice',
error: 'error',
warn: 'warn',
info: 'info',
verbose: 'verbose',
http: 'http',
silly: 'silly',
timing: 'timing',
pause: 'pause',
resume: 'resume',
},
error: function (...args) {
return process.emit('log', 'error', ...args)
},
notice: function (...args) {
return process.emit('log', 'notice', ...args)
},
warn: function (...args) {
return process.emit('log', 'warn', ...args)
},
info: function (...args) {
return process.emit('log', 'info', ...args)
},
verbose: function (...args) {
return process.emit('log', 'verbose', ...args)
},
http: function (...args) {
return process.emit('log', 'http', ...args)
},
silly: function (...args) {
return process.emit('log', 'silly', ...args)
},
timing: function (...args) {
return process.emit('log', 'timing', ...args)
},
pause: function () {
return process.emit('log', 'pause')
},
resume: function () {
return process.emit('log', 'resume')
},
},
time: {
LEVELS: [
'start',
'end',
],
KEYS: {
start: 'start',
end: 'end',
},
start: function (name, fn) {
process.emit('time', 'start', name)
function end () {
return process.emit('time', 'end', name)
}
if (typeof fn === 'function') {
const res = fn()
if (res && res.finally) {
return res.finally(end)
}
end()
return res
}
return end
},
end: function (name) {
return process.emit('time', 'end', name)
},
},
input: {
LEVELS: [
'start',
'end',
'read',
],
KEYS: {
start: 'start',
end: 'end',
read: 'read',
},
start: function (fn) {
process.emit('input', 'start')
function end () {
return process.emit('input', 'end')
}
if (typeof fn === 'function') {
const res = fn()
if (res && res.finally) {
return res.finally(end)
}
end()
return res
}
return end
},
end: function () {
return process.emit('input', 'end')
},
read: function (...args) {
let resolve, reject
const promise = new Promise((_resolve, _reject) => {
resolve = _resolve
reject = _reject
})
process.emit('input', 'read', resolve, reject, ...args)
return promise
},
},
}
proc-log-5.0.0/package.json 0000664 0000000 0000000 00000002154 14666174421 0015541 0 ustar 00root root 0000000 0000000 {
"name": "proc-log",
"version": "5.0.0",
"files": [
"bin/",
"lib/"
],
"main": "lib/index.js",
"description": "just emit 'log' events on the process object",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/proc-log.git"
},
"author": "GitHub Inc.",
"license": "ISC",
"scripts": {
"test": "tap",
"snap": "tap",
"posttest": "npm run lint",
"postsnap": "eslint index.js test/*.js --fix",
"lint": "npm run eslint",
"postlint": "template-oss-check",
"lintfix": "npm run eslint -- --fix",
"template-oss-apply": "template-oss-apply --force",
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
},
"devDependencies": {
"@npmcli/eslint-config": "^5.0.0",
"@npmcli/template-oss": "4.23.3",
"tap": "^16.0.1"
},
"engines": {
"node": "^18.17.0 || >=20.5.0"
},
"templateOSS": {
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "4.23.3",
"publish": true
},
"tap": {
"nyc-arg": [
"--exclude",
"tap-snapshots/**"
]
}
}
proc-log-5.0.0/release-please-config.json 0000664 0000000 0000000 00000001275 14666174421 0020303 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"
}
proc-log-5.0.0/tap-snapshots/ 0000775 0000000 0000000 00000000000 14666174421 0016055 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/tap-snapshots/test/ 0000775 0000000 0000000 00000000000 14666174421 0017034 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/tap-snapshots/test/index.js.test.cjs 0000664 0000000 0000000 00000002614 14666174421 0022240 0 ustar 00root root 0000000 0000000 /* IMPORTANT
* This snapshot file is auto-generated, but designed for humans.
* It should be checked into source control and tracked carefully.
* Re-generate by setting TAP_SNAPSHOT=1 and running tests.
* Make sure to inspect the output below. Do not ignore changes!
*/
'use strict'
exports[`test/index.js TAP input > input keys 1`] = `
Object {
"end": "end",
"read": "read",
"start": "start",
}
`
exports[`test/index.js TAP input > input levels 1`] = `
Array [
"start",
"end",
"read",
]
`
exports[`test/index.js TAP log > log keys 1`] = `
Object {
"error": "error",
"http": "http",
"info": "info",
"notice": "notice",
"pause": "pause",
"resume": "resume",
"silly": "silly",
"timing": "timing",
"verbose": "verbose",
"warn": "warn",
}
`
exports[`test/index.js TAP log > log levels 1`] = `
Array [
"notice",
"error",
"warn",
"info",
"verbose",
"http",
"silly",
"timing",
"pause",
"resume",
]
`
exports[`test/index.js TAP output > output keys 1`] = `
Object {
"buffer": "buffer",
"error": "error",
"flush": "flush",
"standard": "standard",
}
`
exports[`test/index.js TAP output > output levels 1`] = `
Array [
"standard",
"error",
"buffer",
"flush",
]
`
exports[`test/index.js TAP time > time keys 1`] = `
Object {
"end": "end",
"start": "start",
}
`
exports[`test/index.js TAP time > time levels 1`] = `
Array [
"start",
"end",
]
`
proc-log-5.0.0/test/ 0000775 0000000 0000000 00000000000 14666174421 0014230 5 ustar 00root root 0000000 0000000 proc-log-5.0.0/test/index.js 0000664 0000000 0000000 00000004041 14666174421 0015674 0 ustar 00root root 0000000 0000000 const t = require('tap')
const procLog = require('../')
// This makes sure we are testing all known exported methods.
t.plan(5)
for (const method in procLog) {
if (method === 'META') {
t.test(method, t => {
t.type(procLog[method], 'symbol')
t.end()
})
continue
}
t.test(method, t => {
const log = procLog[method]
const { LEVELS, KEYS } = log
t.matchSnapshot(LEVELS, `${method} levels`)
t.matchSnapshot(KEYS, `${method} keys`)
t.strictSame(Object.keys(KEYS), LEVELS, 'all keys are in levels')
t.strictSame(Object.values(KEYS), LEVELS, 'all vales are in levels')
t.test(`all ${method}.LEVELS have a function in ${method}`, t => {
for (const level of LEVELS) {
t.test(level, t => {
t.match(log[level], Function)
process.once(method, (actual, ...args) => {
t.equal(actual, level, `emitted ${method} with expected level`)
switch (`${method}.${level}`) {
case 'time.start':
case 'time.end':
t.strictSame(args, [1], 'single arg')
break
case 'input.start':
case 'input.end':
case 'log.pause':
case 'log.resume':
t.strictSame(args, [], 'no args')
break
case 'input.read':
t.match(args.slice(0, 2), [Function, Function], 'input gets resolvers')
t.same(args.slice(2), [1, 'two', [3], { 4: 4 }], 'got expected args')
break
default:
t.same(args, [1, 'two', [3], { 4: 4 }], 'got expected args')
}
t.end()
})
log[level](1, 'two', [3], { 4: 4 })
})
}
t.end()
})
t.test(`all ${method} functions are in ${method}.LEVELS`, t => {
t.plan(LEVELS.length)
for (const fn in log) {
if (fn !== 'LEVELS' && fn !== 'KEYS') {
t.ok(LEVELS.includes(fn), `${method}.${fn} is in ${method}.LEVELS`)
}
}
})
t.end()
})
}
proc-log-5.0.0/test/input.js 0000664 0000000 0000000 00000003446 14666174421 0015734 0 ustar 00root root 0000000 0000000 const t = require('tap')
const { input } = require('../')
t.test('read', t => {
t.test('will await promise', async t => {
process.once('input', (level, resolve, reject, ...args) => {
if (level === 'read') {
t.strictSame(args, [1, 2, 3])
setTimeout(() => resolve('done'), 100)
}
})
await t.resolves(input.read(1, 2, 3), 'done')
})
t.test('can reject promise', async t => {
process.once('input', (level, resolve, reject, ...args) => {
if (level === 'read') {
t.strictSame(args, [1, 2, 3])
setTimeout(() => reject(new Error('not ok')), 100)
}
})
await t.rejects(input.read(1, 2, 3), { message: 'not ok' })
})
t.end()
})
t.test('start and end', t => {
t.test('returns function to stop', t => {
const called = {}
const handler = (actual) => {
called[actual] = true
if (called.start && called.end) {
t.end()
}
}
process.on('input', handler)
t.teardown(() => process.off('input', handler))
input.start()()
})
t.test('sync callback', t => {
const res = input.start((...args) => {
t.strictSame(args, [], 'get no args')
return 1
})
t.equal(res, 1)
t.end()
})
t.test('async callback', async t => {
const res = await input.start((...args) => {
t.strictSame(args, [], 'get no args')
return Promise.resolve(1)
})
t.equal(res, 1)
})
t.test('async callback that errors', async t => {
const called = {}
const handler = (level) => called[level] = true
process.on('input', handler)
t.teardown(() => process.off('input', handler))
await t.rejects(input.start(() => {
return Promise.reject(new Error('not ok'))
}), { message: 'not ok' })
t.ok(called.start)
t.ok(called.end)
})
t.end()
})
proc-log-5.0.0/test/meta.js 0000664 0000000 0000000 00000002105 14666174421 0015512 0 ustar 00root root 0000000 0000000 const t = require('tap')
const { META, output } = require('../')
// just to show how this would be implemented in consumers
const getMeta = (...args) => {
let meta = {}
const lastArg = args[args.length - 1]
if (
lastArg &&
typeof lastArg === 'object' &&
Object.prototype.hasOwnProperty.call(lastArg, META)
) {
meta = args.pop()
}
return [meta, ...args]
}
// an example of wrapping a handler
const wrapMeta = (handler) => (level, ...args) => handler(level, ...getMeta(...args))
t.test('meta', t => {
process.once('output', (level, ...rawArgs) => {
const [meta, ...args] = getMeta(...rawArgs)
t.equal(level, 'standard')
t.ok(meta.force)
t.strictSame(args, ['arg1', 'arg2'])
t.end()
})
output.standard('arg1', 'arg2', { [META]: 0, force: true })
})
t.test('wrap handler', t => {
process.once('output', wrapMeta((level, meta, ...args) => {
t.equal(level, 'standard')
t.ok(meta.force)
t.strictSame(args, ['arg1', { META: true }])
t.end()
}))
output.standard('arg1', { META: true }, { [META]: null, force: true })
})
proc-log-5.0.0/test/time.js 0000664 0000000 0000000 00000002247 14666174421 0015531 0 ustar 00root root 0000000 0000000 const t = require('tap')
const { time } = require('../')
t.test('time returns function to stop timer', t => {
const called = {}
const handler = (actual, name) => {
t.equal(name, 'timerName')
called[actual] = true
if (called.start && called.end) {
t.end()
}
}
process.on('time', handler)
t.teardown(() => process.off('time', handler))
time.start('timerName')()
})
t.test('time can run a sync callback', t => {
const res = time.start('timerName', (...args) => {
t.strictSame(args, [], 'get no args')
return 1
})
t.equal(res, 1)
t.end()
})
t.test('time can run an async callback', async t => {
const res = await time.start('timerName', (...args) => {
t.strictSame(args, [], 'get no args')
return Promise.resolve(1)
})
t.equal(res, 1)
})
t.test('time can run an async callback that errors', async t => {
const called = {}
const handler = (level) => called[level] = true
process.on('time', handler)
t.teardown(() => process.off('time', handler))
await t.rejects(time.start('timerName', () => {
return Promise.reject(new Error('not ok'))
}), { message: 'not ok' })
t.ok(called.start)
t.ok(called.end)
})