@savvy-web/github-action-builder 0.2.1 → 0.4.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/{123.js → 677.js} +24 -25
- package/bin/github-action-builder.js +20 -6
- package/index.d.ts +28 -26
- package/index.js +7 -4
- package/package.json +10 -10
- package/tsdoc-metadata.json +1 -1
package/{123.js → 677.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context, Data, Effect, Layer, ParseResult, Schema } from "effect";
|
|
2
2
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { dirname, join, relative, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
|
-
import { parse } from "yaml";
|
|
7
|
+
import { parse } from "yaml-effect";
|
|
8
8
|
const ConfigNotFoundBase = Data.TaggedError("ConfigNotFound");
|
|
9
9
|
class ConfigNotFound extends ConfigNotFoundBase {
|
|
10
10
|
}
|
|
@@ -230,7 +230,7 @@ function cleanDirectory(dir) {
|
|
|
230
230
|
},
|
|
231
231
|
catch: (error)=>new CleanError({
|
|
232
232
|
directory: dir,
|
|
233
|
-
cause: error
|
|
233
|
+
cause: error
|
|
234
234
|
})
|
|
235
235
|
});
|
|
236
236
|
}
|
|
@@ -245,7 +245,7 @@ function writeFile(path, content) {
|
|
|
245
245
|
},
|
|
246
246
|
catch: (error)=>new WriteError({
|
|
247
247
|
path,
|
|
248
|
-
cause: error
|
|
248
|
+
cause: error
|
|
249
249
|
})
|
|
250
250
|
});
|
|
251
251
|
}
|
|
@@ -264,7 +264,7 @@ function bundleEntry(entry, config, cwd) {
|
|
|
264
264
|
}),
|
|
265
265
|
catch: (error)=>new BundleFailed({
|
|
266
266
|
entry: entry.path,
|
|
267
|
-
cause: error
|
|
267
|
+
cause: error
|
|
268
268
|
})
|
|
269
269
|
});
|
|
270
270
|
const outputPath = resolve(cwd, entry.output);
|
|
@@ -308,11 +308,13 @@ const BuildServiceLive = Layer.effect(BuildService, Effect.gen(function*() {
|
|
|
308
308
|
const entryResults = [];
|
|
309
309
|
for (const entry of entriesResult.entries){
|
|
310
310
|
const result = yield* Effect.either(bundleEntry(entry, config, cwd));
|
|
311
|
-
if ("Left" === result._tag)
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
311
|
+
if ("Left" === result._tag) {
|
|
312
|
+
const err = result.left;
|
|
313
|
+
entryResults.push({
|
|
314
|
+
success: false,
|
|
315
|
+
error: err.cause instanceof Error ? err.cause.message : String(err.cause)
|
|
316
|
+
});
|
|
317
|
+
} else entryResults.push(result.right);
|
|
316
318
|
}
|
|
317
319
|
yield* writeFile(resolve(cwd, "dist/package.json"), '{ "type": "module" }');
|
|
318
320
|
const duration = Date.now() - startTime;
|
|
@@ -378,7 +380,7 @@ const ConfigServiceLive = Layer.succeed(ConfigService, {
|
|
|
378
380
|
try: async ()=>import(absolutePath),
|
|
379
381
|
catch: (error)=>new ConfigLoadFailed({
|
|
380
382
|
path: configPath,
|
|
381
|
-
cause: error
|
|
383
|
+
cause: error
|
|
382
384
|
})
|
|
383
385
|
});
|
|
384
386
|
const configInput = configModule.default;
|
|
@@ -493,7 +495,7 @@ function validateActionYmlPaths(actionYmlPath, destDir) {
|
|
|
493
495
|
return Effect.gen(function*() {
|
|
494
496
|
if (!existsSync(actionYmlPath)) return;
|
|
495
497
|
const content = readFileSync(actionYmlPath, "utf8");
|
|
496
|
-
const parsed = parse(content);
|
|
498
|
+
const parsed = yield* parse(content).pipe(Effect.catchAll(()=>Effect.succeed(null)));
|
|
497
499
|
if (!parsed?.runs) return;
|
|
498
500
|
for (const entryType of [
|
|
499
501
|
"main",
|
|
@@ -552,7 +554,7 @@ const PersistLocalServiceLive = Layer.succeed(PersistLocalService, {
|
|
|
552
554
|
}),
|
|
553
555
|
catch: (error)=>new PersistLocalError({
|
|
554
556
|
path: outputPath,
|
|
555
|
-
cause: error
|
|
557
|
+
cause: error
|
|
556
558
|
})
|
|
557
559
|
});
|
|
558
560
|
let totalCopied = 0;
|
|
@@ -564,7 +566,7 @@ const PersistLocalServiceLive = Layer.succeed(PersistLocalService, {
|
|
|
564
566
|
try: ()=>syncFile(actionYmlSrc, actionYmlDest),
|
|
565
567
|
catch: (error)=>new PersistLocalError({
|
|
566
568
|
path: actionYmlSrc,
|
|
567
|
-
cause: error
|
|
569
|
+
cause: error
|
|
568
570
|
})
|
|
569
571
|
});
|
|
570
572
|
if (copied) totalCopied++;
|
|
@@ -578,7 +580,7 @@ const PersistLocalServiceLive = Layer.succeed(PersistLocalService, {
|
|
|
578
580
|
try: ()=>syncDirectory(distSrc, resolve(outputPath, "dist")),
|
|
579
581
|
catch: (error)=>new PersistLocalError({
|
|
580
582
|
path: distSrc,
|
|
581
|
-
cause: error
|
|
583
|
+
cause: error
|
|
582
584
|
})
|
|
583
585
|
});
|
|
584
586
|
totalCopied += distStats.copied;
|
|
@@ -595,7 +597,7 @@ const PersistLocalServiceLive = Layer.succeed(PersistLocalService, {
|
|
|
595
597
|
try: ()=>writeFileSync(actrcPath, ACTRC_CONTENT, "utf8"),
|
|
596
598
|
catch: (error)=>new PersistLocalError({
|
|
597
599
|
path: actrcPath,
|
|
598
|
-
cause: error
|
|
600
|
+
cause: error
|
|
599
601
|
})
|
|
600
602
|
});
|
|
601
603
|
actTemplateGenerated = true;
|
|
@@ -610,7 +612,7 @@ const PersistLocalServiceLive = Layer.succeed(PersistLocalService, {
|
|
|
610
612
|
},
|
|
611
613
|
catch: (error)=>new PersistLocalError({
|
|
612
614
|
path: actWorkflowPath,
|
|
613
|
-
cause: error
|
|
615
|
+
cause: error
|
|
614
616
|
})
|
|
615
617
|
});
|
|
616
618
|
actTemplateGenerated = true;
|
|
@@ -723,13 +725,10 @@ const ValidationServiceLive = Layer.effect(ValidationService, Effect.gen(functio
|
|
|
723
725
|
message: "Failed to read file"
|
|
724
726
|
})
|
|
725
727
|
});
|
|
726
|
-
const parsed = yield* Effect
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
message: error instanceof Error ? error.message : "Invalid YAML syntax"
|
|
731
|
-
})
|
|
732
|
-
});
|
|
728
|
+
const parsed = yield* parse(content).pipe(Effect.mapError((error)=>new ActionYmlSyntaxError({
|
|
729
|
+
path,
|
|
730
|
+
message: error.message
|
|
731
|
+
})));
|
|
733
732
|
if (!parsed || "object" != typeof parsed) return yield* new ActionYmlSyntaxError({
|
|
734
733
|
path,
|
|
735
734
|
message: "action.yml must be an object"
|
|
@@ -876,4 +875,4 @@ const ValidationLayer = ValidationServiceLive.pipe(Layer.provide(ConfigServiceLi
|
|
|
876
875
|
const BuildLayer = BuildServiceLive.pipe(Layer.provide(ConfigServiceLive));
|
|
877
876
|
const PersistLocalLayer = PersistLocalServiceLive;
|
|
878
877
|
const AppLayer = Layer.mergeAll(ConfigServiceLive, ValidationLayer, BuildLayer, PersistLocalLayer);
|
|
879
|
-
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlResultSchema, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, AppLayer, BuildFailed, BuildFailedBase, BuildLayer, BuildOptionsSchema, BuildResultSchema, BuildRunnerOptionsSchema, BuildService, BundleFailed, BundleFailedBase, BundleResultSchema, BundleStatsSchema, CleanError, CleanErrorBase, ConfigInputSchema, ConfigInvalid, ConfigInvalidBase, ConfigLayer, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, ConfigSchema, ConfigService,
|
|
878
|
+
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlResultSchema, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, AppLayer, BuildFailed, BuildFailedBase, BuildLayer, BuildOptionsSchema, BuildResultSchema, BuildRunnerOptionsSchema, BuildService, BundleFailed, BundleFailedBase, BundleResultSchema, BundleStatsSchema, CleanError, CleanErrorBase, ConfigInputSchema, ConfigInvalid, ConfigInvalidBase, ConfigLayer, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, ConfigSchema, ConfigService, DetectEntriesResultSchema, DetectedEntrySchema, EntriesSchema, EntryFileMissing, EntryFileMissingBase, LoadConfigOptionsSchema, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, PersistLocalLayer, PersistLocalOptionsSchema, PersistLocalResultSchema, PersistLocalRunnerOptionsSchema, PersistLocalService, ValidateOptionsSchema, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, ValidationOptionsSchema, ValidationResultSchema, ValidationService, ValidationWarningSchema, WriteError, WriteErrorBase, defineConfig };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Args, Command, Options } from "@effect/cli";
|
|
3
3
|
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
4
|
-
import {
|
|
4
|
+
import { Cause, Console, Effect, Layer, Option } from "effect";
|
|
5
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
import { PersistLocalService, ValidationService, AppLayer, BuildService, ConfigService, ValidationFailed, BuildFailed } from "../677.js";
|
|
5
8
|
const configOption = Options.file("config").pipe(Options.withAlias("c"), Options.withDescription("Path to configuration file"), Options.optional);
|
|
6
9
|
const quietOption = Options.boolean("quiet").pipe(Options.withAlias("q"), Options.withDescription("Suppress non-error output"), Options.withDefault(false));
|
|
7
10
|
const noValidateOption = Options.boolean("no-validate").pipe(Options.withDescription("Skip validation step"), Options.withDefault(false));
|
|
@@ -29,7 +32,11 @@ const buildHandler = ({ config, quiet, noValidate, noPersist })=>Effect.gen(func
|
|
|
29
32
|
});
|
|
30
33
|
if (!validationResult.valid) {
|
|
31
34
|
yield* Console.error(`\n${validationService.formatResult(validationResult)}`);
|
|
32
|
-
return yield*
|
|
35
|
+
return yield* new ValidationFailed({
|
|
36
|
+
errorCount: validationResult.errors.length,
|
|
37
|
+
warningCount: validationResult.warnings.length,
|
|
38
|
+
message: "Validation failed"
|
|
39
|
+
});
|
|
33
40
|
}
|
|
34
41
|
if (!quiet && validationResult.warnings.length > 0) yield* Console.log(validationService.formatResult(validationResult));
|
|
35
42
|
else if (!quiet) yield* Console.log(" All checks passed");
|
|
@@ -40,7 +47,10 @@ const buildHandler = ({ config, quiet, noValidate, noPersist })=>Effect.gen(func
|
|
|
40
47
|
});
|
|
41
48
|
if (!buildResult.success) {
|
|
42
49
|
yield* Console.error(`\nBuild failed: ${buildResult.error}`);
|
|
43
|
-
return yield*
|
|
50
|
+
return yield* new BuildFailed({
|
|
51
|
+
message: buildResult.error ?? "One or more entries failed to build",
|
|
52
|
+
failedEntries: buildResult.entries.filter((e)=>!e.success).length
|
|
53
|
+
});
|
|
44
54
|
}
|
|
45
55
|
if (!quiet) {
|
|
46
56
|
yield* Console.log(`\n${buildService.formatResult(buildResult)}`);
|
|
@@ -64,7 +74,7 @@ const actionNameArg = Args.text({
|
|
|
64
74
|
name: "action-name"
|
|
65
75
|
}).pipe(Args.withDescription("Name of the GitHub Action (also the output directory)"));
|
|
66
76
|
const forceOption = Options.boolean("force").pipe(Options.withAlias("f"), Options.withDescription("Overwrite existing files"), Options.withDefault(false));
|
|
67
|
-
const getPackageVersion = ()=>"0.
|
|
77
|
+
const getPackageVersion = ()=>"0.4.0";
|
|
68
78
|
const generatePackageJson = (name)=>{
|
|
69
79
|
const version = getPackageVersion();
|
|
70
80
|
const pkg = {
|
|
@@ -297,8 +307,12 @@ const rootCommand = Command.make("github-action-builder").pipe(Command.withSubco
|
|
|
297
307
|
]));
|
|
298
308
|
const cli = Command.run(rootCommand, {
|
|
299
309
|
name: "github-action-builder",
|
|
300
|
-
version: "0.
|
|
310
|
+
version: "0.4.0"
|
|
301
311
|
});
|
|
302
312
|
const CliLayer = Layer.merge(AppLayer, NodeContext.layer);
|
|
303
|
-
const main = Effect.suspend(()=>cli(process.argv)).pipe(Effect.provide(CliLayer))
|
|
313
|
+
const main = Effect.suspend(()=>cli(process.argv)).pipe(Effect.provide(CliLayer), Effect.catchAllCause((cause)=>{
|
|
314
|
+
const defects = Cause.defects(cause);
|
|
315
|
+
if (defects.length > 0) return Console.error(Cause.pretty(cause)).pipe(Effect.andThen(Effect.failCause(cause)));
|
|
316
|
+
return Effect.failCause(cause);
|
|
317
|
+
}));
|
|
304
318
|
NodeRuntime.runMain(main);
|
package/index.d.ts
CHANGED
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
|
|
51
51
|
import { Context } from 'effect';
|
|
52
52
|
import type { Effect } from 'effect';
|
|
53
|
-
import { Equals } from 'effect/Types';
|
|
54
53
|
import { Layer } from 'effect';
|
|
55
54
|
import { Schema } from 'effect';
|
|
56
55
|
import { URL as URL_2 } from 'node:url';
|
|
56
|
+
import { VoidIfEmpty } from 'effect/Types';
|
|
57
57
|
import { YieldableError } from 'effect/Cause';
|
|
58
58
|
|
|
59
59
|
/**
|
|
@@ -79,7 +79,7 @@ export declare class ActionYmlMissing extends ActionYmlMissingBase<{
|
|
|
79
79
|
*
|
|
80
80
|
* @internal
|
|
81
81
|
*/
|
|
82
|
-
export declare const ActionYmlMissingBase: new <A extends Record<string, any> = {}>(args:
|
|
82
|
+
export declare const ActionYmlMissingBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
83
83
|
readonly _tag: "ActionYmlMissing";
|
|
84
84
|
} & Readonly<A>;
|
|
85
85
|
|
|
@@ -114,7 +114,7 @@ export declare class ActionYmlPathError extends ActionYmlPathErrorBase<{
|
|
|
114
114
|
*
|
|
115
115
|
* @internal
|
|
116
116
|
*/
|
|
117
|
-
export declare const ActionYmlPathErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
117
|
+
export declare const ActionYmlPathErrorBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
118
118
|
readonly _tag: "ActionYmlPathError";
|
|
119
119
|
} & Readonly<A>;
|
|
120
120
|
|
|
@@ -187,7 +187,7 @@ export declare class ActionYmlSchemaError extends ActionYmlSchemaErrorBase<{
|
|
|
187
187
|
*
|
|
188
188
|
* @internal
|
|
189
189
|
*/
|
|
190
|
-
export declare const ActionYmlSchemaErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
190
|
+
export declare const ActionYmlSchemaErrorBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
191
191
|
readonly _tag: "ActionYmlSchemaError";
|
|
192
192
|
} & Readonly<A>;
|
|
193
193
|
|
|
@@ -226,7 +226,7 @@ export declare class ActionYmlSyntaxError extends ActionYmlSyntaxErrorBase<{
|
|
|
226
226
|
*
|
|
227
227
|
* @internal
|
|
228
228
|
*/
|
|
229
|
-
export declare const ActionYmlSyntaxErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
229
|
+
export declare const ActionYmlSyntaxErrorBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
230
230
|
readonly _tag: "ActionYmlSyntaxError";
|
|
231
231
|
} & Readonly<A>;
|
|
232
232
|
|
|
@@ -301,7 +301,7 @@ export declare class BuildFailed extends BuildFailedBase<{
|
|
|
301
301
|
*
|
|
302
302
|
* @internal
|
|
303
303
|
*/
|
|
304
|
-
export declare const BuildFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
304
|
+
export declare const BuildFailedBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
305
305
|
readonly _tag: "BuildFailed";
|
|
306
306
|
} & Readonly<A>;
|
|
307
307
|
|
|
@@ -498,9 +498,9 @@ export declare class BundleFailed extends BundleFailedBase<{
|
|
|
498
498
|
*/
|
|
499
499
|
readonly entry: string;
|
|
500
500
|
/**
|
|
501
|
-
* The underlying error message.
|
|
501
|
+
* The underlying error or error message.
|
|
502
502
|
*/
|
|
503
|
-
readonly cause:
|
|
503
|
+
readonly cause: unknown;
|
|
504
504
|
}> {
|
|
505
505
|
}
|
|
506
506
|
|
|
@@ -514,7 +514,7 @@ export declare class BundleFailed extends BundleFailedBase<{
|
|
|
514
514
|
*
|
|
515
515
|
* @internal
|
|
516
516
|
*/
|
|
517
|
-
export declare const BundleFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
517
|
+
export declare const BundleFailedBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
518
518
|
readonly _tag: "BundleFailed";
|
|
519
519
|
} & Readonly<A>;
|
|
520
520
|
|
|
@@ -578,9 +578,9 @@ export declare class CleanError extends CleanErrorBase<{
|
|
|
578
578
|
*/
|
|
579
579
|
readonly directory: string;
|
|
580
580
|
/**
|
|
581
|
-
* The underlying error message.
|
|
581
|
+
* The underlying error or error message.
|
|
582
582
|
*/
|
|
583
|
-
readonly cause:
|
|
583
|
+
readonly cause: unknown;
|
|
584
584
|
}> {
|
|
585
585
|
}
|
|
586
586
|
|
|
@@ -594,7 +594,7 @@ export declare class CleanError extends CleanErrorBase<{
|
|
|
594
594
|
*
|
|
595
595
|
* @internal
|
|
596
596
|
*/
|
|
597
|
-
export declare const CleanErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
597
|
+
export declare const CleanErrorBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
598
598
|
readonly _tag: "CleanError";
|
|
599
599
|
} & Readonly<A>;
|
|
600
600
|
|
|
@@ -688,7 +688,7 @@ export declare class ConfigInvalid extends ConfigInvalidBase<{
|
|
|
688
688
|
*
|
|
689
689
|
* @internal
|
|
690
690
|
*/
|
|
691
|
-
export declare const ConfigInvalidBase: new <A extends Record<string, any> = {}>(args:
|
|
691
|
+
export declare const ConfigInvalidBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
692
692
|
readonly _tag: "ConfigInvalid";
|
|
693
693
|
} & Readonly<A>;
|
|
694
694
|
|
|
@@ -713,9 +713,9 @@ export declare class ConfigLoadFailed extends ConfigLoadFailedBase<{
|
|
|
713
713
|
*/
|
|
714
714
|
readonly path: string;
|
|
715
715
|
/**
|
|
716
|
-
* The underlying error message.
|
|
716
|
+
* The underlying error or error message.
|
|
717
717
|
*/
|
|
718
|
-
readonly cause:
|
|
718
|
+
readonly cause: unknown;
|
|
719
719
|
}> {
|
|
720
720
|
}
|
|
721
721
|
|
|
@@ -729,7 +729,7 @@ export declare class ConfigLoadFailed extends ConfigLoadFailedBase<{
|
|
|
729
729
|
*
|
|
730
730
|
* @internal
|
|
731
731
|
*/
|
|
732
|
-
export declare const ConfigLoadFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
732
|
+
export declare const ConfigLoadFailedBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
733
733
|
readonly _tag: "ConfigLoadFailed";
|
|
734
734
|
} & Readonly<A>;
|
|
735
735
|
|
|
@@ -760,7 +760,7 @@ export declare class ConfigNotFound extends ConfigNotFoundBase<{
|
|
|
760
760
|
*
|
|
761
761
|
* @internal
|
|
762
762
|
*/
|
|
763
|
-
export declare const ConfigNotFoundBase: new <A extends Record<string, any> = {}>(args:
|
|
763
|
+
export declare const ConfigNotFoundBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
764
764
|
readonly _tag: "ConfigNotFound";
|
|
765
765
|
} & Readonly<A>;
|
|
766
766
|
|
|
@@ -1042,7 +1042,7 @@ export declare class EntryFileMissing extends EntryFileMissingBase<{
|
|
|
1042
1042
|
*
|
|
1043
1043
|
* @internal
|
|
1044
1044
|
*/
|
|
1045
|
-
export declare const EntryFileMissingBase: new <A extends Record<string, any> = {}>(args:
|
|
1045
|
+
export declare const EntryFileMissingBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1046
1046
|
readonly _tag: "EntryFileMissing";
|
|
1047
1047
|
} & Readonly<A>;
|
|
1048
1048
|
|
|
@@ -1287,6 +1287,8 @@ export declare const GitHubActionBuildResultSchema: Schema.Struct<{
|
|
|
1287
1287
|
}>>;
|
|
1288
1288
|
/** Error message if the build or validation failed. */
|
|
1289
1289
|
error: Schema.optional<typeof Schema.String>;
|
|
1290
|
+
/** Raw error object for programmatic inspection. */
|
|
1291
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
1290
1292
|
}>;
|
|
1291
1293
|
|
|
1292
1294
|
/**
|
|
@@ -1395,7 +1397,7 @@ export declare class MainEntryMissing extends MainEntryMissingBase<{
|
|
|
1395
1397
|
*
|
|
1396
1398
|
* @internal
|
|
1397
1399
|
*/
|
|
1398
|
-
export declare const MainEntryMissingBase: new <A extends Record<string, any> = {}>(args:
|
|
1400
|
+
export declare const MainEntryMissingBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1399
1401
|
readonly _tag: "MainEntryMissing";
|
|
1400
1402
|
} & Readonly<A>;
|
|
1401
1403
|
|
|
@@ -1417,9 +1419,9 @@ export declare class PersistLocalError extends PersistLocalErrorBase<{
|
|
|
1417
1419
|
*/
|
|
1418
1420
|
readonly path: string;
|
|
1419
1421
|
/**
|
|
1420
|
-
* The underlying error message.
|
|
1422
|
+
* The underlying error or error message.
|
|
1421
1423
|
*/
|
|
1422
|
-
readonly cause:
|
|
1424
|
+
readonly cause: unknown;
|
|
1423
1425
|
}> {
|
|
1424
1426
|
}
|
|
1425
1427
|
|
|
@@ -1433,7 +1435,7 @@ export declare class PersistLocalError extends PersistLocalErrorBase<{
|
|
|
1433
1435
|
*
|
|
1434
1436
|
* @internal
|
|
1435
1437
|
*/
|
|
1436
|
-
export declare const PersistLocalErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
1438
|
+
export declare const PersistLocalErrorBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1437
1439
|
readonly _tag: "PersistLocalError";
|
|
1438
1440
|
} & Readonly<A>;
|
|
1439
1441
|
|
|
@@ -1632,7 +1634,7 @@ export declare class ValidationFailed extends ValidationFailedBase<{
|
|
|
1632
1634
|
*
|
|
1633
1635
|
* @internal
|
|
1634
1636
|
*/
|
|
1635
|
-
export declare const ValidationFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
1637
|
+
export declare const ValidationFailedBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1636
1638
|
readonly _tag: "ValidationFailed";
|
|
1637
1639
|
} & Readonly<A>;
|
|
1638
1640
|
|
|
@@ -1819,9 +1821,9 @@ export declare class WriteError extends WriteErrorBase<{
|
|
|
1819
1821
|
*/
|
|
1820
1822
|
readonly path: string;
|
|
1821
1823
|
/**
|
|
1822
|
-
* The underlying error message.
|
|
1824
|
+
* The underlying error or error message.
|
|
1823
1825
|
*/
|
|
1824
|
-
readonly cause:
|
|
1826
|
+
readonly cause: unknown;
|
|
1825
1827
|
}> {
|
|
1826
1828
|
}
|
|
1827
1829
|
|
|
@@ -1835,7 +1837,7 @@ export declare class WriteError extends WriteErrorBase<{
|
|
|
1835
1837
|
*
|
|
1836
1838
|
* @internal
|
|
1837
1839
|
*/
|
|
1838
|
-
export declare const WriteErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
1840
|
+
export declare const WriteErrorBase: new <A extends Record<string, any> = {}>(args: VoidIfEmpty< { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => YieldableError & {
|
|
1839
1841
|
readonly _tag: "WriteError";
|
|
1840
1842
|
} & Readonly<A>;
|
|
1841
1843
|
|
package/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Effect, ManagedRuntime, Schema } from "effect";
|
|
2
|
+
import { AppLayer, BuildService, ConfigService, ValidationService, ValidationResultSchema, BuildResultSchema, PersistLocalResultSchema, defineConfig, PersistLocalService } from "./677.js";
|
|
2
3
|
const GitHubActionBuildResultSchema = Schema.Struct({
|
|
3
4
|
success: Schema.Boolean,
|
|
4
5
|
build: Schema.optional(BuildResultSchema),
|
|
5
6
|
validation: Schema.optional(ValidationResultSchema),
|
|
6
7
|
persistLocal: Schema.optional(PersistLocalResultSchema),
|
|
7
|
-
error: Schema.optional(Schema.String)
|
|
8
|
+
error: Schema.optional(Schema.String),
|
|
9
|
+
cause: Schema.optional(Schema.Unknown)
|
|
8
10
|
});
|
|
9
11
|
class GitHubAction {
|
|
10
12
|
runtime;
|
|
@@ -119,7 +121,8 @@ class GitHubAction {
|
|
|
119
121
|
} catch (error) {
|
|
120
122
|
return {
|
|
121
123
|
success: false,
|
|
122
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
124
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
125
|
+
cause: error
|
|
123
126
|
};
|
|
124
127
|
}
|
|
125
128
|
}
|
|
@@ -127,5 +130,5 @@ class GitHubAction {
|
|
|
127
130
|
await this.runtime.dispose();
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlResultSchema, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, AppLayer, BuildFailed, BuildFailedBase, BuildLayer, BuildOptionsSchema, BuildResultSchema, BuildRunnerOptionsSchema, BuildService, BundleFailed, BundleFailedBase, BundleResultSchema, BundleStatsSchema, CleanError, CleanErrorBase, ConfigInputSchema, ConfigInvalid, ConfigInvalidBase, ConfigLayer, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, ConfigSchema, ConfigService, DetectEntriesResultSchema, DetectedEntrySchema, EntriesSchema, EntryFileMissing, EntryFileMissingBase, LoadConfigOptionsSchema, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, PersistLocalLayer, PersistLocalOptionsSchema, PersistLocalResultSchema, PersistLocalRunnerOptionsSchema, PersistLocalService, ValidateOptionsSchema, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, ValidationOptionsSchema, ValidationResultSchema, ValidationService, ValidationWarningSchema, WriteError, WriteErrorBase, defineConfig } from "./
|
|
133
|
+
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlResultSchema, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, AppLayer, BuildFailed, BuildFailedBase, BuildLayer, BuildOptionsSchema, BuildResultSchema, BuildRunnerOptionsSchema, BuildService, BundleFailed, BundleFailedBase, BundleResultSchema, BundleStatsSchema, CleanError, CleanErrorBase, ConfigInputSchema, ConfigInvalid, ConfigInvalidBase, ConfigLayer, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, ConfigSchema, ConfigService, DetectEntriesResultSchema, DetectedEntrySchema, EntriesSchema, EntryFileMissing, EntryFileMissingBase, LoadConfigOptionsSchema, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, PersistLocalLayer, PersistLocalOptionsSchema, PersistLocalResultSchema, PersistLocalRunnerOptionsSchema, PersistLocalService, ValidateOptionsSchema, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, ValidationOptionsSchema, ValidationResultSchema, ValidationService, ValidationWarningSchema, WriteError, WriteErrorBase, defineConfig } from "./677.js";
|
|
131
134
|
export { GitHubAction, GitHubActionBuildResultSchema };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/github-action-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A zero-config build tool for creating GitHub Actions from TypeScript. Bundles with @vercel/ncc, validates action.yml against GitHub's schema, and outputs production-ready Node.js 24 actions.",
|
|
6
6
|
"keywords": [
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"github-action-builder": "./bin/github-action-builder.js"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@effect/cli": "^0.
|
|
47
|
-
"@effect/platform": "^0.
|
|
48
|
-
"@effect/platform-node": "^0.
|
|
49
|
-
"@effect/printer": "^0.
|
|
50
|
-
"@effect/printer-ansi": "^0.
|
|
51
|
-
"@effect/typeclass": "^0.
|
|
46
|
+
"@effect/cli": "^0.74.0",
|
|
47
|
+
"@effect/platform": "^0.95.0",
|
|
48
|
+
"@effect/platform-node": "^0.105.0",
|
|
49
|
+
"@effect/printer": "^0.48.0",
|
|
50
|
+
"@effect/printer-ansi": "^0.48.0",
|
|
51
|
+
"@effect/typeclass": "^0.39.0",
|
|
52
52
|
"@vercel/ncc": "^0.38.4",
|
|
53
|
-
"effect": "^3.
|
|
53
|
+
"effect": "^3.20.0",
|
|
54
54
|
"picocolors": "^1.1.1",
|
|
55
|
-
"yaml": "^
|
|
55
|
+
"yaml-effect": "^0.1.5"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@types/node": "^25.2.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"!github-action-builder.api.json",
|
|
75
75
|
"!tsconfig.json",
|
|
76
76
|
"!tsdoc.json",
|
|
77
|
-
"
|
|
77
|
+
"677.js",
|
|
78
78
|
"LICENSE",
|
|
79
79
|
"README.md",
|
|
80
80
|
"bin/github-action-builder.js",
|