@entro314labs/release-kit 1.0.2 → 1.0.3
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/release.mjs +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entro314labs/release-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Single-file, zero-dependency release mechanism for JS/TS/Node projects: version bump, changelog roll, commit, annotated tag, push, publish, GitHub release",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"changelog",
|
package/release.mjs
CHANGED
|
@@ -480,6 +480,21 @@ const target = argv.find((a) => !a.startsWith('-') && a !== explicitDistTag && a
|
|
|
480
480
|
|
|
481
481
|
const root = tryRead('git', ['rev-parse', '--show-toplevel'])
|
|
482
482
|
if (!root) abort('not inside a git repository')
|
|
483
|
+
|
|
484
|
+
// A release is scoped to the repository: the version, the tag and the push all belong to
|
|
485
|
+
// one git history, so the package released is the one at the git root. Refuse when invoked
|
|
486
|
+
// from a nested package instead — silently releasing the parent is the worse outcome.
|
|
487
|
+
const localManifest = resolve('package.json')
|
|
488
|
+
const rootManifest = join(root, 'package.json')
|
|
489
|
+
if (existsSync(localManifest) && localManifest !== rootManifest) {
|
|
490
|
+
abort(
|
|
491
|
+
`${relative(root, localManifest)} is a nested package, but a release covers the whole ` +
|
|
492
|
+
`repository.\n\n Running here would release ${
|
|
493
|
+
existsSync(rootManifest) ? readJson(rootManifest).name : 'the repository root'
|
|
494
|
+
} instead.\n` +
|
|
495
|
+
' release-kit handles one package per repository; it does not release workspace members.',
|
|
496
|
+
)
|
|
497
|
+
}
|
|
483
498
|
process.chdir(root)
|
|
484
499
|
|
|
485
500
|
if (!existsSync('package.json')) abort(`no package.json at ${root}`)
|