UNPKG

@k11r/nx-cloudflare-wrangler

Version:
30 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = projectGenerator; const tslib_1 = require("tslib"); const devkit_1 = require("@nx/devkit"); function projectGenerator(tree, schema) { return tslib_1.__awaiter(this, void 0, void 0, function* () { addTargets(tree, schema.name, schema.projectName && schema.projectName.length > 0 ? { projectName: schema.projectName } : {}); return () => { (0, devkit_1.installPackagesTask)(tree); }; }); } function addTargets(tree, appName, cloudflareOptions) { var _a; try { const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, appName); const options = Object.keys(cloudflareOptions).length > 0 ? { options: cloudflareOptions } : null; projectConfiguration.targets = Object.assign(Object.assign({}, ((_a = projectConfiguration.targets) !== null && _a !== void 0 ? _a : {})), { deploy: Object.assign({ executor: '@k11r/nx-cloudflare-wrangler:deploy-page' }, options) }); (0, devkit_1.updateProjectConfiguration)(tree, appName, projectConfiguration); } catch (e) { console.error(e); } } //# sourceMappingURL=index.js.map