@pluginfinity/cli 0.3.10 → 0.3.12

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 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
- const stateHome = process.env.XDG_STATE_HOME || `${process.env.HOME || homedir()}/.local/state`;
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.10",
3
+ "version": "0.3.12",
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.6",
44
- "@effected/cli": "^0.23.0",
45
- "@effected/commands": "^0.17.0",
46
- "@effected/config-file": "^0.21.0",
47
- "@effected/engine": "^0.9.0",
48
- "@effected/env": "^0.6.0",
49
- "@effected/glob": "^0.15.0",
50
- "@effected/semver": "^0.18.0",
51
- "@effected/walker": "^0.21.0",
52
- "@pluginfinity/core": "0.3.0",
53
- "@pluginfinity/engine": "0.3.8",
54
- "@pluginfinity/targets": "0.3.0",
55
- "effect": "^4.0.6",
43
+ "@effect/platform-node": "~4.1.1",
44
+ "@effected/cli": "^0.25.0",
45
+ "@effected/commands": "^0.19.0",
46
+ "@effected/config-file": "^0.23.0",
47
+ "@effected/engine": "^0.11.0",
48
+ "@effected/env": "^0.9.0",
49
+ "@effected/glob": "^0.17.0",
50
+ "@effected/semver": "^0.20.0",
51
+ "@effected/walker": "^0.24.0",
52
+ "@effected/xdg": "^0.18.0",
53
+ "@pluginfinity/core": "0.3.1",
54
+ "@pluginfinity/engine": "0.3.10",
55
+ "@pluginfinity/targets": "0.3.1",
56
+ "effect": "~4.1.1",
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 };
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.59.4"
8
+ "packageVersion": "7.60.0"
9
9
  }
10
10
  ]
11
11
  }
package/version.js CHANGED
@@ -8,6 +8,6 @@
8
8
  * with this package's own version, so this is not a runtime environment read.
9
9
  * `"0.0.0"` is the unbuilt-source fallback.
10
10
  */
11
- const CLI_VERSION = "0.3.10";
11
+ const CLI_VERSION = "0.3.12";
12
12
 
13
13
  export { CLI_VERSION };