Skip to content

Commit

Permalink
chore: normalize line endings and symlinks
Browse files Browse the repository at this point in the history
This makes it possible to do a fresh clone of this repo in Windows, and
be able to run the resetdeps command successfully and then have a clean
git status.

The changes required were to:
- Delete our workspace symlinks from node_modules and add a step to
  resetdeps that will do a platform dependent symlink before the initial
  reification
- Add line ending normalization to our `.gitattributes` file and commit
  the result. We now normalize everything to `lf` in git and force `bat`
  and `cmd` files to use `crlf` upon checkout.
- Update workflows to call `node scripts/resetdeps.js` directly since a
  fresh clone of the repo wont have any symlinks in place, so any
  `node .` command will fail due to missing workspaces.

Ref: npm/statusboard#562
  • Loading branch information
lukekarrys committed Jun 22, 2023
1 parent aef96c0 commit 370ac8d
Show file tree
Hide file tree
Showing 55 changed files with 404 additions and 430 deletions.
8 changes: 6 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/node_modules/** linguist-generated=false
/package-lock.json linguist-generated=false
* text=auto eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.tgz binary
/package-lock.json linguist-generated=false
/node_modules/** linguist-generated=false
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps -- --package-lock
run: node scripts/resetdeps.js --package-lock
- name: Run Production Audit
run: node . audit --omit=dev
- name: Run Full Audit
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmaccess.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmaccess
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmaccess
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmdiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmdiff
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmdiff
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmexec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmexec
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmexec
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmfund.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmfund
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmfund
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmhook
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmhook
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmorg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmorg
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmorg
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmpack
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmpack
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmpublish
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmpublish
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmsearch
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmsearch
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmteam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmteam
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmteam
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-libnpmversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w libnpmversion
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w libnpmversion
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-npmcli-arborist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w @npmcli/arborist
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w @npmcli/arborist
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-npmcli-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w @npmcli/config
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w @npmcli/config
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
9 changes: 4 additions & 5 deletions .github/workflows/ci-npmcli-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w @npmcli/docs
- name: Post Lint
Expand Down Expand Up @@ -79,13 +79,12 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w @npmcli/docs
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js

compare-docs:
Expand All @@ -110,7 +109,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Build Docs
run: |
node . run build -w docs
Expand All @@ -121,7 +120,7 @@ jobs:
run: |
git clean -fd
git checkout ${{ github.event.pull_request.base.ref }}
node . run resetdeps
node scripts/resetdeps.js
node . run build -w docs
- name: Diff Man
run: diff -r --color=always man/ man-update/ || true
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ci-npmcli-mock-globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w @npmcli/mock-globals
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w @npmcli/mock-globals
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
5 changes: 2 additions & 3 deletions .github/workflows/ci-npmcli-mock-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
node-version: 18.x
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Lint
run: node . run lint --ignore-scripts -w @npmcli/mock-registry
- name: Post Lint
Expand Down Expand Up @@ -84,11 +84,10 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Reset Deps
run: node . run resetdeps
run: node scripts/resetdeps.js
- name: Add Problem Matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- name: Test
run: node . test --ignore-scripts -w @npmcli/mock-registry
- name: Check Git Status
if: matrix && matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
Loading

0 comments on commit 370ac8d

Please sign in to comment.