-
Notifications
You must be signed in to change notification settings - Fork 170
/
version.ts
33 lines (31 loc) · 1.17 KB
/
version.ts
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
import { defaultReactVersion } from './shared/constants.ts'
/** `VERSION` managed by https://deno.land/x/publish */
export const VERSION = '0.3.0-beta.2'
/** `prepublish` will be invoked before publish */
export async function prepublish(version: string): Promise<boolean> {
const p = Deno.run({
cmd: ['deno', 'run', '-A', 'build.ts'],
cwd: './compiler',
stdout: 'inherit',
stderr: 'inherit',
})
const { success } = await p.status()
p.close()
if (success) {
const data = await Deno.readTextFile('./import_map.json')
const importMap = JSON.parse(data)
Object.assign(importMap.imports, {
'aleph/': `https://deno.land/x/aleph@v${version}/`,
'aleph/types': `https://deno.land/x/aleph@v${version}/types.d.ts`,
'aleph/web': `https://deno.land/x/aleph@v${version}/framework/core/mod.ts`,
'aleph/react': `https://deno.land/x/aleph@v${version}/framework/react/mod.ts`,
'react': `https://esm.sh/react@${defaultReactVersion}`,
'react-dom': `https://esm.sh/react-dom@${defaultReactVersion}`,
})
await Deno.writeTextFile(
'./import_map.json',
JSON.stringify(importMap, undefined, 2)
)
}
return success
}