@nxlv/python
Advanced tools
Comparing version 1.8.1 to 1.9.0
@@ -10,2 +10,8 @@ # Changelog | ||
## [1.9.0] - 2022-07-18 | ||
### Changed | ||
- Modify `@nxlv/nx-python:add` executor to add the CLI option `--extras`. | ||
## [1.8.1] - 2022-07-15 | ||
@@ -12,0 +18,0 @@ |
{ | ||
"name": "@nxlv/python", | ||
"version": "1.8.1", | ||
"version": "1.9.0", | ||
"description": "Custom NX Plugin to support the Python language", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -19,3 +19,3 @@ "use strict"; | ||
console.log((0, chalk_1.default) `\n {bold Adding {bgBlue ${options.name} } workspace dependency...}\n`); | ||
updateLocalProject(context, options.name, projectConfig, rootPyprojectToml, options.group); | ||
updateLocalProject(context, options.name, projectConfig, rootPyprojectToml, options.group, options.extras); | ||
} | ||
@@ -28,2 +28,3 @@ else { | ||
.concat(options.args ? options.args.split(' ') : []) | ||
.concat(options.extras ? options.extras.map(ex => `--extras=${ex}`) : []) | ||
.concat(rootPyprojectToml ? ['--lock'] : []); | ||
@@ -53,8 +54,8 @@ const installCommand = `${executable} ${installArgs.join(' ')}`; | ||
exports.default = executor; | ||
function updateLocalProject(context, dependencyName, projectConfig, updateLockOnly, group) { | ||
function updateLocalProject(context, dependencyName, projectConfig, updateLockOnly, group, extras) { | ||
const dependencyConfig = (0, poetry_1.getLocalDependencyConfig)(context, dependencyName); | ||
const dependencyPath = path_1.default.relative(projectConfig.root, dependencyConfig.root); | ||
const dependencyPkgName = (0, poetry_1.addLocalProjectToPoetryProject)(projectConfig, dependencyConfig, dependencyPath, group); | ||
const dependencyPkgName = (0, poetry_1.addLocalProjectToPoetryProject)(projectConfig, dependencyConfig, dependencyPath, group, extras); | ||
(0, poetry_1.updateProject)(dependencyPkgName, projectConfig.root, updateLockOnly); | ||
} | ||
//# sourceMappingURL=executor.js.map |
@@ -6,2 +6,3 @@ export interface AddExecutorSchema { | ||
group?: string; | ||
extras?: string[]; | ||
} |
@@ -29,2 +29,9 @@ { | ||
"description": "Dependency Group" | ||
}, | ||
"extras": { | ||
"type": "array", | ||
"description": "Extras to activate for the dependency", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
@@ -31,0 +38,0 @@ }, |
import { ExecutorContext, ProjectConfiguration } from '@nrwl/devkit'; | ||
import { PyprojectToml } from '../../graph/dependency-graph'; | ||
export declare function addLocalProjectToPoetryProject(targetConfig: ProjectConfiguration, dependencyConfig: ProjectConfiguration, dependencyPath: string, group?: string): string; | ||
export declare function addLocalProjectToPoetryProject(targetConfig: ProjectConfiguration, dependencyConfig: ProjectConfiguration, dependencyPath: string, group?: string, extras?: string[]): string; | ||
export declare function updateProject(projectName: string, cwd: string, updateLockOnly: boolean): void; | ||
@@ -5,0 +5,0 @@ export declare function getProjectTomlPath(targetConfig: ProjectConfiguration): string; |
@@ -10,3 +10,3 @@ "use strict"; | ||
const fs_1 = (0, tslib_1.__importDefault)(require("fs")); | ||
function addLocalProjectToPoetryProject(targetConfig, dependencyConfig, dependencyPath, group) { | ||
function addLocalProjectToPoetryProject(targetConfig, dependencyConfig, dependencyPath, group, extras) { | ||
const targetToml = getProjectTomlPath(targetConfig); | ||
@@ -20,12 +20,6 @@ const dependencyToml = getProjectTomlPath(dependencyConfig); | ||
targetTomlData.tool.poetry.group[group] = targetTomlData.tool.poetry.group[group] || { dependencies: {} }; | ||
targetTomlData.tool.poetry.group[group].dependencies[dependencyName] = { | ||
path: dependencyPath, | ||
develop: true, | ||
}; | ||
targetTomlData.tool.poetry.group[group].dependencies[dependencyName] = Object.assign({ path: dependencyPath, develop: true }, (extras ? { extras } : {})); | ||
} | ||
else { | ||
targetTomlData.tool.poetry.dependencies[dependencyName] = { | ||
path: dependencyPath, | ||
develop: true, | ||
}; | ||
targetTomlData.tool.poetry.dependencies[dependencyName] = Object.assign({ path: dependencyPath, develop: true }, (extras ? { extras } : {})); | ||
} | ||
@@ -32,0 +26,0 @@ fs_1.default.writeFileSync(targetToml, toml_1.default.stringify(targetTomlData)); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
147970
1571