@take-out/scripts 0.0.58 ā 0.0.60
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/package.json +2 -2
- package/src/release.ts +0 -58
- package/src/up.ts +18 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@take-out/scripts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/run.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@take-out/helpers": "0.0.
|
|
31
|
+
"@take-out/helpers": "0.0.60"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"vxrn": "*1.4.0"
|
package/src/release.ts
CHANGED
|
@@ -303,70 +303,12 @@ async function main() {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
console.info(`ā
Done\n`)
|
|
306
|
-
|
|
307
|
-
// update downstream repos if they exist
|
|
308
|
-
if (!canary) {
|
|
309
|
-
await updateDownstreamRepos()
|
|
310
|
-
}
|
|
311
306
|
} catch (err) {
|
|
312
307
|
console.info('\nError:\n', err)
|
|
313
308
|
process.exit(1)
|
|
314
309
|
}
|
|
315
310
|
}
|
|
316
311
|
|
|
317
|
-
async function updateDownstreamRepos() {
|
|
318
|
-
const homeDir = process.env.HOME || process.env.USERPROFILE || ''
|
|
319
|
-
const downstreamRepos = [join(homeDir, 'takeout-free'), join(homeDir, 'takeout-static')]
|
|
320
|
-
|
|
321
|
-
for (const repoPath of downstreamRepos) {
|
|
322
|
-
if (!(await fs.pathExists(repoPath))) {
|
|
323
|
-
continue
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
console.info(`\nš¦ Found downstream repo: ${repoPath}`)
|
|
327
|
-
|
|
328
|
-
try {
|
|
329
|
-
// check for uncommitted changes
|
|
330
|
-
const statusOut = await run(`git status --porcelain`, {
|
|
331
|
-
cwd: repoPath,
|
|
332
|
-
silent: true,
|
|
333
|
-
})
|
|
334
|
-
if (statusOut.stdout.trim()) {
|
|
335
|
-
console.warn(` ā ļø Skipping ${repoPath}: has uncommitted changes`)
|
|
336
|
-
continue
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// pull latest
|
|
340
|
-
console.info(` Pulling latest...`)
|
|
341
|
-
try {
|
|
342
|
-
await run(`git pull --rebase origin HEAD`, { cwd: repoPath, silent: true })
|
|
343
|
-
} catch (err) {
|
|
344
|
-
console.warn(` ā ļø Skipping ${repoPath}: failed to pull from origin`)
|
|
345
|
-
continue
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
// run upgrade
|
|
349
|
-
console.info(` Running upgrade takeout...`)
|
|
350
|
-
await run(`bun up takeout`, { cwd: repoPath })
|
|
351
|
-
|
|
352
|
-
// run check:all
|
|
353
|
-
console.info(` Running check:all...`)
|
|
354
|
-
try {
|
|
355
|
-
await run(`bun check:all`, { cwd: repoPath })
|
|
356
|
-
console.info(` ā
${repoPath} upgraded successfully`)
|
|
357
|
-
} catch (err) {
|
|
358
|
-
console.warn(
|
|
359
|
-
` ā ļø ${repoPath}: check:all failed after upgrade, please review manually`
|
|
360
|
-
)
|
|
361
|
-
// reset the changes since check failed
|
|
362
|
-
await run(`git checkout .`, { cwd: repoPath, silent: true })
|
|
363
|
-
}
|
|
364
|
-
} catch (err) {
|
|
365
|
-
console.warn(` ā ļø Error updating ${repoPath}:`, err)
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
312
|
async function getWorkspacePackages() {
|
|
371
313
|
// read workspaces from root package.json
|
|
372
314
|
const rootPackageJson = await fs.readJSON(join(process.cwd(), 'package.json'))
|
package/src/up.ts
CHANGED
|
@@ -102,7 +102,7 @@ function findPackageJsonFiles(dir: string): string[] {
|
|
|
102
102
|
try {
|
|
103
103
|
const entries = readdirSync(searchDir, { withFileTypes: true })
|
|
104
104
|
for (const entry of entries) {
|
|
105
|
-
if (entry.isDirectory()) {
|
|
105
|
+
if (entry.isDirectory() && entry.name !== 'node_modules') {
|
|
106
106
|
const subPath = join(searchDir, entry.name)
|
|
107
107
|
const pkgPath = join(subPath, 'package.json')
|
|
108
108
|
if (existsSync(pkgPath)) {
|
|
@@ -302,8 +302,23 @@ async function updatePackages(
|
|
|
302
302
|
await $`bun install`
|
|
303
303
|
console.info('ā
Done!')
|
|
304
304
|
} catch (error: any) {
|
|
305
|
-
const errorMessage = error.message?.split('\n')[0]
|
|
306
|
-
|
|
305
|
+
const errorMessage = error.message?.split('\n')[0] || ''
|
|
306
|
+
// check if it's a version resolution error (common after new publish)
|
|
307
|
+
if (
|
|
308
|
+
errorMessage.includes('No version matching') ||
|
|
309
|
+
errorMessage.includes('failed to resolve')
|
|
310
|
+
) {
|
|
311
|
+
console.info(`ā ļø Version not in cache, retrying with --force...`)
|
|
312
|
+
try {
|
|
313
|
+
await $`bun install --force`
|
|
314
|
+
console.info('ā
Done!')
|
|
315
|
+
} catch (retryError: any) {
|
|
316
|
+
const retryMessage = retryError.message?.split('\n')[0]
|
|
317
|
+
console.error(`šØ 'bun install --force' failed: ${retryMessage}`)
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
console.error(`šØ 'bun install' failed: ${errorMessage}`)
|
|
321
|
+
}
|
|
307
322
|
}
|
|
308
323
|
}
|
|
309
324
|
|