Skip to content

Commit

Permalink
fix: add version to build files
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Jan 14, 2023
1 parent 886de34 commit 79b8c0b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
node-version: 'lts/*'
- name: Install Dependencies
run: npm ci
- name: Lint ✨
- name: Build ⚒️
run: npm run build

Release:
Expand Down
2 changes: 1 addition & 1 deletion marked.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 32 additions & 27 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { defineConfig } from 'rollup';
import fs from 'fs';

const pkg = JSON.parse(fs.readFileSync('./package.json'));
const version = process.env.SEMANTIC_RELEASE_NEXT_VERSION || pkg.version;

console.log('building version:', version);

const banner = `/**
* marked ${process.env.SEMANTIC_RELEASE_NEXT_VERSION || pkg.version} - a markdown parser
* marked v${version} - a markdown parser
* Copyright (c) 2011-${new Date().getFullYear()}, Christopher Jeffrey. (MIT Licensed)
* https://github.com/markedjs/marked
*/
Expand All @@ -16,31 +19,33 @@ const banner = `/**
*/
`;

export default defineConfig([{
input: 'src/marked.js',
output: {
file: 'lib/marked.esm.js',
format: 'esm',
banner
}
},
{
input: 'src/marked.js',
output: [{
file: 'lib/marked.umd.js',
format: 'umd',
name: 'marked',
banner
export default defineConfig([
{
input: 'src/marked.js',
output: {
file: 'lib/marked.esm.js',
format: 'esm',
banner
}
},
{
file: 'lib/marked.cjs',
format: 'cjs',
name: 'marked',
banner
}],
plugins: [
babel({
presets: [['@babel/preset-env', { loose: true }]]
})
]
}]);
input: 'src/marked.js',
output: [{
file: 'lib/marked.umd.js',
format: 'umd',
name: 'marked',
banner
},
{
file: 'lib/marked.cjs',
format: 'cjs',
name: 'marked',
banner
}],
plugins: [
babel({
presets: [['@babel/preset-env', { loose: true }]]
})
]
}
]);

1 comment on commit 79b8c0b

@vercel
Copy link

@vercel vercel bot commented on 79b8c0b Jan 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.