@bobfrankston/npmglobalize 1.0.138 → 1.0.139
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/lib/git.js +13 -0
- package/lib.js +44 -0
- package/package.json +3 -3
package/lib/git.js
CHANGED
|
@@ -673,6 +673,19 @@ export function pushWithProtection(cwd, verbose) {
|
|
|
673
673
|
console.log(colors.green(' ✓ Already up-to-date'));
|
|
674
674
|
return true;
|
|
675
675
|
}
|
|
676
|
+
// No upstream branch — auto-set and retry
|
|
677
|
+
if (combined.includes('no upstream branch') || combined.includes('has no upstream')) {
|
|
678
|
+
if (verbose)
|
|
679
|
+
console.log(colors.yellow(' No upstream branch — setting upstream...'));
|
|
680
|
+
const branchResult = runCommand('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd, silent: true });
|
|
681
|
+
const branch = branchResult.output.trim() || 'master';
|
|
682
|
+
pushResult = runCommand('git', ['push', '--set-upstream', 'origin', branch], { cwd, silent: true });
|
|
683
|
+
if (pushResult.success) {
|
|
684
|
+
if (verbose)
|
|
685
|
+
console.log(colors.green(' ✓ Pushed to remote (set upstream)'));
|
|
686
|
+
return true;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
676
689
|
// Transient network errors (HTTP 408, RPC failed, unexpected disconnect) — retry once
|
|
677
690
|
if (/rpc failed|curl \d+|unexpected disconnect|hung up unexpectedly/i.test(pushResult.stderr)) {
|
|
678
691
|
console.log(colors.yellow('Git push failed with transient error — retrying...'));
|
package/lib.js
CHANGED
|
@@ -1647,6 +1647,20 @@ function pushWithProtection(cwd, verbose) {
|
|
|
1647
1647
|
console.log(colors.green(' ✓ Already up-to-date'));
|
|
1648
1648
|
return true;
|
|
1649
1649
|
}
|
|
1650
|
+
// No upstream branch — auto-set and retry
|
|
1651
|
+
if (combined.includes('no upstream branch') || combined.includes('has no upstream')) {
|
|
1652
|
+
if (verbose)
|
|
1653
|
+
console.log(colors.yellow(' No upstream branch — setting upstream...'));
|
|
1654
|
+
// Detect current branch name
|
|
1655
|
+
const branchResult = runCommand('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd, silent: true });
|
|
1656
|
+
const branch = branchResult.output.trim() || 'master';
|
|
1657
|
+
pushResult = runCommand('git', ['push', '--set-upstream', 'origin', branch], { cwd, silent: true });
|
|
1658
|
+
if (pushResult.success) {
|
|
1659
|
+
if (verbose)
|
|
1660
|
+
console.log(colors.green(' ✓ Pushed to remote (set upstream)'));
|
|
1661
|
+
return true;
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1650
1664
|
// Transient network errors (HTTP 408, RPC failed, unexpected disconnect) — retry once
|
|
1651
1665
|
if (/rpc failed|curl \d+|unexpected disconnect|hung up unexpectedly/i.test(pushResult.stderr)) {
|
|
1652
1666
|
console.log(colors.yellow('Git push failed with transient error — retrying...'));
|
|
@@ -3720,6 +3734,36 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
3720
3734
|
else if (!skipVersionBump) {
|
|
3721
3735
|
console.log(` [dry-run] Would run: npm version ${bump}`);
|
|
3722
3736
|
}
|
|
3737
|
+
// Check for public package depending on private dependencies
|
|
3738
|
+
const publishAccess = effectiveNpmVisibility || currentAccess || (isScoped ? 'restricted' : 'public');
|
|
3739
|
+
if (publishAccess === 'public') {
|
|
3740
|
+
const privateDeps = [];
|
|
3741
|
+
for (const depKey of ['dependencies', 'peerDependencies']) {
|
|
3742
|
+
const deps = pkg[depKey];
|
|
3743
|
+
if (!deps)
|
|
3744
|
+
continue;
|
|
3745
|
+
for (const depName of Object.keys(deps)) {
|
|
3746
|
+
const depAccess = checkNpmAccess(depName);
|
|
3747
|
+
if (depAccess === 'restricted') {
|
|
3748
|
+
privateDeps.push(depName);
|
|
3749
|
+
}
|
|
3750
|
+
else if (depAccess === null && depName.startsWith('@')) {
|
|
3751
|
+
// Scoped package not on npm — will be private by default
|
|
3752
|
+
privateDeps.push(`${depName} (not yet published)`);
|
|
3753
|
+
}
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
if (privateDeps.length > 0) {
|
|
3757
|
+
console.log('');
|
|
3758
|
+
console.error(colors.red('WARNING: Public package depends on PRIVATE dependencies:'));
|
|
3759
|
+
for (const d of privateDeps) {
|
|
3760
|
+
console.error(colors.red(` ${d}`));
|
|
3761
|
+
}
|
|
3762
|
+
console.error(colors.yellow('Consumers will get E404 when installing this package.'));
|
|
3763
|
+
console.error(colors.yellow('Fix: publish those deps as public, or make this package private.'));
|
|
3764
|
+
console.log('');
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3723
3767
|
// Publish
|
|
3724
3768
|
console.log('Publishing to npm...');
|
|
3725
3769
|
if (!dryRun) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/npmglobalize",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.139",
|
|
4
4
|
"description": "Transform file: dependencies to npm versions for publishing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@bobfrankston/freezepak": "^0.1.6",
|
|
35
35
|
"@bobfrankston/importgen": "^0.1.32",
|
|
36
|
-
"@bobfrankston/themecolors": "^0.1.
|
|
37
|
-
"@bobfrankston/userconfig": "^1.0.
|
|
36
|
+
"@bobfrankston/themecolors": "^0.1.2",
|
|
37
|
+
"@bobfrankston/userconfig": "^1.0.6",
|
|
38
38
|
"@npmcli/package-json": "^7.0.4",
|
|
39
39
|
"json5": "^2.2.3",
|
|
40
40
|
"libnpmversion": "^8.0.3",
|