Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit dd3033d

Browse files
author
Je
committed
refactor: clean up
1 parent 21d21aa commit dd3033d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

bump.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { version } from './version.ts';
22

3-
const p = version.split('.').map(s => parseInt(s))
3+
const [major, minor, patch] = version.split('.').map(s => parseInt(s))
44
const versions = [
5-
`${p[0]}.${p[1]}.${p[2] + 1}`,
6-
`${p[0]}.${p[1] + 1}.0`,
7-
`${p[0] + 1}.0.0`,
5+
`${major}.${minor}.${patch + 1}`,
6+
`${major}.${minor + 1}.0`,
7+
`${major + 1}.0.0`,
88
]
99

10-
async function ask(question: string = '', stdin = Deno.stdin, stdout = Deno.stdout) {
10+
async function ask(question: string = ':', stdin = Deno.stdin, stdout = Deno.stdout) {
1111
const buf = new Uint8Array(1024)
12-
await stdout.write(new TextEncoder().encode(question))
12+
await stdout.write(new TextEncoder().encode(question + ' '))
1313
const n = <number>await stdin.read(buf)
1414
const answer = new TextDecoder().decode(buf.subarray(0, n))
1515
return answer.trim()
@@ -27,11 +27,11 @@ async function run(...cmd: string[]) {
2727
}
2828

2929
async function main() {
30-
const answer = await ask([...versions.map((v, i) => `${i + 1}. v${v}`), 'upgrade to: '].join('\n'))
31-
const v = parseInt(answer)
32-
if (!isNaN(v) && v > 0 && v <= 3) {
33-
const up = versions[v - 1]
34-
if (await ask('are you sure? (y/n) ') === 'y') {
30+
const answer = await ask([...versions.map((v, i) => `${i + 1}. v${v}`), 'upgrade to:'].join('\n'))
31+
const n = parseInt(answer)
32+
if (!isNaN(n) && n > 0 && n <= versions.length) {
33+
const up = versions[n - 1]
34+
if (await ask('are you sure? (y/n)') === 'y') {
3535
await Deno.writeTextFile('./version.ts', `export const version = '${up}'\n`)
3636
await run('git', 'add', '.', '--all')
3737
await run('git', 'commit', '-m', `v${up}`)

project.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ export class Project {
762762
return module
763763
}
764764

765+
// todo: force recompile remote modules which URL don't specify version
765766
private async _compile(url: string, options?: { sourceCode?: string, forceCompile?: boolean }) {
766767
const mod = this._moduleFromURL(url)
767768
if (this.#modules.has(mod.id) && !options?.forceCompile) {

0 commit comments

Comments
 (0)