2026-01-09 17:34:20 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
|
|
import fs from 'fs'
|
|
|
|
|
import { execSync } from 'child_process'
|
|
|
|
|
|
2026-02-25 21:14:19 +00:00
|
|
|
const force = process.argv.includes('--force')
|
|
|
|
|
|
|
|
|
|
if (execSync('git status --porcelain', { encoding: 'utf8' }).trim() && !force) {
|
|
|
|
|
console.error('Error: Git working tree is dirty. Please commit or stash your changes first, or re-run with --force.')
|
2026-01-09 17:34:20 +00:00
|
|
|
process.exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-06 15:43:57 +00:00
|
|
|
// One entry per directory under ../welshman/packages.
|
|
|
|
|
const packages = [
|
|
|
|
|
'app',
|
|
|
|
|
'content',
|
|
|
|
|
'domain',
|
|
|
|
|
'editor',
|
|
|
|
|
'feeds',
|
|
|
|
|
'lib',
|
|
|
|
|
'net',
|
|
|
|
|
'signer',
|
|
|
|
|
'store',
|
|
|
|
|
'util',
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// pnpm 11 no longer reads the `pnpm` field in package.json, so overrides live in the workspace
|
|
|
|
|
// file. They are written for the install and reverted straight after: a committed link: override
|
|
|
|
|
// points every clone and every ci run at a checkout that only exists on one machine.
|
|
|
|
|
const file = 'pnpm-workspace.yaml'
|
|
|
|
|
const workspace = fs.readFileSync(file, 'utf8')
|
|
|
|
|
|
|
|
|
|
if (!/^overrides:$/m.test(workspace)) {
|
|
|
|
|
console.error(`Error: ${file} has no \`overrides:\` block to link welshman into.`)
|
|
|
|
|
process.exit(1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const links = packages
|
|
|
|
|
.map(name => ` '@welshman/${name}': link:../welshman/packages/${name}`)
|
|
|
|
|
.join('\n')
|
|
|
|
|
|
|
|
|
|
// Other packages worth linking now and then:
|
|
|
|
|
// '@pomade/core': link:../pomade/packages/core
|
|
|
|
|
// nostr-editor: link:../nostr-editor
|
|
|
|
|
// nostr-signer-capacitor-plugin: link:../nostr-signer-capacitor-plugin
|
|
|
|
|
|
|
|
|
|
fs.writeFileSync(file, workspace.replace(/^overrides:$/m, `overrides:\n${links}`))
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
execSync('pnpm i', { stdio: 'inherit' })
|
|
|
|
|
} finally {
|
|
|
|
|
execSync(`git checkout -f ${file} pnpm-lock.yaml`, { stdio: 'inherit' })
|
|
|
|
|
}
|