@bobfrankston/npmglobalize 1.0.103 → 1.0.105
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/.claude/settings.local.json +2 -1
- package/lib.js +92 -17
- package/package.json +1 -1
package/lib.js
CHANGED
|
@@ -2349,12 +2349,22 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2349
2349
|
}
|
|
2350
2350
|
}
|
|
2351
2351
|
if (currentAccess === 'public') {
|
|
2352
|
-
console.
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2352
|
+
console.log(colors.yellow(`Package '${pkg.name}' is currently PUBLIC on npm. Converting to private...`));
|
|
2353
|
+
if (!dryRun) {
|
|
2354
|
+
const accessResult = runCommand('npm', ['access', 'set', 'status=restricted', pkg.name], { cwd, silent: false });
|
|
2355
|
+
if (accessResult.success) {
|
|
2356
|
+
console.log(colors.green(`✓ Changed ${pkg.name} to PRIVATE on npm`));
|
|
2357
|
+
currentAccess = 'restricted';
|
|
2358
|
+
}
|
|
2359
|
+
else {
|
|
2360
|
+
console.error(colors.red(`Failed to change access. Try manually: npm access set status=restricted ${pkg.name}`));
|
|
2361
|
+
if (!force)
|
|
2362
|
+
return false;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
else {
|
|
2366
|
+
console.log(colors.dim(` [dry-run] Would run: npm access set status=restricted ${pkg.name}`));
|
|
2367
|
+
}
|
|
2358
2368
|
}
|
|
2359
2369
|
// Don't set "private": true in package.json - that blocks all publishing
|
|
2360
2370
|
console.log(`Package '${pkg.name}' will publish as PRIVATE (restricted access).`);
|
|
@@ -2365,12 +2375,22 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2365
2375
|
else if (effectiveNpmVisibility === 'public') {
|
|
2366
2376
|
// User explicitly wants public (or confirmed via prompt)
|
|
2367
2377
|
if (currentAccess === 'restricted') {
|
|
2368
|
-
console.
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2378
|
+
console.log(colors.yellow(`Package '${pkg.name}' is currently PRIVATE on npm. Converting to public...`));
|
|
2379
|
+
if (!dryRun) {
|
|
2380
|
+
const accessResult = runCommand('npm', ['access', 'set', 'status=public', pkg.name], { cwd, silent: false });
|
|
2381
|
+
if (accessResult.success) {
|
|
2382
|
+
console.log(colors.green(`✓ Changed ${pkg.name} to PUBLIC on npm`));
|
|
2383
|
+
currentAccess = 'public';
|
|
2384
|
+
}
|
|
2385
|
+
else {
|
|
2386
|
+
console.error(colors.red(`Failed to change access. Try manually: npm access set status=public ${pkg.name}`));
|
|
2387
|
+
if (!force)
|
|
2388
|
+
return false;
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
else {
|
|
2392
|
+
console.log(colors.dim(` [dry-run] Would run: npm access set status=public ${pkg.name}`));
|
|
2393
|
+
}
|
|
2374
2394
|
}
|
|
2375
2395
|
if (!publicConfirmed) {
|
|
2376
2396
|
console.log(`Will publish '${pkg.name}' to PUBLIC npm registry.`);
|
|
@@ -2677,7 +2697,16 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
2677
2697
|
const isFirstPublish = !currentAccess;
|
|
2678
2698
|
if (!currentGitStatus.hasUncommitted && !message && !justInitialized && !isFirstPublish) {
|
|
2679
2699
|
console.log('');
|
|
2680
|
-
|
|
2700
|
+
if (currentAccess === 'public') {
|
|
2701
|
+
console.log(`${pkg.name}@${pkg.version} is already PUBLIC on npm. No changes to publish.`);
|
|
2702
|
+
}
|
|
2703
|
+
else if (currentAccess === 'restricted') {
|
|
2704
|
+
console.log(`${pkg.name}@${pkg.version} is PRIVATE on npm. No changes to publish.`);
|
|
2705
|
+
}
|
|
2706
|
+
else {
|
|
2707
|
+
console.log('No changes to commit and no custom message specified.');
|
|
2708
|
+
}
|
|
2709
|
+
console.log(colors.dim(' Use -m "message" to force a version bump and republish.'));
|
|
2681
2710
|
// If install/link flag is set, install globally
|
|
2682
2711
|
if (install || link || wsl) {
|
|
2683
2712
|
if (verbose) {
|
|
@@ -3159,8 +3188,8 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3159
3188
|
return false;
|
|
3160
3189
|
}
|
|
3161
3190
|
// Determine what was published
|
|
3162
|
-
const finalAccess = currentAccess || (isScoped ? 'restricted' : 'public');
|
|
3163
|
-
const accessLabel = finalAccess === 'restricted' ? 'PRIVATE' : 'PUBLIC';
|
|
3191
|
+
const finalAccess = effectiveNpmVisibility || currentAccess || (isScoped ? 'restricted' : 'public');
|
|
3192
|
+
const accessLabel = (finalAccess === 'restricted' || finalAccess === 'private') ? 'PRIVATE' : 'PUBLIC';
|
|
3164
3193
|
console.log(colors.green(`✓ Published to npm as ${accessLabel}`));
|
|
3165
3194
|
}
|
|
3166
3195
|
else {
|
|
@@ -3273,8 +3302,8 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3273
3302
|
console.log(colors.green('✓ Release Summary'));
|
|
3274
3303
|
console.log(colors.green('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
3275
3304
|
const finalPkg = readPackageJson(cwd);
|
|
3276
|
-
const finalAccess = currentAccess || (isScoped ? 'restricted' : 'public');
|
|
3277
|
-
const accessLabel = finalAccess === 'restricted' ? 'PRIVATE' : 'PUBLIC';
|
|
3305
|
+
const finalAccess = effectiveNpmVisibility || currentAccess || (isScoped ? 'restricted' : 'public');
|
|
3306
|
+
const accessLabel = (finalAccess === 'restricted' || finalAccess === 'private') ? 'PRIVATE' : 'PUBLIC';
|
|
3278
3307
|
console.log(` Package: ${colors.green(finalPkg.name)}`);
|
|
3279
3308
|
console.log(` Version: ${colors.green('v' + finalPkg.version)}`);
|
|
3280
3309
|
console.log(` Published: ${colors.green('✓')} (${accessLabel})`);
|
|
@@ -3357,6 +3386,52 @@ export async function globalizeWorkspace(rootDir, options = {}, configOptions =
|
|
|
3357
3386
|
console.log(`Filtered to: ${filteredOrder.join(', ')}`);
|
|
3358
3387
|
console.log('');
|
|
3359
3388
|
}
|
|
3389
|
+
// Check for visibility mismatches: public packages depending on would-be-private siblings
|
|
3390
|
+
const visibilityMap = new Map();
|
|
3391
|
+
for (const pkgInfo of packages) {
|
|
3392
|
+
const pkgConfig = readConfig(pkgInfo.dir);
|
|
3393
|
+
const vis = pkgConfig.npmVisibility
|
|
3394
|
+
|| pkgInfo.pkg.publishConfig?.access
|
|
3395
|
+
|| options.npmVisibility; // CLI-level default
|
|
3396
|
+
if (vis === 'public') {
|
|
3397
|
+
visibilityMap.set(pkgInfo.name, 'public');
|
|
3398
|
+
}
|
|
3399
|
+
else if (pkgInfo.pkg.private) {
|
|
3400
|
+
visibilityMap.set(pkgInfo.name, 'private');
|
|
3401
|
+
}
|
|
3402
|
+
else {
|
|
3403
|
+
visibilityMap.set(pkgInfo.name, 'unknown');
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
const wsNameSet = new Set(packages.map(p => p.name));
|
|
3407
|
+
for (const pkgInfo of packages) {
|
|
3408
|
+
if (visibilityMap.get(pkgInfo.name) !== 'public')
|
|
3409
|
+
continue;
|
|
3410
|
+
const deps = { ...pkgInfo.pkg.dependencies, ...pkgInfo.pkg.devDependencies };
|
|
3411
|
+
for (const depName of Object.keys(deps || {})) {
|
|
3412
|
+
if (!wsNameSet.has(depName))
|
|
3413
|
+
continue;
|
|
3414
|
+
if (visibilityMap.get(depName) === 'public')
|
|
3415
|
+
continue;
|
|
3416
|
+
const depInfo = packages.find(p => p.name === depName);
|
|
3417
|
+
if (!depInfo)
|
|
3418
|
+
continue;
|
|
3419
|
+
console.log(colors.yellow(`⚠ Public package ${pkgInfo.name} depends on ${depName} which has no public visibility set.`));
|
|
3420
|
+
if (!options.dryRun) {
|
|
3421
|
+
const makePublic = await confirm(`Make ${depName} public too?`, true);
|
|
3422
|
+
if (makePublic) {
|
|
3423
|
+
const depConfig = readConfig(depInfo.dir);
|
|
3424
|
+
depConfig.npmVisibility = 'public';
|
|
3425
|
+
writeConfig(depInfo.dir, depConfig, new Set(['npmVisibility']));
|
|
3426
|
+
visibilityMap.set(depName, 'public');
|
|
3427
|
+
console.log(colors.green(`✓ Set ${depName} to public in .globalize.json5`));
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
else {
|
|
3431
|
+
console.log(colors.dim(` [dry-run] Would ask to make ${depName} public`));
|
|
3432
|
+
}
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3360
3435
|
// Process each package in dependency order
|
|
3361
3436
|
const results = [];
|
|
3362
3437
|
for (const pkgName of filteredOrder) {
|