@factorialco/gat 1.1.0 → 1.1.2

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/dist/cli.js CHANGED
@@ -19,7 +19,9 @@ const parseFile = async (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.version("1.0.0").description("Write your GitHub Actions workflows using TypeScript");
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 ${((Number(process.hrtime.bigint() - start)) / 1000000).toFixed(2)}ms`);
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
@@ -32,7 +32,9 @@ export interface JobOptions<Step, Runner, Name> {
32
32
  matrix?: Matrix;
33
33
  steps: Step[];
34
34
  outputs?: Record<string, string>;
35
+ workingDirectory?: string;
35
36
  }
37
+ export declare type StringWithNoSpaces<T> = T extends `${string} ${string}` ? never : T extends ` ${string}` ? never : T extends `${string} ` ? never : T;
36
38
  export interface Job<Step, Runner, Name> {
37
39
  name: string;
38
40
  options: JobOptions<Step, Runner, Name>;
@@ -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, options: JobOptions<JobStep, Runner, JobName>): Workflow<JobStep, Runner, JobName | 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/dist/workflow.js CHANGED
@@ -63,7 +63,7 @@ class Workflow {
63
63
  env: this.env.length > 0
64
64
  ? Object.fromEntries(this.env.map(({ name, value }) => [name, value]))
65
65
  : undefined,
66
- jobs: Object.fromEntries(this.jobs.map(({ name, options: { prettyName, permissions, ifExpression, runsOn, matrix, env, steps, dependsOn, services, timeout, concurrency, outputs, }, }) => [
66
+ jobs: Object.fromEntries(this.jobs.map(({ name, options: { prettyName, permissions, ifExpression, runsOn, matrix, env, steps, dependsOn, services, timeout, concurrency, outputs, workingDirectory, }, }) => [
67
67
  name,
68
68
  {
69
69
  name: prettyName,
@@ -89,6 +89,7 @@ class Workflow {
89
89
  }
90
90
  : undefined,
91
91
  env,
92
+ workingDirectory,
92
93
  steps: steps.map(({ id, name, ifExpression, workingDirectory, continueOnError, ...options }) => ({
93
94
  id,
94
95
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorialco/gat",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
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",