libdragon 12.0.2 → 12.0.4
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/modules/actions/exec.js +15 -17
- package/modules/actions/start.js +4 -5
- package/modules/helpers.js +5 -11
- package/modules/npm-utils.js +10 -1
- package/modules/project-info.js +1 -1
- package/modules/utils.js +1 -1
- package/package.json +1 -1
package/modules/actions/exec.js
CHANGED
|
@@ -66,24 +66,22 @@ const exec = async (info) => {
|
|
|
66
66
|
const stdin = new PassThrough();
|
|
67
67
|
|
|
68
68
|
/** @type {string[]} */
|
|
69
|
-
const paramsWithConvertedPaths = (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (item.startsWith('-')) {
|
|
73
|
-
return item;
|
|
74
|
-
}
|
|
75
|
-
if (
|
|
76
|
-
item.includes(path.sep) &&
|
|
77
|
-
((await fileExists(item)) || (await dirExists(item)))
|
|
78
|
-
) {
|
|
79
|
-
return toPosixPath(
|
|
80
|
-
path.isAbsolute(item) ? path.relative(process.cwd(), item) : item
|
|
81
|
-
);
|
|
82
|
-
}
|
|
69
|
+
const paramsWithConvertedPaths = await Promise.all(
|
|
70
|
+
parameters.map(async (item) => {
|
|
71
|
+
if (item.startsWith('-')) {
|
|
83
72
|
return item;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
}
|
|
74
|
+
if (
|
|
75
|
+
item.includes(path.sep) &&
|
|
76
|
+
((await fileExists(item)) || (await dirExists(item)))
|
|
77
|
+
) {
|
|
78
|
+
return toPosixPath(
|
|
79
|
+
path.isAbsolute(item) ? path.relative(process.cwd(), item) : item
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
return item;
|
|
83
|
+
})
|
|
84
|
+
);
|
|
87
85
|
|
|
88
86
|
/**
|
|
89
87
|
*
|
package/modules/actions/start.js
CHANGED
|
@@ -34,13 +34,12 @@ const initContainer = async (libdragonInfo) => {
|
|
|
34
34
|
'run',
|
|
35
35
|
'-d', // Detached
|
|
36
36
|
'--mount',
|
|
37
|
-
'
|
|
37
|
+
'type=bind,source=' +
|
|
38
38
|
libdragonInfo.root +
|
|
39
39
|
',target=' +
|
|
40
|
-
CONTAINER_TARGET_PATH
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
'"' + libdragonInfo.imageName + '"',
|
|
40
|
+
CONTAINER_TARGET_PATH, // Mount files
|
|
41
|
+
'-w=' + CONTAINER_TARGET_PATH, // Set working directory
|
|
42
|
+
libdragonInfo.imageName,
|
|
44
43
|
'tail',
|
|
45
44
|
'-f',
|
|
46
45
|
'/dev/null',
|
package/modules/helpers.js
CHANGED
|
@@ -124,12 +124,11 @@ async function dirExists(path) {
|
|
|
124
124
|
* }} SpawnOptions
|
|
125
125
|
*/
|
|
126
126
|
|
|
127
|
+
// A simple Promise wrapper for child_process.spawn. Return the err/out streams
|
|
128
|
+
// from the process by default. Specify inheritStdout / inheritStderr to disable
|
|
129
|
+
// this and inherit the parent process's stream, passing through the TTY if any.
|
|
127
130
|
/**
|
|
128
|
-
*
|
|
129
|
-
* from the process by default. Specify inheritStdout / inheritStderr to disable
|
|
130
|
-
* this and inherit the parent process's stream, passing through the TTY if any.
|
|
131
|
-
* Runs everything in a shell, so be careful with user input. By default, we get
|
|
132
|
-
* the input from user but this is the whole idea of most of the logic here.
|
|
131
|
+
*
|
|
133
132
|
* @param {string} cmd
|
|
134
133
|
* @param {string[]} params
|
|
135
134
|
* @param {SpawnOptions} options
|
|
@@ -185,15 +184,10 @@ function spawnProcess(
|
|
|
185
184
|
enableErrorTTY ? 'inherit' : 'pipe',
|
|
186
185
|
],
|
|
187
186
|
env: {
|
|
187
|
+
...process.env,
|
|
188
188
|
// Prevent the annoying docker "What's next?" message. It messes up everything.
|
|
189
189
|
DOCKER_CLI_HINTS: 'false',
|
|
190
190
|
},
|
|
191
|
-
// On macos, we need to run the command in a shell for some docker commands
|
|
192
|
-
// to work properly. The ones with paths in them probably not working on
|
|
193
|
-
// macOS. No need to do this on Windows, as it'd now require additional
|
|
194
|
-
// escaping for the paths.
|
|
195
|
-
// shell: process.platform === 'darwin',
|
|
196
|
-
shell: true,
|
|
197
191
|
...spawnOptions,
|
|
198
192
|
});
|
|
199
193
|
|
package/modules/npm-utils.js
CHANGED
|
@@ -21,7 +21,16 @@ async function findNPMRoot() {
|
|
|
21
21
|
function runNPM(params) {
|
|
22
22
|
return spawnProcess(
|
|
23
23
|
/^win/.test(process.platform) ? 'npm.cmd' : 'npm',
|
|
24
|
-
params
|
|
24
|
+
params,
|
|
25
|
+
{
|
|
26
|
+
userCommand: false,
|
|
27
|
+
inheritStdin: true,
|
|
28
|
+
inheritStdout: false,
|
|
29
|
+
inheritStderr: false,
|
|
30
|
+
spawnOptions: {
|
|
31
|
+
shell: true,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
25
34
|
);
|
|
26
35
|
}
|
|
27
36
|
module.exports = {
|
package/modules/project-info.js
CHANGED
package/modules/utils.js
CHANGED
|
@@ -133,7 +133,7 @@ async function runGit(libdragonInfo, params, options = {}) {
|
|
|
133
133
|
|
|
134
134
|
return await spawnProcess(
|
|
135
135
|
'git',
|
|
136
|
-
['-C',
|
|
136
|
+
['-C', libdragonInfo.root, ...params],
|
|
137
137
|
// Windows git is breaking the TTY somehow - disable TTY for now
|
|
138
138
|
// We are not able to display progress for the initial clone b/c of this
|
|
139
139
|
// Enable progress otherwise.
|