-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathesbuild.config.js
More file actions
50 lines (43 loc) · 1.09 KB
/
esbuild.config.js
File metadata and controls
50 lines (43 loc) · 1.09 KB
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
import * as esbuild from 'esbuild';
import { umdWrapper } from 'esbuild-plugin-umd-wrapper';
import fs from 'fs';
const version = process.env.SEMANTIC_RELEASE_NEXT_VERSION || JSON.parse(fs.readFileSync('./package.json')).version;
console.log('building version:', version);
const banner = `/**
* marked v${version} - a markdown parser
* Copyright (c) 2018-${new Date().getFullYear()}, MarkedJS. (MIT License)
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
* https://github.com/markedjs/marked
*/
/**
* DO NOT EDIT THIS FILE
* The code in this file is generated from files in ./src/
*/
`;
function config(options) {
return {
entryPoints: ['src/marked.ts'],
banner: {
js: banner,
},
sourcemap: true,
bundle: true,
minify: true,
...(options.format === 'umd'
? {
plugins: [umdWrapper({
libraryName: 'marked',
})],
}
: {}),
...options,
};
}
await esbuild.build(config({
format: 'esm',
outfile: 'lib/marked.esm.js',
}));
await esbuild.build(config({
format: 'umd',
outfile: 'lib/marked.umd.js',
}));