@savvy-web/github-action-builder 0.7.12 → 0.8.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 +1 -1
- package/cli/commands/init.js +1 -1
- package/errors.js +40 -1
- package/index.d.ts +66 -9
- package/index.js +2 -2
- package/package.json +1 -1
- package/schemas/config.js +15 -3
- package/services/build-live.js +1 -0
- package/services/config-live.js +28 -1
- package/services/config.js +2 -2
- package/services/persist-local-live.js +1 -1
|
@@ -26,7 +26,7 @@ const rootCommand = Command.make("github-action-builder").pipe(Command.withSubco
|
|
|
26
26
|
*/
|
|
27
27
|
const cli = Command.run(rootCommand, {
|
|
28
28
|
name: "github-action-builder",
|
|
29
|
-
version: "0.
|
|
29
|
+
version: "0.8.0"
|
|
30
30
|
});
|
|
31
31
|
/**
|
|
32
32
|
* Combined layer: AppLayer + NodeContext for CLI.
|
package/cli/commands/init.js
CHANGED
|
@@ -20,7 +20,7 @@ const forceOption = Options.boolean("force").pipe(Options.withAlias("f"), Option
|
|
|
20
20
|
* Get current package version (replaced at build time).
|
|
21
21
|
*/
|
|
22
22
|
const getPackageVersion = () => {
|
|
23
|
-
return "0.
|
|
23
|
+
return "0.8.0";
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Generate package.json content.
|
package/errors.js
CHANGED
|
@@ -93,6 +93,45 @@ const MainEntryMissingBase = Data.TaggedError("MainEntryMissing");
|
|
|
93
93
|
*/
|
|
94
94
|
var MainEntryMissing = class extends MainEntryMissingBase {};
|
|
95
95
|
/**
|
|
96
|
+
* Base class for WorkerEntryMissing error.
|
|
97
|
+
*
|
|
98
|
+
* @privateRemarks
|
|
99
|
+
* This export is required for api-extractor documentation generation.
|
|
100
|
+
* Effect's Data.TaggedError creates an anonymous base class that must be
|
|
101
|
+
* explicitly exported to avoid "forgotten export" warnings. Do not delete.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
const WorkerEntryMissingBase = Data.TaggedError("WorkerEntryMissing");
|
|
106
|
+
/**
|
|
107
|
+
* Error when a worker entry source file is not found.
|
|
108
|
+
*
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
var WorkerEntryMissing = class extends WorkerEntryMissingBase {};
|
|
112
|
+
/**
|
|
113
|
+
* Base class for WorkerEntryInvalidName error.
|
|
114
|
+
*
|
|
115
|
+
* @privateRemarks
|
|
116
|
+
* This export is required for api-extractor documentation generation.
|
|
117
|
+
* Effect's Data.TaggedError creates an anonymous base class that must be
|
|
118
|
+
* explicitly exported to avoid "forgotten export" warnings. Do not delete.
|
|
119
|
+
*
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
const WorkerEntryInvalidNameBase = Data.TaggedError("WorkerEntryInvalidName");
|
|
123
|
+
/**
|
|
124
|
+
* Error when a worker entry name is reserved or path-unsafe.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* A worker name becomes both an rsbuild entry key and the emitted filename
|
|
128
|
+
* (`dist/<name>.js`), so it must not collide with a lifecycle bundle
|
|
129
|
+
* (`main`/`pre`/`post`) or contain path separators that would escape `dist/`.
|
|
130
|
+
*
|
|
131
|
+
* @public
|
|
132
|
+
*/
|
|
133
|
+
var WorkerEntryInvalidName = class extends WorkerEntryInvalidNameBase {};
|
|
134
|
+
/**
|
|
96
135
|
* Base class for EntryFileMissing error.
|
|
97
136
|
*
|
|
98
137
|
* @privateRemarks
|
|
@@ -281,4 +320,4 @@ const ActionYmlPathErrorBase = Data.TaggedError("ActionYmlPathError");
|
|
|
281
320
|
var ActionYmlPathError = class extends ActionYmlPathErrorBase {};
|
|
282
321
|
|
|
283
322
|
//#endregion
|
|
284
|
-
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, BuildFailed, BuildFailedBase, BundleFailed, BundleFailedBase, CleanError, CleanErrorBase, ConfigInvalid, ConfigInvalidBase, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, EntryFileMissing, EntryFileMissingBase, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, ValidationFailed, ValidationFailedBase, WriteError, WriteErrorBase };
|
|
323
|
+
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, BuildFailed, BuildFailedBase, BundleFailed, BundleFailedBase, CleanError, CleanErrorBase, ConfigInvalid, ConfigInvalidBase, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, EntryFileMissing, EntryFileMissingBase, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, ValidationFailed, ValidationFailedBase, WorkerEntryInvalidName, WorkerEntryInvalidNameBase, WorkerEntryMissing, WorkerEntryMissingBase, WriteError, WriteErrorBase };
|
package/index.d.ts
CHANGED
|
@@ -5,11 +5,14 @@ import { Context, Effect, Layer, Schema } from "effect";
|
|
|
5
5
|
* Schema for entry point paths.
|
|
6
6
|
*
|
|
7
7
|
* @remarks
|
|
8
|
-
* GitHub Actions support three entry points:
|
|
8
|
+
* GitHub Actions support three lifecycle entry points:
|
|
9
9
|
* - `main`: The primary action entry point (required)
|
|
10
10
|
* - `pre`: Runs before the main action (optional)
|
|
11
11
|
* - `post`: Runs after the main action for cleanup (optional)
|
|
12
12
|
*
|
|
13
|
+
* Additional non-lifecycle bundles can be declared via `workers` (name → source path),
|
|
14
|
+
* each emitted as `dist/<name>.js`.
|
|
15
|
+
*
|
|
13
16
|
* @public
|
|
14
17
|
*/
|
|
15
18
|
declare const EntriesSchema: Schema.Struct<{
|
|
@@ -17,7 +20,8 @@ declare const EntriesSchema: Schema.Struct<{
|
|
|
17
20
|
default: () => string;
|
|
18
21
|
}>; /** Path to the pre-action hook entry point. */
|
|
19
22
|
pre: Schema.optional<typeof Schema.String>; /** Path to the post-action hook entry point. */
|
|
20
|
-
post: Schema.optional<typeof Schema.String>;
|
|
23
|
+
post: Schema.optional<typeof Schema.String>; /** Extra non-lifecycle worker bundles (name -> source path), each emitted as dist/<name>.js. */
|
|
24
|
+
workers: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
21
25
|
}>;
|
|
22
26
|
/**
|
|
23
27
|
* Entry point paths configuration.
|
|
@@ -116,6 +120,7 @@ declare const ConfigInputSchema: Schema.Struct<{
|
|
|
116
120
|
main: Schema.optional<typeof Schema.String>;
|
|
117
121
|
pre: Schema.optional<typeof Schema.String>;
|
|
118
122
|
post: Schema.optional<typeof Schema.String>;
|
|
123
|
+
workers: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
119
124
|
}>>;
|
|
120
125
|
build: Schema.optional<Schema.Struct<{
|
|
121
126
|
minify: Schema.optional<typeof Schema.Boolean>;
|
|
@@ -155,7 +160,8 @@ declare const ConfigSchema: Schema.Struct<{
|
|
|
155
160
|
default: () => string;
|
|
156
161
|
}>; /** Path to the pre-action hook entry point. */
|
|
157
162
|
pre: Schema.optional<typeof Schema.String>; /** Path to the post-action hook entry point. */
|
|
158
|
-
post: Schema.optional<typeof Schema.String>;
|
|
163
|
+
post: Schema.optional<typeof Schema.String>; /** Extra non-lifecycle worker bundles (name -> source path), each emitted as dist/<name>.js. */
|
|
164
|
+
workers: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
159
165
|
}>;
|
|
160
166
|
build: Schema.Struct<{
|
|
161
167
|
/** Enable minification to reduce bundle size. Defaults to true. */minify: Schema.optionalWith<typeof Schema.Boolean, {
|
|
@@ -373,6 +379,56 @@ declare class MainEntryMissing extends MainEntryMissingBase<{
|
|
|
373
379
|
*/
|
|
374
380
|
readonly cwd: string;
|
|
375
381
|
}> {}
|
|
382
|
+
/**
|
|
383
|
+
* Base class for WorkerEntryMissing error.
|
|
384
|
+
*
|
|
385
|
+
* @privateRemarks
|
|
386
|
+
* This export is required for api-extractor documentation generation.
|
|
387
|
+
* Effect's Data.TaggedError creates an anonymous base class that must be
|
|
388
|
+
* explicitly exported to avoid "forgotten export" warnings. Do not delete.
|
|
389
|
+
*
|
|
390
|
+
* @public
|
|
391
|
+
*/
|
|
392
|
+
declare const WorkerEntryMissingBase: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
393
|
+
readonly _tag: "WorkerEntryMissing";
|
|
394
|
+
} & Readonly<A>;
|
|
395
|
+
/**
|
|
396
|
+
* Error when a worker entry source file is not found.
|
|
397
|
+
*
|
|
398
|
+
* @public
|
|
399
|
+
*/
|
|
400
|
+
declare class WorkerEntryMissing extends WorkerEntryMissingBase<{
|
|
401
|
+
/** The worker name (config key). */readonly workerName: string; /** The expected path for the worker entry. */
|
|
402
|
+
readonly expectedPath: string; /** The working directory that was searched. */
|
|
403
|
+
readonly cwd: string;
|
|
404
|
+
}> {}
|
|
405
|
+
/**
|
|
406
|
+
* Base class for WorkerEntryInvalidName error.
|
|
407
|
+
*
|
|
408
|
+
* @privateRemarks
|
|
409
|
+
* This export is required for api-extractor documentation generation.
|
|
410
|
+
* Effect's Data.TaggedError creates an anonymous base class that must be
|
|
411
|
+
* explicitly exported to avoid "forgotten export" warnings. Do not delete.
|
|
412
|
+
*
|
|
413
|
+
* @public
|
|
414
|
+
*/
|
|
415
|
+
declare const WorkerEntryInvalidNameBase: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
416
|
+
readonly _tag: "WorkerEntryInvalidName";
|
|
417
|
+
} & Readonly<A>;
|
|
418
|
+
/**
|
|
419
|
+
* Error when a worker entry name is reserved or path-unsafe.
|
|
420
|
+
*
|
|
421
|
+
* @remarks
|
|
422
|
+
* A worker name becomes both an rsbuild entry key and the emitted filename
|
|
423
|
+
* (`dist/<name>.js`), so it must not collide with a lifecycle bundle
|
|
424
|
+
* (`main`/`pre`/`post`) or contain path separators that would escape `dist/`.
|
|
425
|
+
*
|
|
426
|
+
* @public
|
|
427
|
+
*/
|
|
428
|
+
declare class WorkerEntryInvalidName extends WorkerEntryInvalidNameBase<{
|
|
429
|
+
/** The offending worker name (config key). */readonly workerName: string; /** Why the name was rejected. */
|
|
430
|
+
readonly reason: string;
|
|
431
|
+
}> {}
|
|
376
432
|
/**
|
|
377
433
|
* Base class for EntryFileMissing error.
|
|
378
434
|
*
|
|
@@ -529,7 +585,7 @@ declare class ValidationFailed extends ValidationFailedBase<{
|
|
|
529
585
|
*
|
|
530
586
|
* @public
|
|
531
587
|
*/
|
|
532
|
-
type ValidationError = MainEntryMissing | EntryFileMissing | ActionYmlMissing | ActionYmlSyntaxError | ActionYmlSchemaError | ValidationFailed;
|
|
588
|
+
type ValidationError = MainEntryMissing | WorkerEntryMissing | WorkerEntryInvalidName | EntryFileMissing | ActionYmlMissing | ActionYmlSyntaxError | ActionYmlSchemaError | ValidationFailed;
|
|
533
589
|
/**
|
|
534
590
|
* Base class for BundleFailed error.
|
|
535
591
|
*
|
|
@@ -740,7 +796,7 @@ type LoadConfigOptions = typeof LoadConfigOptionsSchema.Type;
|
|
|
740
796
|
* @public
|
|
741
797
|
*/
|
|
742
798
|
declare const DetectedEntrySchema: Schema.Struct<{
|
|
743
|
-
/** Entry type
|
|
799
|
+
/** Entry type: "main"|"pre"|"post" for lifecycle entries, or the worker name. */type: typeof Schema.String; /** Absolute path to the entry file. */
|
|
744
800
|
path: typeof Schema.String; /** Output path for the bundled file. */
|
|
745
801
|
output: typeof Schema.String;
|
|
746
802
|
}>;
|
|
@@ -756,7 +812,7 @@ type DetectedEntry = typeof DetectedEntrySchema.Type;
|
|
|
756
812
|
declare const DetectEntriesResultSchema: Schema.Struct<{
|
|
757
813
|
/** Whether detection was successful. */success: typeof Schema.Boolean; /** Detected entries. */
|
|
758
814
|
entries: Schema.Array$<Schema.Struct<{
|
|
759
|
-
/** Entry type
|
|
815
|
+
/** Entry type: "main"|"pre"|"post" for lifecycle entries, or the worker name. */type: typeof Schema.String; /** Absolute path to the entry file. */
|
|
760
816
|
path: typeof Schema.String; /** Output path for the bundled file. */
|
|
761
817
|
output: typeof Schema.String;
|
|
762
818
|
}>>;
|
|
@@ -829,7 +885,8 @@ interface ConfigService {
|
|
|
829
885
|
main?: string;
|
|
830
886
|
pre?: string;
|
|
831
887
|
post?: string;
|
|
832
|
-
|
|
888
|
+
workers?: Record<string, string>;
|
|
889
|
+
}) => Effect.Effect<DetectEntriesResult, MainEntryMissing | WorkerEntryMissing | WorkerEntryInvalidName>;
|
|
833
890
|
}
|
|
834
891
|
/**
|
|
835
892
|
* ConfigService tag for dependency injection.
|
|
@@ -950,7 +1007,7 @@ interface BuildService {
|
|
|
950
1007
|
* @param options - Build options
|
|
951
1008
|
* @returns Effect that resolves to build result
|
|
952
1009
|
*/
|
|
953
|
-
readonly build: (config: Config, options?: BuildRunnerOptions) => Effect.Effect<BuildResult, BuildError | MainEntryMissing>;
|
|
1010
|
+
readonly build: (config: Config, options?: BuildRunnerOptions) => Effect.Effect<BuildResult, BuildError | MainEntryMissing | WorkerEntryMissing | WorkerEntryInvalidName>;
|
|
954
1011
|
/**
|
|
955
1012
|
* Bundle a single entry point.
|
|
956
1013
|
*
|
|
@@ -1563,5 +1620,5 @@ declare const PersistLocalLayer: Layer.Layer<PersistLocalService, never, never>;
|
|
|
1563
1620
|
*/
|
|
1564
1621
|
declare const AppLayer: Layer.Layer<ConfigService | ValidationService | BuildService | PersistLocalService, never, never>;
|
|
1565
1622
|
//#endregion
|
|
1566
|
-
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, type ActionYmlResult, ActionYmlResultSchema, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, type AppError, AppLayer, type BuildError, BuildFailed, BuildFailedBase, BuildLayer, type BuildOptions, BuildOptionsSchema, type BuildResult, BuildResultSchema, type BuildRunnerOptions, BuildRunnerOptionsSchema, BuildService, BundleFailed, BundleFailedBase, type BundleResult, BundleResultSchema, type BundleStats, BundleStatsSchema, CleanError, CleanErrorBase, type Config, type ConfigError, type ConfigInput, ConfigInputSchema, ConfigInvalid, ConfigInvalidBase, ConfigLayer, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, ConfigSchema, ConfigService, type DetectEntriesResult, DetectEntriesResultSchema, type DetectedEntry, DetectedEntrySchema, type Entries, EntriesSchema, EntryFileMissing, EntryFileMissingBase, GitHubAction, type GitHubActionBuildResult, GitHubActionBuildResultSchema, type GitHubActionOptions, type LoadConfigOptions, LoadConfigOptionsSchema, type LoadConfigResult, MainEntryMissing, MainEntryMissingBase, type PersistError, PersistLocalError, PersistLocalErrorBase, PersistLocalLayer, type PersistLocalOptions, PersistLocalOptionsSchema, type PersistLocalResult, PersistLocalResultSchema, type PersistLocalRunnerOptions, PersistLocalRunnerOptionsSchema, PersistLocalService, type ValidateOptions, ValidateOptionsSchema, type ValidationError, type ValidationErrorItem, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, type ValidationOptions, ValidationOptionsSchema, type ValidationResult, ValidationResultSchema, ValidationService, type ValidationWarning, ValidationWarningSchema, WriteError, WriteErrorBase, defineConfig };
|
|
1623
|
+
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, type ActionYmlResult, ActionYmlResultSchema, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, type AppError, AppLayer, type BuildError, BuildFailed, BuildFailedBase, BuildLayer, type BuildOptions, BuildOptionsSchema, type BuildResult, BuildResultSchema, type BuildRunnerOptions, BuildRunnerOptionsSchema, BuildService, BundleFailed, BundleFailedBase, type BundleResult, BundleResultSchema, type BundleStats, BundleStatsSchema, CleanError, CleanErrorBase, type Config, type ConfigError, type ConfigInput, ConfigInputSchema, ConfigInvalid, ConfigInvalidBase, ConfigLayer, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, ConfigSchema, ConfigService, type DetectEntriesResult, DetectEntriesResultSchema, type DetectedEntry, DetectedEntrySchema, type Entries, EntriesSchema, EntryFileMissing, EntryFileMissingBase, GitHubAction, type GitHubActionBuildResult, GitHubActionBuildResultSchema, type GitHubActionOptions, type LoadConfigOptions, LoadConfigOptionsSchema, type LoadConfigResult, MainEntryMissing, MainEntryMissingBase, type PersistError, PersistLocalError, PersistLocalErrorBase, PersistLocalLayer, type PersistLocalOptions, PersistLocalOptionsSchema, type PersistLocalResult, PersistLocalResultSchema, type PersistLocalRunnerOptions, PersistLocalRunnerOptionsSchema, PersistLocalService, type ValidateOptions, ValidateOptionsSchema, type ValidationError, type ValidationErrorItem, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, type ValidationOptions, ValidationOptionsSchema, type ValidationResult, ValidationResultSchema, ValidationService, type ValidationWarning, ValidationWarningSchema, WorkerEntryInvalidName, WorkerEntryInvalidNameBase, WorkerEntryMissing, WorkerEntryMissingBase, WriteError, WriteErrorBase, defineConfig };
|
|
1567
1624
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, BuildFailed, BuildFailedBase, BundleFailed, BundleFailedBase, CleanError, CleanErrorBase, ConfigInvalid, ConfigInvalidBase, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, EntryFileMissing, EntryFileMissingBase, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, ValidationFailed, ValidationFailedBase, WriteError, WriteErrorBase } from "./errors.js";
|
|
1
|
+
import { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, BuildFailed, BuildFailedBase, BundleFailed, BundleFailedBase, CleanError, CleanErrorBase, ConfigInvalid, ConfigInvalidBase, ConfigLoadFailed, ConfigLoadFailedBase, ConfigNotFound, ConfigNotFoundBase, EntryFileMissing, EntryFileMissingBase, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, ValidationFailed, ValidationFailedBase, WorkerEntryInvalidName, WorkerEntryInvalidNameBase, WorkerEntryMissing, WorkerEntryMissingBase, WriteError, WriteErrorBase } from "./errors.js";
|
|
2
2
|
import { BuildResultSchema, BuildRunnerOptionsSchema, BuildService, BundleResultSchema, BundleStatsSchema } from "./services/build.js";
|
|
3
3
|
import { BuildOptionsSchema, ConfigInputSchema, ConfigSchema, EntriesSchema, PersistLocalOptionsSchema, ValidationOptionsSchema, defineConfig } from "./schemas/config.js";
|
|
4
4
|
import { ConfigService, DetectEntriesResultSchema, DetectedEntrySchema, LoadConfigOptionsSchema } from "./services/config.js";
|
|
@@ -7,4 +7,4 @@ import { ActionYmlResultSchema, ValidateOptionsSchema, ValidationErrorSchema, Va
|
|
|
7
7
|
import { AppLayer, BuildLayer, ConfigLayer, PersistLocalLayer, ValidationLayer } from "./layers/app.js";
|
|
8
8
|
import { GitHubAction, GitHubActionBuildResultSchema } from "./github-action.js";
|
|
9
9
|
|
|
10
|
-
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, GitHubAction, GitHubActionBuildResultSchema, LoadConfigOptionsSchema, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, PersistLocalLayer, PersistLocalOptionsSchema, PersistLocalResultSchema, PersistLocalRunnerOptionsSchema, PersistLocalService, ValidateOptionsSchema, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, ValidationOptionsSchema, ValidationResultSchema, ValidationService, ValidationWarningSchema, WriteError, WriteErrorBase, defineConfig };
|
|
10
|
+
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, GitHubAction, GitHubActionBuildResultSchema, LoadConfigOptionsSchema, MainEntryMissing, MainEntryMissingBase, PersistLocalError, PersistLocalErrorBase, PersistLocalLayer, PersistLocalOptionsSchema, PersistLocalResultSchema, PersistLocalRunnerOptionsSchema, PersistLocalService, ValidateOptionsSchema, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, ValidationOptionsSchema, ValidationResultSchema, ValidationService, ValidationWarningSchema, WorkerEntryInvalidName, WorkerEntryInvalidNameBase, WorkerEntryMissing, WorkerEntryMissingBase, WriteError, WriteErrorBase, defineConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/github-action-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A zero-config build tool for creating GitHub Actions from TypeScript. Bundles with rsbuild, validates action.yml against GitHub's schema, and outputs production-ready Node.js 24 actions.",
|
|
6
6
|
"keywords": [
|
package/schemas/config.js
CHANGED
|
@@ -14,11 +14,14 @@ import { Schema } from "effect";
|
|
|
14
14
|
* Schema for entry point paths.
|
|
15
15
|
*
|
|
16
16
|
* @remarks
|
|
17
|
-
* GitHub Actions support three entry points:
|
|
17
|
+
* GitHub Actions support three lifecycle entry points:
|
|
18
18
|
* - `main`: The primary action entry point (required)
|
|
19
19
|
* - `pre`: Runs before the main action (optional)
|
|
20
20
|
* - `post`: Runs after the main action for cleanup (optional)
|
|
21
21
|
*
|
|
22
|
+
* Additional non-lifecycle bundles can be declared via `workers` (name → source path),
|
|
23
|
+
* each emitted as `dist/<name>.js`.
|
|
24
|
+
*
|
|
22
25
|
* @public
|
|
23
26
|
*/
|
|
24
27
|
const EntriesSchema = Schema.Struct({
|
|
@@ -27,7 +30,12 @@ const EntriesSchema = Schema.Struct({
|
|
|
27
30
|
/** Path to the pre-action hook entry point. */
|
|
28
31
|
pre: Schema.optional(Schema.String),
|
|
29
32
|
/** Path to the post-action hook entry point. */
|
|
30
|
-
post: Schema.optional(Schema.String)
|
|
33
|
+
post: Schema.optional(Schema.String),
|
|
34
|
+
/** Extra non-lifecycle worker bundles (name -> source path), each emitted as dist/<name>.js. */
|
|
35
|
+
workers: Schema.optional(Schema.Record({
|
|
36
|
+
key: Schema.String,
|
|
37
|
+
value: Schema.String
|
|
38
|
+
}))
|
|
31
39
|
});
|
|
32
40
|
/**
|
|
33
41
|
* Schema for build options.
|
|
@@ -95,7 +103,11 @@ const ConfigInputSchema = Schema.Struct({
|
|
|
95
103
|
entries: Schema.optional(Schema.Struct({
|
|
96
104
|
main: Schema.optional(Schema.String),
|
|
97
105
|
pre: Schema.optional(Schema.String),
|
|
98
|
-
post: Schema.optional(Schema.String)
|
|
106
|
+
post: Schema.optional(Schema.String),
|
|
107
|
+
workers: Schema.optional(Schema.Record({
|
|
108
|
+
key: Schema.String,
|
|
109
|
+
value: Schema.String
|
|
110
|
+
}))
|
|
99
111
|
})),
|
|
100
112
|
build: Schema.optional(Schema.Struct({
|
|
101
113
|
minify: Schema.optional(Schema.Boolean),
|
package/services/build-live.js
CHANGED
|
@@ -183,6 +183,7 @@ const BuildServiceLive = Layer.effect(BuildService, Effect.gen(function* () {
|
|
|
183
183
|
const entriesConfig = { main: config.entries.main };
|
|
184
184
|
if (config.entries.pre) entriesConfig.pre = config.entries.pre;
|
|
185
185
|
if (config.entries.post) entriesConfig.post = config.entries.post;
|
|
186
|
+
if (config.entries.workers) entriesConfig.workers = config.entries.workers;
|
|
186
187
|
const entriesResult = yield* configService.detectEntries(cwd, entriesConfig);
|
|
187
188
|
if (shouldClean) yield* cleanDirectory(resolve(cwd, "dist"));
|
|
188
189
|
const entryResults = [];
|
package/services/config-live.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigInvalid, ConfigLoadFailed, ConfigNotFound, MainEntryMissing } from "../errors.js";
|
|
1
|
+
import { ConfigInvalid, ConfigLoadFailed, ConfigNotFound, MainEntryMissing, WorkerEntryInvalidName, WorkerEntryMissing } from "../errors.js";
|
|
2
2
|
import { defineConfig } from "../schemas/config.js";
|
|
3
3
|
import { ConfigService } from "./config.js";
|
|
4
4
|
import { Effect, Layer } from "effect";
|
|
@@ -21,6 +21,12 @@ const DEFAULT_ENTRIES = {
|
|
|
21
21
|
pre: "src/pre.ts",
|
|
22
22
|
post: "src/post.ts"
|
|
23
23
|
};
|
|
24
|
+
/** Lifecycle bundle names a worker entry must not reuse — they own `dist/main.js` etc. */
|
|
25
|
+
const RESERVED_ENTRY_NAMES = /* @__PURE__ */ new Set([
|
|
26
|
+
"main",
|
|
27
|
+
"pre",
|
|
28
|
+
"post"
|
|
29
|
+
]);
|
|
24
30
|
/**
|
|
25
31
|
* Find config file in the given directory.
|
|
26
32
|
*/
|
|
@@ -100,6 +106,27 @@ const ConfigServiceLive = Layer.succeed(ConfigService, {
|
|
|
100
106
|
if (preEntry) detected.push(preEntry);
|
|
101
107
|
const postEntry = detectOptionalEntry(cwd, "post", entries?.post);
|
|
102
108
|
if (postEntry) detected.push(postEntry);
|
|
109
|
+
for (const [name, workerPath] of Object.entries(entries?.workers ?? {})) {
|
|
110
|
+
if (RESERVED_ENTRY_NAMES.has(name)) return yield* Effect.fail(new WorkerEntryInvalidName({
|
|
111
|
+
workerName: name,
|
|
112
|
+
reason: `"${name}" is a reserved lifecycle bundle name (main/pre/post)`
|
|
113
|
+
}));
|
|
114
|
+
if (name.length === 0 || name.includes("/") || name.includes("\\") || name.includes("..")) return yield* Effect.fail(new WorkerEntryInvalidName({
|
|
115
|
+
workerName: name,
|
|
116
|
+
reason: "worker names must be non-empty and free of path separators"
|
|
117
|
+
}));
|
|
118
|
+
const absoluteWorkerPath = resolve(cwd, workerPath);
|
|
119
|
+
if (!existsSync(absoluteWorkerPath)) return yield* Effect.fail(new WorkerEntryMissing({
|
|
120
|
+
workerName: name,
|
|
121
|
+
expectedPath: workerPath,
|
|
122
|
+
cwd
|
|
123
|
+
}));
|
|
124
|
+
detected.push({
|
|
125
|
+
type: name,
|
|
126
|
+
path: absoluteWorkerPath,
|
|
127
|
+
output: `dist/${name}.js`
|
|
128
|
+
});
|
|
129
|
+
}
|
|
103
130
|
return {
|
|
104
131
|
success: true,
|
|
105
132
|
entries: detected
|
package/services/config.js
CHANGED
|
@@ -23,8 +23,8 @@ const EntryTypeSchema = Schema.Literal("main", "pre", "post");
|
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
25
|
const DetectedEntrySchema = Schema.Struct({
|
|
26
|
-
/** Entry type
|
|
27
|
-
type:
|
|
26
|
+
/** Entry type: "main"|"pre"|"post" for lifecycle entries, or the worker name. */
|
|
27
|
+
type: Schema.String,
|
|
28
28
|
/** Absolute path to the entry file. */
|
|
29
29
|
path: Schema.String,
|
|
30
30
|
/** Output path for the bundled file. */
|