@effect-app/cli 1.29.2 → 2.0.1-beta.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/CHANGELOG.md +12 -0
- package/dist/extract.d.ts +1 -2
- package/dist/extract.d.ts.map +1 -1
- package/dist/extract.js +3 -4
- package/dist/gist.d.ts +180 -103
- package/dist/gist.d.ts.map +1 -1
- package/dist/gist.js +43 -57
- package/dist/index.js +21 -28
- package/dist/os-command.d.ts +12 -9
- package/dist/os-command.d.ts.map +1 -1
- package/dist/os-command.js +13 -17
- package/package.json +10 -9
- package/src/extract.ts +2 -3
- package/src/gist.ts +88 -99
- package/src/index.ts +636 -650
- package/src/os-command.ts +14 -25
- package/tsconfig.json +1 -29
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
|
-
|
|
4
|
-
import {
|
|
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
|
-
|
|
15
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
31
|
-
.
|
|
32
|
-
|
|
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
|
-
|
|
50
|
-
.
|
|
51
|
-
|
|
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,35 +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
|
-
"ignoreEffectWarningsInTscExitCode": true,
|
|
38
|
-
"diagnosticSeverity": {
|
|
39
|
-
"missingEffectServiceDependency": "error",
|
|
40
|
-
"effectFnOpportunity": "warning",
|
|
41
|
-
"globalErrorInEffectFailure": "warning",
|
|
42
|
-
"preferSchemaOverJson": "warning"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
],
|
|
17
|
+
"plugins": [],
|
|
46
18
|
"module": "Node16",
|
|
47
19
|
"lib": [
|
|
48
20
|
"esnext"
|