@payfit/nx-core 5.4.0 → 5.5.0-ephemeral-preview-labels.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/dist/src/executors/preview-deploy/executor.js +2 -19
- package/dist/src/executors/preview-deploy/executor.js.map +1 -1
- package/dist/src/executors/preview-labels/executor.d.ts +7 -0
- package/dist/src/executors/preview-labels/executor.js +90 -0
- package/dist/src/executors/preview-labels/executor.js.map +1 -0
- package/dist/src/executors/preview-labels/schema.json +17 -0
- 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 +1 -1
- package/dist/src/executors/publisher/lambda.js.map +1 -1
- package/dist/src/index.js +8 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/scripts/nx-core-updater.js +60 -311
- package/dist/src/utils/common/environment.d.ts +1 -0
- package/dist/src/utils/common/environment.js +11 -0
- package/dist/src/utils/common/environment.js.map +1 -0
- 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/common/octokit.d.ts +2 -0
- package/dist/src/utils/common/octokit.js +22 -0
- package/dist/src/utils/common/octokit.js.map +1 -0
- package/dist/src/utils/helm.d.ts +1 -1
- package/dist/src/utils/helm.js +3 -8
- package/dist/src/utils/helm.js.map +1 -1
- package/dist/src/utils/spacelift/lib/__generated__/gql.js +1 -1
- package/dist/src/utils/spacelift/lib/__generated__/graphql.d.ts +4 -4
- 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 +5 -0
- package/generators.json +0 -5
- package/package.json +2 -3
- 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
|
@@ -7,17 +7,8 @@ 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
13
|
'authorization',
|
|
23
14
|
'company-lifecycle',
|
|
@@ -31,7 +22,6 @@ const REPOSITORIES = [
|
|
|
31
22
|
'jetlang',
|
|
32
23
|
'organization-structure',
|
|
33
24
|
'payfit-domains',
|
|
34
|
-
'payroll',
|
|
35
25
|
'talent-management',
|
|
36
26
|
'time-absences',
|
|
37
27
|
]
|
|
@@ -78,208 +68,117 @@ async function run(command, cwd = process.cwd()) {
|
|
|
78
68
|
}
|
|
79
69
|
}
|
|
80
70
|
|
|
81
|
-
// Check if
|
|
82
|
-
async function
|
|
71
|
+
// Check if package.json exists and needs update
|
|
72
|
+
async function needsUpdate(repoPath) {
|
|
83
73
|
try {
|
|
84
74
|
const packageJsonPath = path.join(repoPath, 'package.json')
|
|
85
75
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
|
|
86
76
|
const currentVersion = packageJson.devDependencies?.['@payfit/nx-core']
|
|
87
77
|
|
|
88
78
|
if (!currentVersion) {
|
|
89
|
-
console.log(
|
|
79
|
+
console.log(` ℹ @payfit/nx-core not found in devDependencies`)
|
|
90
80
|
return { needsUpdate: false, currentVersion: null }
|
|
91
81
|
}
|
|
92
82
|
|
|
93
83
|
if (compareVersions(currentVersion, NX_CORE_VERSION) === 0) {
|
|
94
|
-
console.log(
|
|
95
|
-
return { needsUpdate: false, currentVersion }
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
console.log(
|
|
99
|
-
`📦 Current version: ${currentVersion}, target: ${NX_CORE_VERSION}`,
|
|
100
|
-
)
|
|
101
|
-
return { needsUpdate: true, currentVersion }
|
|
102
|
-
} catch (error) {
|
|
103
|
-
console.error(`❌ Could not read package.json: ${error.message}`)
|
|
104
|
-
return { needsUpdate: false, currentVersion: null }
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Check if Nx in package.json needs update
|
|
109
|
-
async function needsNxUpdate(repoPath) {
|
|
110
|
-
if (!NX_VERSION) {
|
|
111
|
-
return { needsUpdate: false, currentVersion: null }
|
|
112
|
-
}
|
|
113
|
-
try {
|
|
114
|
-
const packageJsonPath = path.join(repoPath, 'package.json')
|
|
115
|
-
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
|
|
116
|
-
const currentVersion =
|
|
117
|
-
packageJson.devDependencies?.['nx'] ?? packageJson.dependencies?.['nx']
|
|
118
|
-
|
|
119
|
-
if (!currentVersion) {
|
|
120
|
-
console.log(`ℹ nx not found in package.json`)
|
|
121
|
-
return { needsUpdate: false, currentVersion: null }
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (compareVersions(currentVersion, NX_VERSION) === 0) {
|
|
125
|
-
console.log(`ℹ Nx already on version ${NX_VERSION}`)
|
|
84
|
+
console.log(` ℹ Already on version ${NX_CORE_VERSION}`)
|
|
126
85
|
return { needsUpdate: false, currentVersion }
|
|
127
86
|
}
|
|
128
87
|
|
|
129
88
|
console.log(
|
|
130
|
-
|
|
89
|
+
` 📦 Current version: ${currentVersion}, target: ${NX_CORE_VERSION}`,
|
|
131
90
|
)
|
|
132
91
|
return { needsUpdate: true, currentVersion }
|
|
133
92
|
} catch (error) {
|
|
134
|
-
console.error(
|
|
93
|
+
console.error(` ❌ Could not read package.json: ${error.message}`)
|
|
135
94
|
return { needsUpdate: false, currentVersion: null }
|
|
136
95
|
}
|
|
137
96
|
}
|
|
138
97
|
|
|
139
98
|
// Process a single repository
|
|
140
99
|
async function processRepo(repoName) {
|
|
141
|
-
console.log(
|
|
100
|
+
console.log(`\n🚀 Processing ${repoName}`)
|
|
142
101
|
|
|
143
102
|
const repoPath = path.join(WORK_DIR, repoName)
|
|
144
103
|
|
|
145
104
|
try {
|
|
146
105
|
// Clone repo
|
|
147
|
-
console.log(
|
|
106
|
+
console.log(` 📥 Cloning repository...`)
|
|
148
107
|
await run(
|
|
149
108
|
`git clone https://github.com/PayFit/${repoName}.git ${repoPath}`,
|
|
150
109
|
WORK_DIR,
|
|
151
110
|
)
|
|
152
111
|
|
|
153
|
-
// Check if
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
])
|
|
158
|
-
if (!nxCoreUpdateInfo.needsUpdate && !nxUpdateInfo.needsUpdate) {
|
|
159
|
-
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`)
|
|
160
116
|
return
|
|
161
117
|
}
|
|
162
118
|
|
|
163
|
-
// Get changelogs between current and target version
|
|
164
|
-
const releaseNotes =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
)
|
|
169
|
-
: ''
|
|
119
|
+
// Get changelogs between current and target version
|
|
120
|
+
const releaseNotes = await getChangelogBetweenVersions(
|
|
121
|
+
updateInfo.currentVersion,
|
|
122
|
+
NX_CORE_VERSION,
|
|
123
|
+
)
|
|
170
124
|
|
|
171
125
|
// Create branch
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
branchNameParts.push(`nx-core-v${NX_CORE_VERSION}`)
|
|
175
|
-
if (nxUpdateInfo.needsUpdate) branchNameParts.push(`nx-v${NX_VERSION}`)
|
|
176
|
-
const branchName = branchNameParts.join('-') || `nx-maintenance`
|
|
177
|
-
console.log(`🌿 Creating branch ${branchName}`)
|
|
126
|
+
const branchName = `nx-core-v${NX_CORE_VERSION}`
|
|
127
|
+
console.log(` 🌿 Creating branch ${branchName}`)
|
|
178
128
|
await run('git checkout main', repoPath)
|
|
179
129
|
await run(`git checkout -b ${branchName}`, repoPath)
|
|
180
130
|
|
|
181
131
|
// Install dependencies and migrate
|
|
182
|
-
console.log(
|
|
132
|
+
console.log(` 📦 Installing dependencies...`)
|
|
183
133
|
await run('yarn', repoPath)
|
|
184
134
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
console.log(`🔄 Planning Nx migration to version ${NX_VERSION}...`)
|
|
188
|
-
await run(`yarn nx migrate 'nx@${NX_VERSION}'`, repoPath)
|
|
189
|
-
}
|
|
190
|
-
if (nxCoreUpdateInfo.needsUpdate) {
|
|
191
|
-
console.log(
|
|
192
|
-
`🔄 Planning nx-core migration to version ${NX_CORE_VERSION}...`,
|
|
193
|
-
)
|
|
194
|
-
await run(
|
|
195
|
-
`yarn nx migrate '@payfit/nx-core@${NX_CORE_VERSION}'`,
|
|
196
|
-
repoPath,
|
|
197
|
-
)
|
|
198
|
-
}
|
|
135
|
+
console.log(` 🔄 Migrating nx-core to version ${NX_CORE_VERSION}...`)
|
|
136
|
+
await run(`yarn nx migrate '@payfit/nx-core@${NX_CORE_VERSION}'`, repoPath)
|
|
199
137
|
|
|
200
|
-
console.log(
|
|
138
|
+
console.log(` 📦 Installing dependencies after migration...`)
|
|
201
139
|
await run('yarn', repoPath)
|
|
202
140
|
|
|
203
|
-
console.log(
|
|
141
|
+
console.log(` 📦 Run migrations...`)
|
|
204
142
|
await run(`yarn nx migrate --run-migrations --ifExists`, repoPath)
|
|
205
143
|
|
|
206
|
-
// If targeting Nx >= 22, ensure nx.json release.version.updateDependents = "auto"
|
|
207
|
-
if (nxUpdateInfo.needsUpdate && NX_VERSION) {
|
|
208
|
-
const major = parseInt(extractVersion(NX_VERSION).split('.')[0], 10) || 0
|
|
209
|
-
if (major >= 22) {
|
|
210
|
-
console.log(
|
|
211
|
-
`🔧 Ensuring nx.json has release.version.updateDependents = "auto" for Nx >= 22...`,
|
|
212
|
-
)
|
|
213
|
-
const nxJsonChanged = await ensureUpdateDependentsAuto(repoPath)
|
|
214
|
-
if (nxJsonChanged) {
|
|
215
|
-
console.log('🧹 Formatting workspace (npx nx format)...')
|
|
216
|
-
await run('npx nx format', repoPath)
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
144
|
// Stage, commit and push
|
|
222
|
-
console.log(
|
|
145
|
+
console.log(` 📝 Staging and committing changes...`)
|
|
223
146
|
await run('git add .', repoPath)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
if (nxCoreUpdateInfo.needsUpdate) {
|
|
231
|
-
commitParts.push(
|
|
232
|
-
`chore(nx-core): update nx-core from ${nxCoreUpdateInfo.currentVersion} to ${NX_CORE_VERSION}`,
|
|
233
|
-
)
|
|
234
|
-
}
|
|
235
|
-
const commitMessage = commitParts.join('')
|
|
236
|
-
await run(`git commit -m ${JSON.stringify(commitMessage)}`, repoPath)
|
|
237
|
-
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)
|
|
238
152
|
|
|
239
153
|
// Create PR if it doesn't exist
|
|
240
|
-
console.log(
|
|
154
|
+
console.log(` 🔍 Checking for existing pull requests...`)
|
|
241
155
|
const existingPRs = await run(
|
|
242
156
|
`gh pr list --repo PayFit/${repoName} --head ${branchName} --json number`,
|
|
243
157
|
)
|
|
244
158
|
if (JSON.parse(existingPRs).length === 0) {
|
|
245
|
-
console.log(
|
|
159
|
+
console.log(` 📋 Creating pull request...`)
|
|
246
160
|
|
|
247
161
|
// Create PR body with release notes
|
|
248
|
-
const
|
|
249
|
-
if (nxUpdateInfo.needsUpdate) prTitleParts.push(`Nx to v${NX_VERSION}`)
|
|
250
|
-
if (nxCoreUpdateInfo.needsUpdate)
|
|
251
|
-
prTitleParts.push(`@payfit/nx-core to v${NX_CORE_VERSION}`)
|
|
252
|
-
const prTitle = `chore(nx): update ${prTitleParts.join(' and ')}`
|
|
253
|
-
|
|
254
|
-
let prBody = ''
|
|
255
|
-
if (nxUpdateInfo.needsUpdate) {
|
|
256
|
-
prBody += `Update Nx from ${nxUpdateInfo.currentVersion} to ${NX_VERSION}\n\n`
|
|
257
|
-
}
|
|
258
|
-
if (nxCoreUpdateInfo.needsUpdate) {
|
|
259
|
-
prBody += `Update @payfit/nx-core from ${nxCoreUpdateInfo.currentVersion} to ${NX_CORE_VERSION}\n\n`
|
|
260
|
-
prBody += `## Changelog\n\n${releaseNotes}\n`
|
|
261
|
-
}
|
|
162
|
+
const prBody = `Update @payfit/nx-core from ${updateInfo.currentVersion} to ${NX_CORE_VERSION}
|
|
262
163
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
164
|
+
## Changelog
|
|
165
|
+
|
|
166
|
+
${releaseNotes}
|
|
167
|
+
`
|
|
266
168
|
|
|
267
169
|
// Write PR body to a file to preserve formatting (newlines, markdown)
|
|
268
170
|
const prBodyPath = path.join(repoPath, 'nx-core-pr-body.md')
|
|
269
171
|
await fs.writeFile(prBodyPath, prBody, 'utf8')
|
|
270
172
|
|
|
271
|
-
|
|
272
|
-
`gh pr create --repo PayFit/${repoName} --title ${
|
|
273
|
-
prTitle,
|
|
274
|
-
)} --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}`,
|
|
275
175
|
)
|
|
276
|
-
|
|
277
|
-
console.log(`✅ Successfully created PR for ${repoName}: ${prUrl}`)
|
|
176
|
+
console.log(` ✅ Successfully created PR for ${repoName}`)
|
|
278
177
|
} else {
|
|
279
|
-
console.log(
|
|
178
|
+
console.log(` ℹ️ PR already exists for ${repoName}`)
|
|
280
179
|
}
|
|
281
180
|
} catch (error) {
|
|
282
|
-
console.error(
|
|
181
|
+
console.error(` ❌ Failed to process ${repoName}: ${error.message}`)
|
|
283
182
|
throw error
|
|
284
183
|
}
|
|
285
184
|
}
|
|
@@ -288,7 +187,7 @@ async function processRepo(repoName) {
|
|
|
288
187
|
async function getChangelogBetweenVersions(currentVersion, targetVersion) {
|
|
289
188
|
try {
|
|
290
189
|
console.log(
|
|
291
|
-
|
|
190
|
+
` 📋 Fetching changelogs from ${currentVersion} to ${targetVersion}...`,
|
|
292
191
|
)
|
|
293
192
|
|
|
294
193
|
// Get only nx-core releases from the repository, filtered at CLI level
|
|
@@ -323,178 +222,36 @@ async function getChangelogBetweenVersions(currentVersion, targetVersion) {
|
|
|
323
222
|
|
|
324
223
|
// Fetch detailed release notes for each relevant release
|
|
325
224
|
console.log(
|
|
326
|
-
|
|
225
|
+
` 📝 Fetching detailed release notes for ${relevantReleases.length} release(s)...`,
|
|
327
226
|
)
|
|
328
|
-
|
|
227
|
+
let changelog = ''
|
|
329
228
|
for (const release of relevantReleases) {
|
|
330
229
|
try {
|
|
331
230
|
const releaseBody = await run(
|
|
332
231
|
`gh release view ${release.tagName} --repo PayFit/nx-common-packages --json body --jq '.body'`,
|
|
333
232
|
)
|
|
334
233
|
const body = releaseBody.replace(/^"|"$/g, '') // Remove surrounding quotes from jq output
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
body: body || 'No release notes available.',
|
|
338
|
-
})
|
|
234
|
+
changelog += `### ${release.tagName}\n\n`
|
|
235
|
+
changelog += `${body || 'No release notes available.'}\n\n`
|
|
339
236
|
} catch (error) {
|
|
340
237
|
console.log(
|
|
341
|
-
`
|
|
238
|
+
` ⚠️ Could not fetch release notes for ${release.tagName}: ${error.message}`,
|
|
342
239
|
)
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
body: 'Release notes could not be retrieved.',
|
|
346
|
-
})
|
|
240
|
+
changelog += `### ${release.tagName}\n\n`
|
|
241
|
+
changelog += `Release notes could not be retrieved.\n\n`
|
|
347
242
|
}
|
|
348
243
|
}
|
|
349
244
|
|
|
350
245
|
console.log(
|
|
351
|
-
|
|
246
|
+
` ✅ Retrieved ${relevantReleases.length} nx-core release(s) between versions`,
|
|
352
247
|
)
|
|
353
|
-
|
|
354
|
-
if (CHANGELOG_MODE === 'raw') {
|
|
355
|
-
// Plain concatenation with clear spacing
|
|
356
|
-
let raw = ''
|
|
357
|
-
for (const entry of releaseEntries) {
|
|
358
|
-
raw += `### ${entry.tag}\n\n${entry.body}\n\n`
|
|
359
|
-
}
|
|
360
|
-
return raw.trim()
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Combined/aggregated changelog
|
|
364
|
-
return buildCombinedChangelog(releaseEntries)
|
|
248
|
+
return changelog.trim()
|
|
365
249
|
} catch (error) {
|
|
366
|
-
console.log(
|
|
250
|
+
console.log(` ⚠️ Could not fetch release notes: ${error.message}`)
|
|
367
251
|
return `Release notes could not be retrieved between ${currentVersion} and ${targetVersion}.`
|
|
368
252
|
}
|
|
369
253
|
}
|
|
370
254
|
|
|
371
|
-
// Normalize a section heading to a canonical bucket
|
|
372
|
-
function normalizeSection(title) {
|
|
373
|
-
const t = String(title).trim().toLowerCase()
|
|
374
|
-
if (/breaking|migration/.test(t)) return 'Breaking Changes'
|
|
375
|
-
if (/feature/.test(t)) return 'Features'
|
|
376
|
-
if (/fix|bug/.test(t)) return 'Bug Fixes'
|
|
377
|
-
if (/perf|performance/.test(t)) return 'Performance'
|
|
378
|
-
if (/refactor/.test(t)) return 'Refactor'
|
|
379
|
-
if (/doc/.test(t)) return 'Docs'
|
|
380
|
-
if (/chore/.test(t)) return 'Chore'
|
|
381
|
-
if (/revert/.test(t)) return 'Reverts'
|
|
382
|
-
return null
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// Build a combined changelog from multiple release markdown bodies
|
|
386
|
-
function buildCombinedChangelog(entries) {
|
|
387
|
-
const sectionOrder = [
|
|
388
|
-
'Breaking Changes',
|
|
389
|
-
'Features',
|
|
390
|
-
'Bug Fixes',
|
|
391
|
-
'Performance',
|
|
392
|
-
'Refactor',
|
|
393
|
-
'Docs',
|
|
394
|
-
'Chore',
|
|
395
|
-
'Reverts',
|
|
396
|
-
'Other Changes',
|
|
397
|
-
]
|
|
398
|
-
|
|
399
|
-
const aggregated = new Map()
|
|
400
|
-
for (const key of sectionOrder) aggregated.set(key, [])
|
|
401
|
-
|
|
402
|
-
for (const { tag, body } of entries) {
|
|
403
|
-
const lines = String(body).split('\n')
|
|
404
|
-
let current = null
|
|
405
|
-
let inCodeBlock = false
|
|
406
|
-
let pendingBullet = null
|
|
407
|
-
|
|
408
|
-
const flushPending = () => {
|
|
409
|
-
if (pendingBullet) {
|
|
410
|
-
const bucket = current || 'Other Changes'
|
|
411
|
-
aggregated.get(bucket).push(pendingBullet.trim())
|
|
412
|
-
pendingBullet = null
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
for (const raw of lines) {
|
|
417
|
-
const line = raw.replace(/\r$/, '')
|
|
418
|
-
|
|
419
|
-
// Handle fenced code blocks so we don't ingest code as bullets
|
|
420
|
-
if (/^```/.test(line.trim())) {
|
|
421
|
-
inCodeBlock = !inCodeBlock
|
|
422
|
-
continue
|
|
423
|
-
}
|
|
424
|
-
if (inCodeBlock) continue
|
|
425
|
-
|
|
426
|
-
// Headings like ##, ###, ####
|
|
427
|
-
const headingMatch = line.match(/^#{2,4}\s+(.+?)\s*$/)
|
|
428
|
-
if (headingMatch) {
|
|
429
|
-
flushPending()
|
|
430
|
-
const canonical = normalizeSection(headingMatch[1])
|
|
431
|
-
current = canonical
|
|
432
|
-
continue
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// Bullet points
|
|
436
|
-
const bulletMatch = line.match(/^\s*[-*]\s+(.+)$/)
|
|
437
|
-
if (bulletMatch) {
|
|
438
|
-
// Flush previous bullet before starting new
|
|
439
|
-
flushPending()
|
|
440
|
-
pendingBullet = bulletMatch[1]
|
|
441
|
-
continue
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
// Continuation lines for multi-line bullets
|
|
445
|
-
if (pendingBullet && line.trim().length > 0) {
|
|
446
|
-
pendingBullet += ` ${line.trim()}`
|
|
447
|
-
} else if (!pendingBullet && current && line.trim().length > 0) {
|
|
448
|
-
// Non-bullet content under a recognized section
|
|
449
|
-
aggregated.get(current).push(line.trim())
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
flushPending()
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// Build markdown
|
|
456
|
-
let out = ''
|
|
457
|
-
for (const key of sectionOrder) {
|
|
458
|
-
if (key === 'Other Changes') continue // discard Other Changes entirely
|
|
459
|
-
const items = aggregated.get(key)
|
|
460
|
-
if (!items || items.length === 0) continue
|
|
461
|
-
out += `#### ${key}\n\n`
|
|
462
|
-
for (const item of items) {
|
|
463
|
-
out += `- ${item}\n`
|
|
464
|
-
}
|
|
465
|
-
out += `\n`
|
|
466
|
-
}
|
|
467
|
-
return out.trim()
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// Ensure nx.json has release.version.updateDependents = "auto" for Nx >= 22
|
|
471
|
-
async function ensureUpdateDependentsAuto(repoPath) {
|
|
472
|
-
const nxJsonPath = path.join(repoPath, 'nx.json')
|
|
473
|
-
try {
|
|
474
|
-
const content = await fs.readFile(nxJsonPath, 'utf8')
|
|
475
|
-
const data = JSON.parse(content)
|
|
476
|
-
if (!data.release) data.release = {}
|
|
477
|
-
if (!data.release.version) data.release.version = {}
|
|
478
|
-
if (data.release.version.updateDependents === undefined) {
|
|
479
|
-
data.release.version.updateDependents = 'auto'
|
|
480
|
-
await fs.writeFile(
|
|
481
|
-
nxJsonPath,
|
|
482
|
-
JSON.stringify(data, null, 2) + '\n',
|
|
483
|
-
'utf8',
|
|
484
|
-
)
|
|
485
|
-
console.log(
|
|
486
|
-
'🧩 Set release.version.updateDependents to "auto" in nx.json',
|
|
487
|
-
)
|
|
488
|
-
return true
|
|
489
|
-
}
|
|
490
|
-
console.log('ℹ nx.json already has release.version.updateDependents')
|
|
491
|
-
return false
|
|
492
|
-
} catch (error) {
|
|
493
|
-
console.log(`⚠️ Skipped nx.json update: ${error.message}`)
|
|
494
|
-
return false
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
|
|
498
255
|
// Check if gh CLI is installed and user is authenticated
|
|
499
256
|
async function checkGhCli() {
|
|
500
257
|
try {
|
|
@@ -517,9 +274,7 @@ async function checkGhCli() {
|
|
|
517
274
|
|
|
518
275
|
// Main function
|
|
519
276
|
async function main() {
|
|
520
|
-
console.log(
|
|
521
|
-
`🎯 nx-core Updater - nx-core target ${NX_CORE_VERSION}${NX_VERSION ? `, Nx target ${NX_VERSION}` : ''}`,
|
|
522
|
-
)
|
|
277
|
+
console.log(`🎯 nx-core Updater - version ${NX_CORE_VERSION}`)
|
|
523
278
|
console.log(`📋 Processing ${REPOSITORIES.length} repositories`)
|
|
524
279
|
|
|
525
280
|
try {
|
|
@@ -534,25 +289,19 @@ async function main() {
|
|
|
534
289
|
await fs.mkdir(WORK_DIR, { recursive: true })
|
|
535
290
|
|
|
536
291
|
// Process repositories sequentially
|
|
537
|
-
console.log(
|
|
292
|
+
console.log(`\n🔄 Processing repositories...`)
|
|
538
293
|
for (const repo of REPOSITORIES) {
|
|
539
294
|
await processRepo(repo)
|
|
540
295
|
}
|
|
541
296
|
|
|
542
297
|
// Cleanup
|
|
543
|
-
console.log(
|
|
298
|
+
console.log(`\n🧹 Cleaning up work directory...`)
|
|
544
299
|
await fs.rm(WORK_DIR, { recursive: true, force: true }).catch(() => {
|
|
545
300
|
// ignore error if directory does not exist
|
|
546
301
|
})
|
|
547
|
-
|
|
548
|
-
console.log('🔗 Created PRs:')
|
|
549
|
-
for (const url of CREATED_PR_URLS) {
|
|
550
|
-
console.log(`- ${url}`)
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
console.log('🎉 Done!')
|
|
302
|
+
console.log('\n🎉 Done!')
|
|
554
303
|
} catch (error) {
|
|
555
|
-
console.error(
|
|
304
|
+
console.error(`\n💥 Script failed: ${error.message}`)
|
|
556
305
|
process.exit(1)
|
|
557
306
|
}
|
|
558
307
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getEnvVar(name: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEnvVar = getEnvVar;
|
|
4
|
+
function getEnvVar(name) {
|
|
5
|
+
const value = process.env[name];
|
|
6
|
+
if (!value) {
|
|
7
|
+
throw new Error(`Missing env var ${name}`);
|
|
8
|
+
}
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../../../src/utils/common/environment.ts"],"names":[],"mappings":";;AAAA,8BAMC;AAND,SAAgB,SAAS,CAAC,IAAY;IACpC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAA;IAC5C,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import { ArtifactType } from './enums';
|
|
2
1
|
/**
|
|
3
|
-
* Pushes Lambda
|
|
2
|
+
* Pushes Lambda function package.json as OCI artifact to ECR using ORAS.
|
|
4
3
|
*
|
|
5
4
|
* @param ecrRepository - ECR repository name
|
|
6
5
|
* @param tag - Version tag for the artifact
|
|
7
|
-
* @param
|
|
8
|
-
* @param type - Artifact type
|
|
9
|
-
* @param ecrRegistry - ECR registry
|
|
6
|
+
* @param pathToPackageJson - Path to package.json file
|
|
10
7
|
*/
|
|
11
|
-
export declare function pushImageToEcr(ecrRepository: string, tag: string,
|
|
12
|
-
/**
|
|
13
|
-
* Pushes helm chart as OCI artifact to ECR using ORAS.
|
|
14
|
-
*
|
|
15
|
-
* @param ecrRepository - ECR repository name
|
|
16
|
-
* @param tag - Version tag for the artifact
|
|
17
|
-
* @param artifactPath - Path to artifact to package
|
|
18
|
-
* @param type - Artifact type
|
|
19
|
-
* @param ecrRegistry - ECR registry
|
|
20
|
-
* @param chartConfigPath - Path to chart config file in JSON format
|
|
21
|
-
*/
|
|
22
|
-
export declare function pushHelmOciToEcr(ecrRepository: string, tag: string, artifactPath: string, ecrRegistry: string, chartConfigPath: string): Promise<void>;
|
|
8
|
+
export declare function pushImageToEcr(ecrRepository: string, tag: string, pathToPackageJson: string, type: 'lambda' | 'frontend', ecrRegistry: string): Promise<void>;
|
|
@@ -1,57 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pushImageToEcr = pushImageToEcr;
|
|
4
|
-
exports.pushHelmOciToEcr = pushHelmOciToEcr;
|
|
5
4
|
const consola_1 = require("consola");
|
|
6
5
|
const exec_1 = require("./exec");
|
|
7
6
|
const github_1 = require("./github");
|
|
8
7
|
/**
|
|
9
|
-
* Pushes Lambda
|
|
8
|
+
* Pushes Lambda function package.json as OCI artifact to ECR using ORAS.
|
|
10
9
|
*
|
|
11
10
|
* @param ecrRepository - ECR repository name
|
|
12
11
|
* @param tag - Version tag for the artifact
|
|
13
|
-
* @param
|
|
14
|
-
* @param type - Artifact type
|
|
15
|
-
* @param ecrRegistry - ECR registry
|
|
12
|
+
* @param pathToPackageJson - Path to package.json file
|
|
16
13
|
*/
|
|
17
|
-
async function pushImageToEcr(ecrRepository, tag,
|
|
18
|
-
consola_1.consola.log(`OCI: Pushing image to ECR: ${ecrRegistry}/${ecrRepository}:${tag}`);
|
|
14
|
+
async function pushImageToEcr(ecrRepository, tag, pathToPackageJson, type, ecrRegistry) {
|
|
19
15
|
const commitSha = await (0, github_1.getCurrentGitCommitSha)();
|
|
20
16
|
const gitRepoUrl = await (0, github_1.getSanitizedCurrentGitRepoUrl)();
|
|
21
|
-
const artifactType = `application/vnd.payfit.${type}.manifest`;
|
|
22
17
|
const orasPushCommand = [
|
|
23
18
|
`oras push ${ecrRegistry}/${ecrRepository}:${tag}`,
|
|
24
19
|
`--annotation "org.opencontainers.image.source=${gitRepoUrl}"`,
|
|
25
20
|
`--annotation "org.opencontainers.image.revision=${commitSha}"`,
|
|
26
21
|
`--disable-path-validation`,
|
|
27
|
-
`--artifact-type
|
|
28
|
-
].join(' ');
|
|
29
|
-
const uploadToOci = await (0, exec_1.exec)(orasPushCommand, {
|
|
30
|
-
throwOnError: true,
|
|
31
|
-
});
|
|
32
|
-
consola_1.consola.log(uploadToOci.stdout);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Pushes helm chart as OCI artifact to ECR using ORAS.
|
|
36
|
-
*
|
|
37
|
-
* @param ecrRepository - ECR repository name
|
|
38
|
-
* @param tag - Version tag for the artifact
|
|
39
|
-
* @param artifactPath - Path to artifact to package
|
|
40
|
-
* @param type - Artifact type
|
|
41
|
-
* @param ecrRegistry - ECR registry
|
|
42
|
-
* @param chartConfigPath - Path to chart config file in JSON format
|
|
43
|
-
*/
|
|
44
|
-
async function pushHelmOciToEcr(ecrRepository, tag, artifactPath, ecrRegistry, chartConfigPath) {
|
|
45
|
-
consola_1.consola.log(`OCI: Pushing image to ECR: ${ecrRegistry}/${ecrRepository}:${tag}`);
|
|
46
|
-
const commitSha = await (0, github_1.getCurrentGitCommitSha)();
|
|
47
|
-
const gitRepoUrl = await (0, github_1.getSanitizedCurrentGitRepoUrl)();
|
|
48
|
-
const orasPushCommand = [
|
|
49
|
-
`oras push ${ecrRegistry}/${ecrRepository}:${tag}`,
|
|
50
|
-
`--annotation "org.opencontainers.image.source=${gitRepoUrl}"`,
|
|
51
|
-
`--annotation "org.opencontainers.image.revision=${commitSha}"`,
|
|
52
|
-
`--disable-path-validation`,
|
|
53
|
-
`--config ${chartConfigPath}:application/vnd.cncf.helm.config.v1+json`,
|
|
54
|
-
`${artifactPath}:application/vnd.cncf.helm.chart.content.v1.tar+gzip`,
|
|
22
|
+
`--artifact-type application/vnd.payfit.${type}.manifest ${pathToPackageJson}`,
|
|
55
23
|
].join(' ');
|
|
56
24
|
const uploadToOci = await (0, exec_1.exec)(orasPushCommand, {
|
|
57
25
|
throwOnError: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oci.js","sourceRoot":"","sources":["../../../../src/utils/common/oci.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"oci.js","sourceRoot":"","sources":["../../../../src/utils/common/oci.ts"],"names":[],"mappings":";;AAYA,wCAoBC;AAhCD,qCAAiC;AAEjC,iCAA6B;AAC7B,qCAAgF;AAEhF;;;;;;GAMG;AACI,KAAK,UAAU,cAAc,CAClC,aAAqB,EACrB,GAAW,EACX,iBAAyB,EACzB,IAA2B,EAC3B,WAAmB;IAEnB,MAAM,SAAS,GAAG,MAAM,IAAA,+BAAsB,GAAE,CAAA;IAChD,MAAM,UAAU,GAAG,MAAM,IAAA,sCAA6B,GAAE,CAAA;IACxD,MAAM,eAAe,GAAG;QACtB,aAAa,WAAW,IAAI,aAAa,IAAI,GAAG,EAAE;QAClD,iDAAiD,UAAU,GAAG;QAC9D,mDAAmD,SAAS,GAAG;QAC/D,2BAA2B;QAC3B,0CAA0C,IAAI,aAAa,iBAAiB,EAAE;KAC/E,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACX,MAAM,WAAW,GAAG,MAAM,IAAA,WAAI,EAAC,eAAe,EAAE;QAC9C,YAAY,EAAE,IAAI;KACnB,CAAC,CAAA;IACF,iBAAO,CAAC,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OctokitAuth = OctokitAuth;
|
|
4
|
+
const auth_app_1 = require("@octokit/auth-app");
|
|
5
|
+
const rest_1 = require("@octokit/rest");
|
|
6
|
+
const environment_1 = require("./environment");
|
|
7
|
+
function OctokitAuth() {
|
|
8
|
+
if (process.env.GITHUB_TOKEN) {
|
|
9
|
+
return new rest_1.Octokit({ auth: process.env.GITHUB_TOKEN });
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return new rest_1.Octokit({
|
|
13
|
+
authStrategy: auth_app_1.createAppAuth,
|
|
14
|
+
auth: {
|
|
15
|
+
appId: (0, environment_1.getEnvVar)('GITHUB_APP_ID'),
|
|
16
|
+
privateKey: (0, environment_1.getEnvVar)('GITHUB_PRIVATE_KEY'),
|
|
17
|
+
installationId: (0, environment_1.getEnvVar)('GITHUB_INSTALLATION_ID'),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=octokit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"octokit.js","sourceRoot":"","sources":["../../../../src/utils/common/octokit.ts"],"names":[],"mappings":";;AAKA,kCAaC;AAlBD,gDAAiD;AACjD,wCAAuC;AAEvC,+CAAyC;AAEzC,SAAgB,WAAW;IACzB,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QAC7B,OAAO,IAAI,cAAO,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAA;IACxD,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,cAAO,CAAC;YACjB,YAAY,EAAE,wBAAa;YAC3B,IAAI,EAAE;gBACJ,KAAK,EAAE,IAAA,uBAAS,EAAC,eAAe,CAAC;gBACjC,UAAU,EAAE,IAAA,uBAAS,EAAC,oBAAoB,CAAC;gBAC3C,cAAc,EAAE,IAAA,uBAAS,EAAC,wBAAwB,CAAC;aACpD;SACF,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
package/dist/src/utils/helm.d.ts
CHANGED
|
@@ -60,5 +60,5 @@ export declare function pushPackagedHelm(packagedHelmChartFilePath: string, pack
|
|
|
60
60
|
* @param packagedHelmChartFilePath
|
|
61
61
|
* @param ecrRepositoryPath
|
|
62
62
|
*/
|
|
63
|
-
export declare function pushOciPackagedHelm(packagedHelmChartFilePath: string, ecrRepositoryPath: string
|
|
63
|
+
export declare function pushOciPackagedHelm(packagedHelmChartFilePath: string, ecrRepositoryPath: string): Promise<import("tinyexec").Output>;
|
|
64
64
|
export {};
|