Skip to content

Commit

Permalink
Merge branch 'main' into upgrade-spawn-please
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine authored Mar 12, 2024
2 parents d772cc7 + c0b47d6 commit 4cc8375
Show file tree
Hide file tree
Showing 44 changed files with 1,466 additions and 1,064 deletions.
14 changes: 3 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
FORCE_COLOR: 2
NODE_COV: 18
NODE_COV: 20

permissions:
contents: read
Expand All @@ -33,24 +33,16 @@ jobs:

steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm

# node v14 cannot install from current package-lock.json, so use npm install instea of npm ci.
# Cannot read property 'chalk' of undefined
# Regression: e88617964a009dbb9f5e973f64ff76ad289df68c
- name: Install npm dependencies
run: npm i
if: 'matrix.node == 14'

- name: Install npm dependencies
run: npm ci
if: 'matrix.node != 14'

- name: Build
run: npm run build
Expand Down
22 changes: 7 additions & 15 deletions .husky/post-commit → .hooks/post-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

#!/bin/bash
SHORT_SHA=$(git rev-parse HEAD)
LINT_LOG="$TMPDIR"/lint."$SHORT_SHA".log

Expand All @@ -13,18 +11,14 @@ strip() {
notify() {
# if osascript is not supported, do nothing
if [ -f /usr/bin/osascript ]; then
# get '<SHORT_SHA> <FIRST_LINE_OF_COMMIT_MSG>'
COMMIT_INFO=$(git log --oneline -n 1 --format="%h %s")

# read back in the lint errors
# TODO: update for each tye of error
ERRORS=$(cat "$LINT_LOG" | sed 1,4d)

# Trigger apple- or OSA-script on supported platforms
/usr/bin/osascript -e "display notification \"$ERRORS\" with title \"ncu: $COMMIT_INFO: $*\""
/usr/bin/osascript -e "display notification \"$ERRORS\" with title \"$*\""
fi

# always clean up the lint output, and do not clag-up TMPDIR
# clean up
rm "$LINT_LOG"
}

Expand All @@ -37,9 +31,7 @@ if [ -z "$branch" ]; then
exit 0
fi

# Lint asynchrously, not blocking the terminal and piping all output to a file.
# IFF lint fails trigger a pop-up (on supported platforms) with at least the
# first error shown.
# We pipe output so that the terminal (tmux, vim, emacs etc.) isn't borked by
# stray output.
npm run lint:src | strip &> "$LINT_LOG" || notify "Lint Error" &
# Lint in the background, not blocking the terminal and piping all output to a file.
# If the lint fails, trigger a notification (on supported platforms) with at least the first error shown.
# We pipe output so that the terminal (tmux, vim, emacs etc.) isn't borked by stray output.
npm run lint:src | strip &>"$LINT_LOG" || notify "Lint Error" &
9 changes: 9 additions & 0 deletions .hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
fail=0

npm run lint || fail=1
npm run prettier -- --check || fail=1

if [ "$fail" -ne 0 ]; then
exit 1
fi
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/pre-push

This file was deleted.

26 changes: 10 additions & 16 deletions .ncurc.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
module.exports = {
format: 'group',
reject: [
// TODO: major version upgrades
'chai',
'commander',
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/parser',
// ESM only modules
// https://github.com/microsoft/TypeScript/issues/46452
'find-up',
'get-stdin',
'globby',
/* pin to 4.0.0 to match make-fetch-happen/cacache. */
'p-map',
'remote-git-tags',
'untildify',
// Broken in v6.0.0
// Working upgrade is in branch 'hosted-git-info', but hold off on merging due to node engine requirements: ^14.17.0 || ^16.13.0 || >=18.0.0
// https://github.com/npm/hosted-git-info/releases/tag/v6.0.0
'hosted-git-info',
// Waiting for Prettier v3 support in @trivago/prettier-plugin-sort-imports
// https://github.com/trivago/prettier-plugin-sort-imports/issues/240
'prettier',
// Removed support for node v14 in v0.35.0
'makdownlint-cli',
// manually keep in alignment with pacote's version of make-fetch-happen
'make-fetch-happen',
// 5.2.0 breaks moduleResolution
// Need to upgrade module and moduleResolution together (high risk)
'typescript',
// major changes required to upgrade to v3
'spawn-please',
// v0.60.0 breaks cli option description output
// https://github.com/YousefED/typescript-json-schema/issues/568
'typescript-json-schema',
// node >= 18
'update-notifier',
],
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
script-shell = bash
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"importOrder": ["^\\.\\./", "^\\./"],
"importOrderSortSpecifiers": true,
"overrides": [{ "files": "*.ts", "options": { "parser": "typescript" } }],
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"printWidth": 120,
"semi": false,
"singleQuote": true,
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ Options that take no arguments can be negated by prefixing them with `--no-`, e.
</tr>
<tr>
<td>--root</td>
<td>Runs updates on the root project in addition to specified workspaces. Only allowed with <code>--workspace</code> or <code>--workspaces</code>. (default: false)</td>
<td>Runs updates on the root project in addition to specified workspaces. Only allowed with <code>--workspace</code> or <code>--workspaces</code>. (default: true)</td>
</tr>
<tr>
<td>-s, --silent</td>
Expand Down Expand Up @@ -444,7 +444,9 @@ Usage:
ncu --filter [p]
ncu -f [p]

Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Only included packages will be checked with `--peer`.

`--filter` runs _before_ new versions are fetched, in contrast to `--filterResults` which runs _after_.

The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.

Expand All @@ -467,7 +469,7 @@ filterFunction: (name, semver) => {

Filters out upgrades based on a user provided function.

`filterResults` runs _after_ new versions are fetched, in contrast to `filter` and `filterVersion`, which run _before_. This allows you to filter out upgrades with `filterResults` based on how the version has changed (e.g. a major version change).
`filterResults` runs _after_ new versions are fetched, in contrast to `filter`, `reject`, `filterVersion`, and `rejectVersion`, which run _before_. This allows you to filter out upgrades with `filterResults` based on how the version has changed (e.g. a major version change).

Only available in .ncurc.js or when importing npm-check-updates as a module.

Expand Down Expand Up @@ -675,7 +677,9 @@ Usage:
ncu --reject [p]
ncu -x [p]
The inverse of `--filter`. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
The inverse of `--filter`. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. This will also exclude them from the `--peer` check.
`--reject` runs _before_ new versions are fetched, in contrast to `--filterResults` which runs _after_.
The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.
Expand Down
Loading

0 comments on commit 4cc8375

Please sign in to comment.