From 9bf3126b03c8fa8629004ceb0fe0de480fc451f9 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Thu, 21 Apr 2022 16:25:53 -0700 Subject: [PATCH 1/3] fix: properly install and use glob --- lib/util/files.js | 4 +++- package.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/util/files.js b/lib/util/files.js index 32dd9124..cd708179 100644 --- a/lib/util/files.js +++ b/lib/util/files.js @@ -4,6 +4,8 @@ const glob = promisify(require('glob')) const Parser = require('./parser.js') const template = require('./template.js') +const globify = pattern => pattern.split('\\').join('/') + // target paths need to be joinsed with dir and templated const fullTarget = (dir, file, options) => join(dir, template(file, options)) @@ -33,7 +35,7 @@ const getParsers = (dir, files, options) => Object.entries(files).map(([t, s]) = const rmEach = async (dir, files, options, fn) => { const res = [] for (const target of files.map((t) => fullTarget(dir, t, options))) { - for (const file of await glob(target, { cwd: dir })) { + for (const file of await glob(globify(target), { cwd: dir })) { res.push(await fn(file)) } } diff --git a/package.json b/package.json index 99dab9ba..7aedf92f 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@npmcli/map-workspaces": "^2.0.2", "@npmcli/package-json": "^2.0.0", "diff": "^5.0.0", + "glob": "^8.0.1", "handlebars": "^4.7.7", "hosted-git-info": "^5.0.0", "json-parse-even-better-errors": "^2.3.1", From eb55928ada5db8657c57a568057aa886fa8dae4b Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Thu, 21 Apr 2022 10:17:56 -0700 Subject: [PATCH 2/3] fix: correctly set git user and email --- .github/workflows/audit.yml | 4 +- .github/workflows/ci.yml | 8 +-- .github/workflows/codeql-analysis.yml | 4 +- .github/workflows/post-dependabot.yml | 4 +- .github/workflows/pull-request.yml | 4 +- lib/content/setup-git.yml | 4 +- .../test/apply/full-content.js.test.cjs | 72 +++++++++---------- tap-snapshots/test/check/diffs.js.test.cjs | 6 +- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 7f48d351..1e35e279 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -15,8 +15,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 287a8696..eda41a7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -59,8 +59,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0067fc1b..2fbb6309 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,8 +34,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: diff --git a/.github/workflows/post-dependabot.yml b/.github/workflows/post-dependabot.yml index 4dd83131..94f5a8fd 100644 --- a/.github/workflows/post-dependabot.yml +++ b/.github/workflows/post-dependabot.yml @@ -16,8 +16,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index bf86a7da..d2bc7dab 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -20,8 +20,8 @@ jobs: fetch-depth: 0 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x diff --git a/lib/content/setup-git.yml b/lib/content/setup-git.yml index 8c148e97..1d75ab7e 100644 --- a/lib/content/setup-git.yml +++ b/lib/content/setup-git.yml @@ -7,5 +7,5 @@ {{/if}} - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" diff --git a/tap-snapshots/test/apply/full-content.js.test.cjs b/tap-snapshots/test/apply/full-content.js.test.cjs index 5eb207e2..a0fc34cb 100644 --- a/tap-snapshots/test/apply/full-content.js.test.cjs +++ b/tap-snapshots/test/apply/full-content.js.test.cjs @@ -145,8 +145,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -182,8 +182,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -219,8 +219,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: \${{ matrix.node-version }} @@ -283,8 +283,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: @@ -312,8 +312,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -362,8 +362,8 @@ jobs: fetch-depth: 0 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -623,8 +623,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -664,8 +664,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -701,8 +701,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: \${{ matrix.node-version }} @@ -757,8 +757,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -794,8 +794,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: \${{ matrix.node-version }} @@ -846,8 +846,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -883,8 +883,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: \${{ matrix.node-version }} @@ -947,8 +947,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - name: Initialize CodeQL uses: github/codeql-action/init@v1 with: @@ -976,8 +976,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -1026,8 +1026,8 @@ jobs: fetch-depth: 0 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -1085,8 +1085,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x @@ -1148,8 +1148,8 @@ jobs: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x diff --git a/tap-snapshots/test/check/diffs.js.test.cjs b/tap-snapshots/test/check/diffs.js.test.cjs index d834a2d8..6e235a58 100644 --- a/tap-snapshots/test/check/diffs.js.test.cjs +++ b/tap-snapshots/test/check/diffs.js.test.cjs @@ -311,7 +311,7 @@ The repo file ci.yml needs to be updated: .github/workflows/ci.yml ======================================== @@ -63,4 +63,24 @@ - git config --global user.name "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: \${{ matrix.node-version }} @@ -365,8 +365,8 @@ The repo file audit.yml needs to be updated: - uses: actions/checkout@v3 - name: Setup git user run: | - git config --global user.email "npm team" - git config --global user.name "ops+robot@npmjs.com" + git config --global user.email "ops+robot@npmjs.com" + git config --global user.name "npm team" - uses: actions/setup-node@v3 with: node-version: 16.x From 53cb44553716916b86d9a8005b1c905b305e8ff7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 21 Apr 2022 17:30:16 -0700 Subject: [PATCH 3/3] chore(main): release 3.4.2 (#140) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6d7c65e..3c0fa437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +### [3.4.2](https://github.com/npm/template-oss/compare/v3.4.1...v3.4.2) (2022-04-22) + + +### Bug Fixes + +* correctly set git user and email ([eb55928](https://github.com/npm/template-oss/commit/eb55928ada5db8657c57a568057aa886fa8dae4b)) +* properly install and use glob ([9bf3126](https://github.com/npm/template-oss/commit/9bf3126b03c8fa8629004ceb0fe0de480fc451f9)) + ### [3.4.1](https://github.com/npm/template-oss/compare/v3.4.0...v3.4.1) (2022-04-15) diff --git a/package.json b/package.json index 7aedf92f..e4725add 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@npmcli/template-oss", - "version": "3.4.1", + "version": "3.4.2", "description": "templated files used in npm CLI team oss projects", "main": "lib/content/index.js", "bin": {