numux 2.0.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/numux.js +23 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,15 +128,18 @@ numux -n api="bun dev:api" -n web="bun dev:web"
|
|
|
128
128
|
|
|
129
129
|
### Script patterns
|
|
130
130
|
|
|
131
|
-
Run
|
|
131
|
+
Run package.json scripts by name — any colon-containing name is automatically recognized as a script reference:
|
|
132
132
|
|
|
133
133
|
```sh
|
|
134
|
-
numux '
|
|
135
|
-
numux '
|
|
134
|
+
numux 'lint:eslint --fix' # runs: yarn run lint:eslint --fix
|
|
135
|
+
numux 'dev:*' # all scripts matching dev:*
|
|
136
|
+
numux 'npm:*:dev' # explicit npm: prefix (same behavior)
|
|
136
137
|
```
|
|
137
138
|
|
|
138
139
|
`*` does not match across `:` separators (like `/` in file paths), so `format:*` matches `format:store` but not `format:check:store`. Use `format:*:*` to match two levels deep.
|
|
139
140
|
|
|
141
|
+
Append `^` to skip scripts that act as group runners — scripts that have sub-scripts beneath them. For example, if `format:check` runs `numux 'format:check:*'` internally, then `format:*^` excludes it (because `format:check:store` and `format:check:odoo` exist as sub-scripts), avoiding duplicate runs.
|
|
142
|
+
|
|
140
143
|
Extra arguments after the pattern are forwarded to each matched command:
|
|
141
144
|
|
|
142
145
|
```sh
|
package/dist/numux.js
CHANGED
|
@@ -36,7 +36,7 @@ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports,
|
|
|
36
36
|
var require_package = __commonJS((exports, module) => {
|
|
37
37
|
module.exports = {
|
|
38
38
|
name: "numux",
|
|
39
|
-
version: "2.0
|
|
39
|
+
version: "2.2.0",
|
|
40
40
|
description: "Terminal multiplexer with dependency orchestration",
|
|
41
41
|
type: "module",
|
|
42
42
|
license: "MIT",
|
|
@@ -666,6 +666,17 @@ function detectPackageManager(pkgJson, cwd) {
|
|
|
666
666
|
function isGlobPattern(name) {
|
|
667
667
|
return /[*?[]/.test(name);
|
|
668
668
|
}
|
|
669
|
+
function isScriptReference(name, value) {
|
|
670
|
+
if (name.startsWith("npm:") || isGlobPattern(name))
|
|
671
|
+
return true;
|
|
672
|
+
if (!name.includes(":"))
|
|
673
|
+
return false;
|
|
674
|
+
if (typeof value === "string")
|
|
675
|
+
return false;
|
|
676
|
+
if (value && typeof value === "object" && "command" in value)
|
|
677
|
+
return false;
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
669
680
|
function deriveShortName(pattern, scriptName) {
|
|
670
681
|
let prefixEnd = 0;
|
|
671
682
|
while (prefixEnd < pattern.length && !"*?[".includes(pattern[prefixEnd])) {
|
|
@@ -692,8 +703,8 @@ function splitPatternArgs(raw) {
|
|
|
692
703
|
}
|
|
693
704
|
function expandScriptPatterns(config, cwd) {
|
|
694
705
|
const entries = Object.entries(config.processes);
|
|
695
|
-
const
|
|
696
|
-
if (!
|
|
706
|
+
const hasScriptRef = entries.some(([name, value]) => isScriptReference(name, value));
|
|
707
|
+
if (!hasScriptRef)
|
|
697
708
|
return config;
|
|
698
709
|
const dir = config.cwd ?? cwd ?? process.cwd();
|
|
699
710
|
const pkgPath = resolve(dir, "package.json");
|
|
@@ -709,7 +720,7 @@ function expandScriptPatterns(config, cwd) {
|
|
|
709
720
|
const pm = detectPackageManager(pkgJson, dir);
|
|
710
721
|
const expanded = {};
|
|
711
722
|
for (const [name, value] of entries) {
|
|
712
|
-
if (!(name
|
|
723
|
+
if (!isScriptReference(name, value)) {
|
|
713
724
|
expanded[name] = value;
|
|
714
725
|
continue;
|
|
715
726
|
}
|
|
@@ -719,17 +730,19 @@ function expandScriptPatterns(config, cwd) {
|
|
|
719
730
|
if (template.command) {
|
|
720
731
|
throw new Error(`"${name}": wildcard processes cannot have a "command" field (commands come from package.json scripts)`);
|
|
721
732
|
}
|
|
722
|
-
const
|
|
723
|
-
const
|
|
724
|
-
const
|
|
733
|
+
const leafOnly = globPattern.endsWith("^");
|
|
734
|
+
const effectivePattern = leafOnly ? globPattern.slice(0, -1) : globPattern;
|
|
735
|
+
const glob = new Bun.Glob(effectivePattern);
|
|
736
|
+
const colonDepth = (effectivePattern.match(/:/g) || []).length;
|
|
737
|
+
const matches = scriptNames.filter((s) => glob.match(s) && (s.match(/:/g) || []).length === colonDepth && !(leafOnly && scriptNames.some((other) => other.startsWith(`${s}:`))));
|
|
725
738
|
if (matches.length === 0) {
|
|
726
|
-
throw new Error(`"${name}": no scripts matched pattern "${
|
|
739
|
+
throw new Error(`"${name}": no scripts matched pattern "${effectivePattern}". Available scripts: ${scriptNames.join(", ")}`);
|
|
727
740
|
}
|
|
728
741
|
const colors = Array.isArray(template.color) ? template.color : undefined;
|
|
729
742
|
const singleColor = typeof template.color === "string" ? template.color : undefined;
|
|
730
743
|
for (let i = 0;i < matches.length; i++) {
|
|
731
744
|
const scriptName = matches[i];
|
|
732
|
-
const displayName = deriveShortName(
|
|
745
|
+
const displayName = deriveShortName(effectivePattern, scriptName);
|
|
733
746
|
if (expanded[displayName]) {
|
|
734
747
|
throw new Error(`"${name}": expanded script "${scriptName}" collides with an existing process name`);
|
|
735
748
|
}
|
|
@@ -3753,7 +3766,7 @@ async function main() {
|
|
|
3753
3766
|
let config;
|
|
3754
3767
|
const warnings = [];
|
|
3755
3768
|
if (parsed.commands.length > 0 || parsed.named.length > 0 || parsed.workspace) {
|
|
3756
|
-
const isScriptPattern = (c) => c.startsWith("npm:") || /[*?[]/.test(c);
|
|
3769
|
+
const isScriptPattern = (c) => c.startsWith("npm:") || /[*?[]/.test(c) || c.split(/\s+/)[0].includes(":");
|
|
3757
3770
|
const hasNpmPatterns = parsed.commands.some(isScriptPattern);
|
|
3758
3771
|
if (hasNpmPatterns) {
|
|
3759
3772
|
const npmPatterns = parsed.commands.filter(isScriptPattern);
|