@pi-r/gulp 0.10.0 → 0.10.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.
Files changed (2) hide show
  1. package/index.js +7 -17
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -7,8 +7,8 @@ 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
9
  const kGulp = Symbol.for('gulp:constructor');
10
- const BIN_NPX = (0, types_1.sanitizeCmd)(which.sync('npx', { nothrow: true }) || 'npx');
11
- const BIN_GULP = (0, types_1.sanitizeCmd)(which.sync("gulp", { nothrow: true }) || '');
10
+ const BIN_NPX = which.sync('npx', { nothrow: true }) || 'npx';
11
+ const BIN_GULP = which.sync("gulp", { nothrow: true }) || '';
12
12
  const REGEXP_TIMESTAMP = /^\[\d+:\d+:\d+\]$/;
13
13
  async function executeTasks(instance, assets, preceding, host) {
14
14
  if (instance.aborted) {
@@ -192,22 +192,15 @@ class Gulp extends Task {
192
192
  }
193
193
  spawn(gulp, callback) {
194
194
  const { task, origDir, data } = gulp;
195
- const tempDir = this.getTempDir({ uuidDir: true });
195
+ const tempDir = (0, types_1.getTempDir)(true, "gulp");
196
196
  const writeError = (value, err, hint, type = 32) => {
197
197
  if (err) {
198
198
  this.writeFail([value, hint || (this.moduleName + ': ' + task)], err, { type, startTime });
199
199
  }
200
200
  if (hint !== false) {
201
- setImmediate(() => {
202
- Task.removeDir(tempDir);
203
- });
204
201
  callback();
205
202
  }
206
203
  };
207
- if (!tempDir) {
208
- writeError("Unable to create temp directory", null, this.getTempDir());
209
- return;
210
- }
211
204
  const exec = this.settings.exec;
212
205
  let { path: gulpfile, tasks, opts, items } = data, uid, gid;
213
206
  if (!Array.isArray(tasks)) {
@@ -271,10 +264,10 @@ class Gulp extends Task {
271
264
  timeStamp = '';
272
265
  }
273
266
  };
274
- 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 })
267
+ 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 })
275
268
  .on('exit', code => {
276
269
  if (!code) {
277
- this.addLog(types_1.STATUS_TYPE.INFO, out);
270
+ this.addLog(4, out);
278
271
  const result = new Set();
279
272
  let added, deleted;
280
273
  try {
@@ -319,9 +312,6 @@ class Gulp extends Task {
319
312
  (added ||= []).push(value);
320
313
  }
321
314
  }
322
- setImmediate(() => {
323
- Task.removeDir(tempDir);
324
- });
325
315
  callback({ added, deleted });
326
316
  }
327
317
  else {
@@ -334,7 +324,7 @@ class Gulp extends Task {
334
324
  if (stdout) {
335
325
  stdout.setEncoding('utf8').on('data', (value) => {
336
326
  if (broadcastId) {
337
- setMessage(types_1.STATUS_TYPE.INFO, value);
327
+ setMessage(4, value);
338
328
  }
339
329
  out += value;
340
330
  });
@@ -342,7 +332,7 @@ class Gulp extends Task {
342
332
  if (stderr) {
343
333
  stderr.setEncoding('utf8').on('data', (value) => {
344
334
  if (broadcastId) {
345
- setMessage(types_1.STATUS_TYPE.ERROR, value);
335
+ setMessage(2, value);
346
336
  }
347
337
  message += value;
348
338
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/gulp",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Gulp task constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -19,10 +19,10 @@
19
19
  "license": "MIT",
20
20
  "homepage": "https://github.com/anpham6/pi-r#readme",
21
21
  "dependencies": {
22
- "@e-mc/task": "^0.12.0",
23
- "@e-mc/types": "^0.12.0",
24
- "gulp": "^5.0.0",
25
- "gulp-cli": "^3.0.0",
22
+ "@e-mc/task": "^0.12.5",
23
+ "@e-mc/types": "^0.12.5",
24
+ "gulp": "^5.0.1",
25
+ "gulp-cli": "^3.1.0",
26
26
  "which": "^4.0.0"
27
27
  }
28
28
  }