forked from npm/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rewrite
scripts/
with javascript
Goals of this rewrite: - Better portability of scripts to anywhere we can run `node` and no reliance on `make` or other tools - More code inside `scripts/` and less inside of CI workflows to allow for easier local testing - Reuse the same scripts for similar workflows (eg `publish` and `smoke-publish`) Future goals: - Allow testing of `scripts` Some highlights of the new scripts: `scripts/create-node-pr.js` - This now operates on cloned copy of the base repo that is pushed to our fork, so we no longer need to manually sync our fork. - Uses the published registry tarball for as much of the PR as possible, falling back to including local files from source. This will enable for easier migration to eventually only using the tarball contents. `scripts/publish.js` - Replaces `make publish` - Will publish all workspaces that need to be published, before publishing the CLI. - Makes running tests an optional part of the script, since CI now runs the tests. - Can optionally only pack the tarball, for use in CI to test installing the tarball. `scripts/util.js` - Shared utilities for spawning commands including helpers for `npm` and `gh`. - Common interface for running, parsing args, logging, and debugging of scripts.
- Loading branch information
1 parent
0c5834e
commit 9709ae6
Showing
46 changed files
with
668 additions
and
436 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,11 +177,6 @@ jobs: | |
cache: npm | ||
- name: Reset Deps | ||
run: node . run resetdeps | ||
- name: Link | ||
if: matrix | ||
run: node . link -f --ignore-scripts | ||
- name: Rebuild cmark-gfm | ||
run: node . rebuild cmark-gfm | ||
- name: Add Problem Matcher | ||
run: echo "::add-matcher::.github/matchers/tap.json" | ||
- name: Test | ||
|
@@ -284,18 +279,12 @@ jobs: | |
run: | | ||
NPM_VERSION="$(node . --version)-$GITHUB_SHA.0" | ||
node . version $NPM_VERSION --ignore-scripts | ||
node . run resetdeps | ||
git clean -fd | ||
node . ls --omit=dev >/dev/null | ||
node . prune --omit=dev --no-save --no-audit --no-fund | ||
node scripts/git-dirty.js | ||
node . pack --pack-destination=$RUNNER_TEMP | ||
node . install -g $RUNNER_TEMP/npm-$NPM_VERSION.tgz | ||
node scripts/publish.js --pack-destination=$RUNNER_TEMP | ||
node . install --global $RUNNER_TEMP/npm-$NPM_VERSION.tgz | ||
node . install -w smoke-tests --ignore-scripts --no-audit --no-fund | ||
rm -rf {lib,bin,index.js} | ||
# this one should be npm since we explicitly installed our packed | ||
# tarball globally and the next test will make sure our the new | ||
# globally installed version contains the git sha | ||
node scripts/remove-files.js | ||
# call installed npm instead of local source since we are testing | ||
# the packed tarball that we just installed globally | ||
SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts | ||
- name: Conclude Check | ||
uses: LouisBrunner/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# This file is automatically added by @npmcli/template-oss. Do not edit. | ||
|
||
name: "Create Node PR" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
spec: | ||
description: "The npm spec to create the PR from" | ||
required: true | ||
default: 'latest' | ||
dryRun: | ||
description: "Setting this to anything will run all the steps except opening the PR" | ||
|
||
jobs: | ||
create-pull-request: | ||
name: Create Node PR | ||
if: github.repository_owner == 'npm' | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Git User | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "npm CLI robot" | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: npm | ||
- name: Reset Deps | ||
run: node . run resetdeps | ||
- name: Checkout Node | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.NODE_PULL_REQUEST_TOKEN }} | ||
repository: nodejs/node | ||
fetch-depth: 0 | ||
path: node | ||
- name: Create Node Pull Request | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.NODE_PULL_REQUEST_TOKEN }} | ||
run: | | ||
DRY_RUN=$([ -z "${{ inputs.dryRun }}" ] && echo "" || echo "--dry-run") | ||
node scripts/create-node-pr.js "${{ inputs.spec }}" "$DRY_RUN" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.