@nx/devkit
Advanced tools
Comparing version 0.0.0-pr-26891-048ee5a to 0.0.0-pr-26891-0a70597
{ | ||
"name": "@nx/devkit", | ||
"version": "0.0.0-pr-26891-048ee5a", | ||
"version": "0.0.0-pr-26891-0a70597", | ||
"private": false, | ||
@@ -39,3 +39,3 @@ "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more. Learn more about [extending Nx by leveraging the Nx Devkit](https://nx.dev/extending-nx/intro/getting-started) on our docs.", | ||
"minimatch": "9.0.3", | ||
"@nrwl/devkit": "0.0.0-pr-26891-048ee5a" | ||
"@nrwl/devkit": "0.0.0-pr-26891-0a70597" | ||
}, | ||
@@ -51,3 +51,4 @@ "peerDependencies": { | ||
}, | ||
"type": "commonjs" | ||
"type": "commonjs", | ||
"types": "./index.d.ts" | ||
} |
@@ -10,3 +10,3 @@ import type { ProjectConfiguration } from 'nx/src/config/workspace-json-project-json'; | ||
}, inferredTargetConfiguration: InferredTargetConfiguration) => TargetConfiguration | Promise<TargetConfiguration>; | ||
type SkipTargetFilter = (targetConfiguration: TargetConfiguration) => false | string; | ||
type SkipTargetFilter = (targetOptions: Record<string, unknown>, projectConfiguration: ProjectConfiguration) => false | string; | ||
type SkipProjectFilter = (projectConfiguration: ProjectConfiguration) => false | string; | ||
@@ -13,0 +13,0 @@ export declare function migrateProjectExecutorsToPlugin<T>(tree: Tree, projectGraph: ProjectGraph, pluginPath: string, createNodesV2: CreateNodesV2<T>, defaultPluginOptions: T, migrations: Array<{ |
"use strict"; | ||
var _ExecutorToPluginMigrator_instances, _ExecutorToPluginMigrator_projectGraph, _ExecutorToPluginMigrator_executor, _ExecutorToPluginMigrator_pluginPath, _ExecutorToPluginMigrator_pluginOptionsBuilder, _ExecutorToPluginMigrator_postTargetTransformer, _ExecutorToPluginMigrator_skipTargetFilter, _ExecutorToPluginMigrator_skipProjectFilter, _ExecutorToPluginMigrator_specificProjectToMigrate, _ExecutorToPluginMigrator_nxJson, _ExecutorToPluginMigrator_targetDefaultsForExecutor, _ExecutorToPluginMigrator_targetAndProjectsToMigrate, _ExecutorToPluginMigrator_pluginToAddForTarget, _ExecutorToPluginMigrator_createNodes, _ExecutorToPluginMigrator_createNodesV2, _ExecutorToPluginMigrator_createNodesResultsForTargets, _ExecutorToPluginMigrator_skippedProjects, _ExecutorToPluginMigrator_init, _ExecutorToPluginMigrator_migrateTarget, _ExecutorToPluginMigrator_migrateProject, _ExecutorToPluginMigrator_mergeInputs, _ExecutorToPluginMigrator_getTargetAndProjectsToMigrate, _ExecutorToPluginMigrator_getTargetDefaultsForExecutor, _ExecutorToPluginMigrator_getCreatedTargetForProjectRoot, _ExecutorToPluginMigrator_getCreateNodesResults; | ||
var _ExecutorToPluginMigrator_instances, _ExecutorToPluginMigrator_projectGraph, _ExecutorToPluginMigrator_executor, _ExecutorToPluginMigrator_pluginPath, _ExecutorToPluginMigrator_pluginOptionsBuilder, _ExecutorToPluginMigrator_postTargetTransformer, _ExecutorToPluginMigrator_skipTargetFilter, _ExecutorToPluginMigrator_skipProjectFilter, _ExecutorToPluginMigrator_specificProjectToMigrate, _ExecutorToPluginMigrator_nxJson, _ExecutorToPluginMigrator_targetDefaultsForExecutor, _ExecutorToPluginMigrator_targetAndProjectsToMigrate, _ExecutorToPluginMigrator_createNodes, _ExecutorToPluginMigrator_createNodesV2, _ExecutorToPluginMigrator_createNodesResultsForTargets, _ExecutorToPluginMigrator_skippedProjects, _ExecutorToPluginMigrator_init, _ExecutorToPluginMigrator_migrateTarget, _ExecutorToPluginMigrator_migrateProject, _ExecutorToPluginMigrator_mergeInputs, _ExecutorToPluginMigrator_getTargetAndProjectsToMigrate, _ExecutorToPluginMigrator_getTargetDefaultsForExecutor, _ExecutorToPluginMigrator_getCreatedTargetForProjectRoot, _ExecutorToPluginMigrator_getCreateNodesResults; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -9,2 +9,3 @@ exports.migrateProjectExecutorsToPlugin = migrateProjectExecutorsToPlugin; | ||
const node_assert_1 = require("node:assert"); | ||
const posix_1 = require("node:path/posix"); | ||
const devkit_exports_1 = require("nx/src/devkit-exports"); | ||
@@ -28,3 +29,2 @@ const devkit_internals_1 = require("nx/src/devkit-internals"); | ||
_ExecutorToPluginMigrator_targetAndProjectsToMigrate.set(this, void 0); | ||
_ExecutorToPluginMigrator_pluginToAddForTarget.set(this, void 0); | ||
_ExecutorToPluginMigrator_createNodes.set(this, void 0); | ||
@@ -56,3 +56,3 @@ _ExecutorToPluginMigrator_createNodesV2.set(this, void 0); | ||
} | ||
_ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrator_executor = new WeakMap(), _ExecutorToPluginMigrator_pluginPath = new WeakMap(), _ExecutorToPluginMigrator_pluginOptionsBuilder = new WeakMap(), _ExecutorToPluginMigrator_postTargetTransformer = new WeakMap(), _ExecutorToPluginMigrator_skipTargetFilter = new WeakMap(), _ExecutorToPluginMigrator_skipProjectFilter = new WeakMap(), _ExecutorToPluginMigrator_specificProjectToMigrate = new WeakMap(), _ExecutorToPluginMigrator_nxJson = new WeakMap(), _ExecutorToPluginMigrator_targetDefaultsForExecutor = new WeakMap(), _ExecutorToPluginMigrator_targetAndProjectsToMigrate = new WeakMap(), _ExecutorToPluginMigrator_pluginToAddForTarget = new WeakMap(), _ExecutorToPluginMigrator_createNodes = new WeakMap(), _ExecutorToPluginMigrator_createNodesV2 = new WeakMap(), _ExecutorToPluginMigrator_createNodesResultsForTargets = new WeakMap(), _ExecutorToPluginMigrator_skippedProjects = new WeakMap(), _ExecutorToPluginMigrator_instances = new WeakSet(), _ExecutorToPluginMigrator_init = async function _ExecutorToPluginMigrator_init() { | ||
_ExecutorToPluginMigrator_projectGraph = new WeakMap(), _ExecutorToPluginMigrator_executor = new WeakMap(), _ExecutorToPluginMigrator_pluginPath = new WeakMap(), _ExecutorToPluginMigrator_pluginOptionsBuilder = new WeakMap(), _ExecutorToPluginMigrator_postTargetTransformer = new WeakMap(), _ExecutorToPluginMigrator_skipTargetFilter = new WeakMap(), _ExecutorToPluginMigrator_skipProjectFilter = new WeakMap(), _ExecutorToPluginMigrator_specificProjectToMigrate = new WeakMap(), _ExecutorToPluginMigrator_nxJson = new WeakMap(), _ExecutorToPluginMigrator_targetDefaultsForExecutor = new WeakMap(), _ExecutorToPluginMigrator_targetAndProjectsToMigrate = new WeakMap(), _ExecutorToPluginMigrator_createNodes = new WeakMap(), _ExecutorToPluginMigrator_createNodesV2 = new WeakMap(), _ExecutorToPluginMigrator_createNodesResultsForTargets = new WeakMap(), _ExecutorToPluginMigrator_skippedProjects = new WeakMap(), _ExecutorToPluginMigrator_instances = new WeakSet(), _ExecutorToPluginMigrator_init = async function _ExecutorToPluginMigrator_init() { | ||
const nxJson = (0, devkit_exports_1.readNxJson)(this.tree); | ||
@@ -62,3 +62,2 @@ nxJson.plugins ??= []; | ||
tslib_1.__classPrivateFieldSet(this, _ExecutorToPluginMigrator_targetAndProjectsToMigrate, new Map(), "f"); | ||
tslib_1.__classPrivateFieldSet(this, _ExecutorToPluginMigrator_pluginToAddForTarget, new Map(), "f"); | ||
tslib_1.__classPrivateFieldSet(this, _ExecutorToPluginMigrator_createNodesResultsForTargets, new Map(), "f"); | ||
@@ -70,11 +69,5 @@ tslib_1.__classPrivateFieldSet(this, _ExecutorToPluginMigrator_skippedProjects, new Set(), "f"); | ||
}, _ExecutorToPluginMigrator_migrateTarget = async function _ExecutorToPluginMigrator_migrateTarget(targetName) { | ||
const include = []; | ||
for (const projectName of tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_targetAndProjectsToMigrate, "f").get(targetName)) { | ||
include.push(await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_migrateProject).call(this, projectName, targetName)); | ||
await tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_instances, "m", _ExecutorToPluginMigrator_migrateProject).call(this, projectName, targetName); | ||
} | ||
tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_pluginToAddForTarget, "f").set(targetName, { | ||
plugin: tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_pluginPath, "f"), | ||
options: tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_pluginOptionsBuilder, "f").call(this, targetName), | ||
include, | ||
}); | ||
}, _ExecutorToPluginMigrator_migrateProject = async function _ExecutorToPluginMigrator_migrateProject(projectName, targetName) { | ||
@@ -106,3 +99,2 @@ const projectFromGraph = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_projectGraph, "f").nodes[projectName]; | ||
(0, devkit_exports_1.updateProjectConfiguration)(this.tree, projectName, projectConfig); | ||
return `${projectFromGraph.data.root}/**/*`; | ||
}, _ExecutorToPluginMigrator_mergeInputs = function _ExecutorToPluginMigrator_mergeInputs(target, inferredTarget) { | ||
@@ -144,3 +136,3 @@ const isInputInferred = (input) => { | ||
}, _ExecutorToPluginMigrator_getTargetAndProjectsToMigrate = function _ExecutorToPluginMigrator_getTargetAndProjectsToMigrate() { | ||
(0, executor_options_utils_1.forEachExecutorOptions)(this.tree, tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_executor, "f"), (targetConfiguration, projectName, targetName, configurationName) => { | ||
(0, executor_options_utils_1.forEachExecutorOptions)(this.tree, tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_executor, "f"), (options, projectName, targetName, configurationName) => { | ||
if (tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_skippedProjects, "f").has(projectName) || configurationName) { | ||
@@ -163,5 +155,5 @@ return; | ||
} | ||
const skipTargetReason = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_skipTargetFilter, "f").call(this, targetConfiguration); | ||
const skipTargetReason = tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_skipTargetFilter, "f").call(this, options, tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_projectGraph, "f").nodes[projectName].data); | ||
if (skipTargetReason) { | ||
const errorMsg = `${targetName} target on project "${projectName}" cannot be migrated. ${skipTargetReason}`; | ||
const errorMsg = `The ${targetName} target on project "${projectName}" cannot be migrated. ${skipTargetReason}`; | ||
if (tslib_1.__classPrivateFieldGet(this, _ExecutorToPluginMigrator_specificProjectToMigrate, "f")) { | ||
@@ -285,3 +277,5 @@ throw new Error(errorMsg); | ||
options[key] === defaultPluginOptions[key]))); | ||
const projectIncludeGlob = `${projectGraph.nodes[project].data.root}/**/*`; | ||
const projectIncludeGlob = projectGraph.nodes[project].data.root === '.' | ||
? '*' | ||
: (0, posix_1.join)(projectGraph.nodes[project].data.root, '**/*'); | ||
if (!existingPlugin) { | ||
@@ -288,0 +282,0 @@ nxJson.plugins ??= []; |
import type { Tree } from 'nx/src/devkit-exports'; | ||
import type { ScriptTarget, ModuleKind } from 'typescript'; | ||
import type { ModuleKind, ScriptTarget } from 'typescript'; | ||
export type ToJSOptions = { | ||
extension?: '.js' | '.mjs' | '.cjs'; | ||
module?: ModuleKind; | ||
target?: ScriptTarget; | ||
module?: ModuleKind; | ||
extension: '.js' | '.mjs' | '.cjs'; | ||
useJsx?: boolean; | ||
}; | ||
@@ -8,0 +9,0 @@ /** |
@@ -20,5 +20,11 @@ "use strict"; | ||
})); | ||
tree.rename(c.path, c.path.replace(/\.tsx?$/, options?.extension ?? '.js')); | ||
tree.rename(c.path, c.path.replace(/\.ts$/, options?.extension ?? '.js')); | ||
if (options?.useJsx) { | ||
tree.rename(c.path, c.path.replace(/\.tsx$/, '.jsx')); | ||
} | ||
else { | ||
tree.rename(c.path, c.path.replace(/\.tsx$/, options?.extension ?? '.js')); | ||
} | ||
} | ||
} | ||
} |
@@ -14,3 +14,3 @@ "use strict"; | ||
*/ | ||
function installPackagesTask(tree, alwaysRun = false, cwd = '', packageManager = (0, devkit_exports_1.detectPackageManager)(cwd)) { | ||
function installPackagesTask(tree, alwaysRun = false, cwd = '', packageManager = (0, devkit_exports_1.detectPackageManager)((0, path_1.join)(tree.root, cwd))) { | ||
if (!tree | ||
@@ -17,0 +17,0 @@ .listChanges() |
@@ -9,5 +9,5 @@ "use strict"; | ||
bodyLines: [ | ||
`Run "nx show project ${projectName} --web" to view details about this project.`, | ||
`Run "nx show project ${projectName}" to view details about this project.`, | ||
], | ||
}); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
224159
104
5489
32
+ Added@nrwl/devkit@0.0.0-pr-26891-0a70597(transitive)
- Removed@nrwl/devkit@0.0.0-pr-26891-048ee5a(transitive)