@savvy-web/github-action-builder 0.3.0 → 0.5.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} +66 -58
- package/README.md +5 -4
- package/bin/github-action-builder.js +6 -4
- package/index.d.ts +24 -58
- package/index.js +3 -2
- package/package.json +14 -14
- 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
|
-
import { createRequire } from "node:module";
|
|
4
3
|
import { dirname, join, relative, resolve } from "node:path";
|
|
4
|
+
import { createRsbuild } from "@rsbuild/core";
|
|
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
|
}
|
|
@@ -91,22 +91,15 @@ const EntriesSchema = Schema.Struct({
|
|
|
91
91
|
pre: Schema.optional(Schema.String),
|
|
92
92
|
post: Schema.optional(Schema.String)
|
|
93
93
|
});
|
|
94
|
-
const EsTarget = Schema.Literal("es2020", "es2021", "es2022", "es2023", "es2024");
|
|
95
94
|
const BuildOptionsSchema = Schema.Struct({
|
|
96
95
|
minify: Schema.optionalWith(Schema.Boolean, {
|
|
97
96
|
default: ()=>true
|
|
98
97
|
}),
|
|
99
|
-
target: Schema.optionalWith(EsTarget, {
|
|
100
|
-
default: ()=>"es2022"
|
|
101
|
-
}),
|
|
102
98
|
sourceMap: Schema.optionalWith(Schema.Boolean, {
|
|
103
99
|
default: ()=>false
|
|
104
100
|
}),
|
|
105
101
|
externals: Schema.optionalWith(Schema.Array(Schema.String), {
|
|
106
102
|
default: ()=>[]
|
|
107
|
-
}),
|
|
108
|
-
quiet: Schema.optionalWith(Schema.Boolean, {
|
|
109
|
-
default: ()=>false
|
|
110
103
|
})
|
|
111
104
|
});
|
|
112
105
|
const ValidationOptionsSchema = Schema.Struct({
|
|
@@ -135,10 +128,8 @@ const ConfigInputSchema = Schema.Struct({
|
|
|
135
128
|
})),
|
|
136
129
|
build: Schema.optional(Schema.Struct({
|
|
137
130
|
minify: Schema.optional(Schema.Boolean),
|
|
138
|
-
target: Schema.optional(EsTarget),
|
|
139
131
|
sourceMap: Schema.optional(Schema.Boolean),
|
|
140
|
-
externals: Schema.optional(Schema.Array(Schema.String))
|
|
141
|
-
quiet: Schema.optional(Schema.Boolean)
|
|
132
|
+
externals: Schema.optional(Schema.Array(Schema.String))
|
|
142
133
|
})),
|
|
143
134
|
validation: Schema.optional(Schema.Struct({
|
|
144
135
|
requireActionYml: Schema.optional(Schema.Boolean),
|
|
@@ -185,21 +176,6 @@ Schema.Struct({
|
|
|
185
176
|
usingDefaults: Schema.Boolean
|
|
186
177
|
});
|
|
187
178
|
const ConfigService = Context.GenericTag("ConfigService");
|
|
188
|
-
const build_live_require = createRequire(import.meta.url);
|
|
189
|
-
const ncc = build_live_require("@vercel/ncc");
|
|
190
|
-
async function bundle(entryPath, options = {}) {
|
|
191
|
-
return ncc(entryPath, {
|
|
192
|
-
minify: options.minify ?? true,
|
|
193
|
-
sourceMap: options.sourceMap ?? false,
|
|
194
|
-
target: options.target ?? "es2022",
|
|
195
|
-
quiet: options.quiet ?? true,
|
|
196
|
-
externals: options.externals ?? [],
|
|
197
|
-
...options
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
function getBundleSize(code) {
|
|
201
|
-
return Buffer.byteLength(code, "utf8");
|
|
202
|
-
}
|
|
203
179
|
function formatBytes(bytes) {
|
|
204
180
|
if (bytes < 1024) return `${bytes} B`;
|
|
205
181
|
if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
@@ -252,34 +228,69 @@ function writeFile(path, content) {
|
|
|
252
228
|
function bundleEntry(entry, config, cwd) {
|
|
253
229
|
return Effect.gen(function*() {
|
|
254
230
|
const startTime = Date.now();
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
231
|
+
const outputDir = resolve(cwd, "dist");
|
|
232
|
+
const rsbuild = yield* Effect.tryPromise({
|
|
233
|
+
try: ()=>createRsbuild({
|
|
234
|
+
rsbuildConfig: {
|
|
235
|
+
source: {
|
|
236
|
+
entry: {
|
|
237
|
+
[entry.type]: entry.path
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
output: {
|
|
241
|
+
target: "node",
|
|
242
|
+
module: true,
|
|
243
|
+
distPath: {
|
|
244
|
+
root: outputDir
|
|
245
|
+
},
|
|
246
|
+
filename: {
|
|
247
|
+
js: "[name].js"
|
|
248
|
+
},
|
|
249
|
+
externals: [
|
|
250
|
+
/^node:/,
|
|
251
|
+
...config.build.externals
|
|
252
|
+
],
|
|
253
|
+
cleanDistPath: false,
|
|
254
|
+
minify: config.build.minify,
|
|
255
|
+
sourceMap: config.build.sourceMap ? {
|
|
256
|
+
js: "source-map"
|
|
257
|
+
} : false
|
|
258
|
+
},
|
|
259
|
+
performance: {
|
|
260
|
+
chunkSplit: {
|
|
261
|
+
strategy: "all-in-one"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
264
265
|
}),
|
|
265
266
|
catch: (error)=>new BundleFailed({
|
|
266
267
|
entry: entry.path,
|
|
267
268
|
cause: error
|
|
268
269
|
})
|
|
269
270
|
});
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
271
|
+
const buildResult = yield* Effect.tryPromise({
|
|
272
|
+
try: ()=>rsbuild.build(),
|
|
273
|
+
catch: (error)=>new BundleFailed({
|
|
274
|
+
entry: entry.path,
|
|
275
|
+
cause: error
|
|
276
|
+
})
|
|
277
|
+
});
|
|
278
|
+
yield* Effect.tryPromise({
|
|
279
|
+
try: ()=>buildResult.close(),
|
|
280
|
+
catch: (error)=>new BundleFailed({
|
|
281
|
+
entry: entry.path,
|
|
282
|
+
cause: new Error(`rsbuild close() failed: ${error}`)
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
const outputPath = resolve(outputDir, `${entry.type}.js`);
|
|
286
|
+
const size = yield* Effect["try"]({
|
|
287
|
+
try: ()=>statSync(outputPath).size,
|
|
288
|
+
catch: (error)=>new BundleFailed({
|
|
289
|
+
entry: entry.path,
|
|
290
|
+
cause: error
|
|
291
|
+
})
|
|
292
|
+
});
|
|
281
293
|
const duration = Date.now() - startTime;
|
|
282
|
-
const size = getBundleSize(nccResult.code);
|
|
283
294
|
return {
|
|
284
295
|
success: true,
|
|
285
296
|
stats: {
|
|
@@ -495,7 +506,7 @@ function validateActionYmlPaths(actionYmlPath, destDir) {
|
|
|
495
506
|
return Effect.gen(function*() {
|
|
496
507
|
if (!existsSync(actionYmlPath)) return;
|
|
497
508
|
const content = readFileSync(actionYmlPath, "utf8");
|
|
498
|
-
const parsed = parse(content);
|
|
509
|
+
const parsed = yield* parse(content).pipe(Effect.catchAll(()=>Effect.succeed(null)));
|
|
499
510
|
if (!parsed?.runs) return;
|
|
500
511
|
for (const entryType of [
|
|
501
512
|
"main",
|
|
@@ -725,13 +736,10 @@ const ValidationServiceLive = Layer.effect(ValidationService, Effect.gen(functio
|
|
|
725
736
|
message: "Failed to read file"
|
|
726
737
|
})
|
|
727
738
|
});
|
|
728
|
-
const parsed = yield* Effect
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
message: error instanceof Error ? error.message : "Invalid YAML syntax"
|
|
733
|
-
})
|
|
734
|
-
});
|
|
739
|
+
const parsed = yield* parse(content).pipe(Effect.mapError((error)=>new ActionYmlSyntaxError({
|
|
740
|
+
path,
|
|
741
|
+
message: error.message
|
|
742
|
+
})));
|
|
735
743
|
if (!parsed || "object" != typeof parsed) return yield* new ActionYmlSyntaxError({
|
|
736
744
|
path,
|
|
737
745
|
message: "action.yml must be an object"
|
|
@@ -878,4 +886,4 @@ const ValidationLayer = ValidationServiceLive.pipe(Layer.provide(ConfigServiceLi
|
|
|
878
886
|
const BuildLayer = BuildServiceLive.pipe(Layer.provide(ConfigServiceLive));
|
|
879
887
|
const PersistLocalLayer = PersistLocalServiceLive;
|
|
880
888
|
const AppLayer = Layer.mergeAll(ConfigServiceLive, ValidationLayer, BuildLayer, PersistLocalLayer);
|
|
881
|
-
export { ActionYmlMissing, ActionYmlMissingBase, ActionYmlPathError, ActionYmlPathErrorBase, ActionYmlResultSchema, ActionYmlSchemaError, ActionYmlSchemaErrorBase, ActionYmlSyntaxError, ActionYmlSyntaxErrorBase, AppLayer, BuildFailed, BuildFailedBase, BuildLayer, BuildOptionsSchema, BuildResultSchema, BuildRunnerOptionsSchema, BuildService, BundleFailed, BundleFailedBase, BundleResultSchema, BundleStatsSchema,
|
|
889
|
+
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 };
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# @savvy-web/github-action-builder
|
|
2
2
|
|
|
3
3
|
A zero-config build tool for creating GitHub Actions from TypeScript source
|
|
4
|
-
code. Bundles your action with [@
|
|
5
|
-
validates `action.yml` against GitHub's official schema, and
|
|
6
|
-
production-ready Node.js 24 actions.
|
|
4
|
+
code. Bundles your action with [@rsbuild/core](https://github.com/web-infra-dev/rsbuild)
|
|
5
|
+
(rspack-based), validates `action.yml` against GitHub's official schema, and
|
|
6
|
+
outputs production-ready Node.js 24 actions.
|
|
7
7
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
@@ -13,7 +13,8 @@ production-ready Node.js 24 actions.
|
|
|
13
13
|
runtime
|
|
14
14
|
- **Schema validation** - Validates `action.yml` against GitHub's official
|
|
15
15
|
metadata specification
|
|
16
|
-
- **Single-file bundles** - All dependencies inlined
|
|
16
|
+
- **Single-file bundles** - All npm dependencies inlined via rsbuild, `node:`
|
|
17
|
+
builtins externalized, with tree-shaking support
|
|
17
18
|
- **Local testing** - Auto-persists build output for testing with
|
|
18
19
|
[nektos/act](https://github.com/nektos/act)
|
|
19
20
|
- **CI-aware** - Strict validation in CI, warnings-only locally
|
|
@@ -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));
|
|
@@ -71,7 +74,7 @@ const actionNameArg = Args.text({
|
|
|
71
74
|
name: "action-name"
|
|
72
75
|
}).pipe(Args.withDescription("Name of the GitHub Action (also the output directory)"));
|
|
73
76
|
const forceOption = Options.boolean("force").pipe(Options.withAlias("f"), Options.withDescription("Overwrite existing files"), Options.withDefault(false));
|
|
74
|
-
const getPackageVersion = ()=>"0.
|
|
77
|
+
const getPackageVersion = ()=>"0.5.0";
|
|
75
78
|
const generatePackageJson = (name)=>{
|
|
76
79
|
const version = getPackageVersion();
|
|
77
80
|
const pkg = {
|
|
@@ -159,7 +162,6 @@ export default GitHubAction.create({
|
|
|
159
162
|
// build: {
|
|
160
163
|
// minify: true,
|
|
161
164
|
// sourceMap: false,
|
|
162
|
-
// target: "es2022",
|
|
163
165
|
// },
|
|
164
166
|
|
|
165
167
|
// Validation options
|
|
@@ -304,7 +306,7 @@ const rootCommand = Command.make("github-action-builder").pipe(Command.withSubco
|
|
|
304
306
|
]));
|
|
305
307
|
const cli = Command.run(rootCommand, {
|
|
306
308
|
name: "github-action-builder",
|
|
307
|
-
version: "0.
|
|
309
|
+
version: "0.5.0"
|
|
308
310
|
});
|
|
309
311
|
const CliLayer = Layer.merge(AppLayer, NodeContext.layer);
|
|
310
312
|
const main = Effect.suspend(()=>cli(process.argv)).pipe(Effect.provide(CliLayer), Effect.catchAllCause((cause)=>{
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* GitHub Actions into production-ready JavaScript bundles.
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* The package uses
|
|
9
|
+
* The package uses rsbuild under the hood to create single-file bundles
|
|
10
10
|
* that include all dependencies. It automatically detects entry points
|
|
11
11
|
* (`main.ts`, `pre.ts`, `post.ts`) and validates `action.yml` configuration.
|
|
12
12
|
*
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
* },
|
|
41
41
|
* build: {
|
|
42
42
|
* minify: true,
|
|
43
|
-
* target: "es2022",
|
|
44
43
|
* },
|
|
45
44
|
* });
|
|
46
45
|
* ```
|
|
@@ -50,10 +49,10 @@
|
|
|
50
49
|
|
|
51
50
|
import { Context } from 'effect';
|
|
52
51
|
import type { Effect } from 'effect';
|
|
53
|
-
import { Equals } from 'effect/Types';
|
|
54
52
|
import { Layer } from 'effect';
|
|
55
53
|
import { Schema } from 'effect';
|
|
56
54
|
import { URL as URL_2 } from 'node:url';
|
|
55
|
+
import { VoidIfEmpty } from 'effect/Types';
|
|
57
56
|
import { YieldableError } from 'effect/Cause';
|
|
58
57
|
|
|
59
58
|
/**
|
|
@@ -79,7 +78,7 @@ export declare class ActionYmlMissing extends ActionYmlMissingBase<{
|
|
|
79
78
|
*
|
|
80
79
|
* @internal
|
|
81
80
|
*/
|
|
82
|
-
export declare const ActionYmlMissingBase: new <A extends Record<string, any> = {}>(args:
|
|
81
|
+
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
82
|
readonly _tag: "ActionYmlMissing";
|
|
84
83
|
} & Readonly<A>;
|
|
85
84
|
|
|
@@ -114,7 +113,7 @@ export declare class ActionYmlPathError extends ActionYmlPathErrorBase<{
|
|
|
114
113
|
*
|
|
115
114
|
* @internal
|
|
116
115
|
*/
|
|
117
|
-
export declare const ActionYmlPathErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
116
|
+
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
117
|
readonly _tag: "ActionYmlPathError";
|
|
119
118
|
} & Readonly<A>;
|
|
120
119
|
|
|
@@ -187,7 +186,7 @@ export declare class ActionYmlSchemaError extends ActionYmlSchemaErrorBase<{
|
|
|
187
186
|
*
|
|
188
187
|
* @internal
|
|
189
188
|
*/
|
|
190
|
-
export declare const ActionYmlSchemaErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
189
|
+
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
190
|
readonly _tag: "ActionYmlSchemaError";
|
|
192
191
|
} & Readonly<A>;
|
|
193
192
|
|
|
@@ -226,7 +225,7 @@ export declare class ActionYmlSyntaxError extends ActionYmlSyntaxErrorBase<{
|
|
|
226
225
|
*
|
|
227
226
|
* @internal
|
|
228
227
|
*/
|
|
229
|
-
export declare const ActionYmlSyntaxErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
228
|
+
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
229
|
readonly _tag: "ActionYmlSyntaxError";
|
|
231
230
|
} & Readonly<A>;
|
|
232
231
|
|
|
@@ -301,7 +300,7 @@ export declare class BuildFailed extends BuildFailedBase<{
|
|
|
301
300
|
*
|
|
302
301
|
* @internal
|
|
303
302
|
*/
|
|
304
|
-
export declare const BuildFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
303
|
+
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
304
|
readonly _tag: "BuildFailed";
|
|
306
305
|
} & Readonly<A>;
|
|
307
306
|
|
|
@@ -326,7 +325,7 @@ export declare type BuildOptions = typeof BuildOptionsSchema.Type;
|
|
|
326
325
|
* Schema for build options.
|
|
327
326
|
*
|
|
328
327
|
* @remarks
|
|
329
|
-
* Build options control how the TypeScript source is bundled using
|
|
328
|
+
* Build options control how the TypeScript source is bundled using rsbuild.
|
|
330
329
|
* The bundler creates a single JavaScript file with all dependencies inlined.
|
|
331
330
|
*
|
|
332
331
|
* @internal
|
|
@@ -336,22 +335,14 @@ export declare const BuildOptionsSchema: Schema.Struct<{
|
|
|
336
335
|
minify: Schema.optionalWith<typeof Schema.Boolean, {
|
|
337
336
|
default: () => true;
|
|
338
337
|
}>;
|
|
339
|
-
/** ECMAScript target version for the output. Defaults to "es2022". */
|
|
340
|
-
target: Schema.optionalWith<Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>, {
|
|
341
|
-
default: () => "es2022";
|
|
342
|
-
}>;
|
|
343
338
|
/** Generate source maps for debugging. Defaults to false. */
|
|
344
339
|
sourceMap: Schema.optionalWith<typeof Schema.Boolean, {
|
|
345
340
|
default: () => false;
|
|
346
341
|
}>;
|
|
347
|
-
/** Packages to exclude from the bundle. Defaults to []. */
|
|
342
|
+
/** Packages to exclude from the bundle (in addition to node: builtins). Defaults to []. */
|
|
348
343
|
externals: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
|
|
349
344
|
default: () => never[];
|
|
350
345
|
}>;
|
|
351
|
-
/** Suppress build output. Defaults to false. */
|
|
352
|
-
quiet: Schema.optionalWith<typeof Schema.Boolean, {
|
|
353
|
-
default: () => false;
|
|
354
|
-
}>;
|
|
355
346
|
}>;
|
|
356
347
|
|
|
357
348
|
/**
|
|
@@ -413,7 +404,7 @@ export declare const BuildRunnerOptionsSchema: Schema.Struct<{
|
|
|
413
404
|
*
|
|
414
405
|
* @remarks
|
|
415
406
|
* This service handles:
|
|
416
|
-
* - Bundling TypeScript entries with
|
|
407
|
+
* - Bundling TypeScript entries with rsbuild
|
|
417
408
|
* - Managing output directory
|
|
418
409
|
* - Collecting build statistics
|
|
419
410
|
* - Formatting build results
|
|
@@ -488,7 +479,7 @@ export declare interface BuildService {
|
|
|
488
479
|
export declare const BuildService: Context.Tag<BuildService, BuildService>;
|
|
489
480
|
|
|
490
481
|
/**
|
|
491
|
-
* Error when bundling with
|
|
482
|
+
* Error when bundling with rsbuild fails.
|
|
492
483
|
*
|
|
493
484
|
* @public
|
|
494
485
|
*/
|
|
@@ -514,7 +505,7 @@ export declare class BundleFailed extends BundleFailedBase<{
|
|
|
514
505
|
*
|
|
515
506
|
* @internal
|
|
516
507
|
*/
|
|
517
|
-
export declare const BundleFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
508
|
+
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
509
|
readonly _tag: "BundleFailed";
|
|
519
510
|
} & Readonly<A>;
|
|
520
511
|
|
|
@@ -594,7 +585,7 @@ export declare class CleanError extends CleanErrorBase<{
|
|
|
594
585
|
*
|
|
595
586
|
* @internal
|
|
596
587
|
*/
|
|
597
|
-
export declare const CleanErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
588
|
+
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
589
|
readonly _tag: "CleanError";
|
|
599
590
|
} & Readonly<A>;
|
|
600
591
|
|
|
@@ -644,10 +635,8 @@ export declare const ConfigInputSchema: Schema.Struct<{
|
|
|
644
635
|
}>>;
|
|
645
636
|
build: Schema.optional<Schema.Struct<{
|
|
646
637
|
minify: Schema.optional<typeof Schema.Boolean>;
|
|
647
|
-
target: Schema.optional<Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>>;
|
|
648
638
|
sourceMap: Schema.optional<typeof Schema.Boolean>;
|
|
649
639
|
externals: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
650
|
-
quiet: Schema.optional<typeof Schema.Boolean>;
|
|
651
640
|
}>>;
|
|
652
641
|
validation: Schema.optional<Schema.Struct<{
|
|
653
642
|
requireActionYml: Schema.optional<typeof Schema.Boolean>;
|
|
@@ -688,7 +677,7 @@ export declare class ConfigInvalid extends ConfigInvalidBase<{
|
|
|
688
677
|
*
|
|
689
678
|
* @internal
|
|
690
679
|
*/
|
|
691
|
-
export declare const ConfigInvalidBase: new <A extends Record<string, any> = {}>(args:
|
|
680
|
+
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
681
|
readonly _tag: "ConfigInvalid";
|
|
693
682
|
} & Readonly<A>;
|
|
694
683
|
|
|
@@ -729,7 +718,7 @@ export declare class ConfigLoadFailed extends ConfigLoadFailedBase<{
|
|
|
729
718
|
*
|
|
730
719
|
* @internal
|
|
731
720
|
*/
|
|
732
|
-
export declare const ConfigLoadFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
721
|
+
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
722
|
readonly _tag: "ConfigLoadFailed";
|
|
734
723
|
} & Readonly<A>;
|
|
735
724
|
|
|
@@ -760,7 +749,7 @@ export declare class ConfigNotFound extends ConfigNotFoundBase<{
|
|
|
760
749
|
*
|
|
761
750
|
* @internal
|
|
762
751
|
*/
|
|
763
|
-
export declare const ConfigNotFoundBase: new <A extends Record<string, any> = {}>(args:
|
|
752
|
+
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
753
|
readonly _tag: "ConfigNotFound";
|
|
765
754
|
} & Readonly<A>;
|
|
766
755
|
|
|
@@ -785,22 +774,14 @@ export declare const ConfigSchema: Schema.Struct<{
|
|
|
785
774
|
minify: Schema.optionalWith<typeof Schema.Boolean, {
|
|
786
775
|
default: () => true;
|
|
787
776
|
}>;
|
|
788
|
-
/** ECMAScript target version for the output. Defaults to "es2022". */
|
|
789
|
-
target: Schema.optionalWith<Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>, {
|
|
790
|
-
default: () => "es2022";
|
|
791
|
-
}>;
|
|
792
777
|
/** Generate source maps for debugging. Defaults to false. */
|
|
793
778
|
sourceMap: Schema.optionalWith<typeof Schema.Boolean, {
|
|
794
779
|
default: () => false;
|
|
795
780
|
}>;
|
|
796
|
-
/** Packages to exclude from the bundle. Defaults to []. */
|
|
781
|
+
/** Packages to exclude from the bundle (in addition to node: builtins). Defaults to []. */
|
|
797
782
|
externals: Schema.optionalWith<Schema.Array$<typeof Schema.String>, {
|
|
798
783
|
default: () => never[];
|
|
799
784
|
}>;
|
|
800
|
-
/** Suppress build output. Defaults to false. */
|
|
801
|
-
quiet: Schema.optionalWith<typeof Schema.Boolean, {
|
|
802
|
-
default: () => false;
|
|
803
|
-
}>;
|
|
804
785
|
}>;
|
|
805
786
|
validation: Schema.Struct<{
|
|
806
787
|
/** Require action.yml to exist and be valid. Defaults to true. */
|
|
@@ -927,7 +908,6 @@ export declare const ConfigService: Context.Tag<ConfigService, ConfigService>;
|
|
|
927
908
|
* },
|
|
928
909
|
* build: {
|
|
929
910
|
* minify: true,
|
|
930
|
-
* target: "es2022",
|
|
931
911
|
* sourceMap: true,
|
|
932
912
|
* externals: ["@aws-sdk/client-s3"],
|
|
933
913
|
* },
|
|
@@ -1042,24 +1022,10 @@ export declare class EntryFileMissing extends EntryFileMissingBase<{
|
|
|
1042
1022
|
*
|
|
1043
1023
|
* @internal
|
|
1044
1024
|
*/
|
|
1045
|
-
export declare const EntryFileMissingBase: new <A extends Record<string, any> = {}>(args:
|
|
1025
|
+
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
1026
|
readonly _tag: "EntryFileMissing";
|
|
1047
1027
|
} & Readonly<A>;
|
|
1048
1028
|
|
|
1049
|
-
/**
|
|
1050
|
-
* ECMAScript target versions supported by the bundler.
|
|
1051
|
-
*
|
|
1052
|
-
* @internal
|
|
1053
|
-
*/
|
|
1054
|
-
export declare const EsTarget: Schema.Literal<["es2020", "es2021", "es2022", "es2023", "es2024"]>;
|
|
1055
|
-
|
|
1056
|
-
/**
|
|
1057
|
-
* Type for ECMAScript target.
|
|
1058
|
-
*
|
|
1059
|
-
* @public
|
|
1060
|
-
*/
|
|
1061
|
-
export declare type EsTarget = typeof EsTarget.Type;
|
|
1062
|
-
|
|
1063
1029
|
/**
|
|
1064
1030
|
* Main API class for building GitHub Actions.
|
|
1065
1031
|
*
|
|
@@ -1099,7 +1065,7 @@ export declare type EsTarget = typeof EsTarget.Type;
|
|
|
1099
1065
|
* const action = GitHubAction.create({
|
|
1100
1066
|
* config: {
|
|
1101
1067
|
* entries: { main: "src/action.ts" },
|
|
1102
|
-
* build: { minify: true
|
|
1068
|
+
* build: { minify: true },
|
|
1103
1069
|
* },
|
|
1104
1070
|
* cwd: "/path/to/project",
|
|
1105
1071
|
* });
|
|
@@ -1191,7 +1157,7 @@ export declare class GitHubAction {
|
|
|
1191
1157
|
* The build process:
|
|
1192
1158
|
* 1. Loads configuration (if not already loaded)
|
|
1193
1159
|
* 2. Validates the project (unless `skipValidation` is set)
|
|
1194
|
-
* 3. Bundles each entry point with
|
|
1160
|
+
* 3. Bundles each entry point with rsbuild
|
|
1195
1161
|
* 4. Writes output to the `dist/` directory
|
|
1196
1162
|
*
|
|
1197
1163
|
* @returns Build result with success status and details
|
|
@@ -1397,7 +1363,7 @@ export declare class MainEntryMissing extends MainEntryMissingBase<{
|
|
|
1397
1363
|
*
|
|
1398
1364
|
* @internal
|
|
1399
1365
|
*/
|
|
1400
|
-
export declare const MainEntryMissingBase: new <A extends Record<string, any> = {}>(args:
|
|
1366
|
+
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 & {
|
|
1401
1367
|
readonly _tag: "MainEntryMissing";
|
|
1402
1368
|
} & Readonly<A>;
|
|
1403
1369
|
|
|
@@ -1435,7 +1401,7 @@ export declare class PersistLocalError extends PersistLocalErrorBase<{
|
|
|
1435
1401
|
*
|
|
1436
1402
|
* @internal
|
|
1437
1403
|
*/
|
|
1438
|
-
export declare const PersistLocalErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
1404
|
+
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 & {
|
|
1439
1405
|
readonly _tag: "PersistLocalError";
|
|
1440
1406
|
} & Readonly<A>;
|
|
1441
1407
|
|
|
@@ -1634,7 +1600,7 @@ export declare class ValidationFailed extends ValidationFailedBase<{
|
|
|
1634
1600
|
*
|
|
1635
1601
|
* @internal
|
|
1636
1602
|
*/
|
|
1637
|
-
export declare const ValidationFailedBase: new <A extends Record<string, any> = {}>(args:
|
|
1603
|
+
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 & {
|
|
1638
1604
|
readonly _tag: "ValidationFailed";
|
|
1639
1605
|
} & Readonly<A>;
|
|
1640
1606
|
|
|
@@ -1837,7 +1803,7 @@ export declare class WriteError extends WriteErrorBase<{
|
|
|
1837
1803
|
*
|
|
1838
1804
|
* @internal
|
|
1839
1805
|
*/
|
|
1840
|
-
export declare const WriteErrorBase: new <A extends Record<string, any> = {}>(args:
|
|
1806
|
+
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 & {
|
|
1841
1807
|
readonly _tag: "WriteError";
|
|
1842
1808
|
} & Readonly<A>;
|
|
1843
1809
|
|
package/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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),
|
|
@@ -129,5 +130,5 @@ class GitHubAction {
|
|
|
129
130
|
await this.runtime.dispose();
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
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";
|
|
133
134
|
export { GitHubAction, GitHubActionBuildResultSchema };
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@savvy-web/github-action-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "A zero-config build tool for creating GitHub Actions from TypeScript. Bundles with
|
|
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": [
|
|
7
7
|
"github-actions",
|
|
8
8
|
"github",
|
|
9
9
|
"actions",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"rsbuild",
|
|
11
|
+
"rspack",
|
|
12
12
|
"bundler",
|
|
13
13
|
"typescript",
|
|
14
14
|
"node24",
|
|
@@ -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.
|
|
52
|
-
"@
|
|
53
|
-
"effect": "^3.
|
|
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
|
+
"@rsbuild/core": "^1.7.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",
|