From dcf2ac4f51f701a8fd8e09151724903978342a7c Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 20 May 2025 19:20:30 +0200 Subject: [PATCH 1/5] add tests for double stars --- test/pattern.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/pattern.js b/test/pattern.js index 29f5b36..b222dfe 100644 --- a/test/pattern.js +++ b/test/pattern.js @@ -50,6 +50,24 @@ describe('[pattern] it should run matched tasks if glob like patterns are given. }) }) + describe('"test-task:append:**" to "test-task:append:a", "test-task:append:a:c", "test-task:append:a:d", and "test-task:append:b"', () => { + it('Node API', async () => { + await nodeApi('test-task:append:**') + assert(result() === 'aaacacadadbb') + }) + + it('npm-run-all command', async () => { + await runAll(['test-task:append:**']) + assert(result() === 'aaacacadadbb') + }) + + it('run-s command', async () => { + await runSeq(['test-task:append:**']) + assert(result() === 'aaacacadadbb') + }) + }) + + // should act same way as section above describe('"test-task:append:**:*" to "test-task:append:a", "test-task:append:a:c", "test-task:append:a:d", and "test-task:append:b"', () => { it('Node API', async () => { await nodeApi('test-task:append:**:*') From 3c0d2b29e32c07f2a943d5c9451843a57664fcc8 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 20 May 2025 19:20:42 +0200 Subject: [PATCH 2/5] fix new test --- lib/match-tasks.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/match-tasks.js b/lib/match-tasks.js index 8708dff..22ac73d 100644 --- a/lib/match-tasks.js +++ b/lib/match-tasks.js @@ -10,8 +10,7 @@ // Requirements // ------------------------------------------------------------------------------ -const { minimatch } = require('minimatch') -const Minimatch = minimatch.Minimatch +const picomatch = require('picomatch') // ------------------------------------------------------------------------------ // Helpers @@ -21,7 +20,7 @@ const COLON_OR_SLASH = /[:/]/g const CONVERT_MAP = { ':': '/', '/': ':' } /** - * Swaps ":" and "/", in order to use ":" as the separator in minimatch. + * Swaps ":" and "/", in order to use ":" as the separator in picomatch. * * @param {string} s - A text to swap. * @returns {string} The text which was swapped. @@ -44,8 +43,10 @@ function createFilter (pattern) { const spacePos = trimmed.indexOf(' ') const task = spacePos < 0 ? trimmed : trimmed.slice(0, spacePos) const args = spacePos < 0 ? '' : trimmed.slice(spacePos) - const matcher = new Minimatch(swapColonAndSlash(task), { nonegate: true }) - const match = matcher.match.bind(matcher) + const match = picomatch(swapColonAndSlash(task), { + nonegate: true, + strictSlashes: true, + }) return { match, task, args } } From 8f4e37767e3208d4353268037c1fff03d2018e4c Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Tue, 20 May 2025 12:01:00 -0700 Subject: [PATCH 3/5] Try picomatch again --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 071018e..cfbd77a 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "ansi-styles": "^6.2.1", "cross-spawn": "^7.0.6", "memorystream": "^0.3.1", - "minimatch": "^10.0.1", + "picomatch": "^4.0.2", "pidtree": "^0.6.0", "read-package-json-fast": "^4.0.0", "shell-quote": "^1.7.3", From 530288e7d2985dbb7dcc8f6f6347c0c761d3b4af Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Tue, 20 May 2025 14:36:46 -0700 Subject: [PATCH 4/5] Improve npm lifecycles - Remove npm test from preversion. These shouldn't be tied together. - Move postversion to prepublishOnly. Pushing to github is publishing! --- .github/workflows/release.yml | 1 + package.json | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 53a6692..6e348d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,7 @@ jobs: # setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED registry-url: 'https://registry.npmjs.org' - run: npm i + - run: npm test - run: git status # getting odd dirty repo errors during version debug info - run: git diff - name: npm version && npm publish diff --git a/package.json b/package.json index 071018e..d93e062 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "test": "node ./bin/run-s/index.js check test-mocha", "watch": "mocha --timeout 120000 --watch --growl", "version": "auto-changelog -p --template keepachangelog auto-changelog --breaking-pattern 'BREAKING CHANGE:' && git add CHANGELOG.md", - "preversion": "npm test", - "postversion": "git push --follow-tags && gh-release -y" + "prepublishOnly": "git push --follow-tags && gh-release -y" }, "dependencies": { "ansi-styles": "^6.2.1", From e23faeaa29ddc50242f81211081e909031b65b34 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Tue, 20 May 2025 14:38:14 -0700 Subject: [PATCH 5/5] 8.0.4-beta.0 --- CHANGELOG.md | 16 ++++++++++++++-- package.json | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60d3481..7822e31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -## [v8.0.3](https://github.com/bcomnes/npm-run-all2/compare/v8.0.2...v8.0.3) +## [v8.0.4-beta.0](https://github.com/bcomnes/npm-run-all2/compare/v8.0.3...v8.0.4-beta.0) + +### Merged + +- add tests for double stars [`#179`](https://github.com/bcomnes/npm-run-all2/pull/179) + +### Commits + +- Merge pull request #180 from bcomnes/simplify-lifecycles [`fb6721a`](https://github.com/bcomnes/npm-run-all2/commit/fb6721a1d537f0db9bb87645f158a573343c717a) +- fix new test [`3c0d2b2`](https://github.com/bcomnes/npm-run-all2/commit/3c0d2b29e32c07f2a943d5c9451843a57664fcc8) +- Improve npm lifecycles [`530288e`](https://github.com/bcomnes/npm-run-all2/commit/530288e7d2985dbb7dcc8f6f6347c0c761d3b4af) + +## [v8.0.3](https://github.com/bcomnes/npm-run-all2/compare/v8.0.2...v8.0.3) - 2025-05-20 ### Commits @@ -321,8 +333,8 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). ### Commits -- 🐛 use pidtree [`1b41ac5`](https://github.com/bcomnes/npm-run-all2/commit/1b41ac569987c96e224f940ff59f9699322c7824) - ⬆️ update dependencies [`7ec542e`](https://github.com/bcomnes/npm-run-all2/commit/7ec542e95ceb922b9abe593270d9b6f8e0df4bc5) +- 🐛 use pidtree [`1b41ac5`](https://github.com/bcomnes/npm-run-all2/commit/1b41ac569987c96e224f940ff59f9699322c7824) - 🔖 4.1.5 [`df15118`](https://github.com/bcomnes/npm-run-all2/commit/df1511851a2b5e8a406e4a2622829b360f671afc) ## [v4.1.4](https://github.com/bcomnes/npm-run-all2/compare/v4.1.3...v4.1.4) - 2018-11-24 diff --git a/package.json b/package.json index 04a639c..45b0d8a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "npm-run-all2", "type": "commonjs", - "version": "8.0.3", + "version": "8.0.4-beta.0", "description": "A CLI tool to run multiple npm-scripts in parallel or sequential. (Maintenance fork)", "bin": { "run-p": "bin/run-p/index.js",