@payfit/nx-core 5.0.2-ephemeral-vibe-code-spacelift-stack-manager.4 → 5.0.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/src/executors/docker-build/executor.js +3 -6
- package/dist/src/executors/docker-build/executor.js.map +1 -1
- package/dist/src/executors/docker-build/schema.json +5 -0
- package/dist/src/executors/publisher/docker.js +1 -1
- package/dist/src/executors/publisher/docker.js.map +1 -1
- package/dist/src/executors/publisher/executor.js.map +1 -1
- package/dist/src/executors/publisher/frontend.js +1 -2
- package/dist/src/executors/publisher/frontend.js.map +1 -1
- package/dist/src/executors/publisher/helm.js +5 -3
- package/dist/src/executors/publisher/helm.js.map +1 -1
- package/dist/src/executors/publisher/lambda.js +13 -16
- package/dist/src/executors/publisher/lambda.js.map +1 -1
- package/dist/src/executors/publisher/schema.json +5 -0
- package/dist/src/executors/release/executor.js +2 -0
- package/dist/src/executors/release/executor.js.map +1 -1
- package/dist/src/generators/init/globalFiles/.circleci/config.yml.template +1 -4
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.js +116 -54
- package/dist/src/index.js.map +1 -1
- package/dist/src/scripts/nx-core-updater.js +60 -312
- package/dist/src/utils/common/ecr.js +9 -29
- package/dist/src/utils/common/ecr.js.map +1 -1
- package/dist/src/utils/common/nx.d.ts +1 -3
- package/dist/src/utils/common/nx.js +0 -25
- package/dist/src/utils/common/nx.js.map +1 -1
- package/dist/src/utils/common/oci.d.ts +3 -17
- package/dist/src/utils/common/oci.js +4 -36
- package/dist/src/utils/common/oci.js.map +1 -1
- package/dist/src/utils/docker.d.ts +2 -2
- package/dist/src/utils/docker.js +11 -9
- package/dist/src/utils/docker.js.map +1 -1
- package/dist/src/utils/helm.d.ts +1 -1
- package/dist/src/utils/helm.js +6 -11
- package/dist/src/utils/helm.js.map +1 -1
- package/dist/src/utils/helm.mock.d.ts +85 -0
- package/dist/src/utils/helm.mock.js +100 -0
- package/dist/src/utils/helm.mock.js.map +1 -0
- package/dist/src/utils/spacelift/lib/__generated__/gql.js +1 -1
- package/dist/src/utils/spacelift/lib/__generated__/graphql.d.ts +45 -42
- package/dist/src/utils/spacelift/lib/__generated__/graphql.js +3 -3
- package/dist/src/utils/spacelift/lib/__generated__/graphql.js.map +1 -1
- package/executors.json +4 -4
- package/generators.json +0 -5
- package/migrations.json +0 -5
- package/package.json +3 -4
- package/dist/src/executors/publisher/schema.d.ts +0 -26
- package/dist/src/executors/publisher/schema.js +0 -3
- package/dist/src/executors/publisher/schema.js.map +0 -1
- package/dist/src/executors/spacelift-stack-management/executor.d.ts +0 -4
- package/dist/src/executors/spacelift-stack-management/executor.js +0 -195
- package/dist/src/executors/spacelift-stack-management/executor.js.map +0 -1
- package/dist/src/executors/spacelift-stack-management/schema.json +0 -31
- package/dist/src/generators/local-lambda-setup/files/docker-compose/docker-compose.yml.template +0 -21
- package/dist/src/generators/local-lambda-setup/files/scripts/invoke_lambda_local.sh.template +0 -97
- package/dist/src/generators/local-lambda-setup/local-lambda-setup.d.ts +0 -25
- package/dist/src/generators/local-lambda-setup/local-lambda-setup.js +0 -167
- package/dist/src/generators/local-lambda-setup/local-lambda-setup.js.map +0 -1
- package/dist/src/generators/local-lambda-setup/schema.json +0 -24
- package/dist/src/migrations/20251029-nx-conformance-requirement-publish.d.ts +0 -2
- package/dist/src/migrations/20251029-nx-conformance-requirement-publish.js +0 -85
- package/dist/src/migrations/20251029-nx-conformance-requirement-publish.js.map +0 -1
- package/dist/src/utils/common/enums.d.ts +0 -7
- package/dist/src/utils/common/enums.js +0 -12
- package/dist/src/utils/common/enums.js.map +0 -1
|
@@ -7,19 +7,9 @@ const { promisify } = require('util')
|
|
|
7
7
|
|
|
8
8
|
const execAsync = promisify(exec)
|
|
9
9
|
|
|
10
|
-
// Configuration
|
|
11
|
-
const NX_CORE_VERSION = '
|
|
12
|
-
const NX_VERSION = '22.0.2' // e.g. '21.3.11'
|
|
13
|
-
const CHANGELOG_MODE = 'combined' // 'combined' | 'raw'
|
|
14
|
-
|
|
15
|
-
// Read optional Jira ticket URL from env only
|
|
16
|
-
const JIRA_TICKET_URL = undefined
|
|
17
|
-
|
|
18
|
-
// Collect PR URLs created during this run
|
|
19
|
-
const CREATED_PR_URLS = []
|
|
20
|
-
|
|
10
|
+
// Configuration
|
|
11
|
+
const NX_CORE_VERSION = '4.60.1'
|
|
21
12
|
const REPOSITORIES = [
|
|
22
|
-
'appsec',
|
|
23
13
|
'authorization',
|
|
24
14
|
'company-lifecycle',
|
|
25
15
|
'core-platform',
|
|
@@ -32,7 +22,6 @@ const REPOSITORIES = [
|
|
|
32
22
|
'jetlang',
|
|
33
23
|
'organization-structure',
|
|
34
24
|
'payfit-domains',
|
|
35
|
-
'payroll',
|
|
36
25
|
'talent-management',
|
|
37
26
|
'time-absences',
|
|
38
27
|
]
|
|
@@ -79,208 +68,117 @@ async function run(command, cwd = process.cwd()) {
|
|
|
79
68
|
}
|
|
80
69
|
}
|
|
81
70
|
|
|
82
|
-
// Check if
|
|
83
|
-
async function
|
|
71
|
+
// Check if package.json exists and needs update
|
|
72
|
+
async function needsUpdate(repoPath) {
|
|
84
73
|
try {
|
|
85
74
|
const packageJsonPath = path.join(repoPath, 'package.json')
|
|
86
75
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
|
|
87
76
|
const currentVersion = packageJson.devDependencies?.['@payfit/nx-core']
|
|
88
77
|
|
|
89
78
|
if (!currentVersion) {
|
|
90
|
-
console.log(
|
|
79
|
+
console.log(` ℹ @payfit/nx-core not found in devDependencies`)
|
|
91
80
|
return { needsUpdate: false, currentVersion: null }
|
|
92
81
|
}
|
|
93
82
|
|
|
94
83
|
if (compareVersions(currentVersion, NX_CORE_VERSION) === 0) {
|
|
95
|
-
console.log(
|
|
96
|
-
return { needsUpdate: false, currentVersion }
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
console.log(
|
|
100
|
-
`📦 Current version: ${currentVersion}, target: ${NX_CORE_VERSION}`,
|
|
101
|
-
)
|
|
102
|
-
return { needsUpdate: true, currentVersion }
|
|
103
|
-
} catch (error) {
|
|
104
|
-
console.error(`❌ Could not read package.json: ${error.message}`)
|
|
105
|
-
return { needsUpdate: false, currentVersion: null }
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// Check if Nx in package.json needs update
|
|
110
|
-
async function needsNxUpdate(repoPath) {
|
|
111
|
-
if (!NX_VERSION) {
|
|
112
|
-
return { needsUpdate: false, currentVersion: null }
|
|
113
|
-
}
|
|
114
|
-
try {
|
|
115
|
-
const packageJsonPath = path.join(repoPath, 'package.json')
|
|
116
|
-
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
|
|
117
|
-
const currentVersion =
|
|
118
|
-
packageJson.devDependencies?.['nx'] ?? packageJson.dependencies?.['nx']
|
|
119
|
-
|
|
120
|
-
if (!currentVersion) {
|
|
121
|
-
console.log(`ℹ nx not found in package.json`)
|
|
122
|
-
return { needsUpdate: false, currentVersion: null }
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (compareVersions(currentVersion, NX_VERSION) === 0) {
|
|
126
|
-
console.log(`ℹ Nx already on version ${NX_VERSION}`)
|
|
84
|
+
console.log(` ℹ Already on version ${NX_CORE_VERSION}`)
|
|
127
85
|
return { needsUpdate: false, currentVersion }
|
|
128
86
|
}
|
|
129
87
|
|
|
130
88
|
console.log(
|
|
131
|
-
|
|
89
|
+
` 📦 Current version: ${currentVersion}, target: ${NX_CORE_VERSION}`,
|
|
132
90
|
)
|
|
133
91
|
return { needsUpdate: true, currentVersion }
|
|
134
92
|
} catch (error) {
|
|
135
|
-
console.error(
|
|
93
|
+
console.error(` ❌ Could not read package.json: ${error.message}`)
|
|
136
94
|
return { needsUpdate: false, currentVersion: null }
|
|
137
95
|
}
|
|
138
96
|
}
|
|
139
97
|
|
|
140
98
|
// Process a single repository
|
|
141
99
|
async function processRepo(repoName) {
|
|
142
|
-
console.log(
|
|
100
|
+
console.log(`\n🚀 Processing ${repoName}`)
|
|
143
101
|
|
|
144
102
|
const repoPath = path.join(WORK_DIR, repoName)
|
|
145
103
|
|
|
146
104
|
try {
|
|
147
105
|
// Clone repo
|
|
148
|
-
console.log(
|
|
106
|
+
console.log(` 📥 Cloning repository...`)
|
|
149
107
|
await run(
|
|
150
108
|
`git clone https://github.com/PayFit/${repoName}.git ${repoPath}`,
|
|
151
109
|
WORK_DIR,
|
|
152
110
|
)
|
|
153
111
|
|
|
154
|
-
// Check if
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
])
|
|
159
|
-
if (!nxCoreUpdateInfo.needsUpdate && !nxUpdateInfo.needsUpdate) {
|
|
160
|
-
console.log(`⏭️ Skipping ${repoName} - no update needed`)
|
|
112
|
+
// Check if update needed
|
|
113
|
+
const updateInfo = await needsUpdate(repoPath)
|
|
114
|
+
if (!updateInfo.needsUpdate) {
|
|
115
|
+
console.log(` ⏭️ Skipping ${repoName} - no update needed`)
|
|
161
116
|
return
|
|
162
117
|
}
|
|
163
118
|
|
|
164
|
-
// Get changelogs between current and target version
|
|
165
|
-
const releaseNotes =
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
)
|
|
170
|
-
: ''
|
|
119
|
+
// Get changelogs between current and target version
|
|
120
|
+
const releaseNotes = await getChangelogBetweenVersions(
|
|
121
|
+
updateInfo.currentVersion,
|
|
122
|
+
NX_CORE_VERSION,
|
|
123
|
+
)
|
|
171
124
|
|
|
172
125
|
// Create branch
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
branchNameParts.push(`nx-core-v${NX_CORE_VERSION}`)
|
|
176
|
-
if (nxUpdateInfo.needsUpdate) branchNameParts.push(`nx-v${NX_VERSION}`)
|
|
177
|
-
const branchName = branchNameParts.join('-') || `nx-maintenance`
|
|
178
|
-
console.log(`🌿 Creating branch ${branchName}`)
|
|
126
|
+
const branchName = `nx-core-v${NX_CORE_VERSION}`
|
|
127
|
+
console.log(` 🌿 Creating branch ${branchName}`)
|
|
179
128
|
await run('git checkout main', repoPath)
|
|
180
129
|
await run(`git checkout -b ${branchName}`, repoPath)
|
|
181
130
|
|
|
182
131
|
// Install dependencies and migrate
|
|
183
|
-
console.log(
|
|
132
|
+
console.log(` 📦 Installing dependencies...`)
|
|
184
133
|
await run('yarn', repoPath)
|
|
185
134
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
console.log(`🔄 Planning Nx migration to version ${NX_VERSION}...`)
|
|
189
|
-
await run(`yarn nx migrate 'nx@${NX_VERSION}'`, repoPath)
|
|
190
|
-
}
|
|
191
|
-
if (nxCoreUpdateInfo.needsUpdate) {
|
|
192
|
-
console.log(
|
|
193
|
-
`🔄 Planning nx-core migration to version ${NX_CORE_VERSION}...`,
|
|
194
|
-
)
|
|
195
|
-
await run(
|
|
196
|
-
`yarn nx migrate '@payfit/nx-core@${NX_CORE_VERSION}'`,
|
|
197
|
-
repoPath,
|
|
198
|
-
)
|
|
199
|
-
}
|
|
135
|
+
console.log(` 🔄 Migrating nx-core to version ${NX_CORE_VERSION}...`)
|
|
136
|
+
await run(`yarn nx migrate '@payfit/nx-core@${NX_CORE_VERSION}'`, repoPath)
|
|
200
137
|
|
|
201
|
-
console.log(
|
|
138
|
+
console.log(` 📦 Installing dependencies after migration...`)
|
|
202
139
|
await run('yarn', repoPath)
|
|
203
140
|
|
|
204
|
-
console.log(
|
|
141
|
+
console.log(` 📦 Run migrations...`)
|
|
205
142
|
await run(`yarn nx migrate --run-migrations --ifExists`, repoPath)
|
|
206
143
|
|
|
207
|
-
// If targeting Nx >= 22, ensure nx.json release.version.updateDependents = "auto"
|
|
208
|
-
if (nxUpdateInfo.needsUpdate && NX_VERSION) {
|
|
209
|
-
const major = parseInt(extractVersion(NX_VERSION).split('.')[0], 10) || 0
|
|
210
|
-
if (major >= 22) {
|
|
211
|
-
console.log(
|
|
212
|
-
`🔧 Ensuring nx.json has release.version.updateDependents = "auto" for Nx >= 22...`,
|
|
213
|
-
)
|
|
214
|
-
const nxJsonChanged = await ensureUpdateDependentsAuto(repoPath)
|
|
215
|
-
if (nxJsonChanged) {
|
|
216
|
-
console.log('🧹 Formatting workspace (npx nx format)...')
|
|
217
|
-
await run('npx nx format', repoPath)
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
144
|
// Stage, commit and push
|
|
223
|
-
console.log(
|
|
145
|
+
console.log(` 📝 Staging and committing changes...`)
|
|
224
146
|
await run('git add .', repoPath)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
if (nxCoreUpdateInfo.needsUpdate) {
|
|
232
|
-
commitParts.push(
|
|
233
|
-
`chore(nx-core): update nx-core from ${nxCoreUpdateInfo.currentVersion} to ${NX_CORE_VERSION}`,
|
|
234
|
-
)
|
|
235
|
-
}
|
|
236
|
-
const commitMessage = commitParts.join('')
|
|
237
|
-
await run(`git commit -m ${JSON.stringify(commitMessage)}`, repoPath)
|
|
238
|
-
await run(`git push -q origin ${branchName}`, repoPath)
|
|
147
|
+
await run(
|
|
148
|
+
`git commit -m "chore(nx-core): update nx-core from ${updateInfo.currentVersion} to ${NX_CORE_VERSION}"`,
|
|
149
|
+
repoPath,
|
|
150
|
+
)
|
|
151
|
+
await run(`git push origin ${branchName}`, repoPath)
|
|
239
152
|
|
|
240
153
|
// Create PR if it doesn't exist
|
|
241
|
-
console.log(
|
|
154
|
+
console.log(` 🔍 Checking for existing pull requests...`)
|
|
242
155
|
const existingPRs = await run(
|
|
243
156
|
`gh pr list --repo PayFit/${repoName} --head ${branchName} --json number`,
|
|
244
157
|
)
|
|
245
158
|
if (JSON.parse(existingPRs).length === 0) {
|
|
246
|
-
console.log(
|
|
159
|
+
console.log(` 📋 Creating pull request...`)
|
|
247
160
|
|
|
248
161
|
// Create PR body with release notes
|
|
249
|
-
const
|
|
250
|
-
if (nxUpdateInfo.needsUpdate) prTitleParts.push(`Nx to v${NX_VERSION}`)
|
|
251
|
-
if (nxCoreUpdateInfo.needsUpdate)
|
|
252
|
-
prTitleParts.push(`@payfit/nx-core to v${NX_CORE_VERSION}`)
|
|
253
|
-
const prTitle = `chore(nx): update ${prTitleParts.join(' and ')}`
|
|
254
|
-
|
|
255
|
-
let prBody = ''
|
|
256
|
-
if (nxUpdateInfo.needsUpdate) {
|
|
257
|
-
prBody += `Update Nx from ${nxUpdateInfo.currentVersion} to ${NX_VERSION}\n\n`
|
|
258
|
-
}
|
|
259
|
-
if (nxCoreUpdateInfo.needsUpdate) {
|
|
260
|
-
prBody += `Update @payfit/nx-core from ${nxCoreUpdateInfo.currentVersion} to ${NX_CORE_VERSION}\n\n`
|
|
261
|
-
prBody += `## Changelog\n\n${releaseNotes}\n`
|
|
262
|
-
}
|
|
162
|
+
const prBody = `Update @payfit/nx-core from ${updateInfo.currentVersion} to ${NX_CORE_VERSION}
|
|
263
163
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
164
|
+
## Changelog
|
|
165
|
+
|
|
166
|
+
${releaseNotes}
|
|
167
|
+
`
|
|
267
168
|
|
|
268
169
|
// Write PR body to a file to preserve formatting (newlines, markdown)
|
|
269
170
|
const prBodyPath = path.join(repoPath, 'nx-core-pr-body.md')
|
|
270
171
|
await fs.writeFile(prBodyPath, prBody, 'utf8')
|
|
271
172
|
|
|
272
|
-
|
|
273
|
-
`gh pr create --repo PayFit/${repoName} --title ${
|
|
274
|
-
prTitle,
|
|
275
|
-
)} --body-file "${prBodyPath}" --head ${branchName}`,
|
|
173
|
+
await run(
|
|
174
|
+
`gh pr create --repo PayFit/${repoName} --title "chore(nx-core): update nx-core from ${updateInfo.currentVersion} to ${NX_CORE_VERSION}" --body-file "${prBodyPath}" --head ${branchName}`,
|
|
276
175
|
)
|
|
277
|
-
|
|
278
|
-
console.log(`✅ Successfully created PR for ${repoName}: ${prUrl}`)
|
|
176
|
+
console.log(` ✅ Successfully created PR for ${repoName}`)
|
|
279
177
|
} else {
|
|
280
|
-
console.log(
|
|
178
|
+
console.log(` ℹ️ PR already exists for ${repoName}`)
|
|
281
179
|
}
|
|
282
180
|
} catch (error) {
|
|
283
|
-
console.error(
|
|
181
|
+
console.error(` ❌ Failed to process ${repoName}: ${error.message}`)
|
|
284
182
|
throw error
|
|
285
183
|
}
|
|
286
184
|
}
|
|
@@ -289,7 +187,7 @@ async function processRepo(repoName) {
|
|
|
289
187
|
async function getChangelogBetweenVersions(currentVersion, targetVersion) {
|
|
290
188
|
try {
|
|
291
189
|
console.log(
|
|
292
|
-
|
|
190
|
+
` 📋 Fetching changelogs from ${currentVersion} to ${targetVersion}...`,
|
|
293
191
|
)
|
|
294
192
|
|
|
295
193
|
// Get only nx-core releases from the repository, filtered at CLI level
|
|
@@ -324,178 +222,36 @@ async function getChangelogBetweenVersions(currentVersion, targetVersion) {
|
|
|
324
222
|
|
|
325
223
|
// Fetch detailed release notes for each relevant release
|
|
326
224
|
console.log(
|
|
327
|
-
|
|
225
|
+
` 📝 Fetching detailed release notes for ${relevantReleases.length} release(s)...`,
|
|
328
226
|
)
|
|
329
|
-
|
|
227
|
+
let changelog = ''
|
|
330
228
|
for (const release of relevantReleases) {
|
|
331
229
|
try {
|
|
332
230
|
const releaseBody = await run(
|
|
333
231
|
`gh release view ${release.tagName} --repo PayFit/nx-common-packages --json body --jq '.body'`,
|
|
334
232
|
)
|
|
335
233
|
const body = releaseBody.replace(/^"|"$/g, '') // Remove surrounding quotes from jq output
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
body: body || 'No release notes available.',
|
|
339
|
-
})
|
|
234
|
+
changelog += `### ${release.tagName}\n\n`
|
|
235
|
+
changelog += `${body || 'No release notes available.'}\n\n`
|
|
340
236
|
} catch (error) {
|
|
341
237
|
console.log(
|
|
342
|
-
`
|
|
238
|
+
` ⚠️ Could not fetch release notes for ${release.tagName}: ${error.message}`,
|
|
343
239
|
)
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
body: 'Release notes could not be retrieved.',
|
|
347
|
-
})
|
|
240
|
+
changelog += `### ${release.tagName}\n\n`
|
|
241
|
+
changelog += `Release notes could not be retrieved.\n\n`
|
|
348
242
|
}
|
|
349
243
|
}
|
|
350
244
|
|
|
351
245
|
console.log(
|
|
352
|
-
|
|
246
|
+
` ✅ Retrieved ${relevantReleases.length} nx-core release(s) between versions`,
|
|
353
247
|
)
|
|
354
|
-
|
|
355
|
-
if (CHANGELOG_MODE === 'raw') {
|
|
356
|
-
// Plain concatenation with clear spacing
|
|
357
|
-
let raw = ''
|
|
358
|
-
for (const entry of releaseEntries) {
|
|
359
|
-
raw += `### ${entry.tag}\n\n${entry.body}\n\n`
|
|
360
|
-
}
|
|
361
|
-
return raw.trim()
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// Combined/aggregated changelog
|
|
365
|
-
return buildCombinedChangelog(releaseEntries)
|
|
248
|
+
return changelog.trim()
|
|
366
249
|
} catch (error) {
|
|
367
|
-
console.log(
|
|
250
|
+
console.log(` ⚠️ Could not fetch release notes: ${error.message}`)
|
|
368
251
|
return `Release notes could not be retrieved between ${currentVersion} and ${targetVersion}.`
|
|
369
252
|
}
|
|
370
253
|
}
|
|
371
254
|
|
|
372
|
-
// Normalize a section heading to a canonical bucket
|
|
373
|
-
function normalizeSection(title) {
|
|
374
|
-
const t = String(title).trim().toLowerCase()
|
|
375
|
-
if (/breaking|migration/.test(t)) return 'Breaking Changes'
|
|
376
|
-
if (/feature/.test(t)) return 'Features'
|
|
377
|
-
if (/fix|bug/.test(t)) return 'Bug Fixes'
|
|
378
|
-
if (/perf|performance/.test(t)) return 'Performance'
|
|
379
|
-
if (/refactor/.test(t)) return 'Refactor'
|
|
380
|
-
if (/doc/.test(t)) return 'Docs'
|
|
381
|
-
if (/chore/.test(t)) return 'Chore'
|
|
382
|
-
if (/revert/.test(t)) return 'Reverts'
|
|
383
|
-
return null
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// Build a combined changelog from multiple release markdown bodies
|
|
387
|
-
function buildCombinedChangelog(entries) {
|
|
388
|
-
const sectionOrder = [
|
|
389
|
-
'Breaking Changes',
|
|
390
|
-
'Features',
|
|
391
|
-
'Bug Fixes',
|
|
392
|
-
'Performance',
|
|
393
|
-
'Refactor',
|
|
394
|
-
'Docs',
|
|
395
|
-
'Chore',
|
|
396
|
-
'Reverts',
|
|
397
|
-
'Other Changes',
|
|
398
|
-
]
|
|
399
|
-
|
|
400
|
-
const aggregated = new Map()
|
|
401
|
-
for (const key of sectionOrder) aggregated.set(key, [])
|
|
402
|
-
|
|
403
|
-
for (const { tag, body } of entries) {
|
|
404
|
-
const lines = String(body).split('\n')
|
|
405
|
-
let current = null
|
|
406
|
-
let inCodeBlock = false
|
|
407
|
-
let pendingBullet = null
|
|
408
|
-
|
|
409
|
-
const flushPending = () => {
|
|
410
|
-
if (pendingBullet) {
|
|
411
|
-
const bucket = current || 'Other Changes'
|
|
412
|
-
aggregated.get(bucket).push(pendingBullet.trim())
|
|
413
|
-
pendingBullet = null
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
for (const raw of lines) {
|
|
418
|
-
const line = raw.replace(/\r$/, '')
|
|
419
|
-
|
|
420
|
-
// Handle fenced code blocks so we don't ingest code as bullets
|
|
421
|
-
if (/^```/.test(line.trim())) {
|
|
422
|
-
inCodeBlock = !inCodeBlock
|
|
423
|
-
continue
|
|
424
|
-
}
|
|
425
|
-
if (inCodeBlock) continue
|
|
426
|
-
|
|
427
|
-
// Headings like ##, ###, ####
|
|
428
|
-
const headingMatch = line.match(/^#{2,4}\s+(.+?)\s*$/)
|
|
429
|
-
if (headingMatch) {
|
|
430
|
-
flushPending()
|
|
431
|
-
const canonical = normalizeSection(headingMatch[1])
|
|
432
|
-
current = canonical
|
|
433
|
-
continue
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
// Bullet points
|
|
437
|
-
const bulletMatch = line.match(/^\s*[-*]\s+(.+)$/)
|
|
438
|
-
if (bulletMatch) {
|
|
439
|
-
// Flush previous bullet before starting new
|
|
440
|
-
flushPending()
|
|
441
|
-
pendingBullet = bulletMatch[1]
|
|
442
|
-
continue
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// Continuation lines for multi-line bullets
|
|
446
|
-
if (pendingBullet && line.trim().length > 0) {
|
|
447
|
-
pendingBullet += ` ${line.trim()}`
|
|
448
|
-
} else if (!pendingBullet && current && line.trim().length > 0) {
|
|
449
|
-
// Non-bullet content under a recognized section
|
|
450
|
-
aggregated.get(current).push(line.trim())
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
flushPending()
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// Build markdown
|
|
457
|
-
let out = ''
|
|
458
|
-
for (const key of sectionOrder) {
|
|
459
|
-
if (key === 'Other Changes') continue // discard Other Changes entirely
|
|
460
|
-
const items = aggregated.get(key)
|
|
461
|
-
if (!items || items.length === 0) continue
|
|
462
|
-
out += `#### ${key}\n\n`
|
|
463
|
-
for (const item of items) {
|
|
464
|
-
out += `- ${item}\n`
|
|
465
|
-
}
|
|
466
|
-
out += `\n`
|
|
467
|
-
}
|
|
468
|
-
return out.trim()
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// Ensure nx.json has release.version.updateDependents = "auto" for Nx >= 22
|
|
472
|
-
async function ensureUpdateDependentsAuto(repoPath) {
|
|
473
|
-
const nxJsonPath = path.join(repoPath, 'nx.json')
|
|
474
|
-
try {
|
|
475
|
-
const content = await fs.readFile(nxJsonPath, 'utf8')
|
|
476
|
-
const data = JSON.parse(content)
|
|
477
|
-
if (!data.release) data.release = {}
|
|
478
|
-
if (!data.release.version) data.release.version = {}
|
|
479
|
-
if (data.release.version.updateDependents === undefined) {
|
|
480
|
-
data.release.version.updateDependents = 'auto'
|
|
481
|
-
await fs.writeFile(
|
|
482
|
-
nxJsonPath,
|
|
483
|
-
JSON.stringify(data, null, 2) + '\n',
|
|
484
|
-
'utf8',
|
|
485
|
-
)
|
|
486
|
-
console.log(
|
|
487
|
-
'🧩 Set release.version.updateDependents to "auto" in nx.json',
|
|
488
|
-
)
|
|
489
|
-
return true
|
|
490
|
-
}
|
|
491
|
-
console.log('ℹ nx.json already has release.version.updateDependents')
|
|
492
|
-
return false
|
|
493
|
-
} catch (error) {
|
|
494
|
-
console.log(`⚠️ Skipped nx.json update: ${error.message}`)
|
|
495
|
-
return false
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
255
|
// Check if gh CLI is installed and user is authenticated
|
|
500
256
|
async function checkGhCli() {
|
|
501
257
|
try {
|
|
@@ -518,9 +274,7 @@ async function checkGhCli() {
|
|
|
518
274
|
|
|
519
275
|
// Main function
|
|
520
276
|
async function main() {
|
|
521
|
-
console.log(
|
|
522
|
-
`🎯 nx-core Updater - nx-core target ${NX_CORE_VERSION}${NX_VERSION ? `, Nx target ${NX_VERSION}` : ''}`,
|
|
523
|
-
)
|
|
277
|
+
console.log(`🎯 nx-core Updater - version ${NX_CORE_VERSION}`)
|
|
524
278
|
console.log(`📋 Processing ${REPOSITORIES.length} repositories`)
|
|
525
279
|
|
|
526
280
|
try {
|
|
@@ -535,25 +289,19 @@ async function main() {
|
|
|
535
289
|
await fs.mkdir(WORK_DIR, { recursive: true })
|
|
536
290
|
|
|
537
291
|
// Process repositories sequentially
|
|
538
|
-
console.log(
|
|
292
|
+
console.log(`\n🔄 Processing repositories...`)
|
|
539
293
|
for (const repo of REPOSITORIES) {
|
|
540
294
|
await processRepo(repo)
|
|
541
295
|
}
|
|
542
296
|
|
|
543
297
|
// Cleanup
|
|
544
|
-
console.log(
|
|
298
|
+
console.log(`\n🧹 Cleaning up work directory...`)
|
|
545
299
|
await fs.rm(WORK_DIR, { recursive: true, force: true }).catch(() => {
|
|
546
300
|
// ignore error if directory does not exist
|
|
547
301
|
})
|
|
548
|
-
|
|
549
|
-
console.log('🔗 Created PRs:')
|
|
550
|
-
for (const url of CREATED_PR_URLS) {
|
|
551
|
-
console.log(`- ${url}`)
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
console.log('🎉 Done!')
|
|
302
|
+
console.log('\n🎉 Done!')
|
|
555
303
|
} catch (error) {
|
|
556
|
-
console.error(
|
|
304
|
+
console.error(`\n💥 Script failed: ${error.message}`)
|
|
557
305
|
process.exit(1)
|
|
558
306
|
}
|
|
559
307
|
}
|
|
@@ -98,39 +98,19 @@ async function putPublicImageTags(repositoryName, imageManifest, targetTags) {
|
|
|
98
98
|
// Delete a tag from a private ECR repository.
|
|
99
99
|
async function deletePrivateImageTag(repositoryName, tag) {
|
|
100
100
|
const ecr = new client_ecr_1.ECRClient({});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}));
|
|
106
|
-
if (response.failures && response.failures.length > 0) {
|
|
107
|
-
throw new Error(`Error deleting image tag: ${response.failures}`);
|
|
108
|
-
}
|
|
109
|
-
logger_1.consola.log('Successfully deleted image tag', tag);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
logger_1.consola.error('Error deleting image tag', error);
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
101
|
+
await ecr.send(new client_ecr_1.BatchDeleteImageCommand({
|
|
102
|
+
repositoryName,
|
|
103
|
+
imageIds: [{ imageTag: tag }],
|
|
104
|
+
}));
|
|
115
105
|
}
|
|
116
106
|
// Delete a tag from an ECR Public repository.
|
|
117
107
|
async function deletePublicImageTag(repositoryName, tag) {
|
|
118
108
|
const ecr = new EcrPublic.ECRPUBLICClient({ region: 'us-east-1' });
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}));
|
|
125
|
-
if (response.failures && response.failures.length > 0) {
|
|
126
|
-
throw new Error(`Error deleting image tag: ${response.failures}`);
|
|
127
|
-
}
|
|
128
|
-
logger_1.consola.log('Successfully deleted image tag', tag);
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
logger_1.consola.error('Error deleting image tag', error);
|
|
132
|
-
throw error;
|
|
133
|
-
}
|
|
109
|
+
await ecr.send(new EcrPublic.BatchDeleteImageCommand({
|
|
110
|
+
registryId: publicEcrId,
|
|
111
|
+
repositoryName,
|
|
112
|
+
imageIds: [{ imageTag: tag }],
|
|
113
|
+
}));
|
|
134
114
|
}
|
|
135
115
|
// Check if a tag exists in ECR (private or public).
|
|
136
116
|
async function imageTagExistsInEcr(repositoryName, tag, isPublicRegistry) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecr.js","sourceRoot":"","sources":["../../../../src/utils/common/ecr.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"ecr.js","sourceRoot":"","sources":["../../../../src/utils/common/ecr.ts"],"names":[],"mappings":";;AAyLA,kDAgBC;AAGD,8DAuBC;AAGD,sCAqBC;AAOD,8CAKC;AAhQD,oDAK4B;AAC5B,wDAAuD;AAEvD,yCAA2E;AAC3E,qCAAkC;AAElC,MAAM,6BAA6B,GAAG;IACpC,2DAA2D;IAC3D,yCAAyC;IACzC,sDAAsD;IACtD,4CAA4C;CAC7C,CAAA;AAYD,MAAM,WAAW,GAAG,cAAc,CAAA;AAClC,MAAM,cAAc,GAAG,QAAQ,CAAA;AAE/B,KAAK,UAAU,uBAAuB,CACpC,cAAsB;IAEtB,MAAM,KAAK,GAAG,cAAc,cAAc,IAAI,kBAAkB,CAC9D,cAAc,CACf,OAAO,CAAA;IACR,MAAM,GAAG,GAAG,6DAA6D,KAAK,EAAE,CAAA;IAChF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5B,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAA;IAC7B,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAA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,EAAE,UAAU,CAAC,CAAA;QAC/D,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACpC,MAAM,qBAAqB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAA;QACxD,CAAC;IACH,CAAC;AACH,CAAC;AAED,8DAA8D;AACvD,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,gBAAgB,GAAG,KAAK;IAExB,MAAM,IAAA,uBAAY,GAAE,CAAA;IACpB,MAAM,IAAA,qBAAU,EAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;IAE5C,MAAM,mBAAmB,GAAG,MAAM,IAAA,+BAAoB,EAAC,QAAQ,CAAC,CAAA;IAChE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,gBAAO,CAAC,IAAI,CACV,mEAAmE,CACpE,CAAA;QACD,MAAM,IAAA,qBAAU,EAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAA;QAE5C,MAAM,gBAAgB,GAAG,MAAM,IAAA,+BAAoB,EAAC,QAAQ,CAAC,CAAA;QAC7D,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAA;QACH,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAC5B,8CAA8C,CAC/C,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { ExecutorContext
|
|
2
|
-
import { ArtifactType } from './enums';
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
3
2
|
export declare function getDistForApp(context: ExecutorContext): Promise<string>;
|
|
4
|
-
export declare function getProjectArtifactTypes(projectRoot: string, projectConfiguration: ProjectConfiguration): ArtifactType[] | undefined;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDistForApp = getDistForApp;
|
|
4
|
-
exports.getProjectArtifactTypes = getProjectArtifactTypes;
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
4
|
const fs = require("node:fs");
|
|
7
5
|
const path_1 = require("path");
|
|
8
6
|
const devkit_1 = require("@nx/devkit");
|
|
9
7
|
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
10
|
-
const enums_1 = require("./enums");
|
|
11
8
|
async function getDistForApp(context) {
|
|
12
9
|
const target = (0, devkit_1.parseTargetString)('build', context);
|
|
13
10
|
const project = context.projectGraph.nodes[target.project].data;
|
|
@@ -41,26 +38,4 @@ function normalizeOutputPath(outputPath) {
|
|
|
41
38
|
}
|
|
42
39
|
return outputPath;
|
|
43
40
|
}
|
|
44
|
-
function getProjectArtifactTypes(projectRoot, projectConfiguration) {
|
|
45
|
-
const isDockerProject = fs.existsSync((0, path_1.join)(projectRoot, 'Dockerfile')) &&
|
|
46
|
-
!!projectConfiguration?.metadata?.['ecrRepository'];
|
|
47
|
-
const isLambdaProject = !!projectConfiguration?.metadata?.lambdaFunctions &&
|
|
48
|
-
projectConfiguration?.metadata?.lambdaFunctions.length > 0;
|
|
49
|
-
const isFrontendProject = !!projectConfiguration?.metadata?.frontendArtifactsBucketName;
|
|
50
|
-
const isTfModuleProject = fs.existsSync((0, path_1.join)(projectRoot, '.spacelift/config.yml')) &&
|
|
51
|
-
fs.existsSync((0, path_1.join)(projectRoot, 'main.tf'));
|
|
52
|
-
const isHelmProject = (0, fs_1.existsSync)((0, path_1.join)(projectRoot, projectConfiguration?.metadata?.helmChartFolder || '.deploy', 'Chart.yaml'));
|
|
53
|
-
const artifactTypes = [];
|
|
54
|
-
if (isLambdaProject)
|
|
55
|
-
artifactTypes.push(enums_1.ArtifactType.LAMBDA);
|
|
56
|
-
if (isDockerProject)
|
|
57
|
-
artifactTypes.push(enums_1.ArtifactType.DOCKER);
|
|
58
|
-
if (isFrontendProject)
|
|
59
|
-
artifactTypes.push(enums_1.ArtifactType.FRONTEND);
|
|
60
|
-
if (isTfModuleProject)
|
|
61
|
-
artifactTypes.push(enums_1.ArtifactType.TERRAFORM_MODULE);
|
|
62
|
-
if (isHelmProject)
|
|
63
|
-
artifactTypes.push(enums_1.ArtifactType.HELM);
|
|
64
|
-
return artifactTypes.length > 0 ? artifactTypes : [];
|
|
65
|
-
}
|
|
66
41
|
//# sourceMappingURL=nx.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nx.js","sourceRoot":"","sources":["../../../../src/utils/common/nx.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"nx.js","sourceRoot":"","sources":["../../../../src/utils/common/nx.ts"],"names":[],"mappings":";;AAMA,sCAgCC;AAtCD,8BAA6B;AAC7B,+BAAoC;AAEpC,uCAA8E;AAC9E,qDAAuD;AAEhD,KAAK,UAAU,aAAa,CAAC,OAAwB;IAC1D,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAClD,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAA;IAC/D,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAElD,IAAI,eAAe,GACjB,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACxB,WAAW,CAAC,OAAO,CAAC,UAAU;QAC9B,WAAW,CAAC,OAAO,CAAC,SAAS,CAAA;IAE/B,eAAe,GAAG,IAAA,mBAAW,EAAC,eAAe,EAAE;QAC7C,aAAa,EAAb,sBAAa;QACb,WAAW,EAAE,OAAO,CAAC,IAAI;QACzB,WAAW,EAAE,OAAO,CAAC,IAAI;QACzB,OAAO,EAAE;YACP,GAAG,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;SAC/B;KACF,CAAC,CAAA;IAEF,IAAI,C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