npm-workspaces-publish-tool 0.0.14 → 0.0.16
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 +3 -1
- package/build/package.json +1 -1
- package/build/src/cli.js +11 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,13 +23,15 @@ npm install -g npm-workspaces-publish-tool
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
nw-publish [--dry-run] [--registry <url>]
|
|
26
|
+
nw-publish [--dry-run] [--registry <url>] [--auto-tick] [--anchor-tag-suffix <suffix>]
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
### Command Options
|
|
30
30
|
|
|
31
31
|
- `--dry-run`: Runs validation and preview without actual publishing
|
|
32
32
|
- `--registry <url>`: (Optional) NPM registry URL to publish scoped packages to
|
|
33
|
+
- `--auto-tick`: Automatically increment patch versions for packages that need version bumps
|
|
34
|
+
- `--anchor-tag-suffix <suffix>`: (Optional) Suffix to append to git tags (e.g., `-rc` creates tags like `v1.2.3-rc`)
|
|
33
35
|
|
|
34
36
|
## Workflow
|
|
35
37
|
1. **Validation Phase**
|
package/build/package.json
CHANGED
package/build/src/cli.js
CHANGED
|
@@ -734,11 +734,13 @@ function runNpmPublishInReleaseOrder(releaseOrder, packageInfos, packagesToRelea
|
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
function tagAndPushRepo(version) {
|
|
737
|
+
function tagAndPushRepo(version, tagSuffix) {
|
|
738
738
|
try {
|
|
739
|
-
execSync(`git tag v${version}`, { stdio: 'inherit' });
|
|
740
|
-
execSync(`git push origin v${version}`, {
|
|
741
|
-
|
|
739
|
+
execSync(`git tag v${version}${tagSuffix}`, { stdio: 'inherit' });
|
|
740
|
+
execSync(`git push origin v${version}${tagSuffix}`, {
|
|
741
|
+
stdio: 'inherit',
|
|
742
|
+
});
|
|
743
|
+
console.log(`✅ Tagged v${version}${tagSuffix}`);
|
|
742
744
|
}
|
|
743
745
|
catch (err) {
|
|
744
746
|
console.error(`❌ Failed to tag v${version}`);
|
|
@@ -762,11 +764,13 @@ program
|
|
|
762
764
|
.option('--dry-run', 'Run without making changes')
|
|
763
765
|
.option('--registry <url>', 'NPM registry to publish to')
|
|
764
766
|
.option('--auto-tick', 'Automatically tick patch versions if needed')
|
|
767
|
+
.option('--anchor-tag-suffix <suffix>', "A tagging suffix convention which deviates from vx.x.x. E.g. if --anchor-tag-suffix=-rc is provided, tags (when not in dry-run mode) will be created in the form 'vx.x.x-rc'")
|
|
765
768
|
.action((options) => {
|
|
766
769
|
printHeader();
|
|
767
770
|
const dryRun = options.dryRun;
|
|
768
771
|
const registryUrl = options.registry;
|
|
769
772
|
const autoTick = options.autoTick;
|
|
773
|
+
const anchorTagSuffix = options.anchorTagSuffix ?? '';
|
|
770
774
|
const { packageInfos, releaseOrder, packagesToRelease, currentRootVersion, } = validatePublish(dryRun, autoTick);
|
|
771
775
|
if (packagesToRelease.length === 0) {
|
|
772
776
|
return console.log('\n ̄\\_(ツ)_/ ̄ No workspaces to publish\n');
|
|
@@ -784,13 +788,13 @@ program
|
|
|
784
788
|
console.log('\n📦 Publishing packages...');
|
|
785
789
|
runNpmPublishInReleaseOrder(releaseOrder, packageInfos, packagesToRelease, registryUrl);
|
|
786
790
|
console.log('\n🎉 All packages published!\n');
|
|
787
|
-
console.log(`🏷️ Tagging repository with v${currentRootVersion}...`);
|
|
788
|
-
tagAndPushRepo(currentRootVersion);
|
|
791
|
+
console.log(`🏷️ Tagging repository with v${currentRootVersion}${anchorTagSuffix}...`);
|
|
792
|
+
tagAndPushRepo(currentRootVersion, anchorTagSuffix);
|
|
789
793
|
}
|
|
790
794
|
else {
|
|
791
795
|
console.log('\n[dry-run] 📦 Would publish:');
|
|
792
796
|
packagesToRelease.forEach((pkg) => console.log(` - ${pkg}`));
|
|
793
|
-
console.log(`\n[dry-run] 🏷️ Would tag: v${currentRootVersion}`);
|
|
797
|
+
console.log(`\n[dry-run] 🏷️ Would tag: v${currentRootVersion}${anchorTagSuffix}`);
|
|
794
798
|
}
|
|
795
799
|
}
|
|
796
800
|
catch (error) {
|