dksetup 1.0.39 → 1.0.41
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/.dksetup-publish.lock +2 -0
- package/dksetup-publish.mjs +59 -8
- package/justfile +9 -1
- package/package.json +1 -1
package/dksetup-publish.mjs
CHANGED
|
@@ -89,6 +89,9 @@ async function assertNpmAuth(cwd) {
|
|
|
89
89
|
|
|
90
90
|
async function main() {
|
|
91
91
|
const repoRoot = process.cwd();
|
|
92
|
+
|
|
93
|
+
// (lockfile removed) — script now checks registry and publishes existing local
|
|
94
|
+
// versions before bumping, so an external lock is unnecessary.
|
|
92
95
|
const packageStates = [];
|
|
93
96
|
for (const config of packageConfigs) {
|
|
94
97
|
const fullPath = resolve(repoRoot, config.path);
|
|
@@ -111,6 +114,8 @@ async function main() {
|
|
|
111
114
|
publishedCount += 1;
|
|
112
115
|
}
|
|
113
116
|
}
|
|
117
|
+
|
|
118
|
+
// If resumeOnly handling already exists, keep that behavior
|
|
114
119
|
if (resumeOnly && publishedCount > 0 && publishedCount < packageStates.length) {
|
|
115
120
|
if (!dryRun) {
|
|
116
121
|
const npmUser = await assertNpmAuth(repoRoot);
|
|
@@ -169,6 +174,37 @@ async function main() {
|
|
|
169
174
|
console.log('\nResume mode did not publish anything.');
|
|
170
175
|
return;
|
|
171
176
|
}
|
|
177
|
+
|
|
178
|
+
// SAFETY: if some local versions are NOT yet published, publish them first
|
|
179
|
+
// instead of bumping again. This prevents repeated runs from repeatedly
|
|
180
|
+
// incrementing the package version while the registry is still processing.
|
|
181
|
+
if (publishedCount < packageStates.length) {
|
|
182
|
+
if (dryRun) {
|
|
183
|
+
console.log('\nDry run: would publish existing local versions (no bump):');
|
|
184
|
+
for (const pkg of packageStates) {
|
|
185
|
+
if (!pkg.currentPublished) console.log(`- ${pkg.name}@${pkg.oldVersion}`);
|
|
186
|
+
}
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const npmUser = await assertNpmAuth(repoRoot);
|
|
191
|
+
console.log(`\nAuthenticated as npm user: ${npmUser}`);
|
|
192
|
+
console.log('\nPublishing current local versions (no bump) to avoid duplicate increments...');
|
|
193
|
+
|
|
194
|
+
for (const pkg of packageStates) {
|
|
195
|
+
if (!pkg.currentPublished) {
|
|
196
|
+
const publishCwd = resolve(repoRoot, pkg.publishDir);
|
|
197
|
+
console.log(`\nPublishing ${pkg.name}@${pkg.oldVersion} from ${pkg.publishDir}`);
|
|
198
|
+
await runCommand('npm', ['publish', '--access', 'public'], publishCwd);
|
|
199
|
+
console.log(`Published ${pkg.name}@${pkg.oldVersion}`);
|
|
200
|
+
} else {
|
|
201
|
+
console.log(`Skipping ${pkg.name}@${pkg.oldVersion} (already published).`);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
console.log('\nCompleted publishing existing local versions. No bump performed.');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
172
208
|
if (dryRun) {
|
|
173
209
|
console.log('\nPlanned version updates:');
|
|
174
210
|
for (const pkg of packageStates) {
|
|
@@ -179,14 +215,29 @@ async function main() {
|
|
|
179
215
|
}
|
|
180
216
|
const npmUser = await assertNpmAuth(repoRoot);
|
|
181
217
|
console.log(`\nAuthenticated as npm user: ${npmUser}`);
|
|
182
|
-
|
|
183
|
-
pkg
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
218
|
+
try {
|
|
219
|
+
for (const pkg of packageStates) {
|
|
220
|
+
pkg.pkgJson.version = pkg.newVersion;
|
|
221
|
+
await savePackageJson(pkg.fullPath, pkg.pkgJson);
|
|
222
|
+
console.log(`Bumped ${pkg.name} from ${pkg.oldVersion} to ${pkg.newVersion}`);
|
|
223
|
+
const publishCwd = resolve(repoRoot, pkg.publishDir);
|
|
224
|
+
console.log(`Publishing ${pkg.name}@${pkg.newVersion} from ${pkg.publishDir}...`);
|
|
225
|
+
await runCommand('npm', ['publish', '--access', 'public'], publishCwd);
|
|
226
|
+
|
|
227
|
+
// verify registry has the new version
|
|
228
|
+
const maxAttempts = 10;
|
|
229
|
+
let ok = false;
|
|
230
|
+
for (let i = 0; i < maxAttempts; ++i) {
|
|
231
|
+
const published = await isPublished(pkg.name, pkg.newVersion, repoRoot);
|
|
232
|
+
if (published) { ok = true; break; }
|
|
233
|
+
await new Promise((r) => setTimeout(r, 1000));
|
|
234
|
+
}
|
|
235
|
+
if (!ok) {
|
|
236
|
+
throw new Error(`Published ${pkg.name}@${pkg.newVersion} but registry did not report it within timeout.`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
console.log(`Published ${pkg.name}@${pkg.newVersion} successfully.`);
|
|
240
|
+
}
|
|
190
241
|
}
|
|
191
242
|
}
|
|
192
243
|
|
package/justfile
CHANGED
|
@@ -6,6 +6,14 @@ set shell := ["powershell", "-c"]
|
|
|
6
6
|
publish:
|
|
7
7
|
node dksetup-publish.mjs
|
|
8
8
|
|
|
9
|
+
# Force publish (overrides stale lock)
|
|
10
|
+
publish-force:
|
|
11
|
+
node dksetup-publish.mjs --force
|
|
12
|
+
|
|
13
|
+
# Remove publish lock (if stuck)
|
|
14
|
+
publish-unlock:
|
|
15
|
+
Remove-Item -Force .dksetup-publish.lock || echo "no lockfile"
|
|
16
|
+
|
|
9
17
|
# Bump only
|
|
10
18
|
bump:
|
|
11
19
|
npm version patch --no-git-tag-version
|
|
@@ -20,5 +28,5 @@ install:
|
|
|
20
28
|
|
|
21
29
|
# Help
|
|
22
30
|
help:
|
|
23
|
-
echo "Available commands: publish,
|
|
31
|
+
echo "Available commands: publish, publish-force, publish-unlock, version, install"
|
|
24
32
|
|