@pluginfinity/engine 0.3.8 → 0.3.10
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/discovery.js +10 -15
- package/doctor.js +5 -8
- package/package.json +11 -11
- package/tsdoc-metadata.json +1 -1
- package/version.js +1 -1
package/discovery.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigAmbiguous, ConfigNotFound } from "./errors.js";
|
|
2
|
-
import { Effect,
|
|
2
|
+
import { Effect, Option, Path } from "effect";
|
|
3
3
|
import { GlobPattern } from "@effected/glob";
|
|
4
4
|
import { Walker, descend } from "@effected/walker";
|
|
5
5
|
|
|
@@ -20,7 +20,6 @@ const ALL_PRUNE = [
|
|
|
20
20
|
"builds",
|
|
21
21
|
".git"
|
|
22
22
|
];
|
|
23
|
-
const exists = (fs, path) => fs.exists(path).pipe(Effect.orElseSucceed(() => false));
|
|
24
23
|
/**
|
|
25
24
|
* Finding `pluginfinity.config.*` files. Every member takes its start directory
|
|
26
25
|
* as an absolute path and never reads the process working directory.
|
|
@@ -34,20 +33,16 @@ var ConfigDiscovery = class {
|
|
|
34
33
|
* directory that contains `.git`.
|
|
35
34
|
*/
|
|
36
35
|
static nearest = (start) => Effect.gen(function* () {
|
|
37
|
-
const fs = yield* FileSystem.FileSystem;
|
|
38
36
|
const path = yield* Path.Path;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (yield* exists(fs, path.join(dir, ".git"))) break;
|
|
49
|
-
}
|
|
50
|
-
return yield* Effect.fail(new ConfigNotFound({ path: start }));
|
|
37
|
+
const dirs = yield* Walker.ascendToMarker(start, [".git"]);
|
|
38
|
+
const hits = yield* Walker.findUpwardAll(dirs, (dir) => CONFIG_FILE_NAMES.map((name) => path.join(dir, name)));
|
|
39
|
+
if (Option.isNone(hits)) return yield* Effect.fail(new ConfigNotFound({ path: start }));
|
|
40
|
+
const { dir, found } = hits.value;
|
|
41
|
+
if (found.length > 1) return yield* Effect.fail(new ConfigAmbiguous({
|
|
42
|
+
path: dir,
|
|
43
|
+
files: found.map((file) => path.basename(file))
|
|
44
|
+
}));
|
|
45
|
+
return found[0];
|
|
51
46
|
});
|
|
52
47
|
/**
|
|
53
48
|
* Every config at or below `start`, sorted, skipping `node_modules`,
|
package/doctor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigLoader } from "./loader.js";
|
|
2
2
|
import { selectConfigPaths } from "./selection.js";
|
|
3
3
|
import { ENGINE_VERSION } from "./version.js";
|
|
4
|
-
import { Duration, Effect,
|
|
4
|
+
import { Duration, Effect, Option, Path, Result, Schema } from "effect";
|
|
5
5
|
import { TARGETS } from "@pluginfinity/targets";
|
|
6
6
|
import { Walker } from "@effected/walker";
|
|
7
7
|
import { Tool, ToolDiscovery } from "@effected/commands";
|
|
@@ -155,14 +155,11 @@ const toolCheck = (fields, name, timeout) => Effect.gen(function* () {
|
|
|
155
155
|
});
|
|
156
156
|
});
|
|
157
157
|
const detectPackageManager = (start) => Effect.gen(function* () {
|
|
158
|
-
const fs = yield* FileSystem.FileSystem;
|
|
159
158
|
const path = yield* Path.Path;
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
return "npm";
|
|
159
|
+
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");
|
|
166
163
|
});
|
|
167
164
|
const configFailure = (error) => check({
|
|
168
165
|
id: "config",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluginfinity/engine",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
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,19 +34,19 @@
|
|
|
34
34
|
"./package.json": "./package.json"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@effected/commands": "^0.
|
|
38
|
-
"@effected/engine": "^0.
|
|
39
|
-
"@effected/glob": "^0.
|
|
40
|
-
"@effected/semver": "^0.
|
|
41
|
-
"@effected/walker": "^0.
|
|
42
|
-
"@effected/yaml": "^0.
|
|
43
|
-
"@pluginfinity/core": "0.3.
|
|
44
|
-
"@pluginfinity/targets": "0.3.
|
|
37
|
+
"@effected/commands": "^0.19.0",
|
|
38
|
+
"@effected/engine": "^0.11.0",
|
|
39
|
+
"@effected/glob": "^0.17.0",
|
|
40
|
+
"@effected/semver": "^0.20.0",
|
|
41
|
+
"@effected/walker": "^0.24.0",
|
|
42
|
+
"@effected/yaml": "^0.27.0",
|
|
43
|
+
"@pluginfinity/core": "0.3.1",
|
|
44
|
+
"@pluginfinity/targets": "0.3.1",
|
|
45
45
|
"jiti": "^2.6.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@effect/platform-node": "
|
|
49
|
-
"effect": "
|
|
48
|
+
"@effect/platform-node": "~4.1.1",
|
|
49
|
+
"effect": "~4.1.1"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=24.11.0"
|
package/tsdoc-metadata.json
CHANGED