Skip to content

Commit 64a3fe8

Browse files
committed
The npm documentation
0 parents  commit 64a3fe8

File tree

424 files changed

+82853
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

424 files changed

+82853
-0
lines changed

‎.github/workflows/publish.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
# Check out the content (source branch)
12+
- name: Check out source
13+
uses: actions/checkout@v2
14+
15+
# Check out the `dist` branch into the `public` directory.
16+
- name: Check out documentation branch
17+
uses: actions/checkout@v2
18+
with:
19+
ref: 'dist'
20+
path: 'public'
21+
22+
- name: Use Node.js
23+
uses: actions/setup-node@v1
24+
with:
25+
node-version: 12.x
26+
27+
# Update npm to v7
28+
- name: Update npm v7
29+
run: npm install -g npm@latest
30+
31+
# Build the site
32+
- name: Install npm packages
33+
run: npm install
34+
- name: Build documentation
35+
run: npm run build
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
# Check for changes; this avoids publishing a new change to the
40+
# dist branch when we made a change to (for example) a unit test.
41+
# If there were changes made in the publish step above, then this
42+
# will set the variable `has_changes` to `1` for subsequent steps.
43+
- name: Check for changes
44+
id: status
45+
run: |
46+
if [ -n "$(git status --porcelain)" ]; then
47+
echo "::set-output name=has_changes::1"
48+
fi
49+
working-directory: public
50+
51+
# Commit the changes to the dist branch and push the changes up to
52+
# GitHub. (Replace the name and email address with your own.)
53+
# This step only runs if the previous step set `has_changes` to `1`.
54+
- name: Publish documentation
55+
run: |
56+
git add --verbose .
57+
git config user.name 'CI User'
58+
git config user.email 'noreply@npmjs.com'
59+
git commit -m 'Update from CI'
60+
git push origin dist
61+
if: steps.status.outputs.has_changes == '1'
62+
working-directory: public
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Stage Pull Request
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, synchronize, reopened, closed]
6+
workflow_dispatch:
7+
inputs:
8+
pr_number:
9+
description: 'Pull Request Number'
10+
required: true
11+
12+
env:
13+
staging_repo: 'npm/docs-staging'
14+
15+
jobs:
16+
stage_pr:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- run: |
20+
echo "${{ toJson(github) }}"
21+
- name: Identify pull request
22+
id: pull_request
23+
run: |
24+
NOTIFY="false"
25+
26+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
27+
PR_NUMBER="${{ github.event.inputs.pr_number }}"
28+
elif [ "${{ github.event_name }}" = "pull_request_target" ]; then
29+
PR_NUMBER="${{ github.event.pull_request.number }}"
30+
31+
if [ "${{github.event.action}}" = "opened" ]; then
32+
NOTIFY="true"
33+
fi
34+
fi
35+
36+
if [ "$PR_NUMBER" = "" ]; then
37+
echo "::error::Unknown event type or unset pull request number"
38+
exit 1
39+
fi
40+
41+
echo "Building pull request ${PR_NUMBER}"
42+
43+
curl -f -X POST -u ":${{ secrets.NPM_DOCS_TOKEN }}" \
44+
-H "Accept: application/vnd.github.everest-preview+json" \
45+
-H "Content-Type: application/json" \
46+
--data "{ \"event_type\": \"publish_pr\", \"client_payload\": { \"pr_number\":\"$PR_NUMBER\", \"notify\":\"$NOTIFY\" } }" \
47+
https://api.github.com/repos/${{ env.staging_repo }}/dispatches
48+
49+
# - name: Identify pull request
50+
# if: github.event_name == "pull_request_target"
51+
# uses: actions/github-script@v3
52+
# with:
53+
# script: |
54+
# github.issues.createComment({
55+
# issue_number: context.issue.number,
56+
# owner: context.repo.owner,
57+
# repo: context.repo.repo,
58+
# body: "👋 Thanks for opening a pull request! We're building a staging
59+
# })

‎.github/workflows/update-cli.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Update CLI
2+
3+
on:
4+
schedule:
5+
- cron: "14 2 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
# Check out the content (source branch). Use a deploy key so that
13+
# when we push changes, it will trigger the documentation update
14+
# workflow run that runs on: push. (Using the GitHub token would
15+
# not run the workflow to prevent infinite recursion.)
16+
- name: Check out source
17+
uses: actions/checkout@v2
18+
with:
19+
ssh-key: ${{ secrets.CLI_DEPLOY_KEY }}
20+
21+
# Make sure that the new content didn't break the build. We don't
22+
# want to promote anything that would breaks.
23+
- name: Use Node.js
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: 12.x
27+
28+
# Update npm to v7
29+
- name: Update npm v7
30+
run: npm install -g npm@latest
31+
32+
# Add the CLI documentation to the content directory.
33+
- name: Install npm packages
34+
run: npm install
35+
- name: Fetch latest documentation
36+
run: node cli/cli_fetch.js
37+
- name: Import documentation
38+
run: node cli/cli_import.js
39+
40+
# Check for changes; this avoids publishing a new change to the
41+
# dist branch when we made a change to (for example) a unit test.
42+
# If there were changes made in the publish step above, then this
43+
# will set the variable `has_changes` to `1` for subsequent steps.
44+
- name: Check for changes
45+
id: status
46+
run: |
47+
if [ -n "$(git status --porcelain)" ]; then
48+
echo "::set-output name=has_changes::1"
49+
fi
50+
51+
# Commit the changes to the dist branch and push the changes up to
52+
# GitHub. (Replace the name and email address with your own.)
53+
# This step only runs if the previous step set `has_changes` to `1`.
54+
- name: Check in documentation
55+
run: |
56+
git add --verbose .
57+
git config user.name 'CI User'
58+
git config user.email 'noreply@npmjs.com'
59+
git commit -m 'CLI documentation update from CI'
60+
if: steps.status.outputs.has_changes == '1'
61+
62+
# Before we publish the changes, ensure the site builds so that we
63+
# don't break the main branch.
64+
- name: Build documentation
65+
run: npm run build
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
69+
# Publish the documentation updates.
70+
- name: Publish documentation
71+
run: git push origin main
72+
if: steps.status.outputs.has_changes == '1'

‎.gitignore

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Optional REPL history
57+
.node_repl_history
58+
59+
# Output of 'npm pack'
60+
*.tgz
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env
67+
.env.test
68+
69+
# parcel-bundler cache (https://parceljs.org/)
70+
.cache
71+
72+
# next.js build output
73+
.next
74+
75+
# nuxt.js build output
76+
.nuxt
77+
78+
# vuepress build output
79+
.vuepress/dist
80+
81+
# Serverless directories
82+
.serverless/
83+
84+
# FuseBox cache
85+
.fusebox/
86+
87+
# DynamoDB Local files
88+
.dynamodb/
89+
90+
# Gatsby
91+
public/

‎.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "cli/v6"]
2+
path = cli/v6
3+
url = https://github.com/npm/cli
4+
[submodule "cli/v7"]
5+
path = cli/v7
6+
url = https://github.com/npm/cli

0 commit comments

Comments
 (0)