@nx/gatsby
Version:
Gatsby Plugin for Nx
33 lines • 1.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.addJsInclude = void 0;
const tslib_1 = require("tslib");
const devkit_1 = require("@nx/devkit");
function addJsInclude(host) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const projects = (0, devkit_1.getProjects)(host);
projects.forEach((project) => {
var _a, _b;
const tsconfigPath = `${project.root}/tsconfig.app.json`;
if (((_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor) !== '@nx/gatsby:build')
return;
if (!host.exists(tsconfigPath))
return;
(0, devkit_1.updateJson)(host, tsconfigPath, (json) => {
if (!json.include) {
json.include = [];
}
if (!json.exclude) {
json.exclude = [];
}
json.include = uniq([...json.include, '**/*.js', '**/*.jsx']);
json.exclude = uniq([...json.exclude, '**/*.spec.js', '**/*.spec.jsx']);
return json;
});
});
});
}
exports.addJsInclude = addJsInclude;
const uniq = (value) => [...new Set(value)];
exports.default = addJsInclude;
//# sourceMappingURL=add-js-include-11-6-0.js.map