@pi-r/gulp 0.9.4 → 0.10.1
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/index.js +9 -7
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -6,8 +6,9 @@ const which = require("which");
|
|
|
6
6
|
const node_util_1 = require("node:util");
|
|
7
7
|
const types_1 = require("@e-mc/types");
|
|
8
8
|
const Task = require('@e-mc/task');
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const kGulp = Symbol.for('gulp:constructor');
|
|
10
|
+
const BIN_NPX = which.sync('npx', { nothrow: true }) || 'npx';
|
|
11
|
+
const BIN_GULP = which.sync("gulp", { nothrow: true }) || '';
|
|
11
12
|
const REGEXP_TIMESTAMP = /^\[\d+:\d+:\d+\]$/;
|
|
12
13
|
async function executeTasks(instance, assets, preceding, host) {
|
|
13
14
|
if (instance.aborted) {
|
|
@@ -29,8 +30,9 @@ async function executeTasks(instance, assets, preceding, host) {
|
|
|
29
30
|
}
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
|
-
const normalizePath = (value) => Task.PLATFORM_WIN32 ? '"' + value.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"' :
|
|
33
|
+
const normalizePath = (value) => Task.PLATFORM_WIN32 ? '"' + value.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"' : (0, types_1.sanitizeArgs)(value);
|
|
33
34
|
class Gulp extends Task {
|
|
35
|
+
static [kGulp] = true;
|
|
34
36
|
static async finalize(instance, assets) {
|
|
35
37
|
return executeTasks(instance, assets, false, this);
|
|
36
38
|
}
|
|
@@ -255,7 +257,7 @@ class Gulp extends Task {
|
|
|
255
257
|
Promise.all(items.map(async (src) => fs.promises.copyFile(src, path.join(tempDir, path.basename(src)))))
|
|
256
258
|
.then(() => {
|
|
257
259
|
try {
|
|
258
|
-
const args =
|
|
260
|
+
const args = (0, types_1.sanitizeArgs)(tasks).concat(opts, ['--gulpfile', normalizePath(gulpfile), '--cwd', normalizePath(tempDir)]);
|
|
259
261
|
if (!BIN_GULP) {
|
|
260
262
|
args.unshift('gulp');
|
|
261
263
|
}
|
|
@@ -269,7 +271,7 @@ class Gulp extends Task {
|
|
|
269
271
|
timeStamp = '';
|
|
270
272
|
}
|
|
271
273
|
};
|
|
272
|
-
const { stdout, stderr } = child_process.spawn(BIN_GULP || BIN_NPX, args, { cwd: process.cwd(), shell: true, stdio: Task.hasLogType(32768) && !broadcastId ? 'inherit' : undefined, signal: this.signal, uid, gid })
|
|
274
|
+
const { stdout, stderr } = child_process.spawn((0, types_1.sanitizeCmd)(BIN_GULP || BIN_NPX, args), { cwd: process.cwd(), shell: true, stdio: Task.hasLogType(32768) && !broadcastId ? 'inherit' : undefined, signal: this.signal, uid, gid })
|
|
273
275
|
.on('exit', code => {
|
|
274
276
|
if (!code) {
|
|
275
277
|
this.addLog(types_1.STATUS_TYPE.INFO, out);
|
|
@@ -330,7 +332,7 @@ class Gulp extends Task {
|
|
|
330
332
|
writeError("Unknown", err, false, 4);
|
|
331
333
|
});
|
|
332
334
|
if (stdout) {
|
|
333
|
-
stdout.setEncoding('
|
|
335
|
+
stdout.setEncoding('utf8').on('data', (value) => {
|
|
334
336
|
if (broadcastId) {
|
|
335
337
|
setMessage(types_1.STATUS_TYPE.INFO, value);
|
|
336
338
|
}
|
|
@@ -338,7 +340,7 @@ class Gulp extends Task {
|
|
|
338
340
|
});
|
|
339
341
|
}
|
|
340
342
|
if (stderr) {
|
|
341
|
-
stderr.setEncoding('
|
|
343
|
+
stderr.setEncoding('utf8').on('data', (value) => {
|
|
342
344
|
if (broadcastId) {
|
|
343
345
|
setMessage(types_1.STATUS_TYPE.ERROR, value);
|
|
344
346
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-r/gulp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Gulp task constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"homepage": "https://github.com/anpham6/pi-r#readme",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@e-mc/task": "^0.
|
|
23
|
-
"@e-mc/types": "^0.
|
|
22
|
+
"@e-mc/task": "^0.12.3",
|
|
23
|
+
"@e-mc/types": "^0.12.3",
|
|
24
24
|
"gulp": "^5.0.0",
|
|
25
25
|
"gulp-cli": "^3.0.0",
|
|
26
26
|
"which": "^4.0.0"
|