Files
Filip Skokan 2fbc402cb1 build: normalize declaration comments
Run declaration comment cleanup during build:types instead of postbump.
Local builds and package checks now inspect the declarations shipped in
releases. Remove examples, subpath notes, and docs-only tags. Relabel
GitHub alerts for editor hovers.

Use fence-aware parsing so TypeScript examples do not leave orphaned
code in published declarations.

Signed-off-by: Filip Skokan <[email protected]>
2026-07-29 18:50:54 +02:00

43 lines
1.2 KiB
JavaScript
Executable File

const { x } = require('tar')
const { execSync } = require('child_process')
const { readFileSync, writeFileSync } = require('fs')
const { version } = require('../package.json')
const opts = { stdio: 'inherit' }
execSync('npm run docs', opts)
execSync('npm pack', opts)
execSync('rm -rf dist', opts)
x({
f: `jose-${version}.tgz`,
strip: true,
filter(loc) {
return loc.startsWith('package/dist/')
},
sync: true,
})
execSync('npm run build:bundle', opts)
execSync('npm run build:bundle-min', opts)
execSync('npm run build:umd', opts)
execSync('git add -A docs', opts)
const filesToUpdate = [
{ path: './README.md', regex: /jose@v\d+\.\d+\.\d+/gm, replacement: `jose@v${version}` },
{ path: './docs/README.md', regex: /jose@v\d+\.\d+\.\d+/gm, replacement: `jose@v${version}` },
{
path: './jsr.json',
regex: /"version": "\d+\.\d+\.\d+"/gm,
replacement: `"version": "${version}"`,
},
]
filesToUpdate.forEach(({ path, regex, replacement }) => {
writeFileSync(path, readFileSync(path, { encoding: 'utf-8' }).replace(regex, replacement))
execSync(`git add ${path}`, { stdio: 'inherit' })
})
for (const dir of ['types', 'webapi']) {
execSync(`git add dist/${dir} -f`, opts)
}