@node-cli/run 0.0.5 → 0.0.7
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 +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { execaCommand } from \"execa\";\nimport kleur from \"kleur\";\n\n/**\n * Runs a shell command asynchronously and\n * returns both `stdout` and `stderr`.\n * If the command fails to run (invalid command or the commands status is\n * anything but 0), the call will throw an exception. The exception can be\n * ignored if the `options.ignoreError` flag is true.\n *\n * @async\n */\nexport const run = async (\n\tcommand: string,\n\toptions?: { ignoreError?: boolean }\n): Promise<any> => {\n\tconst { ignoreError } = {\n\t\tignoreError: false,\n\t\t...options,\n\t};\n\ttry {\n\t\tconst { stdout, stderr } = await execaCommand(command, {\n\t\t\t/**\n\t\t\t * For some reason, a command with a \" or ' in execa.command() will\n\t\t\t * fail, but it works if shell is set to true... It would work if\n\t\t\t * the execaCommand() API is not used:\n\t\t\t * execa(\"ls\", [\"-l\", \"|\", \"wc\"]);\n\t\t\t * Same problems with &, &&, | and ||.\n\t\t\t */\n\t\t\tshell:\n\t\t\t\tcommand.includes('\"') ||\n\t\t\t\tcommand.includes(\"'\") ||\n\t\t\t\tcommand.includes(\"&&\") ||\n\t\t\t\tcommand.includes(\"&\") ||\n\t\t\t\tcommand.includes(\"||\") ||\n\t\t\t\tcommand.includes(\"|\"),\n\t\t});\n\n\t\treturn { stderr, stdout };\n\t} catch (error) {\n\t\tif (ignoreError) {\n\t\t\treturn {\n\t\t\t\texitCode: error.exitCode === undefined ? 1 : error.exitCode,\n\t\t\t\tshortMessage: error.shortMessage,\n\t\t\t\tstderr: error.exitCode === undefined ? 1 : error.exitCode,\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new Error(kleur.red(error));\n\t\t}\n\t}\n};\n"],"names":["execaCommand","kleur","run","command","options","ignoreError","stdout","stderr","shell","includes","error","exitCode","undefined","shortMessage","Error","red"],"mappings":"AAAA,SAASA,YAAY,QAAQ,QAAQ;AACrC,OAAOC,WAAW,QAAQ;AAE1B;;;;;;;;CAQC,GACD,OAAO,MAAMC,MAAM,OAClBC,SACAC,UACkB;IAClB,MAAM,EAAEC,YAAW,EAAE,GAAG;QACvBA,aAAa,KAAK;QAClB,GAAGD,OAAO;IACX;IACA,IAAI;QACH,MAAM,EAAEE,OAAM,EAAEC,OAAM,EAAE,GAAG,MAAMP,aAAaG,SAAS;YACtD;;;;;;IAMC,GACDK,OACCL,QAAQM,QAAQ,CAAC,QACjBN,QAAQM,QAAQ,CAAC,QACjBN,QAAQM,QAAQ,CAAC,SACjBN,QAAQM,QAAQ,CAAC,QACjBN,QAAQM,QAAQ,CAAC,SACjBN,QAAQM,QAAQ,CAAC;QACnB;QAEA,OAAO;YAAEF;YAAQD;QAAO;IACzB,EAAE,OAAOI,OAAO;QACf,IAAIL,aAAa;YAChB,OAAO;gBACNM,UAAUD,MAAMC,QAAQ,KAAKC,YAAY,IAAIF,MAAMC,QAAQ;gBAC3DE,cAAcH,MAAMG,YAAY;gBAChCN,QAAQG,MAAMC,QAAQ,KAAKC,YAAY,IAAIF,MAAMC,QAAQ;YAC1D;QACD,OAAO;YACN,MAAM,IAAIG,MAAMb,MAAMc,GAAG,CAACL,QAAQ;QACnC,CAAC;IACF;AACD,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-cli/run",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"description": "A wrapper for child_process for nodejs CLI apps",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "npm-run-all --serial clean build:types build:js",
|
|
20
|
-
"build:js": "swc --out-dir dist src",
|
|
20
|
+
"build:js": "swc --source-maps --out-dir dist src",
|
|
21
21
|
"build:types": "tsc",
|
|
22
22
|
"clean": "rimraf dist types coverage",
|
|
23
23
|
"lint": "eslint \"src/*.ts\"",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "7642c241f8d85cb6eb05aa8a4f5d7c8a726b4aab"
|
|
32
32
|
}
|