@pluginfinity/cli 0.3.10 → 0.3.11
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/main.js +4 -5
- package/package.json +13 -12
- package/state-home.js +29 -0
- package/tsdoc-metadata.json +1 -1
- package/version.js +1 -1
package/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CurrentFollow, DEFAULT_FOLLOW } from "./commands/logs.js";
|
|
2
2
|
import { run } from "./cli/run.js";
|
|
3
|
+
import { ShellStateXdg, stateHome } from "./state-home.js";
|
|
3
4
|
import { CLI_VERSION } from "./version.js";
|
|
4
5
|
import { Cause, Effect, Exit, Runtime } from "effect";
|
|
5
|
-
import { homedir } from "node:os";
|
|
6
6
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
|
7
7
|
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
8
8
|
|
|
@@ -23,15 +23,14 @@ const exitAfterFlush = (following) => (exit, onExit) => Runtime.defaultTeardown(
|
|
|
23
23
|
const main = (options = {}) => {
|
|
24
24
|
const argv = process.argv.slice(2);
|
|
25
25
|
let following = false;
|
|
26
|
-
|
|
27
|
-
NodeRuntime.runMain(run(argv, {
|
|
26
|
+
NodeRuntime.runMain(Effect.flatMap(stateHome.pipe(Effect.provide(ShellStateXdg)), (home) => run(argv, {
|
|
28
27
|
version: CLI_VERSION,
|
|
29
28
|
cwd: process.cwd(),
|
|
30
29
|
nodeVersion: process.versions.node,
|
|
31
|
-
stateHome,
|
|
30
|
+
stateHome: home,
|
|
32
31
|
platform: NodeServices.layer,
|
|
33
32
|
distribution: options.distribution
|
|
34
|
-
}).pipe(Effect.provideService(CurrentFollow, {
|
|
33
|
+
})).pipe(Effect.provideService(CurrentFollow, {
|
|
35
34
|
...DEFAULT_FOLLOW,
|
|
36
35
|
onStart: () => {
|
|
37
36
|
following = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluginfinity/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The pluginfinity command-line front end. Install the pluginfinity package to get the pluginfinity bin.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,19 +40,20 @@
|
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@effect/platform-node": "^4.0.
|
|
44
|
-
"@effected/cli": "^0.
|
|
45
|
-
"@effected/commands": "^0.
|
|
46
|
-
"@effected/config-file": "^0.
|
|
47
|
-
"@effected/engine": "^0.
|
|
48
|
-
"@effected/env": "^0.
|
|
49
|
-
"@effected/glob": "^0.
|
|
50
|
-
"@effected/semver": "^0.
|
|
51
|
-
"@effected/walker": "^0.
|
|
43
|
+
"@effect/platform-node": "^4.0.7",
|
|
44
|
+
"@effected/cli": "^0.24.0",
|
|
45
|
+
"@effected/commands": "^0.18.0",
|
|
46
|
+
"@effected/config-file": "^0.22.0",
|
|
47
|
+
"@effected/engine": "^0.10.0",
|
|
48
|
+
"@effected/env": "^0.7.0",
|
|
49
|
+
"@effected/glob": "^0.16.0",
|
|
50
|
+
"@effected/semver": "^0.19.0",
|
|
51
|
+
"@effected/walker": "^0.22.0",
|
|
52
|
+
"@effected/xdg": "^0.17.0",
|
|
52
53
|
"@pluginfinity/core": "0.3.0",
|
|
53
|
-
"@pluginfinity/engine": "0.3.
|
|
54
|
+
"@pluginfinity/engine": "0.3.9",
|
|
54
55
|
"@pluginfinity/targets": "0.3.0",
|
|
55
|
-
"effect": "^4.0.
|
|
56
|
+
"effect": "^4.0.7",
|
|
56
57
|
"jiti": "^2.6.1"
|
|
57
58
|
},
|
|
58
59
|
"engines": {
|
package/state-home.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Effect, Layer } from "effect";
|
|
2
|
+
import { Xdg } from "@effected/xdg";
|
|
3
|
+
|
|
4
|
+
// src/state-home.ts
|
|
5
|
+
/**
|
|
6
|
+
* The XDG departures that make the kit read `XDG_STATE_HOME` as `log.sh`'s
|
|
7
|
+
* `:-` does: an empty variable is unset, a relative `XDG_STATE_HOME` is kept as
|
|
8
|
+
* given, and a missing `HOME` is `/nonexistent`, never the OS home directory.
|
|
9
|
+
*/
|
|
10
|
+
const SHELL_STATE_RULE = {
|
|
11
|
+
homeFallback: () => "/nonexistent",
|
|
12
|
+
relativeHomes: "keep"
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The XDG environment read from the ambient `ConfigProvider` by
|
|
16
|
+
* {@link SHELL_STATE_RULE}. The fallback home is never empty, so the layer's
|
|
17
|
+
* one failure, a missing home, cannot happen.
|
|
18
|
+
*/
|
|
19
|
+
const ShellStateXdg = Xdg.layerWith(SHELL_STATE_RULE).pipe(Layer.orDie);
|
|
20
|
+
/**
|
|
21
|
+
* `XDG_STATE_HOME`, else `<home>/.local/state`, joined as the shell joins it
|
|
22
|
+
* (a trailing `/` on `HOME` is kept, as `log.sh` keeps it).
|
|
23
|
+
*/
|
|
24
|
+
const stateHome = Effect.gen(function* () {
|
|
25
|
+
const xdg = yield* Xdg;
|
|
26
|
+
return xdg.stateHome ?? `${xdg.home}/.local/state`;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { SHELL_STATE_RULE, ShellStateXdg, stateHome };
|
package/tsdoc-metadata.json
CHANGED