npm-workspaces-publish-tool 0.0.7 → 0.0.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/build/package.json +1 -1
- package/build/src/cli.js +17 -9
- package/package.json +1 -1
package/build/package.json
CHANGED
package/build/src/cli.js
CHANGED
|
@@ -58,9 +58,14 @@ function getReleaseOrderFromInDegree(inDegree, dependencies) {
|
|
|
58
58
|
}
|
|
59
59
|
function getDirtyMap(workspaces, lastTag, cwd) {
|
|
60
60
|
const dirtyMap = new Map();
|
|
61
|
-
const
|
|
61
|
+
const changedFilesFromTag = lastTag
|
|
62
62
|
? getChangesBetweenRefs(lastTag, 'HEAD', [], '', cwd)
|
|
63
63
|
: [];
|
|
64
|
+
const changedFilesLocal = git(['diff', '--name-only', 'HEAD'], { cwd })
|
|
65
|
+
.stdout.trim()
|
|
66
|
+
.split('\n')
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
const changedFiles = [...changedFilesFromTag, ...changedFilesLocal];
|
|
64
69
|
for (const ws of workspaces) {
|
|
65
70
|
const isNew = !lastTag;
|
|
66
71
|
const isDirty = changedFiles.some((f) => resolve(cwd, f).includes(ws.path));
|
|
@@ -352,9 +357,18 @@ function validatePublish() {
|
|
|
352
357
|
const packageInfos = getPackageInfos(cwd);
|
|
353
358
|
const { dependencies } = createDependencyMap(packageInfos);
|
|
354
359
|
const inDegree = calculateWorkspaceInDegree(workspaces, dependencies);
|
|
355
|
-
const
|
|
360
|
+
const releaseOrderOriginal = getReleaseOrderFromInDegree(inDegree, dependencies);
|
|
356
361
|
const dirtyMap = getDirtyMap(workspaces, lastMonoRepoTag, cwd);
|
|
357
362
|
const dirtyVersionChanges = getDirtyPackagesVersionChanges(workspaces, dirtyMap, lastMonoRepoTag, cwd);
|
|
363
|
+
const releaseOrder = releaseOrderOriginal.filter((pkgName) => {
|
|
364
|
+
const ws = packageInfos[pkgName];
|
|
365
|
+
const isRoot = workspaces.some((w) => w.path === '.' && w.name === pkgName); // root detection
|
|
366
|
+
const isPrivate = ws?.private;
|
|
367
|
+
if (!isRoot && isPrivate) {
|
|
368
|
+
console.log(`⚠️ Wont publish private workspace: ${pkgName}`);
|
|
369
|
+
}
|
|
370
|
+
return isRoot || !isPrivate; // Keep root, skip other private packages
|
|
371
|
+
});
|
|
358
372
|
console.log('🏗️ Building packages...');
|
|
359
373
|
for (const pkgName of releaseOrder) {
|
|
360
374
|
const pkgInfo = packageInfos[pkgName];
|
|
@@ -451,18 +465,12 @@ function validatePublish() {
|
|
|
451
465
|
console.error('\nFix the above issues before publishing.\n');
|
|
452
466
|
process.exit(1);
|
|
453
467
|
}
|
|
454
|
-
console.log(rootPackageSuccessMessage);
|
|
455
468
|
console.log('\n🗃️ Validating git status...\n');
|
|
456
469
|
if (!verifyCleanGitStatus(workspaces, dirtyMap, cwd)) {
|
|
457
470
|
process.exit(1);
|
|
458
471
|
}
|
|
459
472
|
console.log('📝 Publish summary:\n');
|
|
460
|
-
|
|
461
|
-
console.log(`🌳 Root: ${previousRootVersion} → ${currentRootVersion}`);
|
|
462
|
-
}
|
|
463
|
-
else {
|
|
464
|
-
console.log(`🌳 Root: ${currentRootVersion} (first release)`);
|
|
465
|
-
}
|
|
473
|
+
console.log(rootPackageSuccessMessage);
|
|
466
474
|
console.log('');
|
|
467
475
|
const packagesToRelease = [];
|
|
468
476
|
for (const pkgName of releaseOrder) {
|