-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy.ts
62 lines (53 loc) · 1.93 KB
/
deploy.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
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
import { inc } from 'https://deno.land/std@0.151.0/semver/mod.ts';
import { build, stop } from 'https://deno.land/x/esbuild@v0.14.54/mod.js';
const { readTextFile, writeTextFile } = Deno;
const pkg = JSON.parse(await readTextFile('./package.json'));
pkg.version = inc(pkg.version, 'patch');
await writeTextFile('./package.json', JSON.stringify(pkg, null, '\t'));
const { license, author, email, version } = pkg;
const banner = `/************************************************************************
Name: XElement
Version: ${version}
License: ${license}
Author: ${author}
Email: ${email}
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
************************************************************************/`;
const result = await build({
minify: true,
bundle: true,
format: 'esm',
target: 'es2020',
treeShaking: true,
platform: 'browser',
banner: { js: banner },
outfile: './pro/out.js',
tsconfig: './tsconfig.json',
entryPoints: [ 'src/element/element.ts' ],
});
// const file = await Deno.readTextFile('./src/element/element.ts');
// const result = await transform(file, {
// // entryPoints: [ 'src/element/element.ts' ],
// loader: 'ts',
// format: 'esm',
// // bundle: true,
// target: 'esnext',
// platform: 'browser',
// // banner: { js: banner },
// // outfile: './pro/out.js',
// tsconfigRaw: JSON.stringify({
// "compilerOptions": {
// "strict": true,
// "removeComments": true,
// "module": "ESNext",
// "target": "ESNext",
// "lib": [ "ESNext", "DOM", "DOM.Iterable" ],
// }
// })
// });
// Deno.writeTextFile('./pro/out.js', result.code);
console.log(result);
await writeTextFile('./web/x-poly.js', await readTextFile('./pro/x-poly.js'));
stop();