@effect-app/cli 1.29.1 → 2.0.0

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/src/os-command.ts CHANGED
@@ -1,40 +1,31 @@
1
1
  /* eslint-disable no-constant-binary-expression */
2
2
  /* eslint-disable no-empty-pattern */
3
- // import necessary modules from the libraries
4
- import { Command } from "@effect/platform"
5
-
6
- import { CommandExecutor } from "@effect/platform/CommandExecutor"
7
- import { Effect, identity } from "effect"
3
+ import { Effect, Layer, ServiceMap } from "effect"
4
+ import { ChildProcess } from "effect/unstable/process"
5
+ import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner"
8
6
 
9
7
  /**
10
8
  * Service for executing shell commands using the Effect platform's Command API.
11
9
  * Provides methods to run shell commands with different output handling strategies.
12
10
  * All commands are executed through the system shell (/bin/sh) for proper command parsing.
13
11
  */
14
- // @effect-diagnostics-next-line missingEffectServiceDependency:off
15
- export class RunCommandService extends Effect.Service<RunCommandService>()("RunCommandService", {
16
- dependencies: [],
17
- effect: Effect.gen(function*() {
12
+ export class RunCommandService extends ServiceMap.Service<RunCommandService>()("RunCommandService", {
13
+ make: Effect.gen(function*() {
18
14
  // will be provided by the main CLI pipeline setup
19
- const commandExecutor = yield* CommandExecutor
15
+ const spawner = yield* ChildProcessSpawner
20
16
 
21
17
  /**
22
18
  * Executes a shell command using Command API with inherited stdio streams.
23
- * The command is rn through the system shell (/bin/sh) for proper command parsing.
19
+ * The command is run through the system shell (/bin/sh) for proper command parsing.
24
20
  *
25
21
  * @param cmd - The shell command to execute
26
22
  * @param cwd - Optional working directory to execute the command in
27
23
  * @returns An Effect that succeeds with the exit code or fails with a PlatformError
28
24
  */
29
25
  const runGetExitCode = (cmd: string, cwd?: string) =>
30
- Command
31
- .make("sh", "-c", cmd)
32
- .pipe(
33
- Command.stdout("inherit"),
34
- Command.stderr("inherit"),
35
- cwd ? Command.workingDirectory(cwd) : identity,
36
- Command.exitCode,
37
- Effect.provideService(CommandExecutor, commandExecutor)
26
+ spawner
27
+ .exitCode(
28
+ ChildProcess.make("sh", ["-c", cmd], { stdout: "inherit", stderr: "inherit", cwd })
38
29
  )
39
30
 
40
31
  /**
@@ -46,12 +37,9 @@ export class RunCommandService extends Effect.Service<RunCommandService>()("RunC
46
37
  * @returns An Effect that succeeds with the command's stdout output as string or fails with a PlatformError
47
38
  */
48
39
  const runGetString = (cmd: string, cwd?: string) =>
49
- Command
50
- .make("sh", "-c", cmd)
51
- .pipe(
52
- cwd ? Command.workingDirectory(cwd) : identity,
53
- Command.string,
54
- Effect.provideService(CommandExecutor, commandExecutor)
40
+ spawner
41
+ .string(
42
+ ChildProcess.make("sh", ["-c", cmd], { cwd })
55
43
  )
56
44
 
57
45
  return {
@@ -60,4 +48,5 @@ export class RunCommandService extends Effect.Service<RunCommandService>()("RunC
60
48
  }
61
49
  })
62
50
  }) {
51
+ static Default = Layer.effect(this, this.make)
63
52
  }
package/tsconfig.json CHANGED
@@ -14,33 +14,7 @@
14
14
  "isolatedModules": true,
15
15
  "esModuleInterop": true,
16
16
  "skipLibCheck": true,
17
- "plugins": [
18
- {
19
- "name": "ts-plugin-sort-import-suggestions",
20
- "moveUpPatterns": [
21
- "\\.{1,2}/",
22
- "^(?:\\.\\./)+",
23
- "^#",
24
- "^@/",
25
- "effect",
26
- "^@effect/"
27
- ],
28
- "moveDownPatterns": [
29
- "^node_modules/"
30
- ],
31
- "overrides": {
32
- "effect-app": []
33
- }
34
- },
35
- {
36
- "name": "@effect/language-service",
37
- "diagnosticSeverity": {
38
- "missingEffectServiceDependency": "error",
39
- "effectFnOpportunity": "warning",
40
- "globalErrorInEffectFailure": "warning"
41
- }
42
- }
43
- ],
17
+ "plugins": [],
44
18
  "module": "Node16",
45
19
  "lib": [
46
20
  "esnext"