|
9 | 9 | REPLACEABLE_FILES, |
10 | 10 | type TemplateVariables, |
11 | 11 | } from './constants.js'; |
| 12 | +import { DOCKER_CI_WORKFLOW_TEMPLATE } from './docker-ci-workflow-template.js'; |
12 | 13 |
|
13 | 14 | const TESTING_SCRIPTS = [ |
14 | 15 | 'test', |
@@ -42,6 +43,7 @@ const TESTING_FILE_PATTERNS = [ |
42 | 43 | const TS_CONFIG_FILE_PATTERN = /^tsconfig(?:\.[^.]+)?\.json$/; |
43 | 44 | const AGENT_DOC_TARGETS = ['CLAUDE.md', 'AGENTS.md']; |
44 | 45 | const CI_WORKFLOW_RELATIVE_PATH = '.github/workflows/ci.yml'; |
| 46 | +const DOCKER_CI_WORKFLOW_RELATIVE_PATH = '.github/workflows/docker-build.yml'; |
45 | 47 |
|
46 | 48 | const MARKER_FILES = [ |
47 | 49 | 'apps/api/src/app.ts', |
@@ -283,6 +285,7 @@ async function applyFeatureTransforms( |
283 | 285 | } |
284 | 286 |
|
285 | 287 | await transformCiWorkflow(targetDir, disabledFeatures); |
| 288 | + await transformDockerCiWorkflow(targetDir, features); |
286 | 289 | await transformAgentDocs(targetDir, disabledFeatures); |
287 | 290 | } |
288 | 291 |
|
@@ -515,3 +518,21 @@ async function transformCiWorkflow( |
515 | 518 | content = cleanEmptyLines(content).trimEnd() + '\n'; |
516 | 519 | await fs.writeFile(workflowPath, content, 'utf-8'); |
517 | 520 | } |
| 521 | + |
| 522 | +async function transformDockerCiWorkflow( |
| 523 | + targetDir: string, |
| 524 | + features: FeatureOptions |
| 525 | +): Promise<void> { |
| 526 | + const workflowPath = path.join(targetDir, DOCKER_CI_WORKFLOW_RELATIVE_PATH); |
| 527 | + |
| 528 | + if (!features.dockerDeploy) { |
| 529 | + if (await fs.pathExists(workflowPath)) { |
| 530 | + await fs.remove(workflowPath); |
| 531 | + } |
| 532 | + return; |
| 533 | + } |
| 534 | + |
| 535 | + await fs.ensureDir(path.dirname(workflowPath)); |
| 536 | + const content = DOCKER_CI_WORKFLOW_TEMPLATE.trimEnd() + '\n'; |
| 537 | + await fs.writeFile(workflowPath, content, 'utf-8'); |
| 538 | +} |
0 commit comments