zarro 1.211.0 → 1.211.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-modules/handlers/invoke-gulp.js +35 -1
- package/package.json +1 -1
- package/types.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(function () {
|
|
3
|
-
const os = require("os"), requireModule = require("../../gulp-tasks/modules/require-module"), chalk = requireModule("ansi-colors"), quoteIfRequired = requireModule("quote-if-required"), which = require("which"), { splitPath } = requireModule("path-utils"), path = require("path"), isFile = require("../is-file"), isDir = require("../is-dir"), debug = require("debug")("zarro::invoke-gulp"), projectDir = path.dirname(path.dirname(__dirname)), ZarroError = requireModule("zarro-error");
|
|
3
|
+
const os = require("os"), { fileExistsSync, readTextFileSync } = require("yafs"), requireModule = require("../../gulp-tasks/modules/require-module"), chalk = requireModule("ansi-colors"), quoteIfRequired = requireModule("quote-if-required"), which = require("which"), { splitPath } = requireModule("path-utils"), path = require("path"), isFile = require("../is-file"), isDir = require("../is-dir"), debug = require("debug")("zarro::invoke-gulp"), projectDir = path.dirname(path.dirname(__dirname)), ZarroError = requireModule("zarro-error");
|
|
4
4
|
function alwaysAccept() {
|
|
5
5
|
return true;
|
|
6
6
|
}
|
|
@@ -37,7 +37,41 @@
|
|
|
37
37
|
await validate(nodeModulesDir, binDir);
|
|
38
38
|
return generateFullGulpCliPathFor(binDir);
|
|
39
39
|
}
|
|
40
|
+
function findPkgRoot(startFile, pkgName) {
|
|
41
|
+
let dir = path.dirname(startFile);
|
|
42
|
+
while (true) {
|
|
43
|
+
const test = path.join(dir, "package.json");
|
|
44
|
+
if (fileExistsSync(test)) {
|
|
45
|
+
try {
|
|
46
|
+
const pkg = JSON.parse(readTextFileSync(test));
|
|
47
|
+
if (pkg.name === pkgName) {
|
|
48
|
+
return {
|
|
49
|
+
dir,
|
|
50
|
+
pkg
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
// ignore
|
|
56
|
+
}
|
|
57
|
+
const parent = path.dirname(dir);
|
|
58
|
+
if (parent === dir) {
|
|
59
|
+
throw new Error(`Could not find ${pkgName}'s package.json`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
40
64
|
async function findGulp() {
|
|
65
|
+
var _a;
|
|
66
|
+
try {
|
|
67
|
+
const gulpEntry = require.resolve("gulp"), { dir: gulpDir, pkg } = findPkgRoot(gulpEntry, "gulp"), binRel = typeof pkg.bin === "string" ? pkg.bin : (_a = pkg.bin) === null || _a === void 0 ? void 0 : _a.gulp, gulpBin = path.resolve(gulpDir, binRel);
|
|
68
|
+
if (fileExistsSync(gulpBin)) {
|
|
69
|
+
return gulpBin;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
console.warn("fancy new gulp appropriation not working; falling back on Ye Olde Methodes", e);
|
|
74
|
+
}
|
|
41
75
|
try {
|
|
42
76
|
return await which("gulp");
|
|
43
77
|
}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED