chore: improve scripts for extension
This commit is contained in:
@@ -16,6 +16,7 @@ Thank you for your interest in contributing to PageAgent! We welcome contributio
|
|||||||
```bash
|
```bash
|
||||||
npm ci
|
npm ci
|
||||||
npm start # Start demo and documentation site
|
npm start # Start demo and documentation site
|
||||||
|
npm run build # Build libs and website
|
||||||
```
|
```
|
||||||
|
|
||||||
### Project Structure
|
### Project Structure
|
||||||
|
|||||||
11
package.json
11
package.json
@@ -24,14 +24,17 @@
|
|||||||
"node": "^20.19.0 || ^22.13.0 || >=24"
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"cleanup": "rm -rf packages/*/dist",
|
|
||||||
"start": "npm run dev --workspace=@page-agent/website",
|
"start": "npm run dev --workspace=@page-agent/website",
|
||||||
"build:website": "npm run build:website --workspace=@page-agent/website",
|
"dev:ext": "npm run dev -w @page-agent/ext",
|
||||||
"build:libs": "npm run build --workspaces --if-present",
|
|
||||||
"build": "npm run build:libs && npm run build:website",
|
|
||||||
"dev:demo": "npm run dev:demo --workspace=page-agent",
|
"dev:demo": "npm run dev:demo --workspace=page-agent",
|
||||||
|
"build": "npm run build:libs && npm run build:website",
|
||||||
|
"build:libs": "npm run build --workspaces --if-present",
|
||||||
|
"build:website": "npm run build:website --workspace=@page-agent/website",
|
||||||
|
"build:ext": "npm run build:libs && npm run build:ext -w @page-agent/ext",
|
||||||
"version": "node scripts/sync-version.js",
|
"version": "node scripts/sync-version.js",
|
||||||
|
"version:ext": "node scripts/ext-version.js",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
|
"cleanup": "rm -rf packages/*/dist",
|
||||||
"prepare": "husky"
|
"prepare": "husky"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
40
scripts/ext-version.js
Normal file
40
scripts/ext-version.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
/**
|
||||||
|
* Bump extension version and show git tag commands
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* node scripts/ext-version.js 0.1.16
|
||||||
|
*/
|
||||||
|
import chalk from 'chalk'
|
||||||
|
import { readFileSync, writeFileSync } from 'fs'
|
||||||
|
import { dirname, join } from 'path'
|
||||||
|
import { exit } from 'process'
|
||||||
|
import { fileURLToPath } from 'url'
|
||||||
|
|
||||||
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||||
|
const pkgPath = join(__dirname, '..', 'packages', 'extension', 'package.json')
|
||||||
|
|
||||||
|
const newVersion = process.argv[2]
|
||||||
|
if (!newVersion) {
|
||||||
|
console.log(chalk.yellow('⚠️ Usage: npm run ext:version <version>\n'))
|
||||||
|
exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))
|
||||||
|
const oldVersion = pkg.version
|
||||||
|
|
||||||
|
pkg.version = newVersion
|
||||||
|
writeFileSync(pkgPath, JSON.stringify(pkg, null, ' ') + '\n')
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
chalk.green.bold('\n✓') +
|
||||||
|
` ${chalk.bold('@page-agent/ext')}: ${chalk.dim(oldVersion)} → ${chalk.yellow(newVersion)}\n`
|
||||||
|
)
|
||||||
|
|
||||||
|
const tagName = `EXT_v${newVersion}`
|
||||||
|
console.log(chalk.cyan.bold('📋 Next steps:\n'))
|
||||||
|
console.log(
|
||||||
|
chalk.blueBright(`git add . && git commit -m "chore(extension): bump version to ${newVersion}"`)
|
||||||
|
)
|
||||||
|
console.log(chalk.blueBright(`git tag -a ${tagName} -m "${tagName}"`))
|
||||||
|
console.log(chalk.blueBright(`git push && git push origin ${tagName}\n`))
|
||||||
Reference in New Issue
Block a user