nx-ngrok
Version:
Ngrok support for Nx
34 lines • 1.4 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.tunnelSchematic = exports.tunnelGenerator = void 0;
const tslib_1 = require("tslib");
const devkit_1 = require("@nrwl/devkit");
function tunnelGenerator(tree, config) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const project = (0, devkit_1.readProjectConfiguration)(tree, config.project);
project.targets = project.targets || {};
const options = {
address: config.address,
auth: config.auth,
port: undefined,
protocol: config.protocol,
region: config.region,
target: config.target,
subdomain: config.subdomain,
};
if (config.port === 'auto' || typeof config.port === 'number') {
options.port = config.port;
}
Object.keys(options).forEach((key) => options[key] === undefined && delete options[key]);
project.targets[config.name] = {
executor: 'nx-ngrok:tunnel',
options,
};
(0, devkit_1.updateProjectConfiguration)(tree, config.project, project);
yield (0, devkit_1.formatFiles)(tree);
});
}
exports.tunnelGenerator = tunnelGenerator;
exports.default = tunnelGenerator;
exports.tunnelSchematic = (0, devkit_1.convertNxGenerator)(tunnelGenerator);
//# sourceMappingURL=tunnel.js.map
;