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.
@@ -66,24 +66,22 @@ const exec = async (info) => {
66
66
  const stdin = new PassThrough();
67
67
 
68
68
  /** @type {string[]} */
69
- const paramsWithConvertedPaths = (
70
- await Promise.all(
71
- parameters.map(async (item) => {
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
- ).map((param) => `"${param}"`);
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
  *
@@ -34,13 +34,12 @@ const initContainer = async (libdragonInfo) => {
34
34
  'run',
35
35
  '-d', // Detached
36
36
  '--mount',
37
- '"type=bind,source=' +
37
+ 'type=bind,source=' +
38
38
  libdragonInfo.root +
39
39
  ',target=' +
40
- CONTAINER_TARGET_PATH +
41
- '"', // Mount files
42
- '"-w=' + CONTAINER_TARGET_PATH + '"', // Set working directory
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',
@@ -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
- * A simple Promise wrapper for child_process.spawn. Return the err/out streams
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
 
@@ -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 = {
@@ -91,7 +91,7 @@ async function findContainerId(libdragonInfo) {
91
91
  '--format',
92
92
  '{{.}}{{.ID}}',
93
93
  '-f',
94
- '"volume=' + CONTAINER_TARGET_PATH + '"',
94
+ 'volume=' + CONTAINER_TARGET_PATH,
95
95
  ])
96
96
  )
97
97
  .split('\n')
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', '"' + libdragonInfo.root + '"', ...params],
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libdragon",
3
- "version": "12.0.2",
3
+ "version": "12.0.4",
4
4
  "description": "This is a docker wrapper for libdragon",
5
5
  "main": "index.js",
6
6
  "engines": {