zarro 1.210.2 → 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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zarro",
3
- "version": "1.210.2",
3
+ "version": "1.211.1",
4
4
  "description": "Some glue to make gulp easier, perhaps even zero- or close-to-zero-conf",
5
5
  "bin": {
6
6
  "zarro": "index.js"
package/types.d.ts CHANGED
@@ -363,7 +363,7 @@ declare global {
363
363
  name: string;
364
364
  version: string;
365
365
  description?: string;
366
- bin?: Dictionary<string>;
366
+ bin?: Dictionary<string> | string;
367
367
  homepage?: string;
368
368
  main?: string;
369
369
  scripts?: Dictionary<string>;