@jobgetapp/rush-enforce-categories-plugin
Version:
Utility to ensure rush projects to not leak internal code.
46 lines • 2.11 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const node_core_library_1 = require("@rushstack/node-core-library");
const rush_sdk_1 = require("@rushstack/rush-sdk");
const services_1 = require("./services");
const cli_1 = require("./services/cli");
const terminal = new node_core_library_1.Terminal(new node_core_library_1.ConsoleTerminalProvider());
process.exitCode = 1;
function main() {
return __awaiter(this, void 0, void 0, function* () {
try {
const rushConfiguration = rush_sdk_1.RushConfiguration.loadFromDefaultLocation({
startingFolder: process.cwd()
});
const configService = new services_1.ConfigService(rushConfiguration);
const config = yield configService.load();
const categoryEnforcerService = new services_1.CategoryEnforcerService(terminal, rushConfiguration, config);
const enforceCategoriesCli = new cli_1.EnforceCategoriesCLI(terminal, categoryEnforcerService);
yield enforceCategoriesCli.execute();
}
catch (error) {
if (error.message) {
terminal.writeErrorLine(error.message);
}
else {
throw error;
}
}
});
}
main()
.then(() => {
process.exitCode = 0;
})
.catch(terminal.writeErrorLine);
//# sourceMappingURL=index.js.map