@naxodev/gonx
Version:
Modern Nx plugin to use Go in a Nx workspace
41 lines • 1.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createNodesInternal = createNodesInternal;
const path_1 = require("path");
const has_main_package_1 = require("./has-main-package");
const get_targets_by_project_type_1 = require("./targets/get-targets-by-project-type");
function createNodesInternal(configFilePath, options = {},
// context is not used, but TypeScript needs the parameter
// eslint-disable-next-line @typescript-eslint/no-unused-vars
context) {
// Get the full project root directory
const projectRoot = (0, path_1.dirname)(configFilePath);
// Use the projectRoot as the name to ensure uniqueness
// This also supports Go's release tagging convention (projectRoot/vx.x.x)
const projectName = projectRoot;
// Detect if this is an application or a library
const isApplication = (0, has_main_package_1.hasMainPackage)(projectRoot);
const projectType = isApplication ? 'application' : 'library';
const targets = (0, get_targets_by_project_type_1.getTargetsByProjectType)(projectRoot, options);
// Create the project configuration
const projectConfig = {
name: projectName,
root: projectRoot,
sourceRoot: projectRoot,
projectType,
targets,
tags: options.tagName ? [options.tagName] : [],
// Add release configuration for nx release
release: {
version: {
versionActions: '@naxodev/gonx/src/release/go-version-actions',
},
},
};
return {
projects: {
[projectRoot]: projectConfig,
},
};
}
//# sourceMappingURL=create-nodes-internal.js.map