@take-out/scripts 0.0.44 ā 0.0.46
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 +58 -0
- package/src/update-changelog.ts +74 -0
- package/src/update-deps.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@take-out/scripts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/run.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@take-out/helpers": "0.0.
|
|
27
|
+
"@take-out/helpers": "0.0.46",
|
|
28
28
|
"glob": "^11.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
package/src/release.ts
CHANGED
|
@@ -279,12 +279,70 @@ async function main() {
|
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
console.info(`ā
Done\n`)
|
|
282
|
+
|
|
283
|
+
// update downstream repos if they exist
|
|
284
|
+
if (!canary) {
|
|
285
|
+
await updateDownstreamRepos()
|
|
286
|
+
}
|
|
282
287
|
} catch (err) {
|
|
283
288
|
console.info('\nError:\n', err)
|
|
284
289
|
process.exit(1)
|
|
285
290
|
}
|
|
286
291
|
}
|
|
287
292
|
|
|
293
|
+
async function updateDownstreamRepos() {
|
|
294
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || ''
|
|
295
|
+
const downstreamRepos = [join(homeDir, 'takeout-free'), join(homeDir, 'takeout-static')]
|
|
296
|
+
|
|
297
|
+
for (const repoPath of downstreamRepos) {
|
|
298
|
+
if (!(await fs.pathExists(repoPath))) {
|
|
299
|
+
continue
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
console.info(`\nš¦ Found downstream repo: ${repoPath}`)
|
|
303
|
+
|
|
304
|
+
try {
|
|
305
|
+
// check for uncommitted changes
|
|
306
|
+
const statusOut = await run(`git status --porcelain`, {
|
|
307
|
+
cwd: repoPath,
|
|
308
|
+
silent: true,
|
|
309
|
+
})
|
|
310
|
+
if (statusOut.stdout.trim()) {
|
|
311
|
+
console.warn(` ā ļø Skipping ${repoPath}: has uncommitted changes`)
|
|
312
|
+
continue
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// pull latest
|
|
316
|
+
console.info(` Pulling latest...`)
|
|
317
|
+
try {
|
|
318
|
+
await run(`git pull --rebase origin HEAD`, { cwd: repoPath, silent: true })
|
|
319
|
+
} catch (err) {
|
|
320
|
+
console.warn(` ā ļø Skipping ${repoPath}: failed to pull from origin`)
|
|
321
|
+
continue
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// run upgrade
|
|
325
|
+
console.info(` Running upgrade/takeout...`)
|
|
326
|
+
await run(`bun tko upgrade/takeout`, { cwd: repoPath })
|
|
327
|
+
|
|
328
|
+
// run check:all
|
|
329
|
+
console.info(` Running check:all...`)
|
|
330
|
+
try {
|
|
331
|
+
await run(`bun check:all`, { cwd: repoPath })
|
|
332
|
+
console.info(` ā
${repoPath} upgraded successfully`)
|
|
333
|
+
} catch (err) {
|
|
334
|
+
console.warn(
|
|
335
|
+
` ā ļø ${repoPath}: check:all failed after upgrade, please review manually`
|
|
336
|
+
)
|
|
337
|
+
// reset the changes since check failed
|
|
338
|
+
await run(`git checkout .`, { cwd: repoPath, silent: true })
|
|
339
|
+
}
|
|
340
|
+
} catch (err) {
|
|
341
|
+
console.warn(` ā ļø Error updating ${repoPath}:`, err)
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
288
346
|
async function getWorkspacePackages() {
|
|
289
347
|
// read workspaces from root package.json
|
|
290
348
|
const rootPackageJson = await fs.readJSON(join(process.cwd(), 'package.json'))
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Update changelog.mdx with recent git commits using Claude Code
|
|
5
|
+
*
|
|
6
|
+
* outputs a prompt for claude code to investigate commits and update changelog
|
|
7
|
+
* run: bun tko update-changelog
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execSync } from 'node:child_process'
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
12
|
+
import { join } from 'node:path'
|
|
13
|
+
|
|
14
|
+
const CHANGELOG_PATH = join(process.cwd(), 'src/features/site/docs/changelog.mdx')
|
|
15
|
+
|
|
16
|
+
function getLastSha(): string | null {
|
|
17
|
+
if (!existsSync(CHANGELOG_PATH)) return null
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const content = readFileSync(CHANGELOG_PATH, 'utf-8')
|
|
21
|
+
const match = content.match(/\{\/\* last updated: ([a-f0-9]+) \*\/\}/)
|
|
22
|
+
return match?.[1] || null
|
|
23
|
+
} catch {
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getLatestSha(): string {
|
|
29
|
+
return execSync('git rev-parse --short HEAD', { encoding: 'utf-8' }).trim()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getCommitCount(fromSha: string, toSha: string): number {
|
|
33
|
+
try {
|
|
34
|
+
const result = execSync(`git rev-list --count ${fromSha}..${toSha} --no-merges`, {
|
|
35
|
+
encoding: 'utf-8',
|
|
36
|
+
})
|
|
37
|
+
return parseInt(result.trim(), 10)
|
|
38
|
+
} catch {
|
|
39
|
+
return 0
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const lastSha = getLastSha()
|
|
44
|
+
const latestSha = getLatestSha()
|
|
45
|
+
|
|
46
|
+
if (!lastSha) {
|
|
47
|
+
console.info(`no last sha found in changelog, defaulting to 4 weeks ago`)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const fromRef = lastSha || '$(git log --since="4 weeks ago" --format="%H" | tail -1)'
|
|
51
|
+
const commitCount = lastSha ? getCommitCount(lastSha, latestSha) : '~30'
|
|
52
|
+
|
|
53
|
+
if (commitCount === 0) {
|
|
54
|
+
console.info('no new commits since last update')
|
|
55
|
+
process.exit(0)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.info(`
|
|
59
|
+
Update the changelog at: ${CHANGELOG_PATH}
|
|
60
|
+
|
|
61
|
+
Commit range: ${fromRef}..${latestSha} (${commitCount} commits)
|
|
62
|
+
|
|
63
|
+
Instructions:
|
|
64
|
+
- investigate commits with git log, git show, git diff as needed
|
|
65
|
+
- for vague commits like "cleanups" or "fix Component.tsx", look at the actual diff to understand what changed
|
|
66
|
+
- update the "last updated" comment to: ${latestSha}
|
|
67
|
+
- create new week sections if needed (weeks start monday)
|
|
68
|
+
- format: "## Week of January 20, 2026" with sha in backticks below
|
|
69
|
+
- use ā symbol only for new features, no other emoji
|
|
70
|
+
- group small fixes/chores into "Bug fixes and chores (N)"
|
|
71
|
+
- for tamagui/one upgrades, check ~/tamagui or ~/one repos or github for what actually changed
|
|
72
|
+
- write useful descriptions - explain WHY and WHAT improved, not just "fixed X"
|
|
73
|
+
- stop when you reach commits already in the changelog
|
|
74
|
+
`)
|