pipecraft 0.28.2 → 0.29.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/README.md +5 -2
- package/dist/cli/index.js +1 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/generators/init.tpl.d.ts.map +1 -1
- package/dist/generators/init.tpl.js +140 -67
- package/dist/generators/init.tpl.js.map +1 -1
- package/dist/generators/workflows.tpl.d.ts.map +1 -1
- package/dist/generators/workflows.tpl.js +18 -5
- package/dist/generators/workflows.tpl.js.map +1 -1
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts +32 -0
- package/dist/templates/actions/detect-changes-nx.yml.tpl.d.ts.map +1 -0
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js +227 -0
- package/dist/templates/actions/detect-changes-nx.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts +22 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.d.ts.map +1 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js +196 -0
- package/dist/templates/workflows/pipeline-nx.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts +22 -0
- package/dist/templates/workflows/pipeline.yml.tpl.d.ts.map +1 -0
- package/dist/templates/workflows/pipeline.yml.tpl.js +136 -0
- package/dist/templates/workflows/pipeline.yml.tpl.js.map +1 -0
- package/dist/templates/workflows/shared/index.d.ts +11 -0
- package/dist/templates/workflows/shared/index.d.ts.map +1 -0
- package/dist/templates/workflows/shared/index.js +11 -0
- package/dist/templates/workflows/shared/index.js.map +1 -0
- package/dist/templates/workflows/shared/operations-changes.d.ts +17 -0
- package/dist/templates/workflows/shared/operations-changes.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-changes.js +49 -0
- package/dist/templates/workflows/shared/operations-changes.js.map +1 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts +31 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.js +139 -0
- package/dist/templates/workflows/shared/operations-domain-jobs.js.map +1 -0
- package/dist/templates/workflows/shared/operations-header.d.ts +15 -0
- package/dist/templates/workflows/shared/operations-header.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-header.js +158 -0
- package/dist/templates/workflows/shared/operations-header.js.map +1 -0
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts +16 -0
- package/dist/templates/workflows/shared/operations-tag-promote.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-tag-promote.js +115 -0
- package/dist/templates/workflows/shared/operations-tag-promote.js.map +1 -0
- package/dist/templates/workflows/shared/operations-version.d.ts +16 -0
- package/dist/templates/workflows/shared/operations-version.d.ts.map +1 -0
- package/dist/templates/workflows/shared/operations-version.js +57 -0
- package/dist/templates/workflows/shared/operations-version.js.map +1 -0
- package/dist/templates/yaml-format-utils.d.ts +24 -0
- package/dist/templates/yaml-format-utils.d.ts.map +1 -0
- package/dist/templates/yaml-format-utils.js +50 -0
- package/dist/templates/yaml-format-utils.js.map +1 -0
- package/dist/types/index.d.ts +53 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/generators/init.tpl.ts +151 -73
- package/src/generators/workflows.tpl.ts +19 -5
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts +0 -129
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.d.ts.map +0 -1
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js +0 -1057
- package/dist/templates/workflows/pipeline-path-based.yml.tpl.js.map +0 -1
- package/dist/utils/github-setup-v2.d.ts +0 -15
- package/dist/utils/github-setup-v2.d.ts.map +0 -1
- package/dist/utils/github-setup-v2.js +0 -217
- package/dist/utils/github-setup-v2.js.map +0 -1
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Path-Based Pipeline Template Generator
|
|
3
|
-
*
|
|
4
|
-
* The core template that generates the main CI/CD pipeline workflow for PipeCraft.
|
|
5
|
-
* This is the most complex template in the system, responsible for creating a
|
|
6
|
-
* GitHub Actions workflow that orchestrates the entire trunk-based development flow.
|
|
7
|
-
*
|
|
8
|
-
* ## Key Responsibilities
|
|
9
|
-
*
|
|
10
|
-
* 1. **Change Detection**: Generates jobs to detect which domains (api, web, libs, etc.) changed
|
|
11
|
-
* 2. **Test Execution**: Creates domain-specific test jobs based on changes
|
|
12
|
-
* 3. **Version Management**: Integrates semantic versioning for staging/production branches
|
|
13
|
-
* 4. **Branch Promotion**: Auto-promotes code through branch flow (develop → staging → main)
|
|
14
|
-
* 5. **User Job Preservation**: Maintains user-added custom jobs during regeneration
|
|
15
|
-
* 6. **Comment Preservation**: Retains user comments when updating workflows
|
|
16
|
-
*
|
|
17
|
-
* ## Intelligent Merging
|
|
18
|
-
*
|
|
19
|
-
* The generator distinguishes between:
|
|
20
|
-
* - **Pipecraft-owned jobs**: `changes`, `version`, `tag`, `promote`, `release`, `test-*`, `deploy-*`
|
|
21
|
-
* - **User jobs**: Any jobs not owned by Pipecraft
|
|
22
|
-
*
|
|
23
|
-
* During regeneration:
|
|
24
|
-
* - Pipecraft jobs are completely replaced with template versions
|
|
25
|
-
* - User jobs are preserved exactly as-is
|
|
26
|
-
* - User comments are maintained
|
|
27
|
-
* - Job order is intelligently managed (Pipecraft jobs first, then user jobs)
|
|
28
|
-
*
|
|
29
|
-
* ## Architecture
|
|
30
|
-
*
|
|
31
|
-
* Uses AST-based path operations for surgical YAML manipulation:
|
|
32
|
-
* - Parse existing workflow into AST
|
|
33
|
-
* - Apply precise path-based operations
|
|
34
|
-
* - Preserve formatting and comments
|
|
35
|
-
* - Rebuild YAML maintaining structure
|
|
36
|
-
*
|
|
37
|
-
* @module templates/workflows/pipeline-path-based.yml.tpl
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* import { generate } from './templates/workflows/pipeline-path-based.yml.tpl.js'
|
|
42
|
-
*
|
|
43
|
-
* // Initial generation
|
|
44
|
-
* await generate({
|
|
45
|
-
* cwd: '/path/to/project',
|
|
46
|
-
* branchFlow: ['develop', 'staging', 'main'],
|
|
47
|
-
* domains: {
|
|
48
|
-
* api: { paths: ['src/api/**'], test: true },
|
|
49
|
-
* web: { paths: ['src/web/**'], test: true }
|
|
50
|
-
* }
|
|
51
|
-
* })
|
|
52
|
-
*
|
|
53
|
-
* // Incremental update (preserves user jobs)
|
|
54
|
-
* await generate({
|
|
55
|
-
* cwd: '/path/to/project',
|
|
56
|
-
* existingPipeline: parsedYAML,
|
|
57
|
-
* existingPipelineContent: rawYAMLString,
|
|
58
|
-
* branchFlow: ['develop', 'staging', 'main'],
|
|
59
|
-
* domains: { ... }
|
|
60
|
-
* })
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @see {@link module:utils/ast-path-operations} for YAML manipulation details
|
|
64
|
-
*/
|
|
65
|
-
import { PinionContext } from '@featherscloud/pinion';
|
|
66
|
-
/**
|
|
67
|
-
* Create path-based pipeline content
|
|
68
|
-
*/
|
|
69
|
-
export declare const createPathBasedPipeline: (ctx: any) => {
|
|
70
|
-
yamlContent: string;
|
|
71
|
-
mergeStatus: string;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Main pipeline generator entry point.
|
|
75
|
-
*
|
|
76
|
-
* Generates the complete GitHub Actions pipeline workflow with intelligent
|
|
77
|
-
* merging of existing user customizations.
|
|
78
|
-
*
|
|
79
|
-
* @param {PinionContext & { existingPipeline?: any, outputPipelinePath?: string }} ctx - Generator context
|
|
80
|
-
* @param {any} [ctx.existingPipeline] - Parsed existing pipeline YAML for merging
|
|
81
|
-
* @param {string} [ctx.existingPipelineContent] - Raw existing pipeline content for comment preservation
|
|
82
|
-
* @param {string} [ctx.outputPipelinePath] - Custom output path (default: .github/workflows/pipeline.yml)
|
|
83
|
-
* @param {string[]} ctx.branchFlow - Branch flow sequence (e.g., ['develop', 'staging', 'main'])
|
|
84
|
-
* @param {Record<string, DomainConfig>} ctx.domains - Domain configurations for change detection
|
|
85
|
-
* @param {string} [ctx.ciProvider] - CI provider ('github' or 'gitlab')
|
|
86
|
-
* @param {string} [ctx.mergeStrategy] - Merge strategy ('fast-forward' or 'merge')
|
|
87
|
-
* @returns {Promise<PinionContext>} Updated context with generated YAML
|
|
88
|
-
*
|
|
89
|
-
* @throws {Error} If pipeline file cannot be written
|
|
90
|
-
* @throws {Error} If existing pipeline cannot be parsed
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* // Generate new pipeline
|
|
95
|
-
* await generate({
|
|
96
|
-
* cwd: '/path/to/project',
|
|
97
|
-
* branchFlow: ['develop', 'main'],
|
|
98
|
-
* domains: {
|
|
99
|
-
* api: { paths: ['src/api/**'], test: true }
|
|
100
|
-
* }
|
|
101
|
-
* })
|
|
102
|
-
*
|
|
103
|
-
* // Update existing pipeline (preserves user jobs)
|
|
104
|
-
* const existing = parseDocument(readFileSync('pipeline.yml', 'utf8'))
|
|
105
|
-
* await generate({
|
|
106
|
-
* cwd: '/path/to/project',
|
|
107
|
-
* existingPipeline: existing,
|
|
108
|
-
* existingPipelineContent: readFileSync('pipeline.yml', 'utf8'),
|
|
109
|
-
* branchFlow: ['develop', 'staging', 'main'],
|
|
110
|
-
* domains: { ... }
|
|
111
|
-
* })
|
|
112
|
-
* ```
|
|
113
|
-
*
|
|
114
|
-
* @note The generator performs these steps:
|
|
115
|
-
* 1. Calls `createPathBasedPipeline()` to build the workflow
|
|
116
|
-
* 2. Logs merge status (new vs. merged)
|
|
117
|
-
* 3. Writes the final YAML to the output path
|
|
118
|
-
*
|
|
119
|
-
* The heavy lifting is done by `createPathBasedPipeline()` which handles:
|
|
120
|
-
* - Job generation based on domains and branch flow
|
|
121
|
-
* - User job preservation and merging
|
|
122
|
-
* - Comment preservation from existing pipeline
|
|
123
|
-
* - Intelligent job ordering
|
|
124
|
-
*/
|
|
125
|
-
export declare const generate: (ctx: PinionContext & {
|
|
126
|
-
existingPipeline?: any;
|
|
127
|
-
outputPipelinePath?: string;
|
|
128
|
-
}) => Promise<any>;
|
|
129
|
-
//# sourceMappingURL=pipeline-path-based.yml.tpl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-path-based.yml.tpl.d.ts","sourceRoot":"","sources":["../../../src/templates/workflows/pipeline-path-based.yml.tpl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AAEH,OAAO,EAAE,aAAa,EAA0B,MAAM,uBAAuB,CAAA;AAsD7E;;GAEG;AACH,eAAO,MAAM,uBAAuB,GAAI,KAAK,GAAG;;;CAm5B/C,CAAA;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,aAAa,GAAG;IAAE,gBAAgB,CAAC,EAAE,GAAG,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,iBAoB/F,CAAA"}
|