@factorialco/gat 1.0.0 → 1.1.1
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/README.md +1 -1
- package/dist/cli.js +5 -3
- package/dist/job.d.ts +1 -0
- package/dist/workflow.d.ts +2 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ _Why `gat`?_ The name is an acronym of "GitHub Actions Template Generator" witho
|
|
|
11
11
|
Install the main package and its dependencies using the following command:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm i -D @factorialco/gat typescript ts-node commander
|
|
14
|
+
npm i -D @factorialco/gat typescript ts-node commander @swc/core
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
package/dist/cli.js
CHANGED
|
@@ -15,11 +15,13 @@ const writeFilePromise = (0, util_1.promisify)(fs_1.default.writeFile);
|
|
|
15
15
|
const folder = path_1.default.join(process.cwd(), ".github", "templates");
|
|
16
16
|
const parseFile = async (templateFile) => {
|
|
17
17
|
// NOTE: can we improve this using ts-node or typescript programatically?
|
|
18
|
-
const { stdout } = await execPromise(`npx ts-node ${templateFile}`);
|
|
18
|
+
const { stdout } = await execPromise(`npx ts-node --swc -T ${templateFile}`);
|
|
19
19
|
await writeFilePromise(path_1.default.join(process.cwd(), ".github", "workflows", templateFile.split("/").at(-1).replace(".ts", ".yml")), stdout);
|
|
20
20
|
};
|
|
21
21
|
const cli = new commander_1.Command();
|
|
22
|
-
cli
|
|
22
|
+
cli
|
|
23
|
+
.version("1.0.0")
|
|
24
|
+
.description("Write your GitHub Actions workflows using TypeScript");
|
|
23
25
|
cli
|
|
24
26
|
.command("build")
|
|
25
27
|
.description("Transpile all Gat templates into GitHub Actions workflows.")
|
|
@@ -48,7 +50,7 @@ cli
|
|
|
48
50
|
const start = process.hrtime.bigint();
|
|
49
51
|
process.stdout.write(`😸 Detected change on file ${fileName}. Transpiling... `);
|
|
50
52
|
await parseFile(path_1.default.join(folder, fileName.toString()));
|
|
51
|
-
console.log(`Done in ${(
|
|
53
|
+
console.log(`Done in ${(Number(process.hrtime.bigint() - start) / 1000000).toFixed(2)}ms`);
|
|
52
54
|
}, 1000);
|
|
53
55
|
console.log(`😼 Watching file changes on ${folder}...`);
|
|
54
56
|
fs_1.default.watch(folder).on("change", (_eventName, fileName) => {
|
package/dist/job.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface JobOptions<Step, Runner, Name> {
|
|
|
33
33
|
steps: Step[];
|
|
34
34
|
outputs?: Record<string, string>;
|
|
35
35
|
}
|
|
36
|
+
export declare type StringWithNoSpaces<T> = T extends `${string} ${string}` ? never : T extends ` ${string}` ? never : T extends `${string} ` ? never : T;
|
|
36
37
|
export interface Job<Step, Runner, Name> {
|
|
37
38
|
name: string;
|
|
38
39
|
options: JobOptions<Step, Runner, Name>;
|
package/dist/workflow.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConcurrencyGroup, Job, JobOptions } from "./job";
|
|
1
|
+
import { ConcurrencyGroup, Job, JobOptions, StringWithNoSpaces } from "./job";
|
|
2
2
|
import type { Event, EventName, EventOptions } from "./event";
|
|
3
3
|
import { BaseStep, Step } from "./step";
|
|
4
4
|
declare const DEFAULT_RUNNERS: string[];
|
|
@@ -19,7 +19,7 @@ export declare class Workflow<JobStep extends BaseStep = Step, Runner = typeof D
|
|
|
19
19
|
constructor(name: string);
|
|
20
20
|
on<T extends EventName>(name: T, options?: EventOptions<T>): this;
|
|
21
21
|
addDefaults(options: DefaultOptions): this;
|
|
22
|
-
addJob<T extends string>(name: T
|
|
22
|
+
addJob<T extends string>(name: StringWithNoSpaces<T>, options: JobOptions<JobStep, Runner, JobName>): Workflow<JobStep, Runner, JobName | T>;
|
|
23
23
|
setEnv(name: string, value: string): this;
|
|
24
24
|
setConcurrencyGroup(concurrencyGroup: ConcurrencyGroup): this;
|
|
25
25
|
defaultRunner(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@factorialco/gat",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Write your GitHub Actions workflows using TypeScript",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gat": "dist/cli.js"
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"author": "David Morcillo <david.morcillo@factorial.co>",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"@swc/core": "^1.3.14",
|
|
26
27
|
"@types/js-yaml": "^4.0.5",
|
|
27
28
|
"@types/lodash": "^4.14.184",
|
|
28
29
|
"@typescript-eslint/eslint-plugin": "^5.35.1",
|