@lightweightform/kotlin-cli
Version:
LF Kotlin CLI Plugin
57 lines • 2.6 kB
JavaScript
"use strict";
/*
* @license
* Copyright Lightweightform. All Rights Reserved.
*
* Use of this source code is governed by an Apache2.0-style license that can be
* found at https://www.apache.org/licenses/LICENSE-2.0
*/
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var template_manager_1 = require("./template.manager");
var POM_FILENAME = 'pom.xml';
var MavenManager = /** @class */ (function () {
function MavenManager() {
}
MavenManager.createMavenProject = function (rootDir, commonDir, commonJsDir, commonJvmDir, projectName, groupId, artifactId) {
utils_1.writeFile(rootDir + "/" + POM_FILENAME, template_manager_1.default.loadPomParent({
groupId: groupId,
artifactId: artifactId,
appName: projectName,
}));
utils_1.createDirectory(commonDir);
utils_1.writeFile(commonDir + "/" + POM_FILENAME, template_manager_1.default.loadCommonPom({
parentGroupId: groupId,
parentArtifactId: artifactId,
}));
this._createSubDirectories(commonDir + "/", groupId, 'Common');
utils_1.createDirectory(commonJsDir);
utils_1.writeFile(commonJsDir + "/" + POM_FILENAME, template_manager_1.default.loadCommonJsPom({
parentGroupId: groupId,
parentArtifactId: artifactId,
}));
this._createSubDirectories(commonJsDir + "/", groupId, 'Common-js', 'common-js');
utils_1.createDirectory(commonJvmDir);
utils_1.writeFile(commonJvmDir + "/" + POM_FILENAME, template_manager_1.default.loadCommonJvmPom({
parentGroupId: groupId,
parentArtifactId: artifactId,
}));
this._createSubDirectories(commonJvmDir + "/", groupId, 'Common-jvm', 'common-jvm');
};
MavenManager._createSubDirectories = function (rootDir, groupId, title, template) {
if (title === void 0) { title = ''; }
if (template === void 0) { template = 'common'; }
var packageDir = groupId.replace(/\./g, '/');
var sourcesDir = rootDir + "src/main/kotlin/" + packageDir;
utils_1.createDirectory("" + sourcesDir);
var testSourcesDir = rootDir + "src/test/kotlin/" + packageDir;
utils_1.createDirectory("" + testSourcesDir);
utils_1.writeFile(rootDir + "/README.md", template_manager_1.default.loadReadMe({
template: template,
message: title + " sources",
}));
};
return MavenManager;
}());
exports.default = MavenManager;
//# sourceMappingURL=maven.manager.js.map