@pluginfinity/engine 0.3.16 → 0.3.18

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 (3) hide show
  1. package/doctor.js +18 -11
  2. package/package.json +5 -4
  3. package/version.js +1 -1
package/doctor.js CHANGED
@@ -7,6 +7,7 @@ import { Walker } from "@effected/walker";
7
7
  import { Tool, ToolDiscovery } from "@effected/commands";
8
8
  import { CurrentDistribution, DistributionField, Remediation } from "@effected/kit";
9
9
  import { SemVer } from "@effected/semver";
10
+ import { PackageManagerDetector } from "@effected/workspaces";
10
11
 
11
12
  // src/doctor.ts
12
13
  /**
@@ -86,13 +87,6 @@ var DoctorReport = class extends Schema.Class("DoctorReport")({
86
87
  return !this.checks.some((check) => check.severity === "required" && check.status === "fail");
87
88
  }
88
89
  };
89
- const LOCKFILES = [
90
- ["pnpm-lock.yaml", "pnpm"],
91
- ["package-lock.json", "npm"],
92
- ["yarn.lock", "yarn"],
93
- ["bun.lock", "bun"],
94
- ["bun.lockb", "bun"]
95
- ];
96
90
  const check = (fields) => DoctorCheck.make({
97
91
  id: fields.id,
98
92
  group: fields.group,
@@ -154,12 +148,25 @@ const toolCheck = (fields, name, timeout) => Effect.gen(function* () {
154
148
  detail: version === void 0 ? "found (version unknown)" : `found ${version}`
155
149
  });
156
150
  });
151
+ /**
152
+ * The package manager at the nearest directory, from `start` up to the one
153
+ * holding `.git`, where `@effected/workspaces` finds evidence of one. yarn is a
154
+ * manager the kit does not act on, but its workspaces are npm's, so a yarn root
155
+ * is still named and its CLI checked. With no evidence anywhere, npm: it ships
156
+ * with Node, so it is the manager that is there.
157
+ */
157
158
  const detectPackageManager = (start) => Effect.gen(function* () {
158
- const path = yield* Path.Path;
159
+ const detector = yield* PackageManagerDetector.make;
159
160
  const dirs = yield* Walker.ascendToMarker(start, [".git"]);
160
- const lockfile = yield* Walker.findUpward(dirs, (dir) => LOCKFILES.map(([file]) => path.join(dir, file)));
161
- const manager = Option.flatMapNullishOr(lockfile, (found) => LOCKFILES.find(([file]) => file === path.basename(found))?.[1]);
162
- return Option.getOrElse(manager, () => "npm");
161
+ for (const dir of dirs) {
162
+ const detected = yield* detector.detect(dir).pipe(Effect.map((found) => Option.some(found.name)), Effect.catchTags({
163
+ UnsupportedPackageManagerError: (error) => Effect.succeed(Option.some(error.manager)),
164
+ PackageManagerDetectionError: () => Effect.succeedNone,
165
+ WorkspaceManifestError: () => Effect.succeedNone
166
+ }));
167
+ if (Option.isSome(detected)) return detected.value;
168
+ }
169
+ return "npm";
163
170
  });
164
171
  const configFailure = (error) => check({
165
172
  id: "config",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluginfinity/engine",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "private": false,
5
5
  "description": "The pluginfinity build pipeline shared by every pluginfinity front end: config discovery, read, transform per target, emit and check.",
6
6
  "keywords": [
@@ -34,11 +34,12 @@
34
34
  "./package.json": "./package.json"
35
35
  },
36
36
  "dependencies": {
37
- "@effected/commands": "0.21.0",
38
- "@effected/glob": "0.21.0",
37
+ "@effected/commands": "0.22.0",
38
+ "@effected/glob": "0.22.0",
39
39
  "@effected/kit": "0.14.0",
40
40
  "@effected/semver": "0.24.0",
41
- "@effected/walker": "0.28.0",
41
+ "@effected/walker": "0.29.0",
42
+ "@effected/workspaces": "0.48.0",
42
43
  "@effected/yaml": "0.30.0",
43
44
  "@pluginfinity/core": "0.3.3",
44
45
  "@pluginfinity/targets": "0.3.3",
package/version.js CHANGED
@@ -12,6 +12,6 @@
12
12
  *
13
13
  * @public
14
14
  */
15
- const ENGINE_VERSION = "0.3.16";
15
+ const ENGINE_VERSION = "0.3.18";
16
16
 
17
17
  export { ENGINE_VERSION };