@sap-ux/project-access 1.35.14 → 1.35.16
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.
|
@@ -6,10 +6,12 @@ import type { Logger } from '@sap-ux/logger';
|
|
|
6
6
|
* @param [options] - optional options
|
|
7
7
|
* @param [options.cwd] - optional current working directory
|
|
8
8
|
* @param [options.logger] - optional logger instance
|
|
9
|
+
* @param [options.throwOnError] - optional flag to throw an error if the command exits with a non-zero code, default is false
|
|
9
10
|
* @returns - stdout of the command
|
|
10
11
|
*/
|
|
11
12
|
export declare function execNpmCommand(commandArguments: string[], options?: {
|
|
12
13
|
cwd?: string;
|
|
13
14
|
logger?: Logger;
|
|
15
|
+
throwOnError?: boolean;
|
|
14
16
|
}): Promise<string>;
|
|
15
17
|
//# sourceMappingURL=npm-command.d.ts.map
|
|
@@ -9,6 +9,7 @@ const node_child_process_1 = require("node:child_process");
|
|
|
9
9
|
* @param [options] - optional options
|
|
10
10
|
* @param [options.cwd] - optional current working directory
|
|
11
11
|
* @param [options.logger] - optional logger instance
|
|
12
|
+
* @param [options.throwOnError] - optional flag to throw an error if the command exits with a non-zero code, default is false
|
|
12
13
|
* @returns - stdout of the command
|
|
13
14
|
*/
|
|
14
15
|
async function execNpmCommand(commandArguments, options) {
|
|
@@ -30,20 +31,30 @@ async function execNpmCommand(commandArguments, options) {
|
|
|
30
31
|
spawnProcess.stderr.on('data', (data) => {
|
|
31
32
|
stdErr += data.toString();
|
|
32
33
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
const commandString = `${npmCommand} ${commandArguments.join(' ')}`;
|
|
35
|
+
spawnProcess.on('exit', (code, signal) => {
|
|
36
|
+
if (code === null) {
|
|
37
|
+
logger?.warn(`Command '${commandString}' was killed by signal: ${signal}`);
|
|
38
|
+
}
|
|
39
|
+
else if (code === 0) {
|
|
40
|
+
const stdMessages = [stdOut, stdErr].filter(Boolean).join('\n');
|
|
41
|
+
const output = stdMessages ? `:\n${stdMessages}` : '';
|
|
42
|
+
logger?.info(`Command '${commandString}' successful${output}`);
|
|
43
|
+
}
|
|
44
|
+
else if (options?.throwOnError) {
|
|
39
45
|
if (stdOut) {
|
|
40
|
-
logger
|
|
46
|
+
logger?.info(stdOut);
|
|
41
47
|
}
|
|
48
|
+
reject(new Error(`Command '${commandString}' failed with exit code ${code}. Stderr: ${stdErr}`));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
logger?.error(`Command '${commandString}' not successful, stderr: ${stdErr}`);
|
|
42
53
|
}
|
|
43
54
|
resolve(stdOut);
|
|
44
55
|
});
|
|
45
56
|
spawnProcess.on('error', (error) => {
|
|
46
|
-
logger?.error(`Error executing npm command '${
|
|
57
|
+
logger?.error(`Error executing npm command '${commandString}': ${error}`);
|
|
47
58
|
reject(error);
|
|
48
59
|
});
|
|
49
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.35.
|
|
3
|
+
"version": "1.35.16",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,23 +23,23 @@
|
|
|
23
23
|
"node": ">=20.x"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"fast-xml-parser": "5.
|
|
26
|
+
"fast-xml-parser": "5.5.9",
|
|
27
27
|
"findit2": "2.2.3",
|
|
28
|
-
"json-parse-even-better-errors": "
|
|
28
|
+
"json-parse-even-better-errors": "5.0.0",
|
|
29
29
|
"mem-fs": "2.1.0",
|
|
30
30
|
"mem-fs-editor": "9.4.0",
|
|
31
31
|
"semver": "7.7.4",
|
|
32
|
-
"@sap-ux/i18n": "0.3.
|
|
33
|
-
"@sap-ux/ui5-config": "0.30.
|
|
32
|
+
"@sap-ux/i18n": "0.3.10",
|
|
33
|
+
"@sap-ux/ui5-config": "0.30.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@sap-ux/vocabularies-types": "0.15.0",
|
|
37
37
|
"@types/mem-fs": "1.1.2",
|
|
38
38
|
"@types/mem-fs-editor": "7.0.1",
|
|
39
39
|
"@types/semver": "7.7.1",
|
|
40
|
-
"@ui5/manifest": "1.
|
|
40
|
+
"@ui5/manifest": "1.84.0",
|
|
41
41
|
"vscode-uri": "3.1.0",
|
|
42
|
-
"@sap-ux/logger": "0.8.
|
|
42
|
+
"@sap-ux/logger": "0.8.3"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc --build",
|