@wyxos/zephyr 0.2.8 → 0.2.9
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/package.json +1 -1
- package/src/release-node.mjs +60 -16
package/package.json
CHANGED
package/src/release-node.mjs
CHANGED
|
@@ -106,8 +106,11 @@ async function ensureUpToDateWithUpstream(branch, upstreamRef, rootDir = process
|
|
|
106
106
|
if (remoteName && remoteBranch) {
|
|
107
107
|
logProcessing(`Fetching latest updates from ${remoteName}/${remoteBranch}...`)
|
|
108
108
|
try {
|
|
109
|
-
await runCommand('git', ['fetch', remoteName, remoteBranch], { cwd: rootDir })
|
|
109
|
+
await runCommand('git', ['fetch', remoteName, remoteBranch], { capture: true, cwd: rootDir })
|
|
110
110
|
} catch (error) {
|
|
111
|
+
if (error.stderr) {
|
|
112
|
+
logError(error.stderr)
|
|
113
|
+
}
|
|
111
114
|
throw new Error(`Failed to fetch ${upstreamRef}: ${error.message}`)
|
|
112
115
|
}
|
|
113
116
|
}
|
|
@@ -129,8 +132,11 @@ async function ensureUpToDateWithUpstream(branch, upstreamRef, rootDir = process
|
|
|
129
132
|
logProcessing(`Fast-forwarding ${branch} with ${upstreamRef}...`)
|
|
130
133
|
|
|
131
134
|
try {
|
|
132
|
-
await runCommand('git', ['pull', '--ff-only', remoteName, remoteBranch], { cwd: rootDir })
|
|
135
|
+
await runCommand('git', ['pull', '--ff-only', remoteName, remoteBranch], { capture: true, cwd: rootDir })
|
|
133
136
|
} catch (error) {
|
|
137
|
+
if (error.stderr) {
|
|
138
|
+
logError(error.stderr)
|
|
139
|
+
}
|
|
134
140
|
throw new Error(
|
|
135
141
|
`Unable to fast-forward ${branch} with ${upstreamRef}. Resolve conflicts manually, then rerun the release.\n${error.message}`
|
|
136
142
|
)
|
|
@@ -290,8 +296,8 @@ async function runLibBuild(skipBuild, pkg, rootDir = process.cwd()) {
|
|
|
290
296
|
|
|
291
297
|
if (hasLibChanges) {
|
|
292
298
|
logProcessing('Committing lib build artifacts...')
|
|
293
|
-
await runCommand('git', ['add', 'lib/'], { cwd: rootDir })
|
|
294
|
-
await runCommand('git', ['commit', '-m', 'chore: build lib artifacts'], { cwd: rootDir })
|
|
299
|
+
await runCommand('git', ['add', 'lib/'], { capture: true, cwd: rootDir })
|
|
300
|
+
await runCommand('git', ['commit', '-m', 'chore: build lib artifacts'], { capture: true, cwd: rootDir })
|
|
295
301
|
logSuccess('Lib build artifacts committed.')
|
|
296
302
|
}
|
|
297
303
|
|
|
@@ -300,8 +306,19 @@ async function runLibBuild(skipBuild, pkg, rootDir = process.cwd()) {
|
|
|
300
306
|
|
|
301
307
|
async function ensureNpmAuth(rootDir = process.cwd()) {
|
|
302
308
|
logProcessing('Confirming npm authentication...')
|
|
303
|
-
|
|
304
|
-
|
|
309
|
+
try {
|
|
310
|
+
const result = await runCommand('npm', ['whoami'], { capture: true, cwd: rootDir })
|
|
311
|
+
// Only show username if we captured it, otherwise just show success
|
|
312
|
+
if (result?.stdout) {
|
|
313
|
+
// Silently authenticated - we don't need to show the username
|
|
314
|
+
}
|
|
315
|
+
logSuccess('npm authenticated.')
|
|
316
|
+
} catch (error) {
|
|
317
|
+
if (error.stderr) {
|
|
318
|
+
logError(error.stderr)
|
|
319
|
+
}
|
|
320
|
+
throw error
|
|
321
|
+
}
|
|
305
322
|
}
|
|
306
323
|
|
|
307
324
|
async function bumpVersion(releaseType, rootDir = process.cwd()) {
|
|
@@ -316,21 +333,28 @@ async function bumpVersion(releaseType, rootDir = process.cwd()) {
|
|
|
316
333
|
|
|
317
334
|
if (hasLibChanges) {
|
|
318
335
|
logProcessing('Stashing lib build artifacts...')
|
|
319
|
-
await runCommand('git', ['stash', 'push', '-u', '-m', 'temp: lib build artifacts', 'lib/'], { cwd: rootDir })
|
|
336
|
+
await runCommand('git', ['stash', 'push', '-u', '-m', 'temp: lib build artifacts', 'lib/'], { capture: true, cwd: rootDir })
|
|
320
337
|
}
|
|
321
338
|
|
|
322
339
|
try {
|
|
323
340
|
// npm version will update package.json and create a commit with default message
|
|
324
|
-
await runCommand('npm', ['version', releaseType], { cwd: rootDir })
|
|
341
|
+
const result = await runCommand('npm', ['version', releaseType], { capture: true, cwd: rootDir })
|
|
342
|
+
// Extract version from output (e.g., "v0.2.8" or "0.2.8")
|
|
343
|
+
if (result?.stdout) {
|
|
344
|
+
const versionMatch = result.stdout.match(/v?(\d+\.\d+\.\d+)/)
|
|
345
|
+
if (versionMatch) {
|
|
346
|
+
// Version is shown in the logSuccess message below, no need to show it here
|
|
347
|
+
}
|
|
348
|
+
}
|
|
325
349
|
} finally {
|
|
326
350
|
// Restore lib changes and ensure they're in the commit
|
|
327
351
|
if (hasLibChanges) {
|
|
328
352
|
logProcessing('Restoring lib build artifacts...')
|
|
329
|
-
await runCommand('git', ['stash', 'pop'], { cwd: rootDir })
|
|
330
|
-
await runCommand('git', ['add', 'lib/'], { cwd: rootDir })
|
|
353
|
+
await runCommand('git', ['stash', 'pop'], { capture: true, cwd: rootDir })
|
|
354
|
+
await runCommand('git', ['add', 'lib/'], { capture: true, cwd: rootDir })
|
|
331
355
|
const { stdout: statusAfter } = await runCommand('git', ['status', '--porcelain'], { capture: true, cwd: rootDir })
|
|
332
356
|
if (statusAfter.includes('lib/')) {
|
|
333
|
-
await runCommand('git', ['commit', '--amend', '--no-edit'], { cwd: rootDir })
|
|
357
|
+
await runCommand('git', ['commit', '--amend', '--no-edit'], { capture: true, cwd: rootDir })
|
|
334
358
|
}
|
|
335
359
|
}
|
|
336
360
|
}
|
|
@@ -339,7 +363,7 @@ async function bumpVersion(releaseType, rootDir = process.cwd()) {
|
|
|
339
363
|
const commitMessage = `chore: release ${pkg.version}`
|
|
340
364
|
|
|
341
365
|
// Amend the commit message to use our custom format
|
|
342
|
-
await runCommand('git', ['commit', '--amend', '-m', commitMessage], { cwd: rootDir })
|
|
366
|
+
await runCommand('git', ['commit', '--amend', '-m', commitMessage], { capture: true, cwd: rootDir })
|
|
343
367
|
|
|
344
368
|
logSuccess(`Version updated to ${pkg.version}.`)
|
|
345
369
|
return pkg
|
|
@@ -347,8 +371,18 @@ async function bumpVersion(releaseType, rootDir = process.cwd()) {
|
|
|
347
371
|
|
|
348
372
|
async function pushChanges(rootDir = process.cwd()) {
|
|
349
373
|
logProcessing('Pushing commits and tags to origin...')
|
|
350
|
-
|
|
351
|
-
|
|
374
|
+
try {
|
|
375
|
+
await runCommand('git', ['push', '--follow-tags'], { capture: true, cwd: rootDir })
|
|
376
|
+
logSuccess('Git push completed.')
|
|
377
|
+
} catch (error) {
|
|
378
|
+
if (error.stdout) {
|
|
379
|
+
logError(error.stdout)
|
|
380
|
+
}
|
|
381
|
+
if (error.stderr) {
|
|
382
|
+
logError(error.stderr)
|
|
383
|
+
}
|
|
384
|
+
throw error
|
|
385
|
+
}
|
|
352
386
|
}
|
|
353
387
|
|
|
354
388
|
async function publishPackage(pkg, rootDir = process.cwd()) {
|
|
@@ -362,8 +396,18 @@ async function publishPackage(pkg, rootDir = process.cwd()) {
|
|
|
362
396
|
}
|
|
363
397
|
|
|
364
398
|
logProcessing(`Publishing ${pkg.name}@${pkg.version} to npm...`)
|
|
365
|
-
|
|
366
|
-
|
|
399
|
+
try {
|
|
400
|
+
await runCommand('npm', publishArgs, { capture: true, cwd: rootDir })
|
|
401
|
+
logSuccess('npm publish completed.')
|
|
402
|
+
} catch (error) {
|
|
403
|
+
if (error.stdout) {
|
|
404
|
+
logError(error.stdout)
|
|
405
|
+
}
|
|
406
|
+
if (error.stderr) {
|
|
407
|
+
logError(error.stderr)
|
|
408
|
+
}
|
|
409
|
+
throw error
|
|
410
|
+
}
|
|
367
411
|
}
|
|
368
412
|
|
|
369
413
|
function extractDomainFromHomepage(homepage) {
|