@stackbit/cms-core 3.1.8 → 3.1.9
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/.tsbuildinfo +1 -1
- package/dist/services/run.d.ts +13 -1
- package/dist/services/run.d.ts.map +1 -1
- package/dist/services/run.js +21 -12
- package/dist/services/run.js.map +1 -1
- package/package.json +5 -5
- package/src/services/run.ts +23 -12
package/dist/services/run.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import childProcess from 'child_process';
|
|
6
|
+
import { CommandRunner, Logger } from '@stackbit/types';
|
|
7
|
+
type RunCommandOptions = {
|
|
8
|
+
cwd?: string;
|
|
9
|
+
shell?: boolean;
|
|
10
|
+
env?: NodeJS.ProcessEnv;
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
uid?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function runCommand(command: string, args?: string[], options?: RunCommandOptions): childProcess.ChildProcessWithoutNullStreams;
|
|
4
15
|
export declare function getCommandRunner(commandRunnerOptions: {
|
|
5
16
|
env: NodeJS.ProcessEnv;
|
|
6
17
|
uid?: number;
|
|
7
18
|
}): CommandRunner;
|
|
19
|
+
export {};
|
|
8
20
|
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/services/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/services/run.ts"],"names":[],"mappings":";;;;AAAA,OAAO,YAAgD,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAGnE,KAAK,iBAAiB,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,+CAcvF;AAED,wBAAgB,gBAAgB,CAAC,oBAAoB,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAY9G"}
|
package/dist/services/run.js
CHANGED
|
@@ -3,26 +3,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getCommandRunner = void 0;
|
|
6
|
+
exports.getCommandRunner = exports.runCommand = void 0;
|
|
7
7
|
const child_process_1 = __importDefault(require("child_process"));
|
|
8
8
|
const utils_1 = require("@stackbit/utils");
|
|
9
|
+
function runCommand(command, args, options) {
|
|
10
|
+
if (options?.logger) {
|
|
11
|
+
options.logger.info(`Running command '${command}${args ? ' ' : ''}${args?.join(' ')}'${options?.cwd ? ` in '${options.cwd}'` : ''} ...`);
|
|
12
|
+
}
|
|
13
|
+
const process = child_process_1.default.spawn(command, args, {
|
|
14
|
+
cwd: options?.cwd,
|
|
15
|
+
shell: options?.shell,
|
|
16
|
+
env: options?.env,
|
|
17
|
+
...(options?.uid ? { uid: options.uid } : {})
|
|
18
|
+
});
|
|
19
|
+
if (options?.logger) {
|
|
20
|
+
(0, utils_1.logProcess)(process, 'run', options.logger);
|
|
21
|
+
}
|
|
22
|
+
return process;
|
|
23
|
+
}
|
|
24
|
+
exports.runCommand = runCommand;
|
|
9
25
|
function getCommandRunner(commandRunnerOptions) {
|
|
10
26
|
return (command, args, options) => {
|
|
11
|
-
|
|
12
|
-
options
|
|
13
|
-
|
|
14
|
-
const process = child_process_1.default.spawn(command, args, {
|
|
15
|
-
cwd: options?.cwd,
|
|
16
|
-
shell: options?.shell,
|
|
27
|
+
const process = runCommand(command, args, {
|
|
28
|
+
...options,
|
|
29
|
+
uid: options?.uid ?? commandRunnerOptions.uid,
|
|
17
30
|
env: {
|
|
18
31
|
...commandRunnerOptions.env,
|
|
19
32
|
...options?.env
|
|
20
|
-
}
|
|
21
|
-
...(commandRunnerOptions.uid ? { uid: commandRunnerOptions.uid } : {})
|
|
33
|
+
}
|
|
22
34
|
});
|
|
23
|
-
if (options?.logger) {
|
|
24
|
-
(0, utils_1.logProcess)(process, 'run', options.logger);
|
|
25
|
-
}
|
|
26
35
|
return getProcessPromise(process);
|
|
27
36
|
};
|
|
28
37
|
}
|
package/dist/services/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/services/run.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA6E;AAE7E,2CAA6C;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/services/run.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA6E;AAE7E,2CAA6C;AAI7C,SAAgB,UAAU,CAAC,OAAe,EAAE,IAAe,EAAE,OAA2B;IACpF,IAAI,OAAO,EAAE,MAAM,EAAE;QACjB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;KAC5I;IAC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4
|
"description": "stackbit-dev",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"@iarna/toml": "^2.2.3",
|
|
28
28
|
"@netlify/content-engine": "^1.4.0",
|
|
29
29
|
"@netlify/sdk": "^1.17.2",
|
|
30
|
-
"@stackbit/sdk": "2.1.
|
|
31
|
-
"@stackbit/types": "2.1.
|
|
32
|
-
"@stackbit/utils": "0.7.
|
|
30
|
+
"@stackbit/sdk": "2.1.6",
|
|
31
|
+
"@stackbit/types": "2.1.3",
|
|
32
|
+
"@stackbit/utils": "0.7.5",
|
|
33
33
|
"chalk": "^4.0.1",
|
|
34
34
|
"esm": "^3.2.25",
|
|
35
35
|
"fs-extra": "^8.1.0",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"slugify": "^1.6.5",
|
|
45
45
|
"uuid": "^9.0.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "1f36e9510a47bb14a69d8e8d1f306c7b7ed7f006"
|
|
48
48
|
}
|
package/src/services/run.ts
CHANGED
|
@@ -2,23 +2,34 @@ import childProcess, { ChildProcessWithoutNullStreams } from 'child_process';
|
|
|
2
2
|
import { CommandRunner, Logger, RunResult } from '@stackbit/types';
|
|
3
3
|
import { logProcess } from '@stackbit/utils';
|
|
4
4
|
|
|
5
|
+
type RunCommandOptions = { cwd?: string; shell?: boolean; env?: NodeJS.ProcessEnv; logger?: Logger; uid?: number };
|
|
6
|
+
|
|
7
|
+
export function runCommand(command: string, args?: string[], options?: RunCommandOptions) {
|
|
8
|
+
if (options?.logger) {
|
|
9
|
+
options.logger.info(`Running command '${command}${args ? ' ' : ''}${args?.join(' ')}'${options?.cwd ? ` in '${options.cwd}'` : ''} ...`);
|
|
10
|
+
}
|
|
11
|
+
const process = childProcess.spawn(command, args, {
|
|
12
|
+
cwd: options?.cwd,
|
|
13
|
+
shell: options?.shell,
|
|
14
|
+
env: options?.env,
|
|
15
|
+
...(options?.uid ? { uid: options.uid } : {})
|
|
16
|
+
});
|
|
17
|
+
if (options?.logger) {
|
|
18
|
+
logProcess(process, 'run', options.logger);
|
|
19
|
+
}
|
|
20
|
+
return process;
|
|
21
|
+
}
|
|
22
|
+
|
|
5
23
|
export function getCommandRunner(commandRunnerOptions: { env: NodeJS.ProcessEnv; uid?: number }): CommandRunner {
|
|
6
|
-
return (command: string, args?: string[], options?:
|
|
7
|
-
|
|
8
|
-
options
|
|
9
|
-
|
|
10
|
-
const process = childProcess.spawn(command, args, {
|
|
11
|
-
cwd: options?.cwd,
|
|
12
|
-
shell: options?.shell,
|
|
24
|
+
return (command: string, args?: string[], options?: RunCommandOptions): Promise<RunResult> => {
|
|
25
|
+
const process = runCommand(command, args, {
|
|
26
|
+
...options,
|
|
27
|
+
uid: options?.uid ?? commandRunnerOptions.uid,
|
|
13
28
|
env: {
|
|
14
29
|
...commandRunnerOptions.env,
|
|
15
30
|
...options?.env
|
|
16
|
-
}
|
|
17
|
-
...(commandRunnerOptions.uid ? { uid: commandRunnerOptions.uid } : {})
|
|
31
|
+
}
|
|
18
32
|
});
|
|
19
|
-
if (options?.logger) {
|
|
20
|
-
logProcess(process, 'run', options.logger);
|
|
21
|
-
}
|
|
22
33
|
return getProcessPromise(process);
|
|
23
34
|
};
|
|
24
35
|
}
|