@savvy-web/github-action-builder 0.1.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 +646 -0
- package/LICENSE +21 -0
- package/README.md +156 -0
- package/bin/github-action-builder.js +294 -0
- package/index.d.ts +1621 -0
- package/index.js +118 -0
- package/package.json +69 -0
- package/tsdoc-metadata.json +11 -0
package/index.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Schema, AppLayer, BuildService, ConfigService, ValidationService, Effect, BuildResultSchema, ValidationResultSchema, ManagedRuntime, defineConfig } from "./123.js";
|
|
2
|
+
const GitHubActionBuildResultSchema = Schema.Struct({
|
|
3
|
+
success: Schema.Boolean,
|
|
4
|
+
build: Schema.optional(BuildResultSchema),
|
|
5
|
+
validation: Schema.optional(ValidationResultSchema),
|
|
6
|
+
error: Schema.optional(Schema.String)
|
|
7
|
+
});
|
|
8
|
+
class GitHubAction {
|
|
9
|
+
runtime;
|
|
10
|
+
config = null;
|
|
11
|
+
cwd;
|
|
12
|
+
configSource;
|
|
13
|
+
skipValidation;
|
|
14
|
+
clean;
|
|
15
|
+
constructor(options = {}){
|
|
16
|
+
const layer = options.layer ?? AppLayer;
|
|
17
|
+
this.runtime = ManagedRuntime.make(layer);
|
|
18
|
+
this.configSource = options.config;
|
|
19
|
+
this.cwd = options.cwd ?? process.cwd();
|
|
20
|
+
this.skipValidation = options.skipValidation ?? false;
|
|
21
|
+
this.clean = options.clean ?? true;
|
|
22
|
+
}
|
|
23
|
+
static create(options = {}) {
|
|
24
|
+
return new GitHubAction(options);
|
|
25
|
+
}
|
|
26
|
+
async loadConfig() {
|
|
27
|
+
if (this.config) return this.config;
|
|
28
|
+
const configSource = this.configSource;
|
|
29
|
+
const cwd = this.cwd;
|
|
30
|
+
const program = Effect.gen(function*() {
|
|
31
|
+
const configService = yield* ConfigService;
|
|
32
|
+
if ("string" == typeof configSource) {
|
|
33
|
+
const result = yield* configService.load({
|
|
34
|
+
cwd,
|
|
35
|
+
configPath: configSource
|
|
36
|
+
});
|
|
37
|
+
return result.config;
|
|
38
|
+
}
|
|
39
|
+
if (configSource) return defineConfig(configSource);
|
|
40
|
+
const result = yield* configService.load({
|
|
41
|
+
cwd
|
|
42
|
+
});
|
|
43
|
+
return result.config;
|
|
44
|
+
});
|
|
45
|
+
const config = await this.runtime.runPromise(program);
|
|
46
|
+
this.config = config;
|
|
47
|
+
return config;
|
|
48
|
+
}
|
|
49
|
+
async validate(options = {}) {
|
|
50
|
+
const config = await this.loadConfig();
|
|
51
|
+
const cwd = this.cwd;
|
|
52
|
+
const program = Effect.gen(function*() {
|
|
53
|
+
const validationService = yield* ValidationService;
|
|
54
|
+
return yield* validationService.validate(config, {
|
|
55
|
+
cwd,
|
|
56
|
+
...options
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
return this.runtime.runPromise(program);
|
|
60
|
+
}
|
|
61
|
+
async build() {
|
|
62
|
+
try {
|
|
63
|
+
const config = await this.loadConfig();
|
|
64
|
+
let validationResult;
|
|
65
|
+
if (!this.skipValidation) {
|
|
66
|
+
validationResult = await this.validate();
|
|
67
|
+
if (!validationResult.valid) return {
|
|
68
|
+
success: false,
|
|
69
|
+
validation: validationResult,
|
|
70
|
+
error: "Validation failed"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const cwd = this.cwd;
|
|
74
|
+
const clean = this.clean;
|
|
75
|
+
const program = Effect.gen(function*() {
|
|
76
|
+
const buildService = yield* BuildService;
|
|
77
|
+
const buildOptions = {
|
|
78
|
+
cwd,
|
|
79
|
+
clean
|
|
80
|
+
};
|
|
81
|
+
return yield* buildService.build(config, buildOptions);
|
|
82
|
+
});
|
|
83
|
+
const buildResult = await this.runtime.runPromise(program);
|
|
84
|
+
if (!buildResult.success) {
|
|
85
|
+
if (validationResult) return {
|
|
86
|
+
success: false,
|
|
87
|
+
build: buildResult,
|
|
88
|
+
validation: validationResult,
|
|
89
|
+
error: buildResult.error ?? "Build failed"
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
success: false,
|
|
93
|
+
build: buildResult,
|
|
94
|
+
error: buildResult.error ?? "Build failed"
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (validationResult) return {
|
|
98
|
+
success: true,
|
|
99
|
+
build: buildResult,
|
|
100
|
+
validation: validationResult
|
|
101
|
+
};
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
build: buildResult
|
|
105
|
+
};
|
|
106
|
+
} catch (error) {
|
|
107
|
+
return {
|
|
108
|
+
success: false,
|
|
109
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async dispose() {
|
|
114
|
+
await this.runtime.dispose();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export { ActionYmlMissing, ActionYmlMissingBase, 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, ValidateOptionsSchema, ValidationErrorSchema, ValidationFailed, ValidationFailedBase, ValidationLayer, ValidationOptionsSchema, ValidationResultSchema, ValidationService, ValidationWarningSchema, WriteError, WriteErrorBase, defineConfig } from "./123.js";
|
|
118
|
+
export { GitHubAction, GitHubActionBuildResultSchema };
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@savvy-web/github-action-builder",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
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
|
+
"keywords": [
|
|
7
|
+
"github-actions",
|
|
8
|
+
"github",
|
|
9
|
+
"actions",
|
|
10
|
+
"ncc",
|
|
11
|
+
"vercel-ncc",
|
|
12
|
+
"bundler",
|
|
13
|
+
"typescript",
|
|
14
|
+
"node24",
|
|
15
|
+
"cli",
|
|
16
|
+
"build-tool",
|
|
17
|
+
"action-builder",
|
|
18
|
+
"effect-ts",
|
|
19
|
+
"esm"
|
|
20
|
+
],
|
|
21
|
+
"homepage": "https://github.com/savvy-web/github-action-builder#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/savvy-web/github-action-builder/issues"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/savvy-web/github-action-builder.git"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "C. Spencer Beggs",
|
|
32
|
+
"email": "spencer@savvyweb.systems",
|
|
33
|
+
"url": "https://savvyweb.systems"
|
|
34
|
+
},
|
|
35
|
+
"type": "module",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./index.d.ts",
|
|
39
|
+
"import": "./index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"bin": {
|
|
43
|
+
"github-action-builder": "./bin/github-action-builder.js"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@effect/cli": "^0.73.1",
|
|
47
|
+
"@effect/platform": "^0.94.2",
|
|
48
|
+
"@effect/platform-node": "^0.104.1",
|
|
49
|
+
"@effect/printer": "^0.47.0",
|
|
50
|
+
"@effect/printer-ansi": "^0.47.0",
|
|
51
|
+
"@effect/typeclass": "^0.38.0",
|
|
52
|
+
"@vercel/ncc": "^0.38.4",
|
|
53
|
+
"effect": "^3.19.15",
|
|
54
|
+
"picocolors": "^1.1.1",
|
|
55
|
+
"yaml": "^2.8.2"
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"!github-action-builder.api.json",
|
|
59
|
+
"!tsconfig.json",
|
|
60
|
+
"123.js",
|
|
61
|
+
"LICENSE",
|
|
62
|
+
"README.md",
|
|
63
|
+
"bin/github-action-builder.js",
|
|
64
|
+
"index.d.ts",
|
|
65
|
+
"index.js",
|
|
66
|
+
"package.json",
|
|
67
|
+
"tsdoc-metadata.json"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.56.0"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|