-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
49 lines (35 loc) · 6.21 KB
/
gulpfile.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
45
46
47
48
49
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.regenerate = exports.checkEnv = void 0;
var _path = require("path");
var _core = require("@babel/core");
var _gulp = _interopRequireDefault(require("gulp"));
var _gulpTap = _interopRequireDefault(require("gulp-tap"));
var _fancyLog = _interopRequireDefault(require("fancy-log"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const {
populateEnv
} = require('./src/dev-utils');
const regenTargets = [`config/*.[jt]s`];
const checkEnv = async () => populateEnv();
exports.checkEnv = checkEnv;
checkEnv.description = `Throws an error if any expected environment variables are not properly set ` + `(see expectedEnvVariables key in package.json)`;
const regenerate = () => {
populateEnv();
(0, _fancyLog.default)(`Regenerating targets: "${regenTargets.join('" "')}"`);
process.env.BABEL_ENV = 'generator';
return _gulp.default.src(regenTargets).pipe((0, _gulpTap.default)(file => {
var _babel;
file.contents = file.contents && Buffer.from(((_babel = (0, _core.transformSync)(file.contents.toString('utf8'), {
filename: file.path,
sourceFileName: (0, _path.relative)(__dirname, file.path)
})) === null || _babel === void 0 ? void 0 : _babel.code) || '');
const name = (0, _path.basename)(file.basename, '.ts');
file.basename = name == file.basename ? name : `${name}.js`;
})).pipe(_gulp.default.dest('.'));
};
exports.regenerate = regenerate;
regenerate.description = 'Invokes babel on the files in config, transpiling them into their project root versions';
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNvbmZpZy9ndWxwZmlsZS50cyJdLCJuYW1lcyI6WyJwb3B1bGF0ZUVudiIsInJlcXVpcmUiLCJyZWdlblRhcmdldHMiLCJjaGVja0VudiIsImRlc2NyaXB0aW9uIiwicmVnZW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