forked from validatorjs/validator.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-browser.js
More file actions
34 lines (33 loc) · 762 Bytes
/
build-browser.js
File metadata and controls
34 lines (33 loc) · 762 Bytes
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
/* eslint import/no-extraneous-dependencies: 0 */
import fs from 'fs';
import { rollup } from 'rollup';
import babel from 'rollup-plugin-babel';
import babelPresetEnv from '@babel/preset-env';
import pkg from './package.json';
rollup({
entry: 'src/index.js',
plugins: [
babel({
presets: [[babelPresetEnv, { modules: false }]],
babelrc: false,
}),
],
}).then(bundle => (
bundle.write({
dest: 'validator.js',
format: 'umd',
moduleName: pkg.name,
banner: (
`/*!\n${
String(fs.readFileSync('./LICENSE'))
.trim()
.split('\n')
.map(l => ` * ${l}`)
.join('\n')
}\n */`
),
})
)).catch((e) => {
process.stderr.write(`${e.message}\n`);
process.exit(1);
});