Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rewrite scripts/ with javascript #5739

Merged
merged 2 commits into from
Nov 1, 2022
Merged

chore: rewrite scripts/ with javascript #5739

merged 2 commits into from
Nov 1, 2022

Conversation

lukekarrys
Copy link
Contributor

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.

@lukekarrys lukekarrys requested a review from a team as a code owner October 24, 2022 23:06
@lukekarrys lukekarrys force-pushed the lk/no-make branch 10 times, most recently from 82d744a to 0cb06c6 Compare October 25, 2022 23:22
@lukekarrys
Copy link
Contributor Author

Since this changes the release workflow, I manually triggered it via workflow_dispatch and it succeeds: https://github.com/npm/cli/actions/runs/3325056538

@lukekarrys lukekarrys force-pushed the lk/no-make branch 2 times, most recently from 08ce810 to 33bfa10 Compare October 26, 2022 06:19
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.
@lukekarrys
Copy link
Contributor Author

This requires a few updates to the release wiki. I will make those once this is merged.

@wraithgar wraithgar merged commit 2293fb2 into latest Nov 1, 2022
@wraithgar wraithgar deleted the lk/no-make branch November 1, 2022 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants