Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
run: npm run test:unit
- name: Run Spec Tests 👩🏽‍💻
run: npm run test:specs
- name: Run CJS Tests 👩🏽‍💻
run: npm run test:cjs

OtherTests:
runs-on: ubuntu-latest
Expand Down
61 changes: 61 additions & 0 deletions esbuild.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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) 2011-${new Date().getFullYear()}, Christopher Jeffrey. (MIT Licensed)
* 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: false,
...(options.format === 'umd'
? {
plugins: [umdWrapper({
libraryName: 'marked',
})],
}
: {}),
...options,
};
}

await esbuild.build(config({
format: 'esm',
outfile: 'lib/marked.esm.js',
}));

await esbuild.build(config({
format: 'cjs',
outfile: 'lib/marked.cjs',
}));

await esbuild.build(config({
format: 'umd',
outfile: 'lib/marked.umd.js',
}));

await esbuild.build(config({
sourcemap: false,
minify: true,
format: 'umd',
outfile: 'marked.min.js',
}));
Loading