-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
44 lines (37 loc) · 998 Bytes
/
rollup.config.js
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
import fs from 'fs';
import path from 'path';
import alias from 'rollup-plugin-alias';
import json from 'rollup-plugin-json';
import typescript from 'rollup-plugin-typescript';
import pkg from './package.json';
const commitHash = (function() {
try {
return fs.readFileSync('.commithash', 'utf-8');
} catch (err) {
return 'unknown';
}
})();
const now = new Date().toUTCString();
const banner = `/*
@license
hardpass.js v${pkg.version}
${now} - commit ${commitHash}
https://github.com/akrawchyk/hardpass
Released under the MIT License.
*/`;
const moduleAliases = {
resolve: ['.js', '.json'],
'package.json': path.resolve('package.json')
};
export default {
input: './src/hardpass/index.ts',
plugins: [
alias(moduleAliases),
json(),
typescript()
],
output: [
{ file: 'dist/hardpass.umd.js', format: 'umd', name: 'hardpass', sourcemap: true, banner },
{ file: 'dist/hardpass.esm.js', format: 'esm', banner }
]
}