Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
68 lines (56 loc) · 1.85 KB

File metadata and controls

68 lines (56 loc) · 1.85 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env zx
import "zx/globals"
import * as semver from "semver"
function fail(msg) {
console.error(`Error: ${msg}`)
process.exit(1)
}
function bcVer() {
const bytecodePath = "devicescript/bytecode/bytecode.md"
const bytecodeConst = {}
const bytecodeMd = fs.readFileSync(bytecodePath, "utf-8")
bytecodeMd.replace(/^ (\w+)\s+=\s+(0x[\da-f]+|\d+)/gim, (_, k, v) => {
bytecodeConst[k] = +v
})
const { img_version_major, img_version_minor, img_version_patch } =
bytecodeConst
return `${img_version_major}.${img_version_minor}.${img_version_patch}`
}
await $`git pull`
if (argv.update) {
await $`git submodule update --recursive --remote devicescript`
cd("devicescript")
await $`git checkout main`
await $`git pull`
const vo = await $`git describe --tags`
cd("..")
const msg = "update devicescript to " + vo.stdout.trim() + " (bc: " + bcVer() + ")"
await $`git add devicescript`
const cmt = await $`git commit -m ${msg}`.nothrow()
// sync the tree
await $`git submodule update --recursive devicescript`
process.exit(0)
}
const v0 = semver.parse(bcVer())
const currVer = (
await $`git describe --dirty --tags --match 'v[0-9]*' --always`
).stdout
.trim()
.replace(/-.*/, "")
const v1 = semver.parse(currVer)
let nextVer = `${v0.major}.${v0.minor}.${v0.patch * 100}`
if (v1 && semver.cmp(nextVer, "<=", v1)) {
if (v1.major != v0.major || v1.minor != v0.minor)
fail(`current version ${currVer} is too new`)
nextVer = `${v1.major}.${v1.minor}.${v1.patch + 1}`
}
echo(`bumping ${currVer} -> ${nextVer}`)
if (
!argv.force &&
(await $`git status --porcelain --untracked-files=no`).stdout.trim()
)
fail("you have modified files")
await question(`Enter to continue: `)
await $`git tag ${"v" + nextVer}`
await $`git push --tags`
await $`git push`
Morty Proxy This is a proxified and sanitized view of the page, visit original site.