@savvy-web/github-action-builder 1.1.2 → 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/bin/github-action-builder.js +13 -18
- package/cli/commands/build.js +5 -5
- package/cli/commands/init.js +4 -4
- package/cli/commands/validate.js +1 -1
- package/github-action.js +3 -3
- package/index.d.ts +248 -272
- package/package.json +7 -14
- package/schemas/action-yml.js +272 -10
- package/schemas/config.js +13 -19
- package/schemas/path.js +7 -4
- package/services/build-live.js +5 -5
- package/services/build.js +22 -2
- package/services/config.js +21 -3
- package/services/persist-local-live.js +3 -2
- package/services/persist-local.js +2 -2
- package/services/validation-live.js +18 -17
- package/services/validation.js +22 -2
- package/tsdoc-metadata.json +1 -1
|
@@ -4,9 +4,9 @@ import { buildCommand } from "../cli/commands/build.js";
|
|
|
4
4
|
import { initCommand } from "../cli/commands/init.js";
|
|
5
5
|
import { validateCommand } from "../cli/commands/validate.js";
|
|
6
6
|
import "../cli/commands/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { Effect, Layer } from "effect";
|
|
8
|
+
import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
9
|
+
import { Command } from "effect/unstable/cli";
|
|
10
10
|
|
|
11
11
|
//#region src/cli/index.ts
|
|
12
12
|
/* v8 ignore start - CLI entry point requires integration testing */
|
|
@@ -22,28 +22,23 @@ const rootCommand = Command.make("github-action-builder").pipe(Command.withSubco
|
|
|
22
22
|
initCommand
|
|
23
23
|
]));
|
|
24
24
|
/**
|
|
25
|
-
* CLI application
|
|
25
|
+
* CLI application: reads argv from the Stdio service provided by NodeServices.
|
|
26
26
|
*/
|
|
27
|
-
const cli = Command.run(rootCommand, {
|
|
28
|
-
name: "github-action-builder",
|
|
29
|
-
version: "1.1.2"
|
|
30
|
-
});
|
|
27
|
+
const cli = Command.run(rootCommand, { version: "2.0.0" });
|
|
31
28
|
/**
|
|
32
|
-
* Combined layer: AppLayer +
|
|
29
|
+
* Combined layer: AppLayer + the Node implementations of the CLI
|
|
30
|
+
* environment (FileSystem, Path, Terminal, Stdio, ChildProcessSpawner).
|
|
33
31
|
*/
|
|
34
|
-
const CliLayer = Layer.
|
|
32
|
+
const CliLayer = Layer.mergeAll(AppLayer, NodeServices.layer);
|
|
35
33
|
/**
|
|
36
|
-
* Run the CLI
|
|
34
|
+
* Run the CLI.
|
|
37
35
|
*
|
|
38
36
|
* Expected typed errors (ValidationFailed, BuildFailed, etc.) are already
|
|
39
|
-
* printed by command handlers —
|
|
40
|
-
*
|
|
37
|
+
* printed by command handlers — the failed effect makes the runtime exit
|
|
38
|
+
* non-zero. Usage errors print help via the CLI framework and also fail.
|
|
39
|
+
* NodeRuntime.runMain reports unexpected defects with full cause rendering.
|
|
41
40
|
*/
|
|
42
|
-
|
|
43
|
-
if (Cause.defects(cause).length > 0) return Console.error(Cause.pretty(cause)).pipe(Effect.andThen(Effect.failCause(cause)));
|
|
44
|
-
return Effect.failCause(cause);
|
|
45
|
-
}));
|
|
46
|
-
NodeRuntime.runMain(main);
|
|
41
|
+
NodeRuntime.runMain(cli.pipe(Effect.provide(CliLayer)));
|
|
47
42
|
|
|
48
43
|
//#endregion
|
|
49
44
|
export { };
|
package/cli/commands/build.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ConfigService } from "../../services/config.js";
|
|
|
4
4
|
import { PersistLocalService } from "../../services/persist-local.js";
|
|
5
5
|
import { ValidationService } from "../../services/validation.js";
|
|
6
6
|
import { Console, Effect, Option } from "effect";
|
|
7
|
-
import { Command,
|
|
7
|
+
import { Command, Flag } from "effect/unstable/cli";
|
|
8
8
|
|
|
9
9
|
//#region src/cli/commands/build.ts
|
|
10
10
|
/* v8 ignore start - CLI commands require integration testing */
|
|
@@ -14,19 +14,19 @@ import { Command, Options } from "@effect/cli";
|
|
|
14
14
|
/**
|
|
15
15
|
* Config file option - shared across commands.
|
|
16
16
|
*/
|
|
17
|
-
const configOption =
|
|
17
|
+
const configOption = Flag.file("config").pipe(Flag.withAlias("c"), Flag.withDescription("Path to configuration file"), Flag.optional);
|
|
18
18
|
/**
|
|
19
19
|
* Quiet mode option - suppress non-error output.
|
|
20
20
|
*/
|
|
21
|
-
const quietOption =
|
|
21
|
+
const quietOption = Flag.boolean("quiet").pipe(Flag.withAlias("q"), Flag.withDescription("Suppress non-error output"));
|
|
22
22
|
/**
|
|
23
23
|
* Skip validation option.
|
|
24
24
|
*/
|
|
25
|
-
const noValidateOption =
|
|
25
|
+
const noValidateOption = Flag.boolean("no-validate").pipe(Flag.withDescription("Skip validation step"));
|
|
26
26
|
/**
|
|
27
27
|
* Skip persist-local option.
|
|
28
28
|
*/
|
|
29
|
-
const noPersistOption =
|
|
29
|
+
const noPersistOption = Flag.boolean("no-persist").pipe(Flag.withDescription("Skip persisting build output to local action directory"));
|
|
30
30
|
/**
|
|
31
31
|
* Build command handler using Effect services.
|
|
32
32
|
*/
|
package/cli/commands/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Console, Effect } from "effect";
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
|
-
import {
|
|
4
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
5
5
|
|
|
6
6
|
//#region src/cli/commands/init.ts
|
|
7
7
|
/* v8 ignore start - CLI commands require integration testing */
|
|
@@ -11,16 +11,16 @@ import { Args, Command, Options } from "@effect/cli";
|
|
|
11
11
|
/**
|
|
12
12
|
* Action name positional argument.
|
|
13
13
|
*/
|
|
14
|
-
const actionNameArg =
|
|
14
|
+
const actionNameArg = Argument.string("action-name").pipe(Argument.withDescription("Name of the GitHub Action (also the output directory)"));
|
|
15
15
|
/**
|
|
16
16
|
* Force overwrite option.
|
|
17
17
|
*/
|
|
18
|
-
const forceOption =
|
|
18
|
+
const forceOption = Flag.boolean("force").pipe(Flag.withAlias("f"), Flag.withDescription("Overwrite existing files"));
|
|
19
19
|
/**
|
|
20
20
|
* Get current package version (replaced at build time).
|
|
21
21
|
*/
|
|
22
22
|
const getPackageVersion = () => {
|
|
23
|
-
return "
|
|
23
|
+
return "2.0.0";
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Generate package.json content.
|
package/cli/commands/validate.js
CHANGED
|
@@ -2,7 +2,7 @@ import { ConfigService } from "../../services/config.js";
|
|
|
2
2
|
import { ValidationService } from "../../services/validation.js";
|
|
3
3
|
import { configOption, quietOption } from "./build.js";
|
|
4
4
|
import { Console, Effect, Option } from "effect";
|
|
5
|
-
import { Command } from "
|
|
5
|
+
import { Command } from "effect/unstable/cli";
|
|
6
6
|
|
|
7
7
|
//#region src/cli/commands/validate.ts
|
|
8
8
|
/* v8 ignore start - CLI commands require integration testing */
|
package/github-action.js
CHANGED
|
@@ -39,9 +39,9 @@ const GitHubActionBuildResultSchema = Schema.Struct({
|
|
|
39
39
|
* It handles configuration loading, validation, and bundling in a single workflow.
|
|
40
40
|
*
|
|
41
41
|
* For Effect consumers, use the services directly:
|
|
42
|
-
* - {@link
|
|
43
|
-
* - {@link
|
|
44
|
-
* - {@link
|
|
42
|
+
* - {@link ConfigService} for configuration
|
|
43
|
+
* - {@link ValidationService} for validation
|
|
44
|
+
* - {@link BuildService} for building
|
|
45
45
|
*
|
|
46
46
|
* @example Complete build workflow
|
|
47
47
|
* ```typescript
|