create-nx-maven-workspace
Version:
[](https://badge.fury.io/js/create-nx-maven-workspace)
72 lines • 3.45 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const create_nx_workspace_1 = require("create-nx-workspace");
const enquirer_1 = require("enquirer");
const yargs = require("yargs");
function main() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
let name = process.argv[2];
if (!name) {
name = (yield (0, enquirer_1.prompt)({
type: 'input',
name: 'name',
message: 'What is the name of the workspace?',
})).name;
}
const args = yargs.argv;
let aggregatorProjectGroupId = args['aggregatorProjectGroupId'];
if (!aggregatorProjectGroupId) {
aggregatorProjectGroupId = (yield (0, enquirer_1.prompt)({
type: 'input',
name: 'aggregatorProjectGroupId',
message: 'What groupId would you like to use for root aggregator project?',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
initial: 'com.example',
})).aggregatorProjectGroupId;
}
let aggregatorProjectName = args['aggregatorProjectName'];
if (!aggregatorProjectName) {
aggregatorProjectName = (yield (0, enquirer_1.prompt)({
type: 'input',
name: 'aggregatorProjectName',
message: 'What name would you like to use for root aggregator project?',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
initial: 'root-aggregator-project',
})).aggregatorProjectName;
}
let aggregatorProjectVersion = args['aggregatorProjectVersion'];
if (!aggregatorProjectVersion) {
aggregatorProjectVersion = (yield (0, enquirer_1.prompt)({
type: 'input',
name: 'aggregatorProjectVersion',
message: 'What version would you like to use for root aggregator project?',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
initial: '0.0.1-SNAPSHOT',
})).aggregatorProjectVersion;
}
console.log(`Creating the workspace: ${name}`);
// This assumes "@jnxplus/nx-maven" and "create-nx-maven-workspace" are at the same version
// eslint-disable-next-line @typescript-eslint/no-var-requires
const presetVersion = require('../package.json').version;
console.log(`Using version v${presetVersion} of nx-maven`);
const { directory } = yield (0, create_nx_workspace_1.createWorkspace)(`@jnxplus/nx-maven@${presetVersion}`, {
name,
nxCloud: 'skip',
packageManager: 'npm',
//init generator
aggregatorProjectGroupId,
aggregatorProjectName,
aggregatorProjectVersion,
mavenRootDirectory: (_a = args['mavenRootDirectory']) !== null && _a !== void 0 ? _a : '',
skipWrapper: false,
localRepoRelativePath: (_b = args['localRepoRelativePath']) !== null && _b !== void 0 ? _b : '.m2/repository',
buildTargetName: (_c = args['buildTargetName']) !== null && _c !== void 0 ? _c : 'build',
});
console.log(`Successfully created the workspace: ${directory}.`);
});
}
main();
//# sourceMappingURL=index.js.map
;