1 | const fs = require('fs');
|
2 | const constants = require('constants');
|
3 | const path = require('path');
|
4 |
|
5 | var out = fs.createWriteStream(path.join(__dirname, 'dist', 'constants.js'));
|
6 |
|
7 | Object.keys(constants).forEach(function (key) {
|
8 | var value = constants[key];
|
9 | out.write(`export var ${key} = ${JSON.stringify(value)};\n`);
|
10 | });
|
11 | out.write('export default {\n ');
|
12 | Object.keys(constants).forEach(function (key, i) {
|
13 | if (i) {
|
14 | out.write(',\n ')
|
15 | }
|
16 | out.write(`${key}: ${key}`);
|
17 | });
|
18 | out.end('\n};\n');
|