@github-actions-workflow-ts/cli 2.3.0 → 2.4.0-beta.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 +20 -1
- package/dist/commands/build.d.ts +40 -5
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +103 -14
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/types/build.d.ts +45 -0
- package/dist/commands/types/build.d.ts.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -77,7 +77,26 @@ This will generate `.github/workflows/example-filename.yml` from your TypeScript
|
|
|
77
77
|
|
|
78
78
|
## Configuration
|
|
79
79
|
|
|
80
|
-
Create a
|
|
80
|
+
Create a config file in your project root to customize generation. Both TypeScript (`wac.config.ts`) and JSON (`wac.config.json`) formats are supported. TypeScript config takes precedence if both exist.
|
|
81
|
+
|
|
82
|
+
### TypeScript Config (Recommended)
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// wac.config.ts
|
|
86
|
+
import type { WacConfig } from '@github-actions-workflow-ts/cli'
|
|
87
|
+
|
|
88
|
+
const config: WacConfig = {
|
|
89
|
+
refs: false,
|
|
90
|
+
headerText: [
|
|
91
|
+
'# Auto-generated from <source-file-path>',
|
|
92
|
+
'# Do not edit this file directly',
|
|
93
|
+
],
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default config
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### JSON Config
|
|
81
100
|
|
|
82
101
|
```json
|
|
83
102
|
{
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type Workflow } from '@github-actions-workflow-ts/lib';
|
|
2
2
|
import type { WacConfig } from './types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Default output path for workflow files.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_OUTPUT_PATH: string;
|
|
3
7
|
/**
|
|
4
8
|
* Comment indicating the file should not be modified.
|
|
5
9
|
* @type {string}
|
|
@@ -13,10 +17,38 @@ export declare const DEFAULT_HEADER_TEXT: string[];
|
|
|
13
17
|
*/
|
|
14
18
|
export declare const relativePath: (p: string) => string;
|
|
15
19
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
20
|
+
* Resolves the output path for a workflow file.
|
|
21
|
+
*
|
|
22
|
+
* Priority order:
|
|
23
|
+
* 1. workflow.outputPath (if set on the Workflow instance)
|
|
24
|
+
* 2. config.outputPaths.workflows.overrides (first matching pattern)
|
|
25
|
+
* 3. config.outputPaths.workflows.default
|
|
26
|
+
* 4. DEFAULT_OUTPUT_PATH (.github/workflows)
|
|
27
|
+
*
|
|
28
|
+
* @param {Workflow} workflow - The workflow instance.
|
|
29
|
+
* @param {string} workflowFilePath - The source file path (e.g., "my-workflow.wac.ts").
|
|
30
|
+
* @param {WacConfig} config - The configuration object.
|
|
31
|
+
* @returns {string} - The resolved output directory path.
|
|
32
|
+
*/
|
|
33
|
+
export declare const resolveOutputPath: (workflow: Workflow, workflowFilePath: string, config: WacConfig) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Supported config file names in order of priority.
|
|
36
|
+
* TypeScript config takes precedence over JSON config.
|
|
37
|
+
*/
|
|
38
|
+
export declare const CONFIG_FILE_NAMES: readonly ["wac.config.ts", "wac.config.json"];
|
|
39
|
+
/**
|
|
40
|
+
* Returns the config file (synchronous version for JSON only)
|
|
41
|
+
* @returns {WacConfig | undefined} - The config file as an object
|
|
42
|
+
* @deprecated Use getConfigAsync for TypeScript config support
|
|
18
43
|
*/
|
|
19
44
|
export declare const getConfig: () => WacConfig | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the config file, supporting both TypeScript and JSON formats.
|
|
47
|
+
* Priority: wac.config.ts > wac.config.json
|
|
48
|
+
*
|
|
49
|
+
* @returns {Promise<WacConfig | undefined>} - The config file as an object
|
|
50
|
+
*/
|
|
51
|
+
export declare const getConfigAsync: () => Promise<WacConfig | undefined>;
|
|
20
52
|
/**
|
|
21
53
|
* Retrieves the file paths of all workflow files in the project.
|
|
22
54
|
*
|
|
@@ -37,13 +69,16 @@ export declare const importWorkflowFile: (filePath: string) => Promise<Record<st
|
|
|
37
69
|
* @param {Record<string, Workflow>} workflowJSON - The workflow data in JSON format.
|
|
38
70
|
* @param {string} workflowFilePath - The path to the workflow file.
|
|
39
71
|
* @param {WacConfig} config - Command line arguments.
|
|
72
|
+
* @param {Set<string>} [createdDirectories] - Optional set to track directories that have been created.
|
|
40
73
|
* @returns {number} - The number of workflows written.
|
|
41
74
|
*/
|
|
42
|
-
export declare const writeWorkflowJSONToYamlFiles: (workflowJSON: Record<string, Workflow>, workflowFilePath: string, config: WacConfig) => number;
|
|
75
|
+
export declare const writeWorkflowJSONToYamlFiles: (workflowJSON: Record<string, Workflow>, workflowFilePath: string, config: WacConfig, createdDirectories?: Set<string>) => number;
|
|
43
76
|
/**
|
|
44
|
-
* Creates the
|
|
77
|
+
* Creates the workflow output directory if it doesn't exist.
|
|
78
|
+
*
|
|
79
|
+
* @param {string} [outputPath] - Optional output path. Defaults to DEFAULT_OUTPUT_PATH.
|
|
45
80
|
*/
|
|
46
|
-
export declare const createWorkflowDirectory: () => void;
|
|
81
|
+
export declare const createWorkflowDirectory: (outputPath?: string) => void;
|
|
47
82
|
/**
|
|
48
83
|
* Generates workflow files based on the provided command line arguments.
|
|
49
84
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAOA,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGjD;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAAoC,CAAA;AAEpE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAK/B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,KAAG,MACR,CAAA;AAEjC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,QAAQ,EAClB,kBAAkB,MAAM,EACxB,QAAQ,SAAS,KAChB,MA6BF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,+CAAgD,CAAA;AAE9E;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAO,SAAS,GAAG,SAgBxC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,SAAS,GAAG,SAAS,CAiCpE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,QAAO,MAAM,EAAE,GAAG,SA2BlD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,KACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAQlC,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,GACvC,cAAc,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EACtC,kBAAkB,MAAM,EACxB,QAAQ,SAAS,EACjB,qBAAqB,GAAG,CAAC,MAAM,CAAC,KAC/B,MAyCF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,GAClC,aAAY,MAA4B,KACvC,IASF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,OAAO,CAAC,IAAI,CA6Bd,CAAA"}
|
package/dist/commands/build.js
CHANGED
|
@@ -3,9 +3,14 @@ import * as fs from 'fs';
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import * as jsYaml from 'js-yaml';
|
|
5
5
|
import fg from 'fast-glob';
|
|
6
|
+
import micromatch from 'micromatch';
|
|
6
7
|
import { pathToFileURL } from 'url';
|
|
7
8
|
import { Context } from '@github-actions-workflow-ts/lib';
|
|
8
9
|
import { ConsoleDiagnosticsReporter } from './diagnostics.js';
|
|
10
|
+
/**
|
|
11
|
+
* Default output path for workflow files.
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_OUTPUT_PATH = path.join('.github', 'workflows');
|
|
9
14
|
/**
|
|
10
15
|
* Comment indicating the file should not be modified.
|
|
11
16
|
* @type {string}
|
|
@@ -24,17 +29,89 @@ export const DEFAULT_HEADER_TEXT = [
|
|
|
24
29
|
*/
|
|
25
30
|
export const relativePath = (p) => path.relative(process.cwd(), p);
|
|
26
31
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
32
|
+
* Resolves the output path for a workflow file.
|
|
33
|
+
*
|
|
34
|
+
* Priority order:
|
|
35
|
+
* 1. workflow.outputPath (if set on the Workflow instance)
|
|
36
|
+
* 2. config.outputPaths.workflows.overrides (first matching pattern)
|
|
37
|
+
* 3. config.outputPaths.workflows.default
|
|
38
|
+
* 4. DEFAULT_OUTPUT_PATH (.github/workflows)
|
|
39
|
+
*
|
|
40
|
+
* @param {Workflow} workflow - The workflow instance.
|
|
41
|
+
* @param {string} workflowFilePath - The source file path (e.g., "my-workflow.wac.ts").
|
|
42
|
+
* @param {WacConfig} config - The configuration object.
|
|
43
|
+
* @returns {string} - The resolved output directory path.
|
|
44
|
+
*/
|
|
45
|
+
export const resolveOutputPath = (workflow, workflowFilePath, config) => {
|
|
46
|
+
// 1. Check workflow-level outputPath (highest priority)
|
|
47
|
+
if (workflow.outputPath) {
|
|
48
|
+
return workflow.outputPath;
|
|
49
|
+
}
|
|
50
|
+
// 2. Check config overrides
|
|
51
|
+
const outputPathsConfig = config.outputPaths?.workflows;
|
|
52
|
+
if (outputPathsConfig?.overrides) {
|
|
53
|
+
const filename = path.basename(workflowFilePath);
|
|
54
|
+
for (const override of outputPathsConfig.overrides) {
|
|
55
|
+
// Match against both the full relative path and just the filename
|
|
56
|
+
// This allows patterns like "packages/app-a/**/*.wac.ts" or "deploy.wac.ts"
|
|
57
|
+
if (micromatch.isMatch(workflowFilePath, override.match) ||
|
|
58
|
+
micromatch.isMatch(filename, override.match)) {
|
|
59
|
+
return override.path;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// 3. Check config default
|
|
64
|
+
if (outputPathsConfig?.default) {
|
|
65
|
+
return outputPathsConfig.default;
|
|
66
|
+
}
|
|
67
|
+
// 4. Fall back to hardcoded default
|
|
68
|
+
return DEFAULT_OUTPUT_PATH;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Supported config file names in order of priority.
|
|
72
|
+
* TypeScript config takes precedence over JSON config.
|
|
73
|
+
*/
|
|
74
|
+
export const CONFIG_FILE_NAMES = ['wac.config.ts', 'wac.config.json'];
|
|
75
|
+
/**
|
|
76
|
+
* Returns the config file (synchronous version for JSON only)
|
|
77
|
+
* @returns {WacConfig | undefined} - The config file as an object
|
|
78
|
+
* @deprecated Use getConfigAsync for TypeScript config support
|
|
29
79
|
*/
|
|
30
80
|
export const getConfig = () => {
|
|
31
|
-
const
|
|
32
|
-
if (!fs.existsSync(
|
|
81
|
+
const jsonConfigPath = path.join(process.cwd(), 'wac.config.json');
|
|
82
|
+
if (!fs.existsSync(jsonConfigPath)) {
|
|
33
83
|
console.log('[github-actions-workflow-ts] No config (wac.config.json) file found in root dir. Using default config.');
|
|
34
84
|
return undefined;
|
|
35
85
|
}
|
|
36
86
|
console.log('[github-actions-workflow-ts] wac.config.json config file found in root dir');
|
|
37
|
-
return JSON.parse(fs.readFileSync(
|
|
87
|
+
return JSON.parse(fs.readFileSync(jsonConfigPath, 'utf-8'));
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Returns the config file, supporting both TypeScript and JSON formats.
|
|
91
|
+
* Priority: wac.config.ts > wac.config.json
|
|
92
|
+
*
|
|
93
|
+
* @returns {Promise<WacConfig | undefined>} - The config file as an object
|
|
94
|
+
*/
|
|
95
|
+
export const getConfigAsync = async () => {
|
|
96
|
+
const cwd = process.cwd();
|
|
97
|
+
// Check for TypeScript config first (higher priority)
|
|
98
|
+
const tsConfigPath = path.join(cwd, 'wac.config.ts');
|
|
99
|
+
if (fs.existsSync(tsConfigPath)) {
|
|
100
|
+
console.log('[github-actions-workflow-ts] wac.config.ts config file found in root dir');
|
|
101
|
+
const absolutePath = path.resolve(tsConfigPath);
|
|
102
|
+
const fileUrl = pathToFileURL(absolutePath).href;
|
|
103
|
+
const module = await import(fileUrl);
|
|
104
|
+
// Support both default export and named 'config' export
|
|
105
|
+
return module.default || module.config;
|
|
106
|
+
}
|
|
107
|
+
// Fall back to JSON config
|
|
108
|
+
const jsonConfigPath = path.join(cwd, 'wac.config.json');
|
|
109
|
+
if (fs.existsSync(jsonConfigPath)) {
|
|
110
|
+
console.log('[github-actions-workflow-ts] wac.config.json config file found in root dir');
|
|
111
|
+
return JSON.parse(fs.readFileSync(jsonConfigPath, 'utf-8'));
|
|
112
|
+
}
|
|
113
|
+
console.log('[github-actions-workflow-ts] No config file found in root dir. Using default config.');
|
|
114
|
+
return undefined;
|
|
38
115
|
};
|
|
39
116
|
/**
|
|
40
117
|
* Retrieves the file paths of all workflow files in the project.
|
|
@@ -45,6 +122,7 @@ export const getWorkflowFilePaths = () => {
|
|
|
45
122
|
const workflowFilesPaths = fg.sync(fg.convertPathToPattern(process.cwd()) + '/**/*.wac.ts', {
|
|
46
123
|
onlyFiles: true,
|
|
47
124
|
dot: true,
|
|
125
|
+
ignore: ['**/node_modules/**'],
|
|
48
126
|
});
|
|
49
127
|
if (!workflowFilesPaths || !workflowFilesPaths.length) {
|
|
50
128
|
console.log('[github-actions-workflow-ts] No workflow files found. Please create at least one *.wac.ts file in your project');
|
|
@@ -76,9 +154,10 @@ export const importWorkflowFile = async (filePath) => {
|
|
|
76
154
|
* @param {Record<string, Workflow>} workflowJSON - The workflow data in JSON format.
|
|
77
155
|
* @param {string} workflowFilePath - The path to the workflow file.
|
|
78
156
|
* @param {WacConfig} config - Command line arguments.
|
|
157
|
+
* @param {Set<string>} [createdDirectories] - Optional set to track directories that have been created.
|
|
79
158
|
* @returns {number} - The number of workflows written.
|
|
80
159
|
*/
|
|
81
|
-
export const writeWorkflowJSONToYamlFiles = (workflowJSON, workflowFilePath, config) => {
|
|
160
|
+
export const writeWorkflowJSONToYamlFiles = (workflowJSON, workflowFilePath, config, createdDirectories) => {
|
|
82
161
|
let workflowCount = 0;
|
|
83
162
|
for (const workflowName in workflowJSON) {
|
|
84
163
|
const workflow = workflowJSON[workflowName];
|
|
@@ -90,7 +169,14 @@ export const writeWorkflowJSONToYamlFiles = (workflowJSON, workflowFilePath, con
|
|
|
90
169
|
noRefs: !config.refs,
|
|
91
170
|
...(config.dumpOptions || {}),
|
|
92
171
|
});
|
|
93
|
-
|
|
172
|
+
// Resolve the output path for this workflow
|
|
173
|
+
const outputDir = resolveOutputPath(workflow, workflowFilePath, config);
|
|
174
|
+
// Create directory if not already created
|
|
175
|
+
if (createdDirectories && !createdDirectories.has(outputDir)) {
|
|
176
|
+
createWorkflowDirectory(outputDir);
|
|
177
|
+
createdDirectories.add(outputDir);
|
|
178
|
+
}
|
|
179
|
+
const yamlWorkflowPath = path.join(outputDir, `${workflow.filename}.yml`);
|
|
94
180
|
console.log(`[github-actions-workflow-ts] Writing to ${relativePath(yamlWorkflowPath)}:`);
|
|
95
181
|
const headerText = (config.headerText || DEFAULT_HEADER_TEXT)
|
|
96
182
|
.join('\n')
|
|
@@ -101,12 +187,14 @@ export const writeWorkflowJSONToYamlFiles = (workflowJSON, workflowFilePath, con
|
|
|
101
187
|
return workflowCount;
|
|
102
188
|
};
|
|
103
189
|
/**
|
|
104
|
-
* Creates the
|
|
190
|
+
* Creates the workflow output directory if it doesn't exist.
|
|
191
|
+
*
|
|
192
|
+
* @param {string} [outputPath] - Optional output path. Defaults to DEFAULT_OUTPUT_PATH.
|
|
105
193
|
*/
|
|
106
|
-
export const createWorkflowDirectory = () => {
|
|
107
|
-
const workflowsDir = relativePath(
|
|
194
|
+
export const createWorkflowDirectory = (outputPath = DEFAULT_OUTPUT_PATH) => {
|
|
195
|
+
const workflowsDir = relativePath(outputPath);
|
|
108
196
|
if (!fs.existsSync(workflowsDir)) {
|
|
109
|
-
console.log(
|
|
197
|
+
console.log(`[github-actions-workflow-ts] ${workflowsDir} directory not found. Creating it.`);
|
|
110
198
|
fs.mkdirSync(workflowsDir, { recursive: true });
|
|
111
199
|
}
|
|
112
200
|
};
|
|
@@ -117,10 +205,11 @@ export const createWorkflowDirectory = () => {
|
|
|
117
205
|
* @returns {Promise<void>} - A promise that resolves when the generation is completed.
|
|
118
206
|
*/
|
|
119
207
|
export const generateWorkflowFiles = async (argv) => {
|
|
120
|
-
const config =
|
|
208
|
+
const config = (await getConfigAsync()) || {};
|
|
121
209
|
const workflowFilePaths = getWorkflowFilePaths() || [];
|
|
122
210
|
let workflowCount = 0;
|
|
123
|
-
|
|
211
|
+
// Track created directories to avoid duplicate creation attempts
|
|
212
|
+
const createdDirectories = new Set();
|
|
124
213
|
Context.__internalSetGlobalContext({
|
|
125
214
|
diagnostics: new ConsoleDiagnosticsReporter(),
|
|
126
215
|
diagnosticRules: config.diagnostics?.rules,
|
|
@@ -130,7 +219,7 @@ export const generateWorkflowFiles = async (argv) => {
|
|
|
130
219
|
workflowCount += writeWorkflowJSONToYamlFiles(workflows, relativePath(filePath), {
|
|
131
220
|
...argv,
|
|
132
221
|
...config,
|
|
133
|
-
});
|
|
222
|
+
}, createdDirectories);
|
|
134
223
|
}
|
|
135
224
|
console.log(`[github-actions-workflow-ts] Successfully generated ${workflowCount} workflow file(s)`);
|
|
136
225
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OA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C,CAAA;IACjD,CAAC;AACH,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,IAA6B,EACd,EAAE;IACjB,MAAM,MAAM,GAAG,CAAC,MAAM,cAAc,EAAE,CAAC,IAAI,EAAE,CAAA;IAC7C,MAAM,iBAAiB,GAAG,oBAAoB,EAAE,IAAI,EAAE,CAAA;IACtD,IAAI,aAAa,GAAG,CAAC,CAAA;IAErB,iEAAiE;IACjE,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAA;IAE5C,OAAO,CAAC,0BAA0B,CAAC;QACjC,WAAW,EAAE,IAAI,0BAA0B,EAAE;QAC7C,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK;KAC3C,CAAC,CAAA;IAEF,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAA;QACpD,aAAa,IAAI,4BAA4B,CAC3C,SAAS,EACT,YAAY,CAAC,QAAQ,CAAC,EACtB;YACE,GAAG,IAAI;YACP,GAAG,MAAM;SACG,EACd,kBAAkB,CACnB,CAAA;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CACT,uDAAuD,aAAa,mBAAmB,CACxF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -25,6 +25,46 @@ export type DiagnosticsConfig = {
|
|
|
25
25
|
*/
|
|
26
26
|
rules?: Record<string, DiagnosticRuleConfig>;
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Override rule for output paths.
|
|
30
|
+
* Allows specifying custom output directories for specific workflow files.
|
|
31
|
+
*/
|
|
32
|
+
export type OutputPathOverride = {
|
|
33
|
+
/**
|
|
34
|
+
* Pattern to match against workflow source files.
|
|
35
|
+
* Supports both filename patterns and full path patterns.
|
|
36
|
+
* Examples:
|
|
37
|
+
* - Filename: "app-a-deploy.wac.ts", "*-release.wac.ts"
|
|
38
|
+
* - Full path: "packages/app-a/**.wac.ts", "src/workflows/*.wac.ts"
|
|
39
|
+
*/
|
|
40
|
+
match: string;
|
|
41
|
+
/**
|
|
42
|
+
* Output directory path for matching workflow files.
|
|
43
|
+
* Can be relative or absolute.
|
|
44
|
+
*/
|
|
45
|
+
path: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Configuration for custom output paths.
|
|
49
|
+
* Allows workflows to be written to different directories.
|
|
50
|
+
*/
|
|
51
|
+
export type OutputPathsConfig = {
|
|
52
|
+
/**
|
|
53
|
+
* Configuration for workflow file output paths.
|
|
54
|
+
*/
|
|
55
|
+
workflows?: {
|
|
56
|
+
/**
|
|
57
|
+
* Default output directory for workflow files.
|
|
58
|
+
* Defaults to ".github/workflows" if not specified.
|
|
59
|
+
*/
|
|
60
|
+
default?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Override rules for specific workflow files.
|
|
63
|
+
* Checked in order; first match wins.
|
|
64
|
+
*/
|
|
65
|
+
overrides?: OutputPathOverride[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
28
68
|
export type WacConfig = {
|
|
29
69
|
refs?: boolean;
|
|
30
70
|
headerText?: string[];
|
|
@@ -33,5 +73,10 @@ export type WacConfig = {
|
|
|
33
73
|
* Configuration for diagnostics/warnings emitted during build.
|
|
34
74
|
*/
|
|
35
75
|
diagnostics?: DiagnosticsConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Configuration for custom output paths.
|
|
78
|
+
* Allows workflows to be written to different directories based on filename patterns.
|
|
79
|
+
*/
|
|
80
|
+
outputPaths?: OutputPathsConfig;
|
|
36
81
|
};
|
|
37
82
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/types/build.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO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AM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB;;;WAGG;QACH,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAA;KACjC,CAAA;CACF,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B;;;OAGG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAA;CAChC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@github-actions-workflow-ts/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0-beta.1",
|
|
4
4
|
"description": "CLI to generate GitHub Actions YAML from TypeScript workflow files",
|
|
5
5
|
"author": "Emmanuel N Kyeyune",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"fast-glob": "^3.3.2",
|
|
34
34
|
"js-yaml": "^4.1.0",
|
|
35
|
+
"micromatch": "^4.0.8",
|
|
35
36
|
"tsx": "^4.19.3",
|
|
36
37
|
"yargs": "^17.7.2",
|
|
37
|
-
"@github-actions-workflow-ts/lib": "2.
|
|
38
|
+
"@github-actions-workflow-ts/lib": "2.4.0-beta.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@jest/globals": "^29.7.0",
|
|
41
42
|
"@types/js-yaml": "^4.0.9",
|
|
43
|
+
"@types/micromatch": "^4.0.10",
|
|
42
44
|
"@types/node": "^22.10.1",
|
|
43
45
|
"@types/yargs": "^17.0.33",
|
|
44
46
|
"typescript": "^5.7.2"
|