aeon-ui-engine 1.3.0 → 1.3.1
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/CHANGELOG.md +6 -0
- package/package.json +7 -2
- package/scripts/bump-version.mjs +93 -0
- package/scripts/require-version-bump.mjs +70 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aeon-ui-engine",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,7 +35,12 @@
|
|
|
35
35
|
"test:headless": "pnpm run build:headless && pnpm --filter @aeon-ui/core --filter @aeon-ui/primitives --filter @aeon-ui/react run test",
|
|
36
36
|
"changeset": "changeset",
|
|
37
37
|
"version-packages": "changeset version",
|
|
38
|
-
"release": "pnpm build && changeset publish"
|
|
38
|
+
"release": "pnpm build && changeset publish",
|
|
39
|
+
"version:patch": "node scripts/bump-version.mjs patch",
|
|
40
|
+
"version:minor": "node scripts/bump-version.mjs minor",
|
|
41
|
+
"version:major": "node scripts/bump-version.mjs major",
|
|
42
|
+
"version:push": "node scripts/bump-version.mjs patch --push",
|
|
43
|
+
"version:check": "node scripts/require-version-bump.mjs"
|
|
39
44
|
},
|
|
40
45
|
"devDependencies": {
|
|
41
46
|
"@changesets/cli": "^2.29.0",
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Bump aeon-ui-engine semver, changelog, tag, optionally push + npm publish.
|
|
4
|
+
*
|
|
5
|
+
* node scripts/bump-version.mjs patch|minor|major [--push] [--publish] [--no-commit]
|
|
6
|
+
*/
|
|
7
|
+
import { execSync } from 'node:child_process'
|
|
8
|
+
import fs from 'node:fs'
|
|
9
|
+
import path from 'node:path'
|
|
10
|
+
import { fileURLToPath } from 'node:url'
|
|
11
|
+
|
|
12
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
13
|
+
const pkgPath = path.join(root, 'package.json')
|
|
14
|
+
const changelogPath = path.join(root, 'CHANGELOG.md')
|
|
15
|
+
|
|
16
|
+
const args = process.argv.slice(2)
|
|
17
|
+
const bump = args.find((a) => a === 'patch' || a === 'minor' || a === 'major')
|
|
18
|
+
const noCommit = args.includes('--no-commit')
|
|
19
|
+
const doPush = args.includes('--push')
|
|
20
|
+
const doPublish = args.includes('--publish')
|
|
21
|
+
|
|
22
|
+
if (!bump) {
|
|
23
|
+
console.error('Usage: bump-version.mjs patch|minor|major [--push] [--publish] [--no-commit]')
|
|
24
|
+
process.exit(1)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function parseSemver(v) {
|
|
28
|
+
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v.trim())
|
|
29
|
+
if (!m) throw new Error(`Invalid semver: ${v}`)
|
|
30
|
+
return { major: Number(m[1]), minor: Number(m[2]), patch: Number(m[3]) }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function format({ major, minor, patch }) {
|
|
34
|
+
return `${major}.${minor}.${patch}`
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function bumpSemver(v, kind) {
|
|
38
|
+
const s = parseSemver(v)
|
|
39
|
+
if (kind === 'major') return format({ major: s.major + 1, minor: 0, patch: 0 })
|
|
40
|
+
if (kind === 'minor') return format({ major: s.major, minor: s.minor + 1, patch: 0 })
|
|
41
|
+
return format({ major: s.major, minor: s.minor, patch: s.patch + 1 })
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function today() {
|
|
45
|
+
return new Date().toISOString().slice(0, 10)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function prependChangelog(version) {
|
|
49
|
+
const entry = `## [${version}] - ${today()}\n\n### Changed\n\n- Describe this release.\n\n`
|
|
50
|
+
if (!fs.existsSync(changelogPath)) {
|
|
51
|
+
fs.writeFileSync(changelogPath, `# Changelog\n\n${entry}`)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
const existing = fs.readFileSync(changelogPath, 'utf8')
|
|
55
|
+
if (existing.includes(`## [${version}]`)) return
|
|
56
|
+
if (existing.startsWith('# Changelog')) {
|
|
57
|
+
fs.writeFileSync(changelogPath, existing.replace('# Changelog\n\n', `# Changelog\n\n${entry}`))
|
|
58
|
+
} else {
|
|
59
|
+
fs.writeFileSync(changelogPath, `# Changelog\n\n${entry}${existing}`)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
|
|
64
|
+
const prev = pkg.version
|
|
65
|
+
const next = bumpSemver(prev, bump)
|
|
66
|
+
pkg.version = next
|
|
67
|
+
fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`)
|
|
68
|
+
prependChangelog(next)
|
|
69
|
+
console.log(`aeon-ui-engine ${prev} → ${next}`)
|
|
70
|
+
|
|
71
|
+
if (!noCommit) {
|
|
72
|
+
execSync('git add package.json CHANGELOG.md', { cwd: root, stdio: 'inherit' })
|
|
73
|
+
execSync(`git commit -m "Release aeon-ui-engine v${next}"`, { cwd: root, stdio: 'inherit' })
|
|
74
|
+
try {
|
|
75
|
+
execSync(`git tag v${next}`, { cwd: root, stdio: 'inherit' })
|
|
76
|
+
} catch {
|
|
77
|
+
console.warn(`Tag v${next} already exists`)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (doPush) {
|
|
82
|
+
execSync('git push origin HEAD', { cwd: root, stdio: 'inherit' })
|
|
83
|
+
execSync(`git push origin v${next}`, { cwd: root, stdio: 'inherit' })
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (doPublish) {
|
|
87
|
+
execSync('npm publish --access public', { cwd: root, stdio: 'inherit' })
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!doPush) {
|
|
91
|
+
console.log(`Tagged v${next}. Push: git push && git push origin v${next}`)
|
|
92
|
+
console.log('Or: npm run version:push')
|
|
93
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Fail if package.json version is not strictly newer than the latest remote tag (v*).
|
|
4
|
+
*/
|
|
5
|
+
import { execSync } from 'node:child_process'
|
|
6
|
+
import fs from 'node:fs'
|
|
7
|
+
import path from 'node:path'
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
9
|
+
|
|
10
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
|
11
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
|
|
12
|
+
const local = pkg.version
|
|
13
|
+
|
|
14
|
+
function parse(v) {
|
|
15
|
+
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(String(v).replace(/^v/, ''))
|
|
16
|
+
if (!m) return null
|
|
17
|
+
return [Number(m[1]), Number(m[2]), Number(m[3])]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function gt(a, b) {
|
|
21
|
+
for (let i = 0; i < 3; i++) {
|
|
22
|
+
if (a[i] > b[i]) return true
|
|
23
|
+
if (a[i] < b[i]) return false
|
|
24
|
+
}
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
execSync('git fetch --tags --quiet', { cwd: root, stdio: 'ignore' })
|
|
30
|
+
} catch {
|
|
31
|
+
/* offline */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let remoteTag = ''
|
|
35
|
+
try {
|
|
36
|
+
remoteTag = execSync(
|
|
37
|
+
'git describe --tags --abbrev=0 origin/main 2>/dev/null || git describe --tags --abbrev=0',
|
|
38
|
+
{ cwd: root, encoding: 'utf8' },
|
|
39
|
+
).trim()
|
|
40
|
+
} catch {
|
|
41
|
+
remoteTag = ''
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const localP = parse(local)
|
|
45
|
+
if (!localP) {
|
|
46
|
+
console.error(`Invalid package.json version: ${local}`)
|
|
47
|
+
process.exit(1)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!remoteTag) {
|
|
51
|
+
console.log(`No remote tag yet — allowing push of v${local}`)
|
|
52
|
+
process.exit(0)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const remoteP = parse(remoteTag)
|
|
56
|
+
if (!remoteP) {
|
|
57
|
+
console.log(`Unparsed remote tag ${remoteTag} — allowing push`)
|
|
58
|
+
process.exit(0)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!gt(localP, remoteP)) {
|
|
62
|
+
console.error(`
|
|
63
|
+
Refusing push: aeon-ui-engine ${local} is not newer than remote tag ${remoteTag}.
|
|
64
|
+
|
|
65
|
+
npm run version:push
|
|
66
|
+
`)
|
|
67
|
+
process.exit(1)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log(`Version OK: ${local} > ${remoteTag.replace(/^v/, '')}`)
|