libdragon 12.0.0 → 12.0.2
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/README.md +12 -1
- package/modules/actions/exec.js +17 -15
- package/modules/actions/start.js +5 -4
- package/modules/helpers.js +5 -0
- package/modules/project-info.js +1 -1
- package/modules/utils.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This is a wrapper for a docker container to make managing the libdragon toolchai
|
|
|
6
6
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
9
|
-
You should have [docker](https://www.docker.com/products/docker-desktop) (`>= 27.2.0`)
|
|
9
|
+
You should have [docker](https://www.docker.com/products/docker-desktop) (`>= 27.2.0`) and [git](https://git-scm.com/downloads) installed on your system.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -289,6 +289,17 @@ To create your own dev container backed project, you can use the contents of the
|
|
|
289
289
|
- It will prepare the container and open it in the editor.
|
|
290
290
|
</details>
|
|
291
291
|
|
|
292
|
+
## As an NPM dependency
|
|
293
|
+
|
|
294
|
+
You can install libdragon as an NPM dependency by `npm install libdragon --save` in order to use docker in your N64 projects. A `libdragon` command similar to global installation is provided that can be used in your NPM scripts as follows;
|
|
295
|
+
```json
|
|
296
|
+
"scripts": {
|
|
297
|
+
"prepare": "libdragon init"
|
|
298
|
+
"build": "libdragon make",
|
|
299
|
+
"clean": "libdragon make clean"
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
292
303
|
## Funding
|
|
293
304
|
|
|
294
305
|
If this tool helped you, consider supporting its development by sponsoring it!
|
package/modules/actions/exec.js
CHANGED
|
@@ -66,22 +66,24 @@ const exec = async (info) => {
|
|
|
66
66
|
const stdin = new PassThrough();
|
|
67
67
|
|
|
68
68
|
/** @type {string[]} */
|
|
69
|
-
const paramsWithConvertedPaths =
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
}
|
|
72
83
|
return item;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
);
|
|
84
|
+
})
|
|
85
|
+
)
|
|
86
|
+
).map((param) => `"${param}"`);
|
|
85
87
|
|
|
86
88
|
/**
|
|
87
89
|
*
|
package/modules/actions/start.js
CHANGED
|
@@ -34,12 +34,13 @@ 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
|
-
|
|
42
|
-
|
|
40
|
+
CONTAINER_TARGET_PATH +
|
|
41
|
+
'"', // Mount files
|
|
42
|
+
'"-w=' + CONTAINER_TARGET_PATH + '"', // Set working directory
|
|
43
|
+
'"' + libdragonInfo.imageName + '"',
|
|
43
44
|
'tail',
|
|
44
45
|
'-f',
|
|
45
46
|
'/dev/null',
|
package/modules/helpers.js
CHANGED
|
@@ -188,6 +188,11 @@ function spawnProcess(
|
|
|
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',
|
|
191
196
|
shell: true,
|
|
192
197
|
...spawnOptions,
|
|
193
198
|
});
|
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', 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.
|