diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..04dfdc0a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,99 @@ +name: Publish Packages + +# This workflow publishes packages to npm when changes are merged to main branch or when manually triggered. + +on: + push: + paths: + - package.json + # For security reasons, this should never be set to anything but `main` + branches: [main] + workflow_dispatch: + +permissions: + contents: read + # For npm OIDC (https://docs.npmjs.com/trusted-publishers) + id-token: write + +env: + COMMIT_SHA: ${{ github.sha }} + +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + # Output the matrix of packages to publish for use in the publish job + should_publish: ${{ steps.check.outputs.should_publish }} + steps: + - name: Harden Runner + uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 + with: + egress-policy: audit + + - name: Verify commit authenticity + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Get commit data from GitHub API to verify its authenticity + COMMIT_DATA=$(gh api repos/${{ github.repository }}/commits/$COMMIT_SHA) + # Check if commit signature is verified (GPG signed) + VERIFIED=$(echo "$COMMIT_DATA" | jq -r '.commit.verification.verified') + # Check if commit was made through GitHub's web interface (merge queue) + COMMITTER=$(echo "$COMMIT_DATA" | jq -r '.commit.committer.email') + + # Security checks to ensure we only publish from verified and trusted sources + if [[ "$VERIFIED" != "true" ]]; then + echo "❌ Unverified commit! Aborting." + exit 1 + fi + + if [[ "$COMMITTER" != "noreply@github.com" ]]; then + echo "❌ Not merged with the merge queue! Aborting." + exit 1 + fi + + echo "✅ Commit is verified and trusted." + + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 2 # Need at least 2 commits to detect changes between commits + + - name: Check if we should publish + id: check + env: + EVENT_NAME: ${{ github.event_name }} + run: | + OLD_VERSION=$(git show $COMMIT_SHA~1:package.json | jq -r '.version') + NEW_VERSION=$(jq -r '.version' "package.json") + if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then + echo "should_publish=true" >> $GITHUB_OUTPUT + fi + + publish: + needs: prepare + runs-on: ubuntu-latest + if: needs.prepare.outputs.should_publish == 'true' + steps: + - uses: nodejs/web-team/actions/setup-environment@9f3c83af227d721768d9dbb63009a47ed4f4282f + with: + pnpm: true + use-version-file: true + registry-url: 'https://registry.npmjs.org' + + - name: Publish + run: npm publish --access public --no-git-checks + + - name: Notify + uses: rtCamp/action-slack-notify@e31e87e03dd19038e411e38ae27cbad084a90661 # 2.3.3 + env: + SLACK_COLOR: '#43853D' + SLACK_ICON: https://github.com/nodejs.png?size=48 + SLACK_TITLE: ':rocket: Package Published: @node-core/doc-kit' + SLACK_MESSAGE: | + :package: *Package*: `@node-core/doc-kit` () + :bust_in_silhouette: *Published by*: ${{ github.triggering_actor }} + :octocat: *Commit*: + SLACK_USERNAME: nodejs-bot + SLACK_CHANNEL: nodejs-web-infra + SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f6fbfe84..92851dcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ -# `@nodejs/doc-kit` Contributing Guide +# `@node-core/doc-kit` Contributing Guide -Thank you for your interest in contributing to the `@nodejs/doc-kit` project! We welcome contributions from everyone, and we appreciate your help in making this project better. +Thank you for your interest in contributing to the `@node-core/doc-kit` project! We welcome contributions from everyone, and we appreciate your help in making this project better. ## Table of Contents @@ -26,7 +26,7 @@ Thank you for your interest in contributing to the `@nodejs/doc-kit` project! We ## Getting Started -The steps below will give you a general idea of how to prepare your local environment for the `@nodejs/doc-kit` project and general steps for getting things done and landing your contribution. +The steps below will give you a general idea of how to prepare your local environment for the `@node-core/doc-kit` project and general steps for getting things done and landing your contribution. ### Prerequisites diff --git a/README.md b/README.md index 79a1cee5..607cf69f 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@

- @nodejs/doc-kit is a tool to generate API documentation of Node.js. See this issue for more information. + @node-core/doc-kit is a tool to generate API documentation of Node.js. See this issue for more information.

@@ -40,7 +40,7 @@ $ node bin/cli.mjs --help ``` ``` -Usage: @nodejs/doc-kit [options] [command] +Usage: @node-core/doc-kit [options] [command] CLI tool to generate the Node.js API documentation @@ -56,7 +56,7 @@ Commands: ### `generate` ``` -Usage: @nodejs/doc-kit generate [options] +Usage: @node-core/doc-kit generate [options] Generate API docs @@ -75,7 +75,7 @@ Options: ### `interactive` ``` -Usage: @nodejs/doc-kit interactive [options] +Usage: @node-core/doc-kit interactive [options] Launch guided CLI wizard diff --git a/bin/cli.mjs b/bin/cli.mjs index 297e37d4..42569352 100755 --- a/bin/cli.mjs +++ b/bin/cli.mjs @@ -9,7 +9,7 @@ import { LogLevel } from '../src/logger/constants.mjs'; import logger from '../src/logger/index.mjs'; const program = new Command() - .name('@nodejs/doc-kit') + .name('@node-core/doc-kit') .description('CLI tool to generate the Node.js API documentation') .addOption( new Option('--log-level ', 'Log level') diff --git a/docs/comparators.md b/docs/comparators.md index c830a6b6..4370e64c 100644 --- a/docs/comparators.md +++ b/docs/comparators.md @@ -1,6 +1,6 @@ # Creating Comparators -This guide explains how to create build comparison scripts for `@nodejs/doc-kit`. Comparators help identify differences between documentation builds, useful for CI/CD and regression testing. +This guide explains how to create build comparison scripts for `@node-core/doc-kit`. Comparators help identify differences between documentation builds, useful for CI/CD and regression testing. ## Comparator Concepts diff --git a/docs/generators.md b/docs/generators.md index 86d1d37b..d97ad495 100644 --- a/docs/generators.md +++ b/docs/generators.md @@ -1,6 +1,6 @@ # Creating Generators -This guide explains how to create new documentation generators for `@nodejs/doc-kit`. +This guide explains how to create new documentation generators for `@node-core/doc-kit`. ## Generator Concepts diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b596a16e..182f340e 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,10 +1,12 @@ { - "name": "@nodejs/doc-kit", + "name": "@node-core/doc-kit", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@nodejs/doc-kit", + "name": "@node-core/doc-kit", + "version": "1.0.0", "dependencies": { "@actions/core": "^3.0.0", "@heroicons/react": "^2.2.0", @@ -1044,7 +1046,6 @@ "resolved": "https://registry.npmjs.org/@orama/core/-/core-1.2.19.tgz", "integrity": "sha512-AVEI0eG/a1RUQK+tBloRMppQf46Ky4kIYKEVjo0V0VfIGZHdLOE2PJR4v949kFwiTnfSJCUaxgwM74FCA1uHUA==", "license": "AGPL-3.0", - "peer": true, "dependencies": { "@orama/cuid2": "2.2.3", "@orama/oramacore-events-parser": "0.0.5" @@ -3158,7 +3159,6 @@ "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", "license": "MIT", - "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -3332,7 +3332,6 @@ "integrity": "sha512-9Cnda8GS57AQakvRyG0PTejJNlA2xhvyNtEVIMlDWOOeEyBkYWhGPnfrIAnqxLMTSTo6q8g12XVjjev5l1NvMA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.54.0", @@ -3722,7 +3721,6 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -4511,7 +4509,6 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -7357,7 +7354,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -7500,7 +7496,6 @@ "resolved": "https://registry.npmjs.org/preact/-/preact-10.28.4.tgz", "integrity": "sha512-uKFfOHWuSNpRFVTnljsCluEFq57OKT+0QdOiQo8XWnQ/pSvg7OpX5eNOejELXJMWy+BwM2nobz0FkvzmnpCNsQ==", "license": "MIT", - "peer": true, "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" @@ -7584,7 +7579,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", "license": "MIT", - "peer": true, "engines": { "node": ">=0.10.0" } @@ -8032,7 +8026,8 @@ "version": "0.26.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/semver": { "version": "7.7.4", @@ -8508,7 +8503,6 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", - "peer": true, "engines": { "node": ">=12" }, @@ -8672,7 +8666,6 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "license": "Apache-2.0", - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -8871,7 +8864,6 @@ "integrity": "sha512-VUyWiTNQD7itdiMuJy+EuLEErLj3uwX/EpHQF8EOf33Dq3Ju6VW1GXm+swk6+1h7a49uv9fKZ+dft9jU7esdLA==", "dev": true, "hasInstallScript": true, - "peer": true, "dependencies": { "napi-postinstall": "^0.2.4" }, diff --git a/package.json b/package.json index 4820cabd..18b97ff2 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { - "name": "@nodejs/doc-kit", + "name": "@node-core/doc-kit", "type": "module", + "version": "1.0.0", "repository": { "type": "git", - "url": "git+https://github.com/nodejs/api-docs-tooling.git" + "url": "git+https://github.com/nodejs/doc-kit.git" }, "scripts": { "lint": "eslint . --no-warn-ignored", diff --git a/src/generators/man-page/template.1 b/src/generators/man-page/template.1 index 9d2cf658..9da71f53 100644 --- a/src/generators/man-page/template.1 +++ b/src/generators/man-page/template.1 @@ -1,5 +1,5 @@ .\" -.\" This file was generated automatically by the @nodejs/doc-kit tool. +.\" This file was generated automatically by the @node-core/doc-kit tool. .\" Please do not edit this file manually. Make any updates to cli.md .\" and regenerate the file afterward. .\"