@nxworker/workspace
Version:
Nx plugin providing generators for managing workspace files, including the move-file generator for safely moving files between projects while updating all imports
24 lines (23 loc) • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "buildTargetPath", {
enumerable: true,
get: function() {
return buildTargetPath;
}
});
const _devkit = require("@nx/devkit");
const _nodepath = require("node:path");
function buildTargetPath(targetProject, sourceFilePath, projectDirectory) {
const fileName = _nodepath.posix.basename(sourceFilePath);
// Determine base directory
const baseRoot = targetProject.sourceRoot || _nodepath.posix.join(targetProject.root, 'src');
// Use 'app' for application projects, 'lib' for library projects
const baseDir = targetProject.projectType === 'application' ? 'app' : 'lib';
// If projectDirectory is specified, append it to the base directory
const targetDir = projectDirectory ? _nodepath.posix.join(baseDir, projectDirectory) : baseDir;
return (0, _devkit.normalizePath)(_nodepath.posix.join(baseRoot, targetDir, fileName));
}
//# sourceMappingURL=build-target-path.js.map