@staff0rd/assist 0.151.0 → 0.151.1
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/dist/index.js +16 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.151.
|
|
9
|
+
version: "0.151.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1395,25 +1395,26 @@ function setupVerifyScript(packageJsonPath, scriptName, command) {
|
|
|
1395
1395
|
);
|
|
1396
1396
|
}
|
|
1397
1397
|
|
|
1398
|
-
// src/commands/
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
const
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1404
|
-
name: scriptName,
|
|
1405
|
-
command: needsNpx ? "npx" : parts[0]
|
|
1406
|
-
};
|
|
1407
|
-
const args = needsNpx ? parts : parts.slice(1);
|
|
1408
|
-
if (args.length > 0) entry.args = args;
|
|
1398
|
+
// src/commands/run/buildRunEntry.ts
|
|
1399
|
+
function buildRunEntry(name, command, args) {
|
|
1400
|
+
const effectiveArgs = args.length === 0 && command.includes(" ") ? command.split(/\s+/).slice(1) : args;
|
|
1401
|
+
const effectiveCommand = args.length === 0 && command.includes(" ") ? command.split(/\s+/)[0] : command;
|
|
1402
|
+
const entry = { name, command: effectiveCommand };
|
|
1403
|
+
if (effectiveArgs.length > 0) entry.args = effectiveArgs;
|
|
1409
1404
|
return entry;
|
|
1410
1405
|
}
|
|
1406
|
+
|
|
1407
|
+
// src/commands/verify/setupVerifyRunEntry.ts
|
|
1408
|
+
var GLOBAL_COMMANDS = /* @__PURE__ */ new Set(["assist", "npm", "npx", "node"]);
|
|
1411
1409
|
function setupVerifyRunEntry(scriptName, command) {
|
|
1412
1410
|
const config = loadProjectConfig();
|
|
1413
1411
|
if (!config.run) config.run = [];
|
|
1414
1412
|
const runList = config.run;
|
|
1415
1413
|
if (runList.find((r) => r.name === scriptName)) return;
|
|
1416
|
-
|
|
1414
|
+
const parts = command.split(/\s+/);
|
|
1415
|
+
const needsNpx = !GLOBAL_COMMANDS.has(parts[0]);
|
|
1416
|
+
const fullCommand = needsNpx ? `npx ${command}` : command;
|
|
1417
|
+
runList.push(buildRunEntry(scriptName, fullCommand, []));
|
|
1417
1418
|
saveConfig(config);
|
|
1418
1419
|
}
|
|
1419
1420
|
|
|
@@ -10007,14 +10008,6 @@ function parseAddArguments() {
|
|
|
10007
10008
|
const addIndex = findAddIndex();
|
|
10008
10009
|
return addIndex === -1 ? null : extractAddArgs(addIndex);
|
|
10009
10010
|
}
|
|
10010
|
-
function buildRunEntry2(name, command, args) {
|
|
10011
|
-
const entry = {
|
|
10012
|
-
name,
|
|
10013
|
-
command
|
|
10014
|
-
};
|
|
10015
|
-
if (args.length > 0) entry.args = args;
|
|
10016
|
-
return entry;
|
|
10017
|
-
}
|
|
10018
10011
|
function ensureNoDuplicate(configs, name) {
|
|
10019
10012
|
if (configs.find((r) => r.name === name)) {
|
|
10020
10013
|
console.error(`Run configuration with name "${name}" already exists`);
|
|
@@ -10040,7 +10033,7 @@ function getOrInitRunList() {
|
|
|
10040
10033
|
function saveNewRunConfig(name, command, args) {
|
|
10041
10034
|
const { config, runList } = getOrInitRunList();
|
|
10042
10035
|
ensureNoDuplicate(runList, name);
|
|
10043
|
-
runList.push(
|
|
10036
|
+
runList.push(buildRunEntry(name, command, args));
|
|
10044
10037
|
saveConfig(config);
|
|
10045
10038
|
}
|
|
10046
10039
|
function createCommandFile(name) {
|
|
@@ -10067,7 +10060,7 @@ function add3() {
|
|
|
10067
10060
|
|
|
10068
10061
|
// src/commands/run/index.ts
|
|
10069
10062
|
function buildCommand(command, configArgs, extraArgs) {
|
|
10070
|
-
const parts =
|
|
10063
|
+
const parts = [command, ...configArgs];
|
|
10071
10064
|
return [...parts.map(shellQuote), ...extraArgs.map(shellQuote)].join(" ");
|
|
10072
10065
|
}
|
|
10073
10066
|
function printAvailableConfigs(configs) {
|