forked from validatorjs/validator.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-browser.js
37 lines (36 loc) · 1016 Bytes
/
build-browser.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
/* 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({
file: "validator.js",
// name: pkg.name,
// NOTE: hard-coded below due to @forwardemail/validator
// otherwise tests won't pass in `test/validators.test.js`
// it('should bind validator to the window if no module loaders are available', () => {
//
name: 'validator',
format: "umd",
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);
});