From 1d773c0d352631db9bb463e2f21813914111c4ba Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Thu, 9 Feb 2023 12:48:57 -0500 Subject: [PATCH] fix(devkit): make devkit backwards compatible back to nx 14.1 (#14854) --- docs/generated/devkit/ngcli_adapter.md | 10 +- .../devkit/{index.md => nrwl_devkit.md} | 887 +++++++++--------- docs/generated/manifests/packages.json | 2 +- docs/generated/packages-metadata.json | 2 +- .../packages/devkit/documents/index.md | 887 +++++++++--------- .../devkit/documents/ngcli_adapter.md | 10 +- docs/map.json | 2 +- .../src/e2e/additional-api-references.cy.ts | 2 +- packages/devkit/.eslintrc.json | 31 +- packages/devkit/index.d.ts | 19 + packages/devkit/index.js | 27 + packages/devkit/ngcli-adapter.ts | 1 + .../{index.ts => nx-reexports-pre16.ts} | 36 +- packages/devkit/nx.ts | 7 + packages/devkit/package.json | 2 +- packages/devkit/public-api.ts | 129 +++ .../src/executors/parse-target-string.ts | 7 +- .../src/executors/read-target-options.ts | 5 +- .../devkit/src/generators/format-files.ts | 5 +- .../devkit/src/generators/generate-files.ts | 4 +- .../src/generators/update-ts-configs-to-js.ts | 4 +- .../update-14-2-0/split-create-empty-tree.ts | 7 +- .../devkit/src/tasks/install-packages-task.ts | 11 +- .../devkit/src/utils/convert-nx-executor.ts | 13 +- .../devkit/src/utils/get-workspace-layout.ts | 4 +- .../devkit/src/utils/invoke-nx-generator.ts | 11 +- .../utils/module-federation/package-json.ts | 6 +- .../secondary-entry-points.ts | 8 +- .../src/utils/module-federation/share.spec.ts | 25 +- .../src/utils/module-federation/share.ts | 8 +- .../src/utils/module-federation/typescript.ts | 1 + packages/devkit/src/utils/move-dir.ts | 5 +- packages/devkit/src/utils/package-json.ts | 11 +- .../devkit/{testing.ts => testing-pre16.ts} | 1 + packages/devkit/testing.d.ts | 2 + packages/devkit/testing.js | 9 + packages/devkit/tsconfig.lib.json | 1 + packages/js/src/index.ts | 3 + .../utils/package-json/update-package-json.ts | 4 +- packages/next/package.json | 1 + .../next/src/executors/build/build.impl.ts | 3 +- packages/nx/src/devkit-exports.ts | 243 +++++ packages/nx/src/devkit-testing-exports.ts | 5 + .../nx/src/generators/utils/deprecated.ts | 5 + packages/nx/src/generators/utils/nx-json.ts | 27 +- .../plugins/generate-package-json-plugin.ts | 3 +- .../generate-devkit-documentation.ts | 2 +- scripts/patched-jest-resolver.js | 13 +- 48 files changed, 1521 insertions(+), 990 deletions(-) rename docs/generated/devkit/{index.md => nrwl_devkit.md} (58%) create mode 100644 packages/devkit/index.d.ts create mode 100644 packages/devkit/index.js rename packages/devkit/{index.ts => nx-reexports-pre16.ts} (82%) create mode 100644 packages/devkit/nx.ts create mode 100644 packages/devkit/public-api.ts rename packages/devkit/{testing.ts => testing-pre16.ts} (78%) create mode 100644 packages/devkit/testing.d.ts create mode 100644 packages/devkit/testing.js create mode 100644 packages/nx/src/devkit-exports.ts create mode 100644 packages/nx/src/devkit-testing-exports.ts diff --git a/docs/generated/devkit/ngcli_adapter.md b/docs/generated/devkit/ngcli_adapter.md index ebafd6191a..19fdc03ad8 100644 --- a/docs/generated/devkit/ngcli_adapter.md +++ b/docs/generated/devkit/ngcli_adapter.md @@ -91,7 +91,7 @@ overrideCollectionResolutionForTesting({ ### wrapAngularDevkitSchematic -▸ **wrapAngularDevkitSchematic**(`collectionName`, `generatorName`): (`host`: [`Tree`](../../devkit/documents/index#tree), `generatorOptions`: { [k: string]: `any`; }) => `Promise`<`any`\> +▸ **wrapAngularDevkitSchematic**(`collectionName`, `generatorName`): (`host`: [`Tree`](../../devkit/documents/nrwl_devkit#tree), `generatorOptions`: { [k: string]: `any`; }) => `Promise`<`any`\> #### Parameters @@ -108,10 +108,10 @@ overrideCollectionResolutionForTesting({ ##### Parameters -| Name | Type | -| :----------------- | :------------------------------------------ | -| `host` | [`Tree`](../../devkit/documents/index#tree) | -| `generatorOptions` | `Object` | +| Name | Type | +| :----------------- | :------------------------------------------------ | +| `host` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `generatorOptions` | `Object` | ##### Returns diff --git a/docs/generated/devkit/index.md b/docs/generated/devkit/nrwl_devkit.md similarity index 58% rename from docs/generated/devkit/index.md rename to docs/generated/devkit/nrwl_devkit.md index 95efb14d9e..e22916605a 100644 --- a/docs/generated/devkit/index.md +++ b/docs/generated/devkit/nrwl_devkit.md @@ -1,4 +1,4 @@ -# Module: index +# Module: @nrwl/devkit The Nx Devkit is the underlying technology used to customize Nx to support different technologies and custom use-cases. It contains many utility @@ -13,195 +13,195 @@ It only uses language primitives and immutable objects ### Project Graph Enumerations -- [DependencyType](../../devkit/documents/index#dependencytype) +- [DependencyType](../../devkit/documents/nrwl_devkit#dependencytype) ### Utils Enumerations -- [ChangeType](../../devkit/documents/index#changetype) +- [ChangeType](../../devkit/documents/nrwl_devkit#changetype) ### Project Graph Classes -- [ProjectGraphBuilder](../../devkit/documents/index#projectgraphbuilder) +- [ProjectGraphBuilder](../../devkit/documents/nrwl_devkit#projectgraphbuilder) ### Utils Classes -- [Hasher](../../devkit/documents/index#hasher) +- [Hasher](../../devkit/documents/nrwl_devkit#hasher) ### Workspace Classes -- [Workspaces](../../devkit/documents/index#workspaces) +- [Workspaces](../../devkit/documents/nrwl_devkit#workspaces) ### Commands Interfaces -- [Target](../../devkit/documents/index#target) +- [Target](../../devkit/documents/nrwl_devkit#target) ### Other Interfaces -- [NxPlugin](../../devkit/documents/index#nxplugin) +- [NxPlugin](../../devkit/documents/nrwl_devkit#nxplugin) ### Project Graph Interfaces -- [FileData](../../devkit/documents/index#filedata) -- [ProjectFileMap](../../devkit/documents/index#projectfilemap) -- [ProjectGraph](../../devkit/documents/index#projectgraph) -- [ProjectGraphDependency](../../devkit/documents/index#projectgraphdependency) -- [ProjectGraphExternalNode](../../devkit/documents/index#projectgraphexternalnode) -- [ProjectGraphProcessorContext](../../devkit/documents/index#projectgraphprocessorcontext) -- [ProjectGraphProjectNode](../../devkit/documents/index#projectgraphprojectnode) -- [ProjectGraphV4](../../devkit/documents/index#projectgraphv4) +- [FileData](../../devkit/documents/nrwl_devkit#filedata) +- [ProjectFileMap](../../devkit/documents/nrwl_devkit#projectfilemap) +- [ProjectGraph](../../devkit/documents/nrwl_devkit#projectgraph) +- [ProjectGraphDependency](../../devkit/documents/nrwl_devkit#projectgraphdependency) +- [ProjectGraphExternalNode](../../devkit/documents/nrwl_devkit#projectgraphexternalnode) +- [ProjectGraphProcessorContext](../../devkit/documents/nrwl_devkit#projectgraphprocessorcontext) +- [ProjectGraphProjectNode](../../devkit/documents/nrwl_devkit#projectgraphprojectnode) +- [ProjectGraphV4](../../devkit/documents/nrwl_devkit#projectgraphv4) ### Tree Interfaces -- [FileChange](../../devkit/documents/index#filechange) -- [Tree](../../devkit/documents/index#tree) +- [FileChange](../../devkit/documents/nrwl_devkit#filechange) +- [Tree](../../devkit/documents/nrwl_devkit#tree) ### Utils Interfaces -- [DefaultTasksRunnerOptions](../../devkit/documents/index#defaulttasksrunneroptions) -- [Hash](../../devkit/documents/index#hash) -- [JsonParseOptions](../../devkit/documents/index#jsonparseoptions) -- [JsonSerializeOptions](../../devkit/documents/index#jsonserializeoptions) -- [ModuleFederationConfig](../../devkit/documents/index#modulefederationconfig) -- [RemoteCache](../../devkit/documents/index#remotecache) -- [SharedLibraryConfig](../../devkit/documents/index#sharedlibraryconfig) -- [StringDeletion](../../devkit/documents/index#stringdeletion) -- [StringInsertion](../../devkit/documents/index#stringinsertion) +- [DefaultTasksRunnerOptions](../../devkit/documents/nrwl_devkit#defaulttasksrunneroptions) +- [Hash](../../devkit/documents/nrwl_devkit#hash) +- [JsonParseOptions](../../devkit/documents/nrwl_devkit#jsonparseoptions) +- [JsonSerializeOptions](../../devkit/documents/nrwl_devkit#jsonserializeoptions) +- [ModuleFederationConfig](../../devkit/documents/nrwl_devkit#modulefederationconfig) +- [RemoteCache](../../devkit/documents/nrwl_devkit#remotecache) +- [SharedLibraryConfig](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) +- [StringDeletion](../../devkit/documents/nrwl_devkit#stringdeletion) +- [StringInsertion](../../devkit/documents/nrwl_devkit#stringinsertion) ### Workspace Interfaces -- [ExecutorContext](../../devkit/documents/index#executorcontext) -- [ExecutorsJson](../../devkit/documents/index#executorsjson) -- [GeneratorsJson](../../devkit/documents/index#generatorsjson) -- [HasherContext](../../devkit/documents/index#hashercontext) -- [ImplicitJsonSubsetDependency](../../devkit/documents/index#implicitjsonsubsetdependency) -- [MigrationsJson](../../devkit/documents/index#migrationsjson) -- [NxAffectedConfig](../../devkit/documents/index#nxaffectedconfig) -- [NxJsonConfiguration](../../devkit/documents/index#nxjsonconfiguration) -- [ProjectConfiguration](../../devkit/documents/index#projectconfiguration) -- [ProjectsConfigurations](../../devkit/documents/index#projectsconfigurations) -- [TargetConfiguration](../../devkit/documents/index#targetconfiguration) -- [TargetDependencyConfig](../../devkit/documents/index#targetdependencyconfig) -- [Task](../../devkit/documents/index#task) -- [TaskGraph](../../devkit/documents/index#taskgraph) -- [Workspace](../../devkit/documents/index#workspace) +- [ExecutorContext](../../devkit/documents/nrwl_devkit#executorcontext) +- [ExecutorsJson](../../devkit/documents/nrwl_devkit#executorsjson) +- [GeneratorsJson](../../devkit/documents/nrwl_devkit#generatorsjson) +- [HasherContext](../../devkit/documents/nrwl_devkit#hashercontext) +- [ImplicitJsonSubsetDependency](../../devkit/documents/nrwl_devkit#implicitjsonsubsetdependency) +- [MigrationsJson](../../devkit/documents/nrwl_devkit#migrationsjson) +- [NxAffectedConfig](../../devkit/documents/nrwl_devkit#nxaffectedconfig) +- [NxJsonConfiguration](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) +- [ProjectConfiguration](../../devkit/documents/nrwl_devkit#projectconfiguration) +- [ProjectsConfigurations](../../devkit/documents/nrwl_devkit#projectsconfigurations) +- [TargetConfiguration](../../devkit/documents/nrwl_devkit#targetconfiguration) +- [TargetDependencyConfig](../../devkit/documents/nrwl_devkit#targetdependencyconfig) +- [Task](../../devkit/documents/nrwl_devkit#task) +- [TaskGraph](../../devkit/documents/nrwl_devkit#taskgraph) +- [Workspace](../../devkit/documents/nrwl_devkit#workspace) ### Generators Type aliases -- [WorkspaceConfiguration](../../devkit/documents/index#workspaceconfiguration) +- [WorkspaceConfiguration](../../devkit/documents/nrwl_devkit#workspaceconfiguration) ### Other Type aliases -- [ProjectTargetConfigurator](../../devkit/documents/index#projecttargetconfigurator) +- [ProjectTargetConfigurator](../../devkit/documents/nrwl_devkit#projecttargetconfigurator) ### Package Manager Type aliases -- [PackageManager](../../devkit/documents/index#packagemanager) +- [PackageManager](../../devkit/documents/nrwl_devkit#packagemanager) ### Project Graph Type aliases -- [ProjectGraphNode](../../devkit/documents/index#projectgraphnode) +- [ProjectGraphNode](../../devkit/documents/nrwl_devkit#projectgraphnode) ### Utils Type aliases -- [AdditionalSharedConfig](../../devkit/documents/index#additionalsharedconfig) -- [ModuleFederationLibrary](../../devkit/documents/index#modulefederationlibrary) -- [Remotes](../../devkit/documents/index#remotes) -- [SharedFunction](../../devkit/documents/index#sharedfunction) -- [SharedWorkspaceLibraryConfig](../../devkit/documents/index#sharedworkspacelibraryconfig) -- [StringChange](../../devkit/documents/index#stringchange) -- [WorkspaceLibrary](../../devkit/documents/index#workspacelibrary) -- [WorkspaceLibrarySecondaryEntryPoint](../../devkit/documents/index#workspacelibrarysecondaryentrypoint) +- [AdditionalSharedConfig](../../devkit/documents/nrwl_devkit#additionalsharedconfig) +- [ModuleFederationLibrary](../../devkit/documents/nrwl_devkit#modulefederationlibrary) +- [Remotes](../../devkit/documents/nrwl_devkit#remotes) +- [SharedFunction](../../devkit/documents/nrwl_devkit#sharedfunction) +- [SharedWorkspaceLibraryConfig](../../devkit/documents/nrwl_devkit#sharedworkspacelibraryconfig) +- [StringChange](../../devkit/documents/nrwl_devkit#stringchange) +- [WorkspaceLibrary](../../devkit/documents/nrwl_devkit#workspacelibrary) +- [WorkspaceLibrarySecondaryEntryPoint](../../devkit/documents/nrwl_devkit#workspacelibrarysecondaryentrypoint) ### Workspace Type aliases -- [CustomHasher](../../devkit/documents/index#customhasher) -- [Executor](../../devkit/documents/index#executor) -- [Generator](../../devkit/documents/index#generator) -- [GeneratorCallback](../../devkit/documents/index#generatorcallback) -- [ImplicitDependencyEntry](../../devkit/documents/index#implicitdependencyentry) -- [ProjectType](../../devkit/documents/index#projecttype) -- [TaskGraphExecutor](../../devkit/documents/index#taskgraphexecutor) -- [WorkspaceJsonConfiguration](../../devkit/documents/index#workspacejsonconfiguration) +- [CustomHasher](../../devkit/documents/nrwl_devkit#customhasher) +- [Executor](../../devkit/documents/nrwl_devkit#executor) +- [Generator](../../devkit/documents/nrwl_devkit#generator) +- [GeneratorCallback](../../devkit/documents/nrwl_devkit#generatorcallback) +- [ImplicitDependencyEntry](../../devkit/documents/nrwl_devkit#implicitdependencyentry) +- [ProjectType](../../devkit/documents/nrwl_devkit#projecttype) +- [TaskGraphExecutor](../../devkit/documents/nrwl_devkit#taskgraphexecutor) +- [WorkspaceJsonConfiguration](../../devkit/documents/nrwl_devkit#workspacejsonconfiguration) ### Logger Variables -- [logger](../../devkit/documents/index#logger) +- [logger](../../devkit/documents/nrwl_devkit#logger) ### Utils Variables -- [appRootPath](../../devkit/documents/index#approotpath) -- [cacheDir](../../devkit/documents/index#cachedir) -- [output](../../devkit/documents/index#output) -- [workspaceRoot](../../devkit/documents/index#workspaceroot) +- [appRootPath](../../devkit/documents/nrwl_devkit#approotpath) +- [cacheDir](../../devkit/documents/nrwl_devkit#cachedir) +- [output](../../devkit/documents/nrwl_devkit#output) +- [workspaceRoot](../../devkit/documents/nrwl_devkit#workspaceroot) ### Functions -- [addDependenciesToPackageJson](../../devkit/documents/index#adddependenciestopackagejson) -- [addProjectConfiguration](../../devkit/documents/index#addprojectconfiguration) -- [applyAdditionalShared](../../devkit/documents/index#applyadditionalshared) -- [applyChangesToString](../../devkit/documents/index#applychangestostring) -- [applySharedFunction](../../devkit/documents/index#applysharedfunction) -- [convertNxExecutor](../../devkit/documents/index#convertnxexecutor) -- [convertNxGenerator](../../devkit/documents/index#convertnxgenerator) -- [createLockFile](../../devkit/documents/index#createlockfile) -- [createPackageJson](../../devkit/documents/index#createpackagejson) -- [createProjectGraphAsync](../../devkit/documents/index#createprojectgraphasync) -- [defaultTasksRunner](../../devkit/documents/index#defaulttasksrunner) -- [detectPackageManager](../../devkit/documents/index#detectpackagemanager) -- [detectWorkspaceScope](../../devkit/documents/index#detectworkspacescope) -- [ensurePackage](../../devkit/documents/index#ensurepackage) -- [extractLayoutDirectory](../../devkit/documents/index#extractlayoutdirectory) -- [formatFiles](../../devkit/documents/index#formatfiles) -- [generateFiles](../../devkit/documents/index#generatefiles) -- [getDependentPackagesForProject](../../devkit/documents/index#getdependentpackagesforproject) -- [getImportPath](../../devkit/documents/index#getimportpath) -- [getNpmPackageSharedConfig](../../devkit/documents/index#getnpmpackagesharedconfig) -- [getOutputsForTargetAndConfiguration](../../devkit/documents/index#getoutputsfortargetandconfiguration) -- [getPackageManagerCommand](../../devkit/documents/index#getpackagemanagercommand) -- [getPackageManagerVersion](../../devkit/documents/index#getpackagemanagerversion) -- [getProjects](../../devkit/documents/index#getprojects) -- [getWorkspaceLayout](../../devkit/documents/index#getworkspacelayout) -- [getWorkspacePath](../../devkit/documents/index#getworkspacepath) -- [installPackagesTask](../../devkit/documents/index#installpackagestask) -- [isStandaloneProject](../../devkit/documents/index#isstandaloneproject) -- [joinPathFragments](../../devkit/documents/index#joinpathfragments) -- [mapRemotes](../../devkit/documents/index#mapremotes) -- [mapRemotesForSSR](../../devkit/documents/index#mapremotesforssr) -- [moveFilesToNewDirectory](../../devkit/documents/index#movefilestonewdirectory) -- [names](../../devkit/documents/index#names) -- [normalizePath](../../devkit/documents/index#normalizepath) -- [offsetFromRoot](../../devkit/documents/index#offsetfromroot) -- [parseJson](../../devkit/documents/index#parsejson) -- [parseTargetString](../../devkit/documents/index#parsetargetstring) -- [readAllWorkspaceConfiguration](../../devkit/documents/index#readallworkspaceconfiguration) -- [readCachedProjectGraph](../../devkit/documents/index#readcachedprojectgraph) -- [readJson](../../devkit/documents/index#readjson) -- [readJsonFile](../../devkit/documents/index#readjsonfile) -- [readNxJson](../../devkit/documents/index#readnxjson) -- [readProjectConfiguration](../../devkit/documents/index#readprojectconfiguration) -- [readRootPackageJson](../../devkit/documents/index#readrootpackagejson) -- [readTargetOptions](../../devkit/documents/index#readtargetoptions) -- [readWorkspaceConfiguration](../../devkit/documents/index#readworkspaceconfiguration) -- [removeDependenciesFromPackageJson](../../devkit/documents/index#removedependenciesfrompackagejson) -- [removeProjectConfiguration](../../devkit/documents/index#removeprojectconfiguration) -- [reverse](../../devkit/documents/index#reverse) -- [runExecutor](../../devkit/documents/index#runexecutor) -- [serializeJson](../../devkit/documents/index#serializejson) -- [sharePackages](../../devkit/documents/index#sharepackages) -- [shareWorkspaceLibraries](../../devkit/documents/index#shareworkspacelibraries) -- [stripIndents](../../devkit/documents/index#stripindents) -- [stripJsonComments](../../devkit/documents/index#stripjsoncomments) -- [targetToTargetString](../../devkit/documents/index#targettotargetstring) -- [toJS](../../devkit/documents/index#tojs) -- [updateJson](../../devkit/documents/index#updatejson) -- [updateNxJson](../../devkit/documents/index#updatenxjson) -- [updateProjectConfiguration](../../devkit/documents/index#updateprojectconfiguration) -- [updateTsConfigsToJs](../../devkit/documents/index#updatetsconfigstojs) -- [updateWorkspaceConfiguration](../../devkit/documents/index#updateworkspaceconfiguration) -- [visitNotIgnoredFiles](../../devkit/documents/index#visitnotignoredfiles) -- [workspaceLayout](../../devkit/documents/index#workspacelayout) -- [writeJson](../../devkit/documents/index#writejson) -- [writeJsonFile](../../devkit/documents/index#writejsonfile) +- [addDependenciesToPackageJson](../../devkit/documents/nrwl_devkit#adddependenciestopackagejson) +- [addProjectConfiguration](../../devkit/documents/nrwl_devkit#addprojectconfiguration) +- [applyAdditionalShared](../../devkit/documents/nrwl_devkit#applyadditionalshared) +- [applyChangesToString](../../devkit/documents/nrwl_devkit#applychangestostring) +- [applySharedFunction](../../devkit/documents/nrwl_devkit#applysharedfunction) +- [convertNxExecutor](../../devkit/documents/nrwl_devkit#convertnxexecutor) +- [convertNxGenerator](../../devkit/documents/nrwl_devkit#convertnxgenerator) +- [createLockFile](../../devkit/documents/nrwl_devkit#createlockfile) +- [createPackageJson](../../devkit/documents/nrwl_devkit#createpackagejson) +- [createProjectGraphAsync](../../devkit/documents/nrwl_devkit#createprojectgraphasync) +- [defaultTasksRunner](../../devkit/documents/nrwl_devkit#defaulttasksrunner) +- [detectPackageManager](../../devkit/documents/nrwl_devkit#detectpackagemanager) +- [detectWorkspaceScope](../../devkit/documents/nrwl_devkit#detectworkspacescope) +- [ensurePackage](../../devkit/documents/nrwl_devkit#ensurepackage) +- [extractLayoutDirectory](../../devkit/documents/nrwl_devkit#extractlayoutdirectory) +- [formatFiles](../../devkit/documents/nrwl_devkit#formatfiles) +- [generateFiles](../../devkit/documents/nrwl_devkit#generatefiles) +- [getDependentPackagesForProject](../../devkit/documents/nrwl_devkit#getdependentpackagesforproject) +- [getImportPath](../../devkit/documents/nrwl_devkit#getimportpath) +- [getNpmPackageSharedConfig](../../devkit/documents/nrwl_devkit#getnpmpackagesharedconfig) +- [getOutputsForTargetAndConfiguration](../../devkit/documents/nrwl_devkit#getoutputsfortargetandconfiguration) +- [getPackageManagerCommand](../../devkit/documents/nrwl_devkit#getpackagemanagercommand) +- [getPackageManagerVersion](../../devkit/documents/nrwl_devkit#getpackagemanagerversion) +- [getProjects](../../devkit/documents/nrwl_devkit#getprojects) +- [getWorkspaceLayout](../../devkit/documents/nrwl_devkit#getworkspacelayout) +- [getWorkspacePath](../../devkit/documents/nrwl_devkit#getworkspacepath) +- [installPackagesTask](../../devkit/documents/nrwl_devkit#installpackagestask) +- [isStandaloneProject](../../devkit/documents/nrwl_devkit#isstandaloneproject) +- [joinPathFragments](../../devkit/documents/nrwl_devkit#joinpathfragments) +- [mapRemotes](../../devkit/documents/nrwl_devkit#mapremotes) +- [mapRemotesForSSR](../../devkit/documents/nrwl_devkit#mapremotesforssr) +- [moveFilesToNewDirectory](../../devkit/documents/nrwl_devkit#movefilestonewdirectory) +- [names](../../devkit/documents/nrwl_devkit#names) +- [normalizePath](../../devkit/documents/nrwl_devkit#normalizepath) +- [offsetFromRoot](../../devkit/documents/nrwl_devkit#offsetfromroot) +- [parseJson](../../devkit/documents/nrwl_devkit#parsejson) +- [parseTargetString](../../devkit/documents/nrwl_devkit#parsetargetstring) +- [readAllWorkspaceConfiguration](../../devkit/documents/nrwl_devkit#readallworkspaceconfiguration) +- [readCachedProjectGraph](../../devkit/documents/nrwl_devkit#readcachedprojectgraph) +- [readJson](../../devkit/documents/nrwl_devkit#readjson) +- [readJsonFile](../../devkit/documents/nrwl_devkit#readjsonfile) +- [readNxJson](../../devkit/documents/nrwl_devkit#readnxjson) +- [readProjectConfiguration](../../devkit/documents/nrwl_devkit#readprojectconfiguration) +- [readRootPackageJson](../../devkit/documents/nrwl_devkit#readrootpackagejson) +- [readTargetOptions](../../devkit/documents/nrwl_devkit#readtargetoptions) +- [readWorkspaceConfiguration](../../devkit/documents/nrwl_devkit#readworkspaceconfiguration) +- [removeDependenciesFromPackageJson](../../devkit/documents/nrwl_devkit#removedependenciesfrompackagejson) +- [removeProjectConfiguration](../../devkit/documents/nrwl_devkit#removeprojectconfiguration) +- [reverse](../../devkit/documents/nrwl_devkit#reverse) +- [runExecutor](../../devkit/documents/nrwl_devkit#runexecutor) +- [serializeJson](../../devkit/documents/nrwl_devkit#serializejson) +- [sharePackages](../../devkit/documents/nrwl_devkit#sharepackages) +- [shareWorkspaceLibraries](../../devkit/documents/nrwl_devkit#shareworkspacelibraries) +- [stripIndents](../../devkit/documents/nrwl_devkit#stripindents) +- [stripJsonComments](../../devkit/documents/nrwl_devkit#stripjsoncomments) +- [targetToTargetString](../../devkit/documents/nrwl_devkit#targettotargetstring) +- [toJS](../../devkit/documents/nrwl_devkit#tojs) +- [updateJson](../../devkit/documents/nrwl_devkit#updatejson) +- [updateNxJson](../../devkit/documents/nrwl_devkit#updatenxjson) +- [updateProjectConfiguration](../../devkit/documents/nrwl_devkit#updateprojectconfiguration) +- [updateTsConfigsToJs](../../devkit/documents/nrwl_devkit#updatetsconfigstojs) +- [updateWorkspaceConfiguration](../../devkit/documents/nrwl_devkit#updateworkspaceconfiguration) +- [visitNotIgnoredFiles](../../devkit/documents/nrwl_devkit#visitnotignoredfiles) +- [workspaceLayout](../../devkit/documents/nrwl_devkit#workspacelayout) +- [writeJson](../../devkit/documents/nrwl_devkit#writejson) +- [writeJsonFile](../../devkit/documents/nrwl_devkit#writejsonfile) ## Project Graph Enumerations @@ -495,7 +495,7 @@ A plugin for Nx ### WorkspaceConfiguration -Ƭ **WorkspaceConfiguration**: `Omit`<[`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations), `"projects"`\> & `Partial`<[`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration)\> +Ƭ **WorkspaceConfiguration**: `Omit`<[`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations), `"projects"`\> & `Partial`<[`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration)\> --- @@ -503,11 +503,11 @@ A plugin for Nx ### ProjectTargetConfigurator -Ƭ **ProjectTargetConfigurator**: (`file`: `string`) => `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/index#targetconfiguration)\> +Ƭ **ProjectTargetConfigurator**: (`file`: `string`) => `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/nrwl_devkit#targetconfiguration)\> #### Type declaration -▸ (`file`): `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/index#targetconfiguration)\> +▸ (`file`): `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/nrwl_devkit#targetconfiguration)\> ##### Parameters @@ -517,7 +517,7 @@ A plugin for Nx ##### Returns -`Record`<`string`, [`TargetConfiguration`](../../devkit/documents/index#targetconfiguration)\> +`Record`<`string`, [`TargetConfiguration`](../../devkit/documents/nrwl_devkit#targetconfiguration)\> --- @@ -533,7 +533,7 @@ A plugin for Nx ### ProjectGraphNode -Ƭ **ProjectGraphNode**: [`ProjectGraphProjectNode`](../../devkit/documents/index#projectgraphprojectnode) \| [`ProjectGraphExternalNode`](../../devkit/documents/index#projectgraphexternalnode) +Ƭ **ProjectGraphNode**: [`ProjectGraphProjectNode`](../../devkit/documents/nrwl_devkit#projectgraphprojectnode) \| [`ProjectGraphExternalNode`](../../devkit/documents/nrwl_devkit#projectgraphexternalnode) --- @@ -541,7 +541,7 @@ A plugin for Nx ### AdditionalSharedConfig -Ƭ **AdditionalSharedConfig**: (`string` \| [libraryName: string, sharedConfig: SharedLibraryConfig] \| { `libraryName`: `string` ; `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) })[] +Ƭ **AdditionalSharedConfig**: (`string` \| [libraryName: string, sharedConfig: SharedLibraryConfig] \| { `libraryName`: `string` ; `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) })[] --- @@ -566,22 +566,22 @@ A plugin for Nx ### SharedFunction -Ƭ **SharedFunction**: (`libraryName`: `string`, `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)) => `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) +Ƭ **SharedFunction**: (`libraryName`: `string`, `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)) => `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) #### Type declaration -▸ (`libraryName`, `sharedConfig`): `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) +▸ (`libraryName`, `sharedConfig`): `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) ##### Parameters -| Name | Type | -| :------------- | :------------------------------------------------------------------------ | -| `libraryName` | `string` | -| `sharedConfig` | [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) | +| Name | Type | +| :------------- | :------------------------------------------------------------------------------ | +| `libraryName` | `string` | +| `sharedConfig` | [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) | ##### Returns -`undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) +`undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) --- @@ -591,17 +591,17 @@ A plugin for Nx #### Type declaration -| Name | Type | -| :--------------------- | :---------------------------------------------------------------------------------------------------------------------- | -| `getAliases` | () => `Record`<`string`, `string`\> | -| `getLibraries` | (`eager?`: `boolean`) => `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> | -| `getReplacementPlugin` | () => `NormalModuleReplacementPlugin` | +| Name | Type | +| :--------------------- | :---------------------------------------------------------------------------------------------------------------------------- | +| `getAliases` | () => `Record`<`string`, `string`\> | +| `getLibraries` | (`eager?`: `boolean`) => `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> | +| `getReplacementPlugin` | () => `NormalModuleReplacementPlugin` | --- ### StringChange -Ƭ **StringChange**: [`StringInsertion`](../../devkit/documents/index#stringinsertion) \| [`StringDeletion`](../../devkit/documents/index#stringdeletion) +Ƭ **StringChange**: [`StringInsertion`](../../devkit/documents/nrwl_devkit#stringinsertion) \| [`StringDeletion`](../../devkit/documents/nrwl_devkit#stringdeletion) --- @@ -636,28 +636,28 @@ A plugin for Nx ### CustomHasher -Ƭ **CustomHasher**: (`task`: [`Task`](../../devkit/documents/index#task), `context`: [`HasherContext`](../../devkit/documents/index#hashercontext)) => `Promise`<[`Hash`](../../devkit/documents/index#hash)\> +Ƭ **CustomHasher**: (`task`: [`Task`](../../devkit/documents/nrwl_devkit#task), `context`: [`HasherContext`](../../devkit/documents/nrwl_devkit#hashercontext)) => `Promise`<[`Hash`](../../devkit/documents/nrwl_devkit#hash)\> #### Type declaration -▸ (`task`, `context`): `Promise`<[`Hash`](../../devkit/documents/index#hash)\> +▸ (`task`, `context`): `Promise`<[`Hash`](../../devkit/documents/nrwl_devkit#hash)\> ##### Parameters -| Name | Type | -| :-------- | :------------------------------------------------------------ | -| `task` | [`Task`](../../devkit/documents/index#task) | -| `context` | [`HasherContext`](../../devkit/documents/index#hashercontext) | +| Name | Type | +| :-------- | :------------------------------------------------------------------ | +| `task` | [`Task`](../../devkit/documents/nrwl_devkit#task) | +| `context` | [`HasherContext`](../../devkit/documents/nrwl_devkit#hashercontext) | ##### Returns -`Promise`<[`Hash`](../../devkit/documents/index#hash)\> +`Promise`<[`Hash`](../../devkit/documents/nrwl_devkit#hash)\> --- ### Executor -Ƭ **Executor**<`T`\>: (`options`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/index#executorcontext)) => `Promise`<`Object`\> \| `AsyncIterableIterator`<`Object`\> +Ƭ **Executor**<`T`\>: (`options`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext)) => `Promise`<`Object`\> \| `AsyncIterableIterator`<`Object`\> #### Type parameters @@ -673,10 +673,10 @@ Implementation of a target of a project ##### Parameters -| Name | Type | -| :-------- | :---------------------------------------------------------------- | -| `options` | `T` | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :-------- | :---------------------------------------------------------------------- | +| `options` | `T` | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | ##### Returns @@ -686,7 +686,7 @@ Implementation of a target of a project ### Generator -Ƭ **Generator**<`T`\>: (`tree`: `any`, `schema`: `T`) => `void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback)\> +Ƭ **Generator**<`T`\>: (`tree`: `any`, `schema`: `T`) => `void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback)\> #### Type parameters @@ -696,7 +696,7 @@ Implementation of a target of a project #### Type declaration -▸ (`tree`, `schema`): `void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback)\> +▸ (`tree`, `schema`): `void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback)\> A function that schedules updates to the filesystem to be done atomically @@ -709,7 +709,7 @@ A function that schedules updates to the filesystem to be done atomically ##### Returns -`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback)\> +`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback)\> --- @@ -741,7 +741,7 @@ A callback function that is executed after changes are made to the file system #### Index signature -▪ [key: `string`]: `T` \| [`ImplicitJsonSubsetDependency`](../../devkit/documents/index#implicitjsonsubsetdependency)<`T`\> +▪ [key: `string`]: `T` \| [`ImplicitJsonSubsetDependency`](../../devkit/documents/nrwl_devkit#implicitjsonsubsetdependency)<`T`\> --- @@ -753,7 +753,7 @@ A callback function that is executed after changes are made to the file system ### TaskGraphExecutor -Ƭ **TaskGraphExecutor**<`T`\>: (`taskGraph`: [`TaskGraph`](../../devkit/documents/index#taskgraph), `options`: `Record`<`string`, `T`\>, `overrides`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/index#executorcontext)) => `Promise`<`Record`<`string`, `Object`\>\> +Ƭ **TaskGraphExecutor**<`T`\>: (`taskGraph`: [`TaskGraph`](../../devkit/documents/nrwl_devkit#taskgraph), `options`: `Record`<`string`, `T`\>, `overrides`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext)) => `Promise`<`Record`<`string`, `Object`\>\> #### Type parameters @@ -769,12 +769,12 @@ Implementation of a target of a project that handles multiple projects to be bat ##### Parameters -| Name | Type | -| :---------- | :---------------------------------------------------------------- | -| `taskGraph` | [`TaskGraph`](../../devkit/documents/index#taskgraph) | -| `options` | `Record`<`string`, `T`\> | -| `overrides` | `T` | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :---------- | :---------------------------------------------------------------------- | +| `taskGraph` | [`TaskGraph`](../../devkit/documents/nrwl_devkit#taskgraph) | +| `options` | `Record`<`string`, `T`\> | +| `overrides` | `T` | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | ##### Returns @@ -784,7 +784,7 @@ Implementation of a target of a project that handles multiple projects to be bat ### WorkspaceJsonConfiguration -Ƭ **WorkspaceJsonConfiguration**: [`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations) +Ƭ **WorkspaceJsonConfiguration**: [`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations) ## Logger Variables @@ -833,7 +833,7 @@ Implementation of a target of a project that handles multiple projects to be bat ### addDependenciesToPackageJson -▸ **addDependenciesToPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +▸ **addDependenciesToPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Add Dependencies and Dev Dependencies to package.json @@ -847,16 +847,16 @@ This will **add** `react` and `jest` to the dependencies and devDependencies sec #### Parameters -| Name | Type | Default value | Description | -| :---------------- | :------------------------------------------ | :--------------- | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | Tree representing file system to modify | -| `dependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the dependencies section of package.json | -| `devDependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the devDependencies section of package.json | -| `packageJsonPath` | `string` | `'package.json'` | Path to package.json | +| Name | Type | Default value | Description | +| :---------------- | :------------------------------------------------ | :--------------- | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | Tree representing file system to modify | +| `dependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the dependencies section of package.json | +| `devDependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the devDependencies section of package.json | +| `packageJsonPath` | `string` | `'package.json'` | Path to package.json | #### Returns -[`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +[`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Callback to install dependencies only if necessary, no-op otherwise @@ -870,12 +870,12 @@ Adds project configuration to the Nx workspace. #### Parameters -| Name | Type | Default value | Description | -| :--------------------- | :-------------------------------------------------------------------------- | :------------ | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | the file system tree | -| `projectName` | `string` | `undefined` | unique name. Often directories are part of the name (e.g., mydir-mylib) | -| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) | `undefined` | project configuration | -| `standalone` | `boolean` | `true` | whether the project is configured in workspace.json or not | +| Name | Type | Default value | Description | +| :--------------------- | :-------------------------------------------------------------------------------- | :------------ | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | the file system tree | +| `projectName` | `string` | `undefined` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) | `undefined` | project configuration | +| `standalone` | `boolean` | `true` | whether the project is configured in workspace.json or not | #### Returns @@ -896,11 +896,11 @@ hierarchy. #### Parameters -| Name | Type | Description | -| :----------------- | :--------------------------------------------------------------------------------------------- | :--------------------------------- | -| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> | The original Shared Config | -| `additionalShared` | [`AdditionalSharedConfig`](../../devkit/documents/index#additionalsharedconfig) | The additional dependencies to add | -| `projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | The Nx project graph | +| Name | Type | Description | +| :----------------- | :--------------------------------------------------------------------------------------------------- | :--------------------------------- | +| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> | The original Shared Config | +| `additionalShared` | [`AdditionalSharedConfig`](../../devkit/documents/nrwl_devkit#additionalsharedconfig) | The additional dependencies to add | +| `projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | The Nx project graph | #### Returns @@ -944,10 +944,10 @@ bootstrap({ #### Parameters -| Name | Type | -| :-------- | :------------------------------------------------------------ | -| `text` | `string` | -| `changes` | [`StringChange`](../../devkit/documents/index#stringchange)[] | +| Name | Type | +| :-------- | :------------------------------------------------------------------ | +| `text` | `string` | +| `changes` | [`StringChange`](../../devkit/documents/nrwl_devkit#stringchange)[] | #### Returns @@ -964,10 +964,10 @@ of the dependencies for the Module Federation build. #### Parameters -| Name | Type | Description | -| :------------- | :--------------------------------------------------------------------------------------------- | :---------------------------------------- | -| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> | The original Shared Config to be modified | -| `sharedFn` | [`SharedFunction`](../../devkit/documents/index#sharedfunction) | The custom function to run | +| Name | Type | Description | +| :------------- | :--------------------------------------------------------------------------------------------------- | :---------------------------------------- | +| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> | The original Shared Config to be modified | +| `sharedFn` | [`SharedFunction`](../../devkit/documents/nrwl_devkit#sharedfunction) | The custom function to run | #### Returns @@ -985,9 +985,9 @@ Use this to expose a compatible Angular Builder #### Parameters -| Name | Type | -| :--------- | :---------------------------------------------------------- | -| `executor` | [`Executor`](../../devkit/documents/index#executor)<`any`\> | +| Name | Type | +| :--------- | :---------------------------------------------------------------- | +| `executor` | [`Executor`](../../devkit/documents/nrwl_devkit#executor)<`any`\> | #### Returns @@ -1009,10 +1009,10 @@ Convert an Nx Generator into an Angular Devkit Schematic. #### Parameters -| Name | Type | Default value | Description | -| :----------------------------- | :---------------------------------------------------------- | :------------ | :---------------------------------------------------------- | -| `generator` | [`Generator`](../../devkit/documents/index#generator)<`T`\> | `undefined` | The Nx generator to convert to an Angular Devkit Schematic. | -| `skipWritingConfigInOldFormat` | `boolean` | `false` | - | +| Name | Type | Default value | Description | +| :----------------------------- | :---------------------------------------------------------------- | :------------ | :---------------------------------------------------------- | +| `generator` | [`Generator`](../../devkit/documents/nrwl_devkit#generator)<`T`\> | `undefined` | The Nx generator to convert to an Angular Devkit Schematic. | +| `skipWritingConfigInOldFormat` | `boolean` | `false` | - | #### Returns @@ -1047,16 +1047,16 @@ Convert an Nx Generator into an Angular Devkit Schematic. ### createLockFile -▸ **createLockFile**(`packageJson`, `packageManager?`): `string` +▸ `Const` **createLockFile**(`packageJson`, `packageManager?`): `string` -Create lock file based on the root level lock file and (pruned) package.json +**`deprecated`** Import this from @nrwl/js instead #### Parameters -| Name | Type | -| :--------------- | :-------------------------------------------------------------- | -| `packageJson` | `PackageJson` | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | +| Name | Type | +| :--------------- | :-------------------------------------------------------------------- | +| `packageJson` | `PackageJson` | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | #### Returns @@ -1066,22 +1066,19 @@ Create lock file based on the root level lock file and (pruned) package.json ### createPackageJson -▸ **createPackageJson**(`projectName`, `graph`, `options?`): `PackageJson` +▸ `Const` **createPackageJson**(`projectName`, `graph`, `options?`): `PackageJson` -Creates a package.json in the output directory for support to install dependencies within containers. - -If a package.json exists in the project, it will reuse that. -If isProduction flag is set, it wil remove devDependencies and optional peerDependencies +**`deprecated`** Import this from @nrwl/js instead #### Parameters -| Name | Type | -| :---------------------- | :---------------------------------------------------------- | -| `projectName` | `string` | -| `graph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | -| `options` | `Object` | -| `options.isProduction?` | `boolean` | -| `options.root?` | `string` | +| Name | Type | +| :---------------------- | :---------------------------------------------------------------- | +| `projectName` | `string` | +| `graph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | +| `options` | `Object` | +| `options.isProduction?` | `boolean` | +| `options.root?` | `string` | #### Returns @@ -1091,7 +1088,7 @@ If isProduction flag is set, it wil remove devDependencies and optional peerDepe ### createProjectGraphAsync -▸ **createProjectGraphAsync**(`opts?`): `Promise`<[`ProjectGraph`](../../devkit/documents/index#projectgraph)\> +▸ **createProjectGraphAsync**(`opts?`): `Promise`<[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph)\> Computes and returns a ProjectGraph. @@ -1125,7 +1122,7 @@ stored in the daemon process. To reset both run: `nx reset`. #### Returns -`Promise`<[`ProjectGraph`](../../devkit/documents/index#projectgraph)\> +`Promise`<[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph)\> --- @@ -1135,19 +1132,19 @@ stored in the daemon process. To reset both run: `nx reset`. #### Parameters -| Name | Type | -| :--------------------------- | :---------------------------------------------------------------------------------------------- | -| `tasks` | [`Task`](../../devkit/documents/index#task)[] | -| `options` | [`DefaultTasksRunnerOptions`](../../devkit/documents/index#defaulttasksrunneroptions) | -| `context?` | `Object` | -| `context.daemon?` | `DaemonClient` | -| `context.hasher?` | [`Hasher`](../../devkit/documents/index#hasher) | -| `context.initiatingProject?` | `string` | -| `context.nxArgs` | `NxArgs` | -| `context.nxJson` | [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration)<`string`[] \| `"*"`\> | -| `context.projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | -| `context.target?` | `string` | -| `context.taskGraph?` | [`TaskGraph`](../../devkit/documents/index#taskgraph) | +| Name | Type | +| :--------------------------- | :---------------------------------------------------------------------------------------------------- | +| `tasks` | [`Task`](../../devkit/documents/nrwl_devkit#task)[] | +| `options` | [`DefaultTasksRunnerOptions`](../../devkit/documents/nrwl_devkit#defaulttasksrunneroptions) | +| `context?` | `Object` | +| `context.daemon?` | `DaemonClient` | +| `context.hasher?` | [`Hasher`](../../devkit/documents/nrwl_devkit#hasher) | +| `context.initiatingProject?` | `string` | +| `context.nxArgs` | `NxArgs` | +| `context.nxJson` | [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration)<`string`[] \| `"*"`\> | +| `context.projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | +| `context.target?` | `string` | +| `context.taskGraph?` | [`TaskGraph`](../../devkit/documents/nrwl_devkit#taskgraph) | #### Returns @@ -1157,7 +1154,7 @@ stored in the daemon process. To reset both run: `nx reset`. ### detectPackageManager -▸ **detectPackageManager**(`dir?`): [`PackageManager`](../../devkit/documents/index#packagemanager) +▸ **detectPackageManager**(`dir?`): [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) Detects which package manager is used in the workspace based on the lock file. @@ -1169,7 +1166,7 @@ Detects which package manager is used in the workspace based on the lock file. #### Returns -[`PackageManager`](../../devkit/documents/index#packagemanager) +[`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) --- @@ -1209,14 +1206,14 @@ When running with --dryRun, the function will throw when dependencies are missin #### Parameters -| Name | Type | Description | -| :------------------------ | :------------------------------------------ | :----------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `pkg` | `string` | the package to check (e.g. @nrwl/jest) | -| `requiredVersion` | `string` | the version or semver range to check (e.g. ~1.0.0, >=1.0.0 <2.0.0) | -| `options` | `Object` | | -| `options.dev?` | `boolean` | - | -| `options.throwOnMissing?` | `boolean` | - | +| Name | Type | Description | +| :------------------------ | :------------------------------------------------ | :----------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `pkg` | `string` | the package to check (e.g. @nrwl/jest) | +| `requiredVersion` | `string` | the version or semver range to check (e.g. ~1.0.0, >=1.0.0 <2.0.0) | +| `options` | `Object` | | +| `options.dev?` | `boolean` | - | +| `options.throwOnMissing?` | `boolean` | - | #### Returns @@ -1255,9 +1252,9 @@ Formats all the created or updated files using Prettier #### Parameters -| Name | Type | Description | -| :----- | :------------------------------------------ | :------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | +| Name | Type | Description | +| :----- | :------------------------------------------------ | :------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | #### Returns @@ -1293,12 +1290,12 @@ doesn't get confused about incorrect TypeScript files. #### Parameters -| Name | Type | Description | -| :-------------- | :------------------------------------------ | :-------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `srcFolder` | `string` | the source folder of files (absolute path) | -| `target` | `string` | the target folder (relative to the tree root) | -| `substitutions` | `Object` | an object of key-value pairs | +| Name | Type | Description | +| :-------------- | :------------------------------------------------ | :-------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `srcFolder` | `string` | the source folder of files (absolute path) | +| `target` | `string` | the target folder (relative to the tree root) | +| `substitutions` | `Object` | an object of key-value pairs | #### Returns @@ -1312,19 +1309,19 @@ doesn't get confused about incorrect TypeScript files. #### Parameters -| Name | Type | -| :------------- | :---------------------------------------------------------- | -| `projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | -| `name` | `string` | +| Name | Type | +| :------------- | :---------------------------------------------------------------- | +| `projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | +| `name` | `string` | #### Returns `Object` -| Name | Type | -| :------------------- | :-------------------------------------------------------------------- | -| `npmPackages` | `string`[] | -| `workspaceLibraries` | [`WorkspaceLibrary`](../../devkit/documents/index#workspacelibrary)[] | +| Name | Type | +| :------------------- | :-------------------------------------------------------------------------- | +| `npmPackages` | `string`[] | +| `workspaceLibraries` | [`WorkspaceLibrary`](../../devkit/documents/nrwl_devkit#workspacelibrary)[] | --- @@ -1349,7 +1346,7 @@ Prefixes project name with npm scope ### getNpmPackageSharedConfig -▸ **getNpmPackageSharedConfig**(`pkgName`, `version`): [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) \| `undefined` +▸ **getNpmPackageSharedConfig**(`pkgName`, `version`): [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) \| `undefined` Build the Module Federation Share Config for a specific package and the specified version of that package. @@ -1363,7 +1360,7 @@ specified version of that package. #### Returns -[`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) \| `undefined` +[`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) \| `undefined` --- @@ -1375,10 +1372,10 @@ Returns the list of outputs that will be cached. #### Parameters -| Name | Type | Description | -| :----- | :-------------------------------------------------------------------------------- | :-------------------------------------------------------- | -| `task` | `Pick`<[`Task`](../../devkit/documents/index#task), `"overrides"` \| `"target"`\> | target + overrides | -| `node` | [`ProjectGraphProjectNode`](../../devkit/documents/index#projectgraphprojectnode) | ProjectGraphProjectNode object that the task runs against | +| Name | Type | Description | +| :----- | :-------------------------------------------------------------------------------------- | :-------------------------------------------------------- | +| `task` | `Pick`<[`Task`](../../devkit/documents/nrwl_devkit#task), `"overrides"` \| `"target"`\> | target + overrides | +| `node` | [`ProjectGraphProjectNode`](../../devkit/documents/nrwl_devkit#projectgraphprojectnode) | ProjectGraphProjectNode object that the task runs against | #### Returns @@ -1402,9 +1399,9 @@ execSync(`${getPackageManagerCommand().addDev} my-dev-package`); #### Parameters -| Name | Type | -| :--------------- | :-------------------------------------------------------------- | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | +| Name | Type | +| :--------------- | :-------------------------------------------------------------------- | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | #### Returns @@ -1422,9 +1419,9 @@ but it can also be passed in explicitly. #### Parameters -| Name | Type | -| :--------------- | :-------------------------------------------------------------- | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | +| Name | Type | +| :--------------- | :-------------------------------------------------------------------- | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | #### Returns @@ -1434,21 +1431,21 @@ but it can also be passed in explicitly. ### getProjects -▸ **getProjects**(`tree`): `Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration)\> +▸ **getProjects**(`tree`): `Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration)\> Get a map of all projects in a workspace. -Use [readProjectConfiguration](../../devkit/documents/index#readprojectconfiguration) if only one project is needed. +Use [readProjectConfiguration](../../devkit/documents/nrwl_devkit#readprojectconfiguration) if only one project is needed. #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns -`Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration)\> +`Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration)\> --- @@ -1467,9 +1464,9 @@ Example: #### Parameters -| Name | Type | Description | -| :----- | :------------------------------------------ | :--------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | file system tree | +| Name | Type | Description | +| :----- | :------------------------------------------------ | :--------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | file system tree | #### Returns @@ -1492,9 +1489,9 @@ Example: #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns @@ -1511,12 +1508,12 @@ Runs `npm install` or `yarn install`. It will skip running the install if #### Parameters -| Name | Type | Default value | Description | -| :--------------- | :-------------------------------------------------------------- | :------------ | :------------------------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | the file system tree | -| `alwaysRun` | `boolean` | `false` | always run the command even if `package.json` hasn't changed. | -| `cwd` | `string` | `''` | - | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | `undefined` | - | +| Name | Type | Default value | Description | +| :--------------- | :-------------------------------------------------------------------- | :------------ | :------------------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | the file system tree | +| `alwaysRun` | `boolean` | `false` | always run the command even if `package.json` hasn't changed. | +| `cwd` | `string` | `''` | - | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | `undefined` | - | #### Returns @@ -1534,10 +1531,10 @@ Returns if a project has a standalone configuration (project.json). #### Parameters -| Name | Type | Description | -| :-------- | :------------------------------------------ | :------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `project` | `string` | the project name | +| Name | Type | Description | +| :-------- | :------------------------------------------------ | :------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `project` | `string` | the project name | #### Returns @@ -1572,11 +1569,11 @@ Federation. #### Parameters -| Name | Type | Description | -| :------------------- | :------------------------------------------------ | :------------------------------------------------------- | -| `remotes` | [`Remotes`](../../devkit/documents/index#remotes) | The remotes to map | -| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | -| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | +| Name | Type | Description | +| :------------------- | :------------------------------------------------------ | :------------------------------------------------------- | +| `remotes` | [`Remotes`](../../devkit/documents/nrwl_devkit#remotes) | The remotes to map | +| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | +| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | #### Returns @@ -1593,11 +1590,11 @@ Federation. #### Parameters -| Name | Type | Description | -| :------------------- | :------------------------------------------------ | :------------------------------------------------------- | -| `remotes` | [`Remotes`](../../devkit/documents/index#remotes) | The remotes to map | -| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | -| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | +| Name | Type | Description | +| :------------------- | :------------------------------------------------------ | :------------------------------------------------------- | +| `remotes` | [`Remotes`](../../devkit/documents/nrwl_devkit#remotes) | The remotes to map | +| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | +| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | #### Returns @@ -1613,11 +1610,11 @@ Analogous to cp -r oldDir newDir #### Parameters -| Name | Type | -| :------- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `oldDir` | `string` | -| `newDir` | `string` | +| Name | Type | +| :------- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `oldDir` | `string` | +| `newDir` | `string` | #### Returns @@ -1716,10 +1713,10 @@ By default javascript-style comments and trailing commas are allowed. #### Parameters -| Name | Type | Description | -| :--------- | :------------------------------------------------------------------ | :--------------------- | -| `input` | `string` | JSON content as string | -| `options?` | [`JsonParseOptions`](../../devkit/documents/index#jsonparseoptions) | JSON parse options | +| Name | Type | Description | +| :--------- | :------------------------------------------------------------------------ | :--------------------- | +| `input` | `string` | JSON content as string | +| `options?` | [`JsonParseOptions`](../../devkit/documents/nrwl_devkit#jsonparseoptions) | JSON parse options | #### Returns @@ -1731,7 +1728,7 @@ Object the JSON content represents ### parseTargetString -▸ **parseTargetString**(`targetString`): [`Target`](../../devkit/documents/index#target) +▸ **parseTargetString**(`targetString`): [`Target`](../../devkit/documents/nrwl_devkit#target) **`deprecated(v17)`** A project graph should be passed to parseTargetString for best accuracy. @@ -1743,9 +1740,9 @@ Object the JSON content represents #### Returns -[`Target`](../../devkit/documents/index#target) +[`Target`](../../devkit/documents/nrwl_devkit#target) -▸ **parseTargetString**(`targetString`, `projectGraph`): [`Target`](../../devkit/documents/index#target) +▸ **parseTargetString**(`targetString`, `projectGraph`): [`Target`](../../devkit/documents/nrwl_devkit#target) Parses a target string into {project, target, configuration} @@ -1758,20 +1755,20 @@ parseTargetString('proj:test:production', graph); // returns { project: "proj", #### Parameters -| Name | Type | Description | -| :------------- | :---------------------------------------------------------- | :--------------- | -| `targetString` | `string` | target reference | -| `projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | - | +| Name | Type | Description | +| :------------- | :---------------------------------------------------------------- | :--------------- | +| `targetString` | `string` | target reference | +| `projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | - | #### Returns -[`Target`](../../devkit/documents/index#target) +[`Target`](../../devkit/documents/nrwl_devkit#target) --- ### readAllWorkspaceConfiguration -▸ **readAllWorkspaceConfiguration**(): [`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) +▸ **readAllWorkspaceConfiguration**(): [`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) TODO(vsavkin): Remove after Nx 16 is out @@ -1779,13 +1776,13 @@ TODO(vsavkin): Remove after Nx 16 is out #### Returns -[`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) +[`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) --- ### readCachedProjectGraph -▸ **readCachedProjectGraph**(): [`ProjectGraph`](../../devkit/documents/index#projectgraph) +▸ **readCachedProjectGraph**(): [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) Synchronously reads the latest cached copy of the workspace's ProjectGraph. @@ -1793,7 +1790,7 @@ Synchronously reads the latest cached copy of the workspace's ProjectGraph. #### Returns -[`ProjectGraph`](../../devkit/documents/index#projectgraph) +[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) --- @@ -1811,11 +1808,11 @@ Reads a json file, removes all comments and parses JSON. #### Parameters -| Name | Type | Description | -| :--------- | :------------------------------------------------------------------ | :-------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | file system tree | -| `path` | `string` | file path | -| `options?` | [`JsonParseOptions`](../../devkit/documents/index#jsonparseoptions) | Optional JSON Parse Options | +| Name | Type | Description | +| :--------- | :------------------------------------------------------------------------ | :-------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | file system tree | +| `path` | `string` | file path | +| `options?` | [`JsonParseOptions`](../../devkit/documents/nrwl_devkit#jsonparseoptions) | Optional JSON Parse Options | #### Returns @@ -1852,25 +1849,35 @@ Object the JSON content of the file represents ### readNxJson -▸ **readNxJson**(`tree`): [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) \| `null` +▸ **readNxJson**(): [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` + +Reads nx.json + +**`deprecated`** You must pass a [Tree](../../devkit/documents/nrwl_devkit#tree) + +#### Returns + +[`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` + +▸ **readNxJson**(`tree`): [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` Reads nx.json #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns -[`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) \| `null` +[`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` --- ### readProjectConfiguration -▸ **readProjectConfiguration**(`tree`, `projectName`): [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) +▸ **readProjectConfiguration**(`tree`, `projectName`): [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) Reads a project configuration. @@ -1878,14 +1885,14 @@ Reads a project configuration. #### Parameters -| Name | Type | Description | -| :------------ | :------------------------------------------ | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| Name | Type | Description | +| :------------ | :------------------------------------------------ | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | #### Returns -[`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) +[`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) --- @@ -1920,10 +1927,10 @@ Works as if you invoked the target yourself without passing any command lint ove #### Parameters -| Name | Type | -| :------------------ | :---------------------------------------------------------------- | -| `__namedParameters` | [`Target`](../../devkit/documents/index#target) | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :------------------ | :---------------------------------------------------------------------- | +| `__namedParameters` | [`Target`](../../devkit/documents/nrwl_devkit#target) | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | #### Returns @@ -1933,29 +1940,29 @@ Works as if you invoked the target yourself without passing any command lint ove ### readWorkspaceConfiguration -▸ **readWorkspaceConfiguration**(`tree`): [`WorkspaceConfiguration`](../../devkit/documents/index#workspaceconfiguration) +▸ **readWorkspaceConfiguration**(`tree`): [`WorkspaceConfiguration`](../../devkit/documents/nrwl_devkit#workspaceconfiguration) Read general workspace configuration such as the default project or cli settings -This does _not_ provide projects configuration, use [readProjectConfiguration](../../devkit/documents/index#readprojectconfiguration) instead. +This does _not_ provide projects configuration, use [readProjectConfiguration](../../devkit/documents/nrwl_devkit#readprojectconfiguration) instead. **`deprecated`** use readNxJson #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns -[`WorkspaceConfiguration`](../../devkit/documents/index#workspaceconfiguration) +[`WorkspaceConfiguration`](../../devkit/documents/nrwl_devkit#workspaceconfiguration) --- ### removeDependenciesFromPackageJson -▸ **removeDependenciesFromPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +▸ **removeDependenciesFromPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Remove Dependencies and Dev Dependencies from package.json @@ -1969,16 +1976,16 @@ This will **remove** `react` and `jest` from the dependencies and devDependencie #### Parameters -| Name | Type | Default value | Description | -| :---------------- | :------------------------------------------ | :--------------- | :-------------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | - | -| `dependencies` | `string`[] | `undefined` | Dependencies to be removed from the dependencies section of package.json | -| `devDependencies` | `string`[] | `undefined` | Dependencies to be removed from the devDependencies section of package.json | -| `packageJsonPath` | `string` | `'package.json'` | - | +| Name | Type | Default value | Description | +| :---------------- | :------------------------------------------------ | :--------------- | :-------------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | - | +| `dependencies` | `string`[] | `undefined` | Dependencies to be removed from the dependencies section of package.json | +| `devDependencies` | `string`[] | `undefined` | Dependencies to be removed from the devDependencies section of package.json | +| `packageJsonPath` | `string` | `'package.json'` | - | #### Returns -[`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +[`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Callback to uninstall dependencies only if necessary. undefined is returned if changes are not necessary. @@ -1992,10 +1999,10 @@ Removes the configuration of an existing project. #### Parameters -| Name | Type | Description | -| :------------ | :------------------------------------------ | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| Name | Type | Description | +| :------------ | :------------------------------------------------ | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | #### Returns @@ -2005,7 +2012,7 @@ Removes the configuration of an existing project. ### reverse -▸ **reverse**(`graph`): [`ProjectGraph`](../../devkit/documents/index#projectgraph) +▸ **reverse**(`graph`): [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) Returns a new project graph where all the edges are reversed. @@ -2014,13 +2021,13 @@ B will depend on A. #### Parameters -| Name | Type | -| :------ | :---------------------------------------------------------- | -| `graph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | +| Name | Type | +| :------ | :---------------------------------------------------------------- | +| `graph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | #### Returns -[`ProjectGraph`](../../devkit/documents/index#projectgraph) +[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) --- @@ -2064,14 +2071,14 @@ Note that the return value is a promise of an iterator, so you need to await bef #### Parameters -| Name | Type | -| :--------------------------------- | :---------------------------------------------------------------- | -| `targetDescription` | `Object` | -| `targetDescription.configuration?` | `string` | -| `targetDescription.project` | `string` | -| `targetDescription.target` | `string` | -| `overrides` | `Object` | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :--------------------------------- | :---------------------------------------------------------------------- | +| `targetDescription` | `Object` | +| `targetDescription.configuration?` | `string` | +| `targetDescription.project` | `string` | +| `targetDescription.target` | `string` | +| `overrides` | `Object` | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | #### Returns @@ -2094,10 +2101,10 @@ By default the JSON string is formatted with a 2 space indentation to be easy re #### Parameters -| Name | Type | Description | -| :--------- | :-------------------------------------------------------------------------- | :---------------------------------------- | -| `input` | `T` | Object which should be serialized to JSON | -| `options?` | [`JsonSerializeOptions`](../../devkit/documents/index#jsonserializeoptions) | JSON serialize options | +| Name | Type | Description | +| :--------- | :-------------------------------------------------------------------------------- | :---------------------------------------- | +| `input` | `T` | Object which should be serialized to JSON | +| `options?` | [`JsonSerializeOptions`](../../devkit/documents/nrwl_devkit#jsonserializeoptions) | JSON serialize options | #### Returns @@ -2109,7 +2116,7 @@ the formatted JSON representation of the object ### sharePackages -▸ **sharePackages**(`packages`): `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> +▸ **sharePackages**(`packages`): `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> Create a dictionary of packages and their Module Federation Shared Config from an array of package names. @@ -2125,27 +2132,27 @@ workspace. #### Returns -`Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> +`Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> --- ### shareWorkspaceLibraries -▸ **shareWorkspaceLibraries**(`libraries`, `tsConfigPath?`): [`SharedWorkspaceLibraryConfig`](../../devkit/documents/index#sharedworkspacelibraryconfig) +▸ **shareWorkspaceLibraries**(`libraries`, `tsConfigPath?`): [`SharedWorkspaceLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedworkspacelibraryconfig) Build an object of functions to be used with the ModuleFederationPlugin to share Nx Workspace Libraries between Hosts and Remotes. #### Parameters -| Name | Type | Description | -| :------------- | :-------------------------------------------------------------------- | :--------------------------------------------------------------------------- | -| `libraries` | [`WorkspaceLibrary`](../../devkit/documents/index#workspacelibrary)[] | The Nx Workspace Libraries to share | -| `tsConfigPath` | `string` | The path to TS Config File that contains the Path Mappings for the Libraries | +| Name | Type | Description | +| :------------- | :-------------------------------------------------------------------------- | :--------------------------------------------------------------------------- | +| `libraries` | [`WorkspaceLibrary`](../../devkit/documents/nrwl_devkit#workspacelibrary)[] | The Nx Workspace Libraries to share | +| `tsConfigPath` | `string` | The path to TS Config File that contains the Path Mappings for the Libraries | #### Returns -[`SharedWorkspaceLibraryConfig`](../../devkit/documents/index#sharedworkspacelibraryconfig) +[`SharedWorkspaceLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedworkspacelibraryconfig) --- @@ -2207,9 +2214,9 @@ Returns a string in the format "project:target[:configuration]" for the target #### Parameters -| Name | Type | Description | -| :------- | :---------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `target` | [`Target`](../../devkit/documents/index#target) | target object Examples: `typescript targetToTargetString({ project: "proj", target: "test" }) // returns "proj:test" targetToTargetString({ project: "proj", target: "test", configuration: "production" }) // returns "proj:test:production" ` | +| Name | Type | Description | +| :------- | :---------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `target` | [`Target`](../../devkit/documents/nrwl_devkit#target) | target object Examples: `typescript targetToTargetString({ project: "proj", target: "test" }) // returns "proj:test" targetToTargetString({ project: "proj", target: "test", configuration: "production" }) // returns "proj:test:production" ` | #### Returns @@ -2225,9 +2232,9 @@ Rename and transpile any new typescript files created to javascript files #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns @@ -2250,12 +2257,12 @@ Updates a JSON value to the file system tree #### Parameters -| Name | Type | Description | -| :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | File system tree | -| `path` | `string` | Path of JSON file in the Tree | -| `updater` | (`value`: `T`) => `U` | Function that maps the current value of a JSON document to a new value to be written to the document | -| `options?` | [`JsonParseOptions`](../../devkit/documents/index#jsonparseoptions) & [`JsonSerializeOptions`](../../devkit/documents/index#jsonserializeoptions) | Optional JSON Parse and Serialize Options | +| Name | Type | Description | +| :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | File system tree | +| `path` | `string` | Path of JSON file in the Tree | +| `updater` | (`value`: `T`) => `U` | Function that maps the current value of a JSON document to a new value to be written to the document | +| `options?` | [`JsonParseOptions`](../../devkit/documents/nrwl_devkit#jsonparseoptions) & [`JsonSerializeOptions`](../../devkit/documents/nrwl_devkit#jsonserializeoptions) | Optional JSON Parse and Serialize Options | #### Returns @@ -2271,10 +2278,10 @@ Update nx.json #### Parameters -| Name | Type | -| :------- | :---------------------------------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `nxJson` | [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration)<`string`[] \| `"*"`\> | +| Name | Type | +| :------- | :---------------------------------------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `nxJson` | [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration)<`string`[] \| `"*"`\> | #### Returns @@ -2290,11 +2297,11 @@ Updates the configuration of an existing project. #### Parameters -| Name | Type | Description | -| :--------------------- | :-------------------------------------------------------------------------- | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | -| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) | project configuration | +| Name | Type | Description | +| :--------------------- | :-------------------------------------------------------------------------------- | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) | project configuration | #### Returns @@ -2308,11 +2315,11 @@ Updates the configuration of an existing project. #### Parameters -| Name | Type | -| :-------------------- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `options` | `Object` | -| `options.projectRoot` | `string` | +| Name | Type | +| :-------------------- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `options` | `Object` | +| `options.projectRoot` | `string` | #### Returns @@ -2326,16 +2333,16 @@ Updates the configuration of an existing project. Update general workspace configuration such as the default project or cli settings. -This does _not_ update projects configuration, use [updateProjectConfiguration](../../devkit/documents/index#updateprojectconfiguration) or [addProjectConfiguration](../../devkit/documents/index#addprojectconfiguration) instead. +This does _not_ update projects configuration, use [updateProjectConfiguration](../../devkit/documents/nrwl_devkit#updateprojectconfiguration) or [addProjectConfiguration](../../devkit/documents/nrwl_devkit#addprojectconfiguration) instead. **`deprecated`** use updateNxJson #### Parameters -| Name | Type | -| :---------------- | :------------------------------------------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `workspaceConfig` | [`WorkspaceConfiguration`](../../devkit/documents/index#workspaceconfiguration) | +| Name | Type | +| :---------------- | :------------------------------------------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `workspaceConfig` | [`WorkspaceConfiguration`](../../devkit/documents/nrwl_devkit#workspaceconfiguration) | #### Returns @@ -2351,11 +2358,11 @@ Utility to act on all files in a tree that are not ignored by git. #### Parameters -| Name | Type | Default value | -| :-------- | :------------------------------------------ | :------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | -| `dirPath` | `string` | `tree.root` | -| `visitor` | (`path`: `string`) => `void` | `undefined` | +| Name | Type | Default value | +| :-------- | :------------------------------------------------ | :------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | +| `dirPath` | `string` | `tree.root` | +| `visitor` | (`path`: `string`) => `void` | `undefined` | #### Returns @@ -2394,12 +2401,12 @@ Writes a JSON value to the file system tree #### Parameters -| Name | Type | Description | -| :--------- | :-------------------------------------------------------------------------- | :------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | File system tree | -| `path` | `string` | Path of JSON file in the Tree | -| `value` | `T` | Serializable value to write | -| `options?` | [`JsonSerializeOptions`](../../devkit/documents/index#jsonserializeoptions) | Optional JSON Serialize Options | +| Name | Type | Description | +| :--------- | :-------------------------------------------------------------------------------- | :------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | File system tree | +| `path` | `string` | Path of JSON file in the Tree | +| `value` | `T` | Serializable value to write | +| `options?` | [`JsonSerializeOptions`](../../devkit/documents/nrwl_devkit#jsonserializeoptions) | Optional JSON Serialize Options | #### Returns diff --git a/docs/generated/manifests/packages.json b/docs/generated/manifests/packages.json index 029217299e..23090c3230 100644 --- a/docs/generated/manifests/packages.json +++ b/docs/generated/manifests/packages.json @@ -623,7 +623,7 @@ "isExternal": false, "path": "/packages/devkit/documents/index", "tags": [], - "originalFilePath": "generated/devkit/index" + "originalFilePath": "generated/devkit/nrwl_devkit" }, "/packages/devkit/documents/ngcli_adapter": { "id": "ngcli_adapter", diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json index 5b63bb2886..eaa4c4da74 100644 --- a/docs/generated/packages-metadata.json +++ b/docs/generated/packages-metadata.json @@ -613,7 +613,7 @@ "isExternal": false, "path": "devkit/documents/index", "tags": [], - "originalFilePath": "generated/devkit/index" + "originalFilePath": "generated/devkit/nrwl_devkit" }, { "id": "ngcli_adapter", diff --git a/docs/generated/packages/devkit/documents/index.md b/docs/generated/packages/devkit/documents/index.md index 95efb14d9e..e22916605a 100644 --- a/docs/generated/packages/devkit/documents/index.md +++ b/docs/generated/packages/devkit/documents/index.md @@ -1,4 +1,4 @@ -# Module: index +# Module: @nrwl/devkit The Nx Devkit is the underlying technology used to customize Nx to support different technologies and custom use-cases. It contains many utility @@ -13,195 +13,195 @@ It only uses language primitives and immutable objects ### Project Graph Enumerations -- [DependencyType](../../devkit/documents/index#dependencytype) +- [DependencyType](../../devkit/documents/nrwl_devkit#dependencytype) ### Utils Enumerations -- [ChangeType](../../devkit/documents/index#changetype) +- [ChangeType](../../devkit/documents/nrwl_devkit#changetype) ### Project Graph Classes -- [ProjectGraphBuilder](../../devkit/documents/index#projectgraphbuilder) +- [ProjectGraphBuilder](../../devkit/documents/nrwl_devkit#projectgraphbuilder) ### Utils Classes -- [Hasher](../../devkit/documents/index#hasher) +- [Hasher](../../devkit/documents/nrwl_devkit#hasher) ### Workspace Classes -- [Workspaces](../../devkit/documents/index#workspaces) +- [Workspaces](../../devkit/documents/nrwl_devkit#workspaces) ### Commands Interfaces -- [Target](../../devkit/documents/index#target) +- [Target](../../devkit/documents/nrwl_devkit#target) ### Other Interfaces -- [NxPlugin](../../devkit/documents/index#nxplugin) +- [NxPlugin](../../devkit/documents/nrwl_devkit#nxplugin) ### Project Graph Interfaces -- [FileData](../../devkit/documents/index#filedata) -- [ProjectFileMap](../../devkit/documents/index#projectfilemap) -- [ProjectGraph](../../devkit/documents/index#projectgraph) -- [ProjectGraphDependency](../../devkit/documents/index#projectgraphdependency) -- [ProjectGraphExternalNode](../../devkit/documents/index#projectgraphexternalnode) -- [ProjectGraphProcessorContext](../../devkit/documents/index#projectgraphprocessorcontext) -- [ProjectGraphProjectNode](../../devkit/documents/index#projectgraphprojectnode) -- [ProjectGraphV4](../../devkit/documents/index#projectgraphv4) +- [FileData](../../devkit/documents/nrwl_devkit#filedata) +- [ProjectFileMap](../../devkit/documents/nrwl_devkit#projectfilemap) +- [ProjectGraph](../../devkit/documents/nrwl_devkit#projectgraph) +- [ProjectGraphDependency](../../devkit/documents/nrwl_devkit#projectgraphdependency) +- [ProjectGraphExternalNode](../../devkit/documents/nrwl_devkit#projectgraphexternalnode) +- [ProjectGraphProcessorContext](../../devkit/documents/nrwl_devkit#projectgraphprocessorcontext) +- [ProjectGraphProjectNode](../../devkit/documents/nrwl_devkit#projectgraphprojectnode) +- [ProjectGraphV4](../../devkit/documents/nrwl_devkit#projectgraphv4) ### Tree Interfaces -- [FileChange](../../devkit/documents/index#filechange) -- [Tree](../../devkit/documents/index#tree) +- [FileChange](../../devkit/documents/nrwl_devkit#filechange) +- [Tree](../../devkit/documents/nrwl_devkit#tree) ### Utils Interfaces -- [DefaultTasksRunnerOptions](../../devkit/documents/index#defaulttasksrunneroptions) -- [Hash](../../devkit/documents/index#hash) -- [JsonParseOptions](../../devkit/documents/index#jsonparseoptions) -- [JsonSerializeOptions](../../devkit/documents/index#jsonserializeoptions) -- [ModuleFederationConfig](../../devkit/documents/index#modulefederationconfig) -- [RemoteCache](../../devkit/documents/index#remotecache) -- [SharedLibraryConfig](../../devkit/documents/index#sharedlibraryconfig) -- [StringDeletion](../../devkit/documents/index#stringdeletion) -- [StringInsertion](../../devkit/documents/index#stringinsertion) +- [DefaultTasksRunnerOptions](../../devkit/documents/nrwl_devkit#defaulttasksrunneroptions) +- [Hash](../../devkit/documents/nrwl_devkit#hash) +- [JsonParseOptions](../../devkit/documents/nrwl_devkit#jsonparseoptions) +- [JsonSerializeOptions](../../devkit/documents/nrwl_devkit#jsonserializeoptions) +- [ModuleFederationConfig](../../devkit/documents/nrwl_devkit#modulefederationconfig) +- [RemoteCache](../../devkit/documents/nrwl_devkit#remotecache) +- [SharedLibraryConfig](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) +- [StringDeletion](../../devkit/documents/nrwl_devkit#stringdeletion) +- [StringInsertion](../../devkit/documents/nrwl_devkit#stringinsertion) ### Workspace Interfaces -- [ExecutorContext](../../devkit/documents/index#executorcontext) -- [ExecutorsJson](../../devkit/documents/index#executorsjson) -- [GeneratorsJson](../../devkit/documents/index#generatorsjson) -- [HasherContext](../../devkit/documents/index#hashercontext) -- [ImplicitJsonSubsetDependency](../../devkit/documents/index#implicitjsonsubsetdependency) -- [MigrationsJson](../../devkit/documents/index#migrationsjson) -- [NxAffectedConfig](../../devkit/documents/index#nxaffectedconfig) -- [NxJsonConfiguration](../../devkit/documents/index#nxjsonconfiguration) -- [ProjectConfiguration](../../devkit/documents/index#projectconfiguration) -- [ProjectsConfigurations](../../devkit/documents/index#projectsconfigurations) -- [TargetConfiguration](../../devkit/documents/index#targetconfiguration) -- [TargetDependencyConfig](../../devkit/documents/index#targetdependencyconfig) -- [Task](../../devkit/documents/index#task) -- [TaskGraph](../../devkit/documents/index#taskgraph) -- [Workspace](../../devkit/documents/index#workspace) +- [ExecutorContext](../../devkit/documents/nrwl_devkit#executorcontext) +- [ExecutorsJson](../../devkit/documents/nrwl_devkit#executorsjson) +- [GeneratorsJson](../../devkit/documents/nrwl_devkit#generatorsjson) +- [HasherContext](../../devkit/documents/nrwl_devkit#hashercontext) +- [ImplicitJsonSubsetDependency](../../devkit/documents/nrwl_devkit#implicitjsonsubsetdependency) +- [MigrationsJson](../../devkit/documents/nrwl_devkit#migrationsjson) +- [NxAffectedConfig](../../devkit/documents/nrwl_devkit#nxaffectedconfig) +- [NxJsonConfiguration](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) +- [ProjectConfiguration](../../devkit/documents/nrwl_devkit#projectconfiguration) +- [ProjectsConfigurations](../../devkit/documents/nrwl_devkit#projectsconfigurations) +- [TargetConfiguration](../../devkit/documents/nrwl_devkit#targetconfiguration) +- [TargetDependencyConfig](../../devkit/documents/nrwl_devkit#targetdependencyconfig) +- [Task](../../devkit/documents/nrwl_devkit#task) +- [TaskGraph](../../devkit/documents/nrwl_devkit#taskgraph) +- [Workspace](../../devkit/documents/nrwl_devkit#workspace) ### Generators Type aliases -- [WorkspaceConfiguration](../../devkit/documents/index#workspaceconfiguration) +- [WorkspaceConfiguration](../../devkit/documents/nrwl_devkit#workspaceconfiguration) ### Other Type aliases -- [ProjectTargetConfigurator](../../devkit/documents/index#projecttargetconfigurator) +- [ProjectTargetConfigurator](../../devkit/documents/nrwl_devkit#projecttargetconfigurator) ### Package Manager Type aliases -- [PackageManager](../../devkit/documents/index#packagemanager) +- [PackageManager](../../devkit/documents/nrwl_devkit#packagemanager) ### Project Graph Type aliases -- [ProjectGraphNode](../../devkit/documents/index#projectgraphnode) +- [ProjectGraphNode](../../devkit/documents/nrwl_devkit#projectgraphnode) ### Utils Type aliases -- [AdditionalSharedConfig](../../devkit/documents/index#additionalsharedconfig) -- [ModuleFederationLibrary](../../devkit/documents/index#modulefederationlibrary) -- [Remotes](../../devkit/documents/index#remotes) -- [SharedFunction](../../devkit/documents/index#sharedfunction) -- [SharedWorkspaceLibraryConfig](../../devkit/documents/index#sharedworkspacelibraryconfig) -- [StringChange](../../devkit/documents/index#stringchange) -- [WorkspaceLibrary](../../devkit/documents/index#workspacelibrary) -- [WorkspaceLibrarySecondaryEntryPoint](../../devkit/documents/index#workspacelibrarysecondaryentrypoint) +- [AdditionalSharedConfig](../../devkit/documents/nrwl_devkit#additionalsharedconfig) +- [ModuleFederationLibrary](../../devkit/documents/nrwl_devkit#modulefederationlibrary) +- [Remotes](../../devkit/documents/nrwl_devkit#remotes) +- [SharedFunction](../../devkit/documents/nrwl_devkit#sharedfunction) +- [SharedWorkspaceLibraryConfig](../../devkit/documents/nrwl_devkit#sharedworkspacelibraryconfig) +- [StringChange](../../devkit/documents/nrwl_devkit#stringchange) +- [WorkspaceLibrary](../../devkit/documents/nrwl_devkit#workspacelibrary) +- [WorkspaceLibrarySecondaryEntryPoint](../../devkit/documents/nrwl_devkit#workspacelibrarysecondaryentrypoint) ### Workspace Type aliases -- [CustomHasher](../../devkit/documents/index#customhasher) -- [Executor](../../devkit/documents/index#executor) -- [Generator](../../devkit/documents/index#generator) -- [GeneratorCallback](../../devkit/documents/index#generatorcallback) -- [ImplicitDependencyEntry](../../devkit/documents/index#implicitdependencyentry) -- [ProjectType](../../devkit/documents/index#projecttype) -- [TaskGraphExecutor](../../devkit/documents/index#taskgraphexecutor) -- [WorkspaceJsonConfiguration](../../devkit/documents/index#workspacejsonconfiguration) +- [CustomHasher](../../devkit/documents/nrwl_devkit#customhasher) +- [Executor](../../devkit/documents/nrwl_devkit#executor) +- [Generator](../../devkit/documents/nrwl_devkit#generator) +- [GeneratorCallback](../../devkit/documents/nrwl_devkit#generatorcallback) +- [ImplicitDependencyEntry](../../devkit/documents/nrwl_devkit#implicitdependencyentry) +- [ProjectType](../../devkit/documents/nrwl_devkit#projecttype) +- [TaskGraphExecutor](../../devkit/documents/nrwl_devkit#taskgraphexecutor) +- [WorkspaceJsonConfiguration](../../devkit/documents/nrwl_devkit#workspacejsonconfiguration) ### Logger Variables -- [logger](../../devkit/documents/index#logger) +- [logger](../../devkit/documents/nrwl_devkit#logger) ### Utils Variables -- [appRootPath](../../devkit/documents/index#approotpath) -- [cacheDir](../../devkit/documents/index#cachedir) -- [output](../../devkit/documents/index#output) -- [workspaceRoot](../../devkit/documents/index#workspaceroot) +- [appRootPath](../../devkit/documents/nrwl_devkit#approotpath) +- [cacheDir](../../devkit/documents/nrwl_devkit#cachedir) +- [output](../../devkit/documents/nrwl_devkit#output) +- [workspaceRoot](../../devkit/documents/nrwl_devkit#workspaceroot) ### Functions -- [addDependenciesToPackageJson](../../devkit/documents/index#adddependenciestopackagejson) -- [addProjectConfiguration](../../devkit/documents/index#addprojectconfiguration) -- [applyAdditionalShared](../../devkit/documents/index#applyadditionalshared) -- [applyChangesToString](../../devkit/documents/index#applychangestostring) -- [applySharedFunction](../../devkit/documents/index#applysharedfunction) -- [convertNxExecutor](../../devkit/documents/index#convertnxexecutor) -- [convertNxGenerator](../../devkit/documents/index#convertnxgenerator) -- [createLockFile](../../devkit/documents/index#createlockfile) -- [createPackageJson](../../devkit/documents/index#createpackagejson) -- [createProjectGraphAsync](../../devkit/documents/index#createprojectgraphasync) -- [defaultTasksRunner](../../devkit/documents/index#defaulttasksrunner) -- [detectPackageManager](../../devkit/documents/index#detectpackagemanager) -- [detectWorkspaceScope](../../devkit/documents/index#detectworkspacescope) -- [ensurePackage](../../devkit/documents/index#ensurepackage) -- [extractLayoutDirectory](../../devkit/documents/index#extractlayoutdirectory) -- [formatFiles](../../devkit/documents/index#formatfiles) -- [generateFiles](../../devkit/documents/index#generatefiles) -- [getDependentPackagesForProject](../../devkit/documents/index#getdependentpackagesforproject) -- [getImportPath](../../devkit/documents/index#getimportpath) -- [getNpmPackageSharedConfig](../../devkit/documents/index#getnpmpackagesharedconfig) -- [getOutputsForTargetAndConfiguration](../../devkit/documents/index#getoutputsfortargetandconfiguration) -- [getPackageManagerCommand](../../devkit/documents/index#getpackagemanagercommand) -- [getPackageManagerVersion](../../devkit/documents/index#getpackagemanagerversion) -- [getProjects](../../devkit/documents/index#getprojects) -- [getWorkspaceLayout](../../devkit/documents/index#getworkspacelayout) -- [getWorkspacePath](../../devkit/documents/index#getworkspacepath) -- [installPackagesTask](../../devkit/documents/index#installpackagestask) -- [isStandaloneProject](../../devkit/documents/index#isstandaloneproject) -- [joinPathFragments](../../devkit/documents/index#joinpathfragments) -- [mapRemotes](../../devkit/documents/index#mapremotes) -- [mapRemotesForSSR](../../devkit/documents/index#mapremotesforssr) -- [moveFilesToNewDirectory](../../devkit/documents/index#movefilestonewdirectory) -- [names](../../devkit/documents/index#names) -- [normalizePath](../../devkit/documents/index#normalizepath) -- [offsetFromRoot](../../devkit/documents/index#offsetfromroot) -- [parseJson](../../devkit/documents/index#parsejson) -- [parseTargetString](../../devkit/documents/index#parsetargetstring) -- [readAllWorkspaceConfiguration](../../devkit/documents/index#readallworkspaceconfiguration) -- [readCachedProjectGraph](../../devkit/documents/index#readcachedprojectgraph) -- [readJson](../../devkit/documents/index#readjson) -- [readJsonFile](../../devkit/documents/index#readjsonfile) -- [readNxJson](../../devkit/documents/index#readnxjson) -- [readProjectConfiguration](../../devkit/documents/index#readprojectconfiguration) -- [readRootPackageJson](../../devkit/documents/index#readrootpackagejson) -- [readTargetOptions](../../devkit/documents/index#readtargetoptions) -- [readWorkspaceConfiguration](../../devkit/documents/index#readworkspaceconfiguration) -- [removeDependenciesFromPackageJson](../../devkit/documents/index#removedependenciesfrompackagejson) -- [removeProjectConfiguration](../../devkit/documents/index#removeprojectconfiguration) -- [reverse](../../devkit/documents/index#reverse) -- [runExecutor](../../devkit/documents/index#runexecutor) -- [serializeJson](../../devkit/documents/index#serializejson) -- [sharePackages](../../devkit/documents/index#sharepackages) -- [shareWorkspaceLibraries](../../devkit/documents/index#shareworkspacelibraries) -- [stripIndents](../../devkit/documents/index#stripindents) -- [stripJsonComments](../../devkit/documents/index#stripjsoncomments) -- [targetToTargetString](../../devkit/documents/index#targettotargetstring) -- [toJS](../../devkit/documents/index#tojs) -- [updateJson](../../devkit/documents/index#updatejson) -- [updateNxJson](../../devkit/documents/index#updatenxjson) -- [updateProjectConfiguration](../../devkit/documents/index#updateprojectconfiguration) -- [updateTsConfigsToJs](../../devkit/documents/index#updatetsconfigstojs) -- [updateWorkspaceConfiguration](../../devkit/documents/index#updateworkspaceconfiguration) -- [visitNotIgnoredFiles](../../devkit/documents/index#visitnotignoredfiles) -- [workspaceLayout](../../devkit/documents/index#workspacelayout) -- [writeJson](../../devkit/documents/index#writejson) -- [writeJsonFile](../../devkit/documents/index#writejsonfile) +- [addDependenciesToPackageJson](../../devkit/documents/nrwl_devkit#adddependenciestopackagejson) +- [addProjectConfiguration](../../devkit/documents/nrwl_devkit#addprojectconfiguration) +- [applyAdditionalShared](../../devkit/documents/nrwl_devkit#applyadditionalshared) +- [applyChangesToString](../../devkit/documents/nrwl_devkit#applychangestostring) +- [applySharedFunction](../../devkit/documents/nrwl_devkit#applysharedfunction) +- [convertNxExecutor](../../devkit/documents/nrwl_devkit#convertnxexecutor) +- [convertNxGenerator](../../devkit/documents/nrwl_devkit#convertnxgenerator) +- [createLockFile](../../devkit/documents/nrwl_devkit#createlockfile) +- [createPackageJson](../../devkit/documents/nrwl_devkit#createpackagejson) +- [createProjectGraphAsync](../../devkit/documents/nrwl_devkit#createprojectgraphasync) +- [defaultTasksRunner](../../devkit/documents/nrwl_devkit#defaulttasksrunner) +- [detectPackageManager](../../devkit/documents/nrwl_devkit#detectpackagemanager) +- [detectWorkspaceScope](../../devkit/documents/nrwl_devkit#detectworkspacescope) +- [ensurePackage](../../devkit/documents/nrwl_devkit#ensurepackage) +- [extractLayoutDirectory](../../devkit/documents/nrwl_devkit#extractlayoutdirectory) +- [formatFiles](../../devkit/documents/nrwl_devkit#formatfiles) +- [generateFiles](../../devkit/documents/nrwl_devkit#generatefiles) +- [getDependentPackagesForProject](../../devkit/documents/nrwl_devkit#getdependentpackagesforproject) +- [getImportPath](../../devkit/documents/nrwl_devkit#getimportpath) +- [getNpmPackageSharedConfig](../../devkit/documents/nrwl_devkit#getnpmpackagesharedconfig) +- [getOutputsForTargetAndConfiguration](../../devkit/documents/nrwl_devkit#getoutputsfortargetandconfiguration) +- [getPackageManagerCommand](../../devkit/documents/nrwl_devkit#getpackagemanagercommand) +- [getPackageManagerVersion](../../devkit/documents/nrwl_devkit#getpackagemanagerversion) +- [getProjects](../../devkit/documents/nrwl_devkit#getprojects) +- [getWorkspaceLayout](../../devkit/documents/nrwl_devkit#getworkspacelayout) +- [getWorkspacePath](../../devkit/documents/nrwl_devkit#getworkspacepath) +- [installPackagesTask](../../devkit/documents/nrwl_devkit#installpackagestask) +- [isStandaloneProject](../../devkit/documents/nrwl_devkit#isstandaloneproject) +- [joinPathFragments](../../devkit/documents/nrwl_devkit#joinpathfragments) +- [mapRemotes](../../devkit/documents/nrwl_devkit#mapremotes) +- [mapRemotesForSSR](../../devkit/documents/nrwl_devkit#mapremotesforssr) +- [moveFilesToNewDirectory](../../devkit/documents/nrwl_devkit#movefilestonewdirectory) +- [names](../../devkit/documents/nrwl_devkit#names) +- [normalizePath](../../devkit/documents/nrwl_devkit#normalizepath) +- [offsetFromRoot](../../devkit/documents/nrwl_devkit#offsetfromroot) +- [parseJson](../../devkit/documents/nrwl_devkit#parsejson) +- [parseTargetString](../../devkit/documents/nrwl_devkit#parsetargetstring) +- [readAllWorkspaceConfiguration](../../devkit/documents/nrwl_devkit#readallworkspaceconfiguration) +- [readCachedProjectGraph](../../devkit/documents/nrwl_devkit#readcachedprojectgraph) +- [readJson](../../devkit/documents/nrwl_devkit#readjson) +- [readJsonFile](../../devkit/documents/nrwl_devkit#readjsonfile) +- [readNxJson](../../devkit/documents/nrwl_devkit#readnxjson) +- [readProjectConfiguration](../../devkit/documents/nrwl_devkit#readprojectconfiguration) +- [readRootPackageJson](../../devkit/documents/nrwl_devkit#readrootpackagejson) +- [readTargetOptions](../../devkit/documents/nrwl_devkit#readtargetoptions) +- [readWorkspaceConfiguration](../../devkit/documents/nrwl_devkit#readworkspaceconfiguration) +- [removeDependenciesFromPackageJson](../../devkit/documents/nrwl_devkit#removedependenciesfrompackagejson) +- [removeProjectConfiguration](../../devkit/documents/nrwl_devkit#removeprojectconfiguration) +- [reverse](../../devkit/documents/nrwl_devkit#reverse) +- [runExecutor](../../devkit/documents/nrwl_devkit#runexecutor) +- [serializeJson](../../devkit/documents/nrwl_devkit#serializejson) +- [sharePackages](../../devkit/documents/nrwl_devkit#sharepackages) +- [shareWorkspaceLibraries](../../devkit/documents/nrwl_devkit#shareworkspacelibraries) +- [stripIndents](../../devkit/documents/nrwl_devkit#stripindents) +- [stripJsonComments](../../devkit/documents/nrwl_devkit#stripjsoncomments) +- [targetToTargetString](../../devkit/documents/nrwl_devkit#targettotargetstring) +- [toJS](../../devkit/documents/nrwl_devkit#tojs) +- [updateJson](../../devkit/documents/nrwl_devkit#updatejson) +- [updateNxJson](../../devkit/documents/nrwl_devkit#updatenxjson) +- [updateProjectConfiguration](../../devkit/documents/nrwl_devkit#updateprojectconfiguration) +- [updateTsConfigsToJs](../../devkit/documents/nrwl_devkit#updatetsconfigstojs) +- [updateWorkspaceConfiguration](../../devkit/documents/nrwl_devkit#updateworkspaceconfiguration) +- [visitNotIgnoredFiles](../../devkit/documents/nrwl_devkit#visitnotignoredfiles) +- [workspaceLayout](../../devkit/documents/nrwl_devkit#workspacelayout) +- [writeJson](../../devkit/documents/nrwl_devkit#writejson) +- [writeJsonFile](../../devkit/documents/nrwl_devkit#writejsonfile) ## Project Graph Enumerations @@ -495,7 +495,7 @@ A plugin for Nx ### WorkspaceConfiguration -Ƭ **WorkspaceConfiguration**: `Omit`<[`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations), `"projects"`\> & `Partial`<[`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration)\> +Ƭ **WorkspaceConfiguration**: `Omit`<[`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations), `"projects"`\> & `Partial`<[`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration)\> --- @@ -503,11 +503,11 @@ A plugin for Nx ### ProjectTargetConfigurator -Ƭ **ProjectTargetConfigurator**: (`file`: `string`) => `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/index#targetconfiguration)\> +Ƭ **ProjectTargetConfigurator**: (`file`: `string`) => `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/nrwl_devkit#targetconfiguration)\> #### Type declaration -▸ (`file`): `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/index#targetconfiguration)\> +▸ (`file`): `Record`<`string`, [`TargetConfiguration`](../../devkit/documents/nrwl_devkit#targetconfiguration)\> ##### Parameters @@ -517,7 +517,7 @@ A plugin for Nx ##### Returns -`Record`<`string`, [`TargetConfiguration`](../../devkit/documents/index#targetconfiguration)\> +`Record`<`string`, [`TargetConfiguration`](../../devkit/documents/nrwl_devkit#targetconfiguration)\> --- @@ -533,7 +533,7 @@ A plugin for Nx ### ProjectGraphNode -Ƭ **ProjectGraphNode**: [`ProjectGraphProjectNode`](../../devkit/documents/index#projectgraphprojectnode) \| [`ProjectGraphExternalNode`](../../devkit/documents/index#projectgraphexternalnode) +Ƭ **ProjectGraphNode**: [`ProjectGraphProjectNode`](../../devkit/documents/nrwl_devkit#projectgraphprojectnode) \| [`ProjectGraphExternalNode`](../../devkit/documents/nrwl_devkit#projectgraphexternalnode) --- @@ -541,7 +541,7 @@ A plugin for Nx ### AdditionalSharedConfig -Ƭ **AdditionalSharedConfig**: (`string` \| [libraryName: string, sharedConfig: SharedLibraryConfig] \| { `libraryName`: `string` ; `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) })[] +Ƭ **AdditionalSharedConfig**: (`string` \| [libraryName: string, sharedConfig: SharedLibraryConfig] \| { `libraryName`: `string` ; `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) })[] --- @@ -566,22 +566,22 @@ A plugin for Nx ### SharedFunction -Ƭ **SharedFunction**: (`libraryName`: `string`, `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)) => `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) +Ƭ **SharedFunction**: (`libraryName`: `string`, `sharedConfig`: [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)) => `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) #### Type declaration -▸ (`libraryName`, `sharedConfig`): `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) +▸ (`libraryName`, `sharedConfig`): `undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) ##### Parameters -| Name | Type | -| :------------- | :------------------------------------------------------------------------ | -| `libraryName` | `string` | -| `sharedConfig` | [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) | +| Name | Type | +| :------------- | :------------------------------------------------------------------------------ | +| `libraryName` | `string` | +| `sharedConfig` | [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) | ##### Returns -`undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) +`undefined` \| `false` \| [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) --- @@ -591,17 +591,17 @@ A plugin for Nx #### Type declaration -| Name | Type | -| :--------------------- | :---------------------------------------------------------------------------------------------------------------------- | -| `getAliases` | () => `Record`<`string`, `string`\> | -| `getLibraries` | (`eager?`: `boolean`) => `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> | -| `getReplacementPlugin` | () => `NormalModuleReplacementPlugin` | +| Name | Type | +| :--------------------- | :---------------------------------------------------------------------------------------------------------------------------- | +| `getAliases` | () => `Record`<`string`, `string`\> | +| `getLibraries` | (`eager?`: `boolean`) => `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> | +| `getReplacementPlugin` | () => `NormalModuleReplacementPlugin` | --- ### StringChange -Ƭ **StringChange**: [`StringInsertion`](../../devkit/documents/index#stringinsertion) \| [`StringDeletion`](../../devkit/documents/index#stringdeletion) +Ƭ **StringChange**: [`StringInsertion`](../../devkit/documents/nrwl_devkit#stringinsertion) \| [`StringDeletion`](../../devkit/documents/nrwl_devkit#stringdeletion) --- @@ -636,28 +636,28 @@ A plugin for Nx ### CustomHasher -Ƭ **CustomHasher**: (`task`: [`Task`](../../devkit/documents/index#task), `context`: [`HasherContext`](../../devkit/documents/index#hashercontext)) => `Promise`<[`Hash`](../../devkit/documents/index#hash)\> +Ƭ **CustomHasher**: (`task`: [`Task`](../../devkit/documents/nrwl_devkit#task), `context`: [`HasherContext`](../../devkit/documents/nrwl_devkit#hashercontext)) => `Promise`<[`Hash`](../../devkit/documents/nrwl_devkit#hash)\> #### Type declaration -▸ (`task`, `context`): `Promise`<[`Hash`](../../devkit/documents/index#hash)\> +▸ (`task`, `context`): `Promise`<[`Hash`](../../devkit/documents/nrwl_devkit#hash)\> ##### Parameters -| Name | Type | -| :-------- | :------------------------------------------------------------ | -| `task` | [`Task`](../../devkit/documents/index#task) | -| `context` | [`HasherContext`](../../devkit/documents/index#hashercontext) | +| Name | Type | +| :-------- | :------------------------------------------------------------------ | +| `task` | [`Task`](../../devkit/documents/nrwl_devkit#task) | +| `context` | [`HasherContext`](../../devkit/documents/nrwl_devkit#hashercontext) | ##### Returns -`Promise`<[`Hash`](../../devkit/documents/index#hash)\> +`Promise`<[`Hash`](../../devkit/documents/nrwl_devkit#hash)\> --- ### Executor -Ƭ **Executor**<`T`\>: (`options`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/index#executorcontext)) => `Promise`<`Object`\> \| `AsyncIterableIterator`<`Object`\> +Ƭ **Executor**<`T`\>: (`options`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext)) => `Promise`<`Object`\> \| `AsyncIterableIterator`<`Object`\> #### Type parameters @@ -673,10 +673,10 @@ Implementation of a target of a project ##### Parameters -| Name | Type | -| :-------- | :---------------------------------------------------------------- | -| `options` | `T` | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :-------- | :---------------------------------------------------------------------- | +| `options` | `T` | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | ##### Returns @@ -686,7 +686,7 @@ Implementation of a target of a project ### Generator -Ƭ **Generator**<`T`\>: (`tree`: `any`, `schema`: `T`) => `void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback)\> +Ƭ **Generator**<`T`\>: (`tree`: `any`, `schema`: `T`) => `void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback)\> #### Type parameters @@ -696,7 +696,7 @@ Implementation of a target of a project #### Type declaration -▸ (`tree`, `schema`): `void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback)\> +▸ (`tree`, `schema`): `void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback)\> A function that schedules updates to the filesystem to be done atomically @@ -709,7 +709,7 @@ A function that schedules updates to the filesystem to be done atomically ##### Returns -`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/index#generatorcallback)\> +`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) \| `Promise`<`void` \| [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback)\> --- @@ -741,7 +741,7 @@ A callback function that is executed after changes are made to the file system #### Index signature -▪ [key: `string`]: `T` \| [`ImplicitJsonSubsetDependency`](../../devkit/documents/index#implicitjsonsubsetdependency)<`T`\> +▪ [key: `string`]: `T` \| [`ImplicitJsonSubsetDependency`](../../devkit/documents/nrwl_devkit#implicitjsonsubsetdependency)<`T`\> --- @@ -753,7 +753,7 @@ A callback function that is executed after changes are made to the file system ### TaskGraphExecutor -Ƭ **TaskGraphExecutor**<`T`\>: (`taskGraph`: [`TaskGraph`](../../devkit/documents/index#taskgraph), `options`: `Record`<`string`, `T`\>, `overrides`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/index#executorcontext)) => `Promise`<`Record`<`string`, `Object`\>\> +Ƭ **TaskGraphExecutor**<`T`\>: (`taskGraph`: [`TaskGraph`](../../devkit/documents/nrwl_devkit#taskgraph), `options`: `Record`<`string`, `T`\>, `overrides`: `T`, `context`: [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext)) => `Promise`<`Record`<`string`, `Object`\>\> #### Type parameters @@ -769,12 +769,12 @@ Implementation of a target of a project that handles multiple projects to be bat ##### Parameters -| Name | Type | -| :---------- | :---------------------------------------------------------------- | -| `taskGraph` | [`TaskGraph`](../../devkit/documents/index#taskgraph) | -| `options` | `Record`<`string`, `T`\> | -| `overrides` | `T` | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :---------- | :---------------------------------------------------------------------- | +| `taskGraph` | [`TaskGraph`](../../devkit/documents/nrwl_devkit#taskgraph) | +| `options` | `Record`<`string`, `T`\> | +| `overrides` | `T` | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | ##### Returns @@ -784,7 +784,7 @@ Implementation of a target of a project that handles multiple projects to be bat ### WorkspaceJsonConfiguration -Ƭ **WorkspaceJsonConfiguration**: [`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations) +Ƭ **WorkspaceJsonConfiguration**: [`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations) ## Logger Variables @@ -833,7 +833,7 @@ Implementation of a target of a project that handles multiple projects to be bat ### addDependenciesToPackageJson -▸ **addDependenciesToPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +▸ **addDependenciesToPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Add Dependencies and Dev Dependencies to package.json @@ -847,16 +847,16 @@ This will **add** `react` and `jest` to the dependencies and devDependencies sec #### Parameters -| Name | Type | Default value | Description | -| :---------------- | :------------------------------------------ | :--------------- | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | Tree representing file system to modify | -| `dependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the dependencies section of package.json | -| `devDependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the devDependencies section of package.json | -| `packageJsonPath` | `string` | `'package.json'` | Path to package.json | +| Name | Type | Default value | Description | +| :---------------- | :------------------------------------------------ | :--------------- | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | Tree representing file system to modify | +| `dependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the dependencies section of package.json | +| `devDependencies` | `Record`<`string`, `string`\> | `undefined` | Dependencies to be added to the devDependencies section of package.json | +| `packageJsonPath` | `string` | `'package.json'` | Path to package.json | #### Returns -[`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +[`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Callback to install dependencies only if necessary, no-op otherwise @@ -870,12 +870,12 @@ Adds project configuration to the Nx workspace. #### Parameters -| Name | Type | Default value | Description | -| :--------------------- | :-------------------------------------------------------------------------- | :------------ | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | the file system tree | -| `projectName` | `string` | `undefined` | unique name. Often directories are part of the name (e.g., mydir-mylib) | -| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) | `undefined` | project configuration | -| `standalone` | `boolean` | `true` | whether the project is configured in workspace.json or not | +| Name | Type | Default value | Description | +| :--------------------- | :-------------------------------------------------------------------------------- | :------------ | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | the file system tree | +| `projectName` | `string` | `undefined` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) | `undefined` | project configuration | +| `standalone` | `boolean` | `true` | whether the project is configured in workspace.json or not | #### Returns @@ -896,11 +896,11 @@ hierarchy. #### Parameters -| Name | Type | Description | -| :----------------- | :--------------------------------------------------------------------------------------------- | :--------------------------------- | -| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> | The original Shared Config | -| `additionalShared` | [`AdditionalSharedConfig`](../../devkit/documents/index#additionalsharedconfig) | The additional dependencies to add | -| `projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | The Nx project graph | +| Name | Type | Description | +| :----------------- | :--------------------------------------------------------------------------------------------------- | :--------------------------------- | +| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> | The original Shared Config | +| `additionalShared` | [`AdditionalSharedConfig`](../../devkit/documents/nrwl_devkit#additionalsharedconfig) | The additional dependencies to add | +| `projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | The Nx project graph | #### Returns @@ -944,10 +944,10 @@ bootstrap({ #### Parameters -| Name | Type | -| :-------- | :------------------------------------------------------------ | -| `text` | `string` | -| `changes` | [`StringChange`](../../devkit/documents/index#stringchange)[] | +| Name | Type | +| :-------- | :------------------------------------------------------------------ | +| `text` | `string` | +| `changes` | [`StringChange`](../../devkit/documents/nrwl_devkit#stringchange)[] | #### Returns @@ -964,10 +964,10 @@ of the dependencies for the Module Federation build. #### Parameters -| Name | Type | Description | -| :------------- | :--------------------------------------------------------------------------------------------- | :---------------------------------------- | -| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> | The original Shared Config to be modified | -| `sharedFn` | [`SharedFunction`](../../devkit/documents/index#sharedfunction) | The custom function to run | +| Name | Type | Description | +| :------------- | :--------------------------------------------------------------------------------------------------- | :---------------------------------------- | +| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> | The original Shared Config to be modified | +| `sharedFn` | [`SharedFunction`](../../devkit/documents/nrwl_devkit#sharedfunction) | The custom function to run | #### Returns @@ -985,9 +985,9 @@ Use this to expose a compatible Angular Builder #### Parameters -| Name | Type | -| :--------- | :---------------------------------------------------------- | -| `executor` | [`Executor`](../../devkit/documents/index#executor)<`any`\> | +| Name | Type | +| :--------- | :---------------------------------------------------------------- | +| `executor` | [`Executor`](../../devkit/documents/nrwl_devkit#executor)<`any`\> | #### Returns @@ -1009,10 +1009,10 @@ Convert an Nx Generator into an Angular Devkit Schematic. #### Parameters -| Name | Type | Default value | Description | -| :----------------------------- | :---------------------------------------------------------- | :------------ | :---------------------------------------------------------- | -| `generator` | [`Generator`](../../devkit/documents/index#generator)<`T`\> | `undefined` | The Nx generator to convert to an Angular Devkit Schematic. | -| `skipWritingConfigInOldFormat` | `boolean` | `false` | - | +| Name | Type | Default value | Description | +| :----------------------------- | :---------------------------------------------------------------- | :------------ | :---------------------------------------------------------- | +| `generator` | [`Generator`](../../devkit/documents/nrwl_devkit#generator)<`T`\> | `undefined` | The Nx generator to convert to an Angular Devkit Schematic. | +| `skipWritingConfigInOldFormat` | `boolean` | `false` | - | #### Returns @@ -1047,16 +1047,16 @@ Convert an Nx Generator into an Angular Devkit Schematic. ### createLockFile -▸ **createLockFile**(`packageJson`, `packageManager?`): `string` +▸ `Const` **createLockFile**(`packageJson`, `packageManager?`): `string` -Create lock file based on the root level lock file and (pruned) package.json +**`deprecated`** Import this from @nrwl/js instead #### Parameters -| Name | Type | -| :--------------- | :-------------------------------------------------------------- | -| `packageJson` | `PackageJson` | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | +| Name | Type | +| :--------------- | :-------------------------------------------------------------------- | +| `packageJson` | `PackageJson` | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | #### Returns @@ -1066,22 +1066,19 @@ Create lock file based on the root level lock file and (pruned) package.json ### createPackageJson -▸ **createPackageJson**(`projectName`, `graph`, `options?`): `PackageJson` +▸ `Const` **createPackageJson**(`projectName`, `graph`, `options?`): `PackageJson` -Creates a package.json in the output directory for support to install dependencies within containers. - -If a package.json exists in the project, it will reuse that. -If isProduction flag is set, it wil remove devDependencies and optional peerDependencies +**`deprecated`** Import this from @nrwl/js instead #### Parameters -| Name | Type | -| :---------------------- | :---------------------------------------------------------- | -| `projectName` | `string` | -| `graph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | -| `options` | `Object` | -| `options.isProduction?` | `boolean` | -| `options.root?` | `string` | +| Name | Type | +| :---------------------- | :---------------------------------------------------------------- | +| `projectName` | `string` | +| `graph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | +| `options` | `Object` | +| `options.isProduction?` | `boolean` | +| `options.root?` | `string` | #### Returns @@ -1091,7 +1088,7 @@ If isProduction flag is set, it wil remove devDependencies and optional peerDepe ### createProjectGraphAsync -▸ **createProjectGraphAsync**(`opts?`): `Promise`<[`ProjectGraph`](../../devkit/documents/index#projectgraph)\> +▸ **createProjectGraphAsync**(`opts?`): `Promise`<[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph)\> Computes and returns a ProjectGraph. @@ -1125,7 +1122,7 @@ stored in the daemon process. To reset both run: `nx reset`. #### Returns -`Promise`<[`ProjectGraph`](../../devkit/documents/index#projectgraph)\> +`Promise`<[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph)\> --- @@ -1135,19 +1132,19 @@ stored in the daemon process. To reset both run: `nx reset`. #### Parameters -| Name | Type | -| :--------------------------- | :---------------------------------------------------------------------------------------------- | -| `tasks` | [`Task`](../../devkit/documents/index#task)[] | -| `options` | [`DefaultTasksRunnerOptions`](../../devkit/documents/index#defaulttasksrunneroptions) | -| `context?` | `Object` | -| `context.daemon?` | `DaemonClient` | -| `context.hasher?` | [`Hasher`](../../devkit/documents/index#hasher) | -| `context.initiatingProject?` | `string` | -| `context.nxArgs` | `NxArgs` | -| `context.nxJson` | [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration)<`string`[] \| `"*"`\> | -| `context.projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | -| `context.target?` | `string` | -| `context.taskGraph?` | [`TaskGraph`](../../devkit/documents/index#taskgraph) | +| Name | Type | +| :--------------------------- | :---------------------------------------------------------------------------------------------------- | +| `tasks` | [`Task`](../../devkit/documents/nrwl_devkit#task)[] | +| `options` | [`DefaultTasksRunnerOptions`](../../devkit/documents/nrwl_devkit#defaulttasksrunneroptions) | +| `context?` | `Object` | +| `context.daemon?` | `DaemonClient` | +| `context.hasher?` | [`Hasher`](../../devkit/documents/nrwl_devkit#hasher) | +| `context.initiatingProject?` | `string` | +| `context.nxArgs` | `NxArgs` | +| `context.nxJson` | [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration)<`string`[] \| `"*"`\> | +| `context.projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | +| `context.target?` | `string` | +| `context.taskGraph?` | [`TaskGraph`](../../devkit/documents/nrwl_devkit#taskgraph) | #### Returns @@ -1157,7 +1154,7 @@ stored in the daemon process. To reset both run: `nx reset`. ### detectPackageManager -▸ **detectPackageManager**(`dir?`): [`PackageManager`](../../devkit/documents/index#packagemanager) +▸ **detectPackageManager**(`dir?`): [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) Detects which package manager is used in the workspace based on the lock file. @@ -1169,7 +1166,7 @@ Detects which package manager is used in the workspace based on the lock file. #### Returns -[`PackageManager`](../../devkit/documents/index#packagemanager) +[`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) --- @@ -1209,14 +1206,14 @@ When running with --dryRun, the function will throw when dependencies are missin #### Parameters -| Name | Type | Description | -| :------------------------ | :------------------------------------------ | :----------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `pkg` | `string` | the package to check (e.g. @nrwl/jest) | -| `requiredVersion` | `string` | the version or semver range to check (e.g. ~1.0.0, >=1.0.0 <2.0.0) | -| `options` | `Object` | | -| `options.dev?` | `boolean` | - | -| `options.throwOnMissing?` | `boolean` | - | +| Name | Type | Description | +| :------------------------ | :------------------------------------------------ | :----------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `pkg` | `string` | the package to check (e.g. @nrwl/jest) | +| `requiredVersion` | `string` | the version or semver range to check (e.g. ~1.0.0, >=1.0.0 <2.0.0) | +| `options` | `Object` | | +| `options.dev?` | `boolean` | - | +| `options.throwOnMissing?` | `boolean` | - | #### Returns @@ -1255,9 +1252,9 @@ Formats all the created or updated files using Prettier #### Parameters -| Name | Type | Description | -| :----- | :------------------------------------------ | :------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | +| Name | Type | Description | +| :----- | :------------------------------------------------ | :------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | #### Returns @@ -1293,12 +1290,12 @@ doesn't get confused about incorrect TypeScript files. #### Parameters -| Name | Type | Description | -| :-------------- | :------------------------------------------ | :-------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `srcFolder` | `string` | the source folder of files (absolute path) | -| `target` | `string` | the target folder (relative to the tree root) | -| `substitutions` | `Object` | an object of key-value pairs | +| Name | Type | Description | +| :-------------- | :------------------------------------------------ | :-------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `srcFolder` | `string` | the source folder of files (absolute path) | +| `target` | `string` | the target folder (relative to the tree root) | +| `substitutions` | `Object` | an object of key-value pairs | #### Returns @@ -1312,19 +1309,19 @@ doesn't get confused about incorrect TypeScript files. #### Parameters -| Name | Type | -| :------------- | :---------------------------------------------------------- | -| `projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | -| `name` | `string` | +| Name | Type | +| :------------- | :---------------------------------------------------------------- | +| `projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | +| `name` | `string` | #### Returns `Object` -| Name | Type | -| :------------------- | :-------------------------------------------------------------------- | -| `npmPackages` | `string`[] | -| `workspaceLibraries` | [`WorkspaceLibrary`](../../devkit/documents/index#workspacelibrary)[] | +| Name | Type | +| :------------------- | :-------------------------------------------------------------------------- | +| `npmPackages` | `string`[] | +| `workspaceLibraries` | [`WorkspaceLibrary`](../../devkit/documents/nrwl_devkit#workspacelibrary)[] | --- @@ -1349,7 +1346,7 @@ Prefixes project name with npm scope ### getNpmPackageSharedConfig -▸ **getNpmPackageSharedConfig**(`pkgName`, `version`): [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) \| `undefined` +▸ **getNpmPackageSharedConfig**(`pkgName`, `version`): [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) \| `undefined` Build the Module Federation Share Config for a specific package and the specified version of that package. @@ -1363,7 +1360,7 @@ specified version of that package. #### Returns -[`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig) \| `undefined` +[`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig) \| `undefined` --- @@ -1375,10 +1372,10 @@ Returns the list of outputs that will be cached. #### Parameters -| Name | Type | Description | -| :----- | :-------------------------------------------------------------------------------- | :-------------------------------------------------------- | -| `task` | `Pick`<[`Task`](../../devkit/documents/index#task), `"overrides"` \| `"target"`\> | target + overrides | -| `node` | [`ProjectGraphProjectNode`](../../devkit/documents/index#projectgraphprojectnode) | ProjectGraphProjectNode object that the task runs against | +| Name | Type | Description | +| :----- | :-------------------------------------------------------------------------------------- | :-------------------------------------------------------- | +| `task` | `Pick`<[`Task`](../../devkit/documents/nrwl_devkit#task), `"overrides"` \| `"target"`\> | target + overrides | +| `node` | [`ProjectGraphProjectNode`](../../devkit/documents/nrwl_devkit#projectgraphprojectnode) | ProjectGraphProjectNode object that the task runs against | #### Returns @@ -1402,9 +1399,9 @@ execSync(`${getPackageManagerCommand().addDev} my-dev-package`); #### Parameters -| Name | Type | -| :--------------- | :-------------------------------------------------------------- | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | +| Name | Type | +| :--------------- | :-------------------------------------------------------------------- | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | #### Returns @@ -1422,9 +1419,9 @@ but it can also be passed in explicitly. #### Parameters -| Name | Type | -| :--------------- | :-------------------------------------------------------------- | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | +| Name | Type | +| :--------------- | :-------------------------------------------------------------------- | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | #### Returns @@ -1434,21 +1431,21 @@ but it can also be passed in explicitly. ### getProjects -▸ **getProjects**(`tree`): `Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration)\> +▸ **getProjects**(`tree`): `Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration)\> Get a map of all projects in a workspace. -Use [readProjectConfiguration](../../devkit/documents/index#readprojectconfiguration) if only one project is needed. +Use [readProjectConfiguration](../../devkit/documents/nrwl_devkit#readprojectconfiguration) if only one project is needed. #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns -`Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration)\> +`Map`<`string`, [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration)\> --- @@ -1467,9 +1464,9 @@ Example: #### Parameters -| Name | Type | Description | -| :----- | :------------------------------------------ | :--------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | file system tree | +| Name | Type | Description | +| :----- | :------------------------------------------------ | :--------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | file system tree | #### Returns @@ -1492,9 +1489,9 @@ Example: #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns @@ -1511,12 +1508,12 @@ Runs `npm install` or `yarn install`. It will skip running the install if #### Parameters -| Name | Type | Default value | Description | -| :--------------- | :-------------------------------------------------------------- | :------------ | :------------------------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | the file system tree | -| `alwaysRun` | `boolean` | `false` | always run the command even if `package.json` hasn't changed. | -| `cwd` | `string` | `''` | - | -| `packageManager` | [`PackageManager`](../../devkit/documents/index#packagemanager) | `undefined` | - | +| Name | Type | Default value | Description | +| :--------------- | :-------------------------------------------------------------------- | :------------ | :------------------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | the file system tree | +| `alwaysRun` | `boolean` | `false` | always run the command even if `package.json` hasn't changed. | +| `cwd` | `string` | `''` | - | +| `packageManager` | [`PackageManager`](../../devkit/documents/nrwl_devkit#packagemanager) | `undefined` | - | #### Returns @@ -1534,10 +1531,10 @@ Returns if a project has a standalone configuration (project.json). #### Parameters -| Name | Type | Description | -| :-------- | :------------------------------------------ | :------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `project` | `string` | the project name | +| Name | Type | Description | +| :-------- | :------------------------------------------------ | :------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `project` | `string` | the project name | #### Returns @@ -1572,11 +1569,11 @@ Federation. #### Parameters -| Name | Type | Description | -| :------------------- | :------------------------------------------------ | :------------------------------------------------------- | -| `remotes` | [`Remotes`](../../devkit/documents/index#remotes) | The remotes to map | -| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | -| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | +| Name | Type | Description | +| :------------------- | :------------------------------------------------------ | :------------------------------------------------------- | +| `remotes` | [`Remotes`](../../devkit/documents/nrwl_devkit#remotes) | The remotes to map | +| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | +| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | #### Returns @@ -1593,11 +1590,11 @@ Federation. #### Parameters -| Name | Type | Description | -| :------------------- | :------------------------------------------------ | :------------------------------------------------------- | -| `remotes` | [`Remotes`](../../devkit/documents/index#remotes) | The remotes to map | -| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | -| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | +| Name | Type | Description | +| :------------------- | :------------------------------------------------------ | :------------------------------------------------------- | +| `remotes` | [`Remotes`](../../devkit/documents/nrwl_devkit#remotes) | The remotes to map | +| `remoteEntryExt` | `"js"` \| `"mjs"` | The file extension of the remoteEntry file | +| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote | #### Returns @@ -1613,11 +1610,11 @@ Analogous to cp -r oldDir newDir #### Parameters -| Name | Type | -| :------- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `oldDir` | `string` | -| `newDir` | `string` | +| Name | Type | +| :------- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `oldDir` | `string` | +| `newDir` | `string` | #### Returns @@ -1716,10 +1713,10 @@ By default javascript-style comments and trailing commas are allowed. #### Parameters -| Name | Type | Description | -| :--------- | :------------------------------------------------------------------ | :--------------------- | -| `input` | `string` | JSON content as string | -| `options?` | [`JsonParseOptions`](../../devkit/documents/index#jsonparseoptions) | JSON parse options | +| Name | Type | Description | +| :--------- | :------------------------------------------------------------------------ | :--------------------- | +| `input` | `string` | JSON content as string | +| `options?` | [`JsonParseOptions`](../../devkit/documents/nrwl_devkit#jsonparseoptions) | JSON parse options | #### Returns @@ -1731,7 +1728,7 @@ Object the JSON content represents ### parseTargetString -▸ **parseTargetString**(`targetString`): [`Target`](../../devkit/documents/index#target) +▸ **parseTargetString**(`targetString`): [`Target`](../../devkit/documents/nrwl_devkit#target) **`deprecated(v17)`** A project graph should be passed to parseTargetString for best accuracy. @@ -1743,9 +1740,9 @@ Object the JSON content represents #### Returns -[`Target`](../../devkit/documents/index#target) +[`Target`](../../devkit/documents/nrwl_devkit#target) -▸ **parseTargetString**(`targetString`, `projectGraph`): [`Target`](../../devkit/documents/index#target) +▸ **parseTargetString**(`targetString`, `projectGraph`): [`Target`](../../devkit/documents/nrwl_devkit#target) Parses a target string into {project, target, configuration} @@ -1758,20 +1755,20 @@ parseTargetString('proj:test:production', graph); // returns { project: "proj", #### Parameters -| Name | Type | Description | -| :------------- | :---------------------------------------------------------- | :--------------- | -| `targetString` | `string` | target reference | -| `projectGraph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | - | +| Name | Type | Description | +| :------------- | :---------------------------------------------------------------- | :--------------- | +| `targetString` | `string` | target reference | +| `projectGraph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | - | #### Returns -[`Target`](../../devkit/documents/index#target) +[`Target`](../../devkit/documents/nrwl_devkit#target) --- ### readAllWorkspaceConfiguration -▸ **readAllWorkspaceConfiguration**(): [`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) +▸ **readAllWorkspaceConfiguration**(): [`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) TODO(vsavkin): Remove after Nx 16 is out @@ -1779,13 +1776,13 @@ TODO(vsavkin): Remove after Nx 16 is out #### Returns -[`ProjectsConfigurations`](../../devkit/documents/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) +[`ProjectsConfigurations`](../../devkit/documents/nrwl_devkit#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) --- ### readCachedProjectGraph -▸ **readCachedProjectGraph**(): [`ProjectGraph`](../../devkit/documents/index#projectgraph) +▸ **readCachedProjectGraph**(): [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) Synchronously reads the latest cached copy of the workspace's ProjectGraph. @@ -1793,7 +1790,7 @@ Synchronously reads the latest cached copy of the workspace's ProjectGraph. #### Returns -[`ProjectGraph`](../../devkit/documents/index#projectgraph) +[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) --- @@ -1811,11 +1808,11 @@ Reads a json file, removes all comments and parses JSON. #### Parameters -| Name | Type | Description | -| :--------- | :------------------------------------------------------------------ | :-------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | file system tree | -| `path` | `string` | file path | -| `options?` | [`JsonParseOptions`](../../devkit/documents/index#jsonparseoptions) | Optional JSON Parse Options | +| Name | Type | Description | +| :--------- | :------------------------------------------------------------------------ | :-------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | file system tree | +| `path` | `string` | file path | +| `options?` | [`JsonParseOptions`](../../devkit/documents/nrwl_devkit#jsonparseoptions) | Optional JSON Parse Options | #### Returns @@ -1852,25 +1849,35 @@ Object the JSON content of the file represents ### readNxJson -▸ **readNxJson**(`tree`): [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) \| `null` +▸ **readNxJson**(): [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` + +Reads nx.json + +**`deprecated`** You must pass a [Tree](../../devkit/documents/nrwl_devkit#tree) + +#### Returns + +[`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` + +▸ **readNxJson**(`tree`): [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` Reads nx.json #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns -[`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration) \| `null` +[`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration) \| `null` --- ### readProjectConfiguration -▸ **readProjectConfiguration**(`tree`, `projectName`): [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) +▸ **readProjectConfiguration**(`tree`, `projectName`): [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) Reads a project configuration. @@ -1878,14 +1885,14 @@ Reads a project configuration. #### Parameters -| Name | Type | Description | -| :------------ | :------------------------------------------ | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| Name | Type | Description | +| :------------ | :------------------------------------------------ | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | #### Returns -[`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) +[`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) --- @@ -1920,10 +1927,10 @@ Works as if you invoked the target yourself without passing any command lint ove #### Parameters -| Name | Type | -| :------------------ | :---------------------------------------------------------------- | -| `__namedParameters` | [`Target`](../../devkit/documents/index#target) | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :------------------ | :---------------------------------------------------------------------- | +| `__namedParameters` | [`Target`](../../devkit/documents/nrwl_devkit#target) | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | #### Returns @@ -1933,29 +1940,29 @@ Works as if you invoked the target yourself without passing any command lint ove ### readWorkspaceConfiguration -▸ **readWorkspaceConfiguration**(`tree`): [`WorkspaceConfiguration`](../../devkit/documents/index#workspaceconfiguration) +▸ **readWorkspaceConfiguration**(`tree`): [`WorkspaceConfiguration`](../../devkit/documents/nrwl_devkit#workspaceconfiguration) Read general workspace configuration such as the default project or cli settings -This does _not_ provide projects configuration, use [readProjectConfiguration](../../devkit/documents/index#readprojectconfiguration) instead. +This does _not_ provide projects configuration, use [readProjectConfiguration](../../devkit/documents/nrwl_devkit#readprojectconfiguration) instead. **`deprecated`** use readNxJson #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns -[`WorkspaceConfiguration`](../../devkit/documents/index#workspaceconfiguration) +[`WorkspaceConfiguration`](../../devkit/documents/nrwl_devkit#workspaceconfiguration) --- ### removeDependenciesFromPackageJson -▸ **removeDependenciesFromPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +▸ **removeDependenciesFromPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Remove Dependencies and Dev Dependencies from package.json @@ -1969,16 +1976,16 @@ This will **remove** `react` and `jest` from the dependencies and devDependencie #### Parameters -| Name | Type | Default value | Description | -| :---------------- | :------------------------------------------ | :--------------- | :-------------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | - | -| `dependencies` | `string`[] | `undefined` | Dependencies to be removed from the dependencies section of package.json | -| `devDependencies` | `string`[] | `undefined` | Dependencies to be removed from the devDependencies section of package.json | -| `packageJsonPath` | `string` | `'package.json'` | - | +| Name | Type | Default value | Description | +| :---------------- | :------------------------------------------------ | :--------------- | :-------------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | - | +| `dependencies` | `string`[] | `undefined` | Dependencies to be removed from the dependencies section of package.json | +| `devDependencies` | `string`[] | `undefined` | Dependencies to be removed from the devDependencies section of package.json | +| `packageJsonPath` | `string` | `'package.json'` | - | #### Returns -[`GeneratorCallback`](../../devkit/documents/index#generatorcallback) +[`GeneratorCallback`](../../devkit/documents/nrwl_devkit#generatorcallback) Callback to uninstall dependencies only if necessary. undefined is returned if changes are not necessary. @@ -1992,10 +1999,10 @@ Removes the configuration of an existing project. #### Parameters -| Name | Type | Description | -| :------------ | :------------------------------------------ | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| Name | Type | Description | +| :------------ | :------------------------------------------------ | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | #### Returns @@ -2005,7 +2012,7 @@ Removes the configuration of an existing project. ### reverse -▸ **reverse**(`graph`): [`ProjectGraph`](../../devkit/documents/index#projectgraph) +▸ **reverse**(`graph`): [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) Returns a new project graph where all the edges are reversed. @@ -2014,13 +2021,13 @@ B will depend on A. #### Parameters -| Name | Type | -| :------ | :---------------------------------------------------------- | -| `graph` | [`ProjectGraph`](../../devkit/documents/index#projectgraph) | +| Name | Type | +| :------ | :---------------------------------------------------------------- | +| `graph` | [`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) | #### Returns -[`ProjectGraph`](../../devkit/documents/index#projectgraph) +[`ProjectGraph`](../../devkit/documents/nrwl_devkit#projectgraph) --- @@ -2064,14 +2071,14 @@ Note that the return value is a promise of an iterator, so you need to await bef #### Parameters -| Name | Type | -| :--------------------------------- | :---------------------------------------------------------------- | -| `targetDescription` | `Object` | -| `targetDescription.configuration?` | `string` | -| `targetDescription.project` | `string` | -| `targetDescription.target` | `string` | -| `overrides` | `Object` | -| `context` | [`ExecutorContext`](../../devkit/documents/index#executorcontext) | +| Name | Type | +| :--------------------------------- | :---------------------------------------------------------------------- | +| `targetDescription` | `Object` | +| `targetDescription.configuration?` | `string` | +| `targetDescription.project` | `string` | +| `targetDescription.target` | `string` | +| `overrides` | `Object` | +| `context` | [`ExecutorContext`](../../devkit/documents/nrwl_devkit#executorcontext) | #### Returns @@ -2094,10 +2101,10 @@ By default the JSON string is formatted with a 2 space indentation to be easy re #### Parameters -| Name | Type | Description | -| :--------- | :-------------------------------------------------------------------------- | :---------------------------------------- | -| `input` | `T` | Object which should be serialized to JSON | -| `options?` | [`JsonSerializeOptions`](../../devkit/documents/index#jsonserializeoptions) | JSON serialize options | +| Name | Type | Description | +| :--------- | :-------------------------------------------------------------------------------- | :---------------------------------------- | +| `input` | `T` | Object which should be serialized to JSON | +| `options?` | [`JsonSerializeOptions`](../../devkit/documents/nrwl_devkit#jsonserializeoptions) | JSON serialize options | #### Returns @@ -2109,7 +2116,7 @@ the formatted JSON representation of the object ### sharePackages -▸ **sharePackages**(`packages`): `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> +▸ **sharePackages**(`packages`): `Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> Create a dictionary of packages and their Module Federation Shared Config from an array of package names. @@ -2125,27 +2132,27 @@ workspace. #### Returns -`Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/index#sharedlibraryconfig)\> +`Record`<`string`, [`SharedLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedlibraryconfig)\> --- ### shareWorkspaceLibraries -▸ **shareWorkspaceLibraries**(`libraries`, `tsConfigPath?`): [`SharedWorkspaceLibraryConfig`](../../devkit/documents/index#sharedworkspacelibraryconfig) +▸ **shareWorkspaceLibraries**(`libraries`, `tsConfigPath?`): [`SharedWorkspaceLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedworkspacelibraryconfig) Build an object of functions to be used with the ModuleFederationPlugin to share Nx Workspace Libraries between Hosts and Remotes. #### Parameters -| Name | Type | Description | -| :------------- | :-------------------------------------------------------------------- | :--------------------------------------------------------------------------- | -| `libraries` | [`WorkspaceLibrary`](../../devkit/documents/index#workspacelibrary)[] | The Nx Workspace Libraries to share | -| `tsConfigPath` | `string` | The path to TS Config File that contains the Path Mappings for the Libraries | +| Name | Type | Description | +| :------------- | :-------------------------------------------------------------------------- | :--------------------------------------------------------------------------- | +| `libraries` | [`WorkspaceLibrary`](../../devkit/documents/nrwl_devkit#workspacelibrary)[] | The Nx Workspace Libraries to share | +| `tsConfigPath` | `string` | The path to TS Config File that contains the Path Mappings for the Libraries | #### Returns -[`SharedWorkspaceLibraryConfig`](../../devkit/documents/index#sharedworkspacelibraryconfig) +[`SharedWorkspaceLibraryConfig`](../../devkit/documents/nrwl_devkit#sharedworkspacelibraryconfig) --- @@ -2207,9 +2214,9 @@ Returns a string in the format "project:target[:configuration]" for the target #### Parameters -| Name | Type | Description | -| :------- | :---------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `target` | [`Target`](../../devkit/documents/index#target) | target object Examples: `typescript targetToTargetString({ project: "proj", target: "test" }) // returns "proj:test" targetToTargetString({ project: "proj", target: "test", configuration: "production" }) // returns "proj:test:production" ` | +| Name | Type | Description | +| :------- | :---------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `target` | [`Target`](../../devkit/documents/nrwl_devkit#target) | target object Examples: `typescript targetToTargetString({ project: "proj", target: "test" }) // returns "proj:test" targetToTargetString({ project: "proj", target: "test", configuration: "production" }) // returns "proj:test:production" ` | #### Returns @@ -2225,9 +2232,9 @@ Rename and transpile any new typescript files created to javascript files #### Parameters -| Name | Type | -| :----- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | +| Name | Type | +| :----- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | #### Returns @@ -2250,12 +2257,12 @@ Updates a JSON value to the file system tree #### Parameters -| Name | Type | Description | -| :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | File system tree | -| `path` | `string` | Path of JSON file in the Tree | -| `updater` | (`value`: `T`) => `U` | Function that maps the current value of a JSON document to a new value to be written to the document | -| `options?` | [`JsonParseOptions`](../../devkit/documents/index#jsonparseoptions) & [`JsonSerializeOptions`](../../devkit/documents/index#jsonserializeoptions) | Optional JSON Parse and Serialize Options | +| Name | Type | Description | +| :--------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | File system tree | +| `path` | `string` | Path of JSON file in the Tree | +| `updater` | (`value`: `T`) => `U` | Function that maps the current value of a JSON document to a new value to be written to the document | +| `options?` | [`JsonParseOptions`](../../devkit/documents/nrwl_devkit#jsonparseoptions) & [`JsonSerializeOptions`](../../devkit/documents/nrwl_devkit#jsonserializeoptions) | Optional JSON Parse and Serialize Options | #### Returns @@ -2271,10 +2278,10 @@ Update nx.json #### Parameters -| Name | Type | -| :------- | :---------------------------------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `nxJson` | [`NxJsonConfiguration`](../../devkit/documents/index#nxjsonconfiguration)<`string`[] \| `"*"`\> | +| Name | Type | +| :------- | :---------------------------------------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `nxJson` | [`NxJsonConfiguration`](../../devkit/documents/nrwl_devkit#nxjsonconfiguration)<`string`[] \| `"*"`\> | #### Returns @@ -2290,11 +2297,11 @@ Updates the configuration of an existing project. #### Parameters -| Name | Type | Description | -| :--------------------- | :-------------------------------------------------------------------------- | :---------------------------------------------------------------------- | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | the file system tree | -| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | -| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/index#projectconfiguration) | project configuration | +| Name | Type | Description | +| :--------------------- | :-------------------------------------------------------------------------------- | :---------------------------------------------------------------------- | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | the file system tree | +| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) | +| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/documents/nrwl_devkit#projectconfiguration) | project configuration | #### Returns @@ -2308,11 +2315,11 @@ Updates the configuration of an existing project. #### Parameters -| Name | Type | -| :-------------------- | :------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `options` | `Object` | -| `options.projectRoot` | `string` | +| Name | Type | +| :-------------------- | :------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `options` | `Object` | +| `options.projectRoot` | `string` | #### Returns @@ -2326,16 +2333,16 @@ Updates the configuration of an existing project. Update general workspace configuration such as the default project or cli settings. -This does _not_ update projects configuration, use [updateProjectConfiguration](../../devkit/documents/index#updateprojectconfiguration) or [addProjectConfiguration](../../devkit/documents/index#addprojectconfiguration) instead. +This does _not_ update projects configuration, use [updateProjectConfiguration](../../devkit/documents/nrwl_devkit#updateprojectconfiguration) or [addProjectConfiguration](../../devkit/documents/nrwl_devkit#addprojectconfiguration) instead. **`deprecated`** use updateNxJson #### Parameters -| Name | Type | -| :---------------- | :------------------------------------------------------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | -| `workspaceConfig` | [`WorkspaceConfiguration`](../../devkit/documents/index#workspaceconfiguration) | +| Name | Type | +| :---------------- | :------------------------------------------------------------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `workspaceConfig` | [`WorkspaceConfiguration`](../../devkit/documents/nrwl_devkit#workspaceconfiguration) | #### Returns @@ -2351,11 +2358,11 @@ Utility to act on all files in a tree that are not ignored by git. #### Parameters -| Name | Type | Default value | -| :-------- | :------------------------------------------ | :------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | `undefined` | -| `dirPath` | `string` | `tree.root` | -| `visitor` | (`path`: `string`) => `void` | `undefined` | +| Name | Type | Default value | +| :-------- | :------------------------------------------------ | :------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | `undefined` | +| `dirPath` | `string` | `tree.root` | +| `visitor` | (`path`: `string`) => `void` | `undefined` | #### Returns @@ -2394,12 +2401,12 @@ Writes a JSON value to the file system tree #### Parameters -| Name | Type | Description | -| :--------- | :-------------------------------------------------------------------------- | :------------------------------ | -| `tree` | [`Tree`](../../devkit/documents/index#tree) | File system tree | -| `path` | `string` | Path of JSON file in the Tree | -| `value` | `T` | Serializable value to write | -| `options?` | [`JsonSerializeOptions`](../../devkit/documents/index#jsonserializeoptions) | Optional JSON Serialize Options | +| Name | Type | Description | +| :--------- | :-------------------------------------------------------------------------------- | :------------------------------ | +| `tree` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | File system tree | +| `path` | `string` | Path of JSON file in the Tree | +| `value` | `T` | Serializable value to write | +| `options?` | [`JsonSerializeOptions`](../../devkit/documents/nrwl_devkit#jsonserializeoptions) | Optional JSON Serialize Options | #### Returns diff --git a/docs/generated/packages/devkit/documents/ngcli_adapter.md b/docs/generated/packages/devkit/documents/ngcli_adapter.md index ebafd6191a..19fdc03ad8 100644 --- a/docs/generated/packages/devkit/documents/ngcli_adapter.md +++ b/docs/generated/packages/devkit/documents/ngcli_adapter.md @@ -91,7 +91,7 @@ overrideCollectionResolutionForTesting({ ### wrapAngularDevkitSchematic -▸ **wrapAngularDevkitSchematic**(`collectionName`, `generatorName`): (`host`: [`Tree`](../../devkit/documents/index#tree), `generatorOptions`: { [k: string]: `any`; }) => `Promise`<`any`\> +▸ **wrapAngularDevkitSchematic**(`collectionName`, `generatorName`): (`host`: [`Tree`](../../devkit/documents/nrwl_devkit#tree), `generatorOptions`: { [k: string]: `any`; }) => `Promise`<`any`\> #### Parameters @@ -108,10 +108,10 @@ overrideCollectionResolutionForTesting({ ##### Parameters -| Name | Type | -| :----------------- | :------------------------------------------ | -| `host` | [`Tree`](../../devkit/documents/index#tree) | -| `generatorOptions` | `Object` | +| Name | Type | +| :----------------- | :------------------------------------------------ | +| `host` | [`Tree`](../../devkit/documents/nrwl_devkit#tree) | +| `generatorOptions` | `Object` | ##### Returns diff --git a/docs/map.json b/docs/map.json index 7ab1cb5543..11a63834b2 100644 --- a/docs/map.json +++ b/docs/map.json @@ -1550,7 +1550,7 @@ { "id": "index", "name": "Overview", - "file": "generated/devkit/index" + "file": "generated/devkit/nrwl_devkit" }, { "id": "ngcli_adapter", diff --git a/nx-dev/nx-dev-e2e/src/e2e/additional-api-references.cy.ts b/nx-dev/nx-dev-e2e/src/e2e/additional-api-references.cy.ts index c4585af317..5bfc2c9246 100644 --- a/nx-dev/nx-dev-e2e/src/e2e/additional-api-references.cy.ts +++ b/nx-dev/nx-dev-e2e/src/e2e/additional-api-references.cy.ts @@ -49,7 +49,7 @@ describe('nx-dev: Additional API references section', () => { path: '/storybook/storybook-composition-setup', }, { - title: 'Module: index', + title: 'Module: @nrwl/devkit', path: '/devkit/index', }, { diff --git a/packages/devkit/.eslintrc.json b/packages/devkit/.eslintrc.json index 25e21f47c2..eeccfb166a 100644 --- a/packages/devkit/.eslintrc.json +++ b/packages/devkit/.eslintrc.json @@ -1,12 +1,27 @@ { "extends": "../../.eslintrc", "rules": { - "no-restricted-imports": [ + "@typescript-eslint/no-restricted-imports": [ "error", - "@nrwl/workspace", - "@angular-devkit/core", - "@angular-devkit/architect", - "@angular-devkit/schematics" + { + "paths": [ + "@nrwl/workspace", + "@angular-devkit/core", + "@angular-devkit/architect", + "@angular-devkit/schematics" + ], + "patterns": [ + { + "group": ["nx/**/*"], + "message": "Use getNx() from packages/devkit/nx.ts OR use a type import instead.", + "allowTypeImports": true + }, + { + "group": ["@nrwl/devkit/**/*"], + "message": "Use a relative import" + } + ] + } ] }, "ignorePatterns": ["!**/*"], @@ -15,6 +30,12 @@ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "rules": {} }, + { + "files": ["*.spec.ts"], + "rules": { + "@typescript-eslint/no-restricted-imports": "off" + } + }, { "files": ["*.ts", "*.tsx"], "rules": { diff --git a/packages/devkit/index.d.ts b/packages/devkit/index.d.ts new file mode 100644 index 0000000000..49962bfbc3 --- /dev/null +++ b/packages/devkit/index.d.ts @@ -0,0 +1,19 @@ +/** + * The Nx Devkit is the underlying technology used to customize Nx to support + * different technologies and custom use-cases. It contains many utility + * functions for reading and writing files, updating configuration, + * working with Abstract Syntax Trees(ASTs), and more. + * + * As with most things in Nx, the core of Nx Devkit is very simple. + * It only uses language primitives and immutable objects + * (the tree being the only exception). + * + * @module @nrwl/devkit + */ + +// TODO(v17): remove this file, we can use the normally generated index.d.ts from index.ts + +/* eslint-disable @typescript-eslint/no-restricted-imports */ +export * from 'nx/src/devkit-exports'; + +export * from './public-api'; diff --git a/packages/devkit/index.js b/packages/devkit/index.js new file mode 100644 index 0000000000..3d35c59299 --- /dev/null +++ b/packages/devkit/index.js @@ -0,0 +1,27 @@ +/** + * The Nx Devkit is the underlying technology used to customize Nx to support + * different technologies and custom use-cases. It contains many utility + * functions for reading and writing files, updating configuration, + * working with Abstract Syntax Trees(ASTs), and more. + * + * As with most things in Nx, the core of Nx Devkit is very simple. + * It only uses language primitives and immutable objects + * (the tree being the only exception). + * + * @module @nrwl/devkit + */ + +try { + // TODO(v17): We will not need to maintain this file anymore, change this to a regular export statement + // This file was introduced in the nx package in v15.7 but devkit is compatible down to v14.1 which doesn't have this file. + module.exports = require('nx/src/devkit-exports'); +} catch { + // These are the nx-reexports from before v16 + // TODO(v17): This can be removed once the above is done. + module.exports = require('./nx-reexports-pre16'); +} + +module.exports = { + ...module.exports, + ...require('./public-api'), +}; diff --git a/packages/devkit/ngcli-adapter.ts b/packages/devkit/ngcli-adapter.ts index 917d1b8a41..197c62d08a 100644 --- a/packages/devkit/ngcli-adapter.ts +++ b/packages/devkit/ngcli-adapter.ts @@ -1,6 +1,7 @@ /** * @category Ng CLI Adapter */ +// eslint-disable-next-line @typescript-eslint/no-restricted-imports export { wrapAngularDevkitSchematic, overrideCollectionResolutionForTesting, diff --git a/packages/devkit/index.ts b/packages/devkit/nx-reexports-pre16.ts similarity index 82% rename from packages/devkit/index.ts rename to packages/devkit/nx-reexports-pre16.ts index 462aaaae8b..67f256ef19 100644 --- a/packages/devkit/index.ts +++ b/packages/devkit/nx-reexports-pre16.ts @@ -1,23 +1,12 @@ /** - * The Nx Devkit is the underlying technology used to customize Nx to support - * different technologies and custom use-cases. It contains many utility - * functions for reading and writing files, updating configuration, - * working with Abstract Syntax Trees(ASTs), and more. + * STOP! Do not change this file! * - * As with most things in Nx, the core of Nx Devkit is very simple. - * It only uses language primitives and immutable objects - * (the tree being the only exception). + * If you need to export something from nx, it should go into nx/src/devkit-exports */ -/** - * Note to developers: This is the Public API of @nrwl/devkit. - * @nrwl/devkit should be compatible with versions of Nx 1 major version prior. - * This is so that plugins can use the latest @nrwl/devkit while their users may use versions +/- 1 of Nx. - * - * 1. Try hard to not add to this API to reduce the surface area we need to maintain. - * 2. Do not add newly created paths from the nx package to this file as they will not be available in older versions of Nx. - * a. We might need to duplicate code instead of importing from nx until all supported versions of nx contain the file. - */ +// TODO(v17): Remove this file + +/* eslint-disable @typescript-eslint/no-restricted-imports */ /** * @category Tree @@ -138,21 +127,18 @@ export { getProjects, } from 'nx/src/generators/utils/project-configuration'; -/** - * @category Generators - */ -export { readNxJson, updateNxJson } from 'nx/src/generators/utils/nx-json'; - /** * @category Generators */ export { + readNxJson, + updateNxJson, readWorkspaceConfiguration, updateWorkspaceConfiguration, isStandaloneProject, WorkspaceConfiguration, getWorkspacePath, -} from 'nx/src/generators/utils/deprecated'; +} from 'nx/src/generators/utils/project-configuration'; /** * @category Generators @@ -366,8 +352,4 @@ export { Hash, Hasher } from 'nx/src/hasher/hasher'; */ export { cacheDir } from 'nx/src/utils/cache-directory'; -/** - * @category Package Manager - */ -export { createLockFile } from 'nx/src/lock-file/lock-file'; -export { createPackageJson } from 'nx/src/utils/create-package-json'; +// STOP! Do not export any new things from the nx package diff --git a/packages/devkit/nx.ts b/packages/devkit/nx.ts new file mode 100644 index 0000000000..1eccb0723e --- /dev/null +++ b/packages/devkit/nx.ts @@ -0,0 +1,7 @@ +export function requireNx(): typeof import('nx/src/devkit-exports') { + try { + return require('nx/src/devkit-exports'); + } catch { + return require('./nx-reexports-pre16'); + } +} diff --git a/packages/devkit/package.json b/packages/devkit/package.json index f605f5a02c..92ffd314e7 100644 --- a/packages/devkit/package.json +++ b/packages/devkit/package.json @@ -35,7 +35,7 @@ "semver": "7.3.4" }, "peerDependencies": { - "nx": ">= 14 <= 16" + "nx": ">= 14.1 <= 16" }, "nx-migrations": { "migrations": "./migrations.json" diff --git a/packages/devkit/public-api.ts b/packages/devkit/public-api.ts new file mode 100644 index 0000000000..ecf98ac082 --- /dev/null +++ b/packages/devkit/public-api.ts @@ -0,0 +1,129 @@ +/** + * Note to developers: STOP! This is the Public API of @nrwl/devkit. + * @nrwl/devkit should be compatible with versions of Nx 1 major version prior. + * This is so that plugins can use the latest @nrwl/devkit while their users may use versions +/- 1 of Nx. + * + * 1. Try hard to not add to this API to reduce the surface area we need to maintain. + * 2. Do not add newly created paths from the nx package to this file as they will not be available in older versions of Nx. + * a. We might need to duplicate code instead of importing from nx until all supported versions of nx contain the file. + */ + +/** + * @category Generators + */ +export { formatFiles } from './src/generators/format-files'; + +/** + * @category Generators + */ +export { generateFiles } from './src/generators/generate-files'; + +/** + * @category Generators + */ +export { toJS } from './src/generators/to-js'; + +/** + * @category Generators + */ +export { updateTsConfigsToJs } from './src/generators/update-ts-configs-to-js'; + +/** + * @category Generators + */ +export { visitNotIgnoredFiles } from './src/generators/visit-not-ignored-files'; + +export { + parseTargetString, + targetToTargetString, +} from './src/executors/parse-target-string'; + +/** + * @category Executors + */ +export { readTargetOptions } from './src/executors/read-target-options'; + +/** + * @category Utils + */ +export { + addDependenciesToPackageJson, + ensurePackage, + removeDependenciesFromPackageJson, +} from './src/utils/package-json'; + +/** + * @category Utils + */ +export { installPackagesTask } from './src/tasks/install-packages-task'; + +/** + * @category Utils + */ +export { names } from './src/utils/names'; + +/** + * @category Utils + */ +export { + getWorkspaceLayout, + extractLayoutDirectory, +} from './src/utils/get-workspace-layout'; + +/** + * @category Utils + */ +export type { + StringChange, + StringDeletion, + StringInsertion, +} from './src/utils/string-change'; + +/** + * @category Utils + */ +export { applyChangesToString, ChangeType } from './src/utils/string-change'; + +/** + * @category Utils + */ +export { offsetFromRoot } from './src/utils/offset-from-root'; + +/** + * @category Utils + */ +export { convertNxGenerator } from './src/utils/invoke-nx-generator'; + +/** + * @category Utils + */ +export { convertNxExecutor } from './src/utils/convert-nx-executor'; + +/** + * @category Utils + */ +export { moveFilesToNewDirectory } from './src/utils/move-dir'; + +/** + * @category Utils + */ +export { + SharedLibraryConfig, + SharedWorkspaceLibraryConfig, + AdditionalSharedConfig, + applySharedFunction, + applyAdditionalShared, + mapRemotes, + mapRemotesForSSR, + getNpmPackageSharedConfig, + shareWorkspaceLibraries, + sharePackages, + getDependentPackagesForProject, + ModuleFederationConfig, + ModuleFederationLibrary, + readRootPackageJson, + WorkspaceLibrary, + SharedFunction, + WorkspaceLibrarySecondaryEntryPoint, + Remotes, +} from './src/utils/module-federation'; diff --git a/packages/devkit/src/executors/parse-target-string.ts b/packages/devkit/src/executors/parse-target-string.ts index c7ca504284..f40978a814 100644 --- a/packages/devkit/src/executors/parse-target-string.ts +++ b/packages/devkit/src/executors/parse-target-string.ts @@ -1,7 +1,10 @@ import type { Target } from 'nx/src/command-line/run'; -import { ProjectGraph } from 'nx/src/config/project-graph'; -import { readCachedProjectGraph } from 'nx/src/project-graph/project-graph'; +import type { ProjectGraph } from 'nx/src/config/project-graph'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import { splitTarget } from 'nx/src/utils/split-target'; +import { requireNx } from '../../nx'; + +const { readCachedProjectGraph } = requireNx(); /** * @deprecated(v17) A project graph should be passed to parseTargetString for best accuracy. diff --git a/packages/devkit/src/executors/read-target-options.ts b/packages/devkit/src/executors/read-target-options.ts index 77706de2fc..225b46a99e 100644 --- a/packages/devkit/src/executors/read-target-options.ts +++ b/packages/devkit/src/executors/read-target-options.ts @@ -1,7 +1,10 @@ import type { Target } from 'nx/src/command-line/run'; import type { ExecutorContext } from 'nx/src/config/misc-interfaces'; -import { Workspaces } from 'nx/src/config/workspaces'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import { combineOptionsForExecutor } from 'nx/src/utils/params'; +import { requireNx } from '../../nx'; + +const { Workspaces } = requireNx(); /** * Reads and combines options for a given target. diff --git a/packages/devkit/src/generators/format-files.ts b/packages/devkit/src/generators/format-files.ts index 5c2ed78a80..38a1b3a2ed 100644 --- a/packages/devkit/src/generators/format-files.ts +++ b/packages/devkit/src/generators/format-files.ts @@ -1,8 +1,11 @@ import type { Tree } from 'nx/src/generators/tree'; import * as path from 'path'; import type * as Prettier from 'prettier'; -import { readJson, updateJson, writeJson } from 'nx/src/generators/utils/json'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import { sortObjectByKeys } from 'nx/src/utils/object-sort'; +import { requireNx } from '../../nx'; + +const { updateJson } = requireNx(); /** * Formats all the created or updated files using Prettier diff --git a/packages/devkit/src/generators/generate-files.ts b/packages/devkit/src/generators/generate-files.ts index 5aed85b770..cfd3d28343 100644 --- a/packages/devkit/src/generators/generate-files.ts +++ b/packages/devkit/src/generators/generate-files.ts @@ -1,7 +1,9 @@ import { readFileSync, readdirSync, statSync } from 'fs'; import * as path from 'path'; import type { Tree } from 'nx/src/generators/tree'; -import { logger } from 'nx/src/utils/logger'; +import { requireNx } from '../../nx'; + +const { logger } = requireNx(); const binaryExts = new Set([ // // Image types originally from https://github.com/sindresorhus/image-type/blob/5541b6a/index.js diff --git a/packages/devkit/src/generators/update-ts-configs-to-js.ts b/packages/devkit/src/generators/update-ts-configs-to-js.ts index 865892a6fc..a61b366961 100644 --- a/packages/devkit/src/generators/update-ts-configs-to-js.ts +++ b/packages/devkit/src/generators/update-ts-configs-to-js.ts @@ -1,5 +1,7 @@ import type { Tree } from 'nx/src/generators/tree'; -import { updateJson } from 'nx/src/generators/utils/json'; +import { requireNx } from '../../nx'; + +const { updateJson } = requireNx(); export function updateTsConfigsToJs( tree: Tree, diff --git a/packages/devkit/src/migrations/update-14-2-0/split-create-empty-tree.ts b/packages/devkit/src/migrations/update-14-2-0/split-create-empty-tree.ts index fc914c1ae1..aed802547c 100644 --- a/packages/devkit/src/migrations/update-14-2-0/split-create-empty-tree.ts +++ b/packages/devkit/src/migrations/update-14-2-0/split-create-empty-tree.ts @@ -1,5 +1,4 @@ -import { Tree } from 'nx/src/generators/tree'; -import { getProjects } from 'nx/src/generators/utils/project-configuration'; +import type { Tree } from 'nx/src/generators/tree'; import { StringChange, ChangeType, @@ -10,6 +9,10 @@ import { tsquery } from '@phenomnomnominal/tsquery'; import { visitNotIgnoredFiles } from '../../generators/visit-not-ignored-files'; import { formatFiles } from '../../generators/format-files'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports +import { requireNx } from '../../../nx'; + +const { getProjects } = requireNx(); export default async function update(tree: Tree): Promise { for (const [project, { root }] of getProjects(tree)) { diff --git a/packages/devkit/src/tasks/install-packages-task.ts b/packages/devkit/src/tasks/install-packages-task.ts index 54979b7d98..0a88618314 100644 --- a/packages/devkit/src/tasks/install-packages-task.ts +++ b/packages/devkit/src/tasks/install-packages-task.ts @@ -1,12 +1,11 @@ -import type { Tree } from 'nx/src/generators/tree'; import { execSync } from 'child_process'; import { join } from 'path'; -import { - detectPackageManager, - getPackageManagerCommand, -} from 'nx/src/utils/package-manager'; +import { requireNx } from '../../nx'; + +import type { Tree } from 'nx/src/generators/tree'; import type { PackageManager } from 'nx/src/utils/package-manager'; -import { joinPathFragments } from 'nx/src/utils/path'; +const { detectPackageManager, getPackageManagerCommand, joinPathFragments } = + requireNx(); /** * Runs `npm install` or `yarn install`. It will skip running the install if diff --git a/packages/devkit/src/utils/convert-nx-executor.ts b/packages/devkit/src/utils/convert-nx-executor.ts index 043a40dd1d..2612881fe5 100644 --- a/packages/devkit/src/utils/convert-nx-executor.ts +++ b/packages/devkit/src/utils/convert-nx-executor.ts @@ -1,11 +1,10 @@ import type { Observable } from 'rxjs'; -import { Workspaces } from 'nx/src/config/workspaces'; -import { Executor, ExecutorContext } from 'nx/src/config/misc-interfaces'; -import { - createProjectGraphAsync, - readCachedProjectGraph, -} from 'nx/src/project-graph/project-graph'; -import { ProjectGraph } from 'nx/src/config/project-graph'; +import type { Executor, ExecutorContext } from 'nx/src/config/misc-interfaces'; +import type { ProjectGraph } from 'nx/src/config/project-graph'; +import { requireNx } from '../../nx'; + +const { createProjectGraphAsync, readCachedProjectGraph, Workspaces } = + requireNx(); /** * Convert an Nx Executor into an Angular Devkit Builder diff --git a/packages/devkit/src/utils/get-workspace-layout.ts b/packages/devkit/src/utils/get-workspace-layout.ts index 9783549d4c..389eb80180 100644 --- a/packages/devkit/src/utils/get-workspace-layout.ts +++ b/packages/devkit/src/utils/get-workspace-layout.ts @@ -1,5 +1,7 @@ -import { readNxJson } from 'nx/src/generators/utils/nx-json'; import type { Tree } from 'nx/src/generators/tree'; +import { requireNx } from '../../nx'; + +const { readNxJson } = requireNx(); /** * Returns workspace defaults. It includes defaults folders for apps and libs, diff --git a/packages/devkit/src/utils/invoke-nx-generator.ts b/packages/devkit/src/utils/invoke-nx-generator.ts index 68894c8a97..a13724d489 100644 --- a/packages/devkit/src/utils/invoke-nx-generator.ts +++ b/packages/devkit/src/utils/invoke-nx-generator.ts @@ -1,12 +1,19 @@ -import { logger, stripIndent } from 'nx/src/utils/logger'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports +import { stripIndent } from 'nx/src/utils/logger'; import type { FileChange, Tree, TreeWriteOptions, } from 'nx/src/generators/tree'; -import { Generator, GeneratorCallback } from 'nx/src/config/misc-interfaces'; +import type { + Generator, + GeneratorCallback, +} from 'nx/src/config/misc-interfaces'; import { join, relative } from 'path'; import type { Mode } from 'fs'; +import { requireNx } from '../../nx'; + +const { logger } = requireNx(); class RunCallbackTask { constructor(private callback: GeneratorCallback) {} diff --git a/packages/devkit/src/utils/module-federation/package-json.ts b/packages/devkit/src/utils/module-federation/package-json.ts index e1ee0e86ca..ce68761fcf 100644 --- a/packages/devkit/src/utils/module-federation/package-json.ts +++ b/packages/devkit/src/utils/module-federation/package-json.ts @@ -1,7 +1,7 @@ -import { joinPathFragments } from 'nx/src/utils/path'; -import { readJsonFile } from 'nx/src/utils/fileutils'; -import { workspaceRoot } from 'nx/src/utils/workspace-root'; import { existsSync } from 'fs'; +import { requireNx } from '../../../nx'; + +const { workspaceRoot, readJsonFile, joinPathFragments } = requireNx(); export function readRootPackageJson(): { dependencies?: { [key: string]: string }; diff --git a/packages/devkit/src/utils/module-federation/secondary-entry-points.ts b/packages/devkit/src/utils/module-federation/secondary-entry-points.ts index eb9e4e764c..4a4a9fd585 100644 --- a/packages/devkit/src/utils/module-federation/secondary-entry-points.ts +++ b/packages/devkit/src/utils/module-federation/secondary-entry-points.ts @@ -2,10 +2,12 @@ import type { WorkspaceLibrary } from './models'; import { WorkspaceLibrarySecondaryEntryPoint } from './models'; import { dirname, join, relative } from 'path'; import { existsSync, lstatSync, readdirSync } from 'fs'; + +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import { PackageJson, readModulePackageJson } from 'nx/src/utils/package-json'; -import { workspaceRoot } from 'nx/src/utils/workspace-root'; -import { joinPathFragments } from 'nx/src/utils/path'; -import { readJsonFile } from 'nx/src/utils/fileutils'; +import { requireNx } from '../../../nx'; + +const { readJsonFile, joinPathFragments, workspaceRoot } = requireNx(); export function collectWorkspaceLibrarySecondaryEntryPoints( library: WorkspaceLibrary, diff --git a/packages/devkit/src/utils/module-federation/share.spec.ts b/packages/devkit/src/utils/module-federation/share.spec.ts index 330a11d752..6adf0722f2 100644 --- a/packages/devkit/src/utils/module-federation/share.spec.ts +++ b/packages/devkit/src/utils/module-federation/share.spec.ts @@ -2,7 +2,13 @@ jest.mock('fs'); import * as fs from 'fs'; import * as tsUtils from './typescript'; -import * as nxFileutils from 'nx/src/utils/fileutils'; +jest.mock('nx/src/devkit-exports', () => { + return { + ...jest.requireActual('nx/src/devkit-exports'), + readJsonFile: jest.fn(), + }; +}); +import * as nxFileutils from 'nx/src/devkit-exports'; import { sharePackages, shareWorkspaceLibraries } from './share'; describe('MF Share Utils', () => { @@ -336,13 +342,16 @@ describe('MF Share Utils', () => { (fs.existsSync as jest.Mock).mockImplementation( (file) => !file.endsWith('non-existent-top-level-package/package.json') ); - jest.spyOn(nxFileutils, 'readJsonFile').mockImplementation((file) => ({ - name: file - .replace(/\\/g, '/') - .replace(/^.*node_modules[/]/, '') - .replace('/package.json', ''), - dependencies: { '@angular/core': '~13.2.0' }, - })); + jest.spyOn(nxFileutils, 'readJsonFile').mockImplementation((file) => { + console.log('HELLO?'); + return { + name: file + .replace(/\\/g, '/') + .replace(/^.*node_modules[/]/, '') + .replace('/package.json', ''), + dependencies: { '@angular/core': '~13.2.0' }, + }; + }); // ACT & ASSERT expect(() => diff --git a/packages/devkit/src/utils/module-federation/share.ts b/packages/devkit/src/utils/module-federation/share.ts index 99c80bfb86..5aceb98d9b 100644 --- a/packages/devkit/src/utils/module-federation/share.ts +++ b/packages/devkit/src/utils/module-federation/share.ts @@ -11,10 +11,12 @@ import { collectPackageSecondaryEntryPoints, collectWorkspaceLibrarySecondaryEntryPoints, } from './secondary-entry-points'; -import { workspaceRoot } from 'nx/src/utils/workspace-root'; -import { logger } from 'nx/src/utils/logger'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import { getRootTsConfigPath } from 'nx/src/utils/typescript'; -import { ProjectGraph } from 'nx/src/config/project-graph'; +import type { ProjectGraph } from 'nx/src/config/project-graph'; +import { requireNx } from '../../../nx'; + +const { workspaceRoot, logger } = requireNx(); /** * Build an object of functions to be used with the ModuleFederationPlugin to diff --git a/packages/devkit/src/utils/module-federation/typescript.ts b/packages/devkit/src/utils/module-federation/typescript.ts index df8909c200..4b5c8ad816 100644 --- a/packages/devkit/src/utils/module-federation/typescript.ts +++ b/packages/devkit/src/utils/module-federation/typescript.ts @@ -1,5 +1,6 @@ import { existsSync } from 'fs'; import { ParsedCommandLine } from 'typescript'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import { getRootTsConfigPath } from 'nx/src/utils/typescript'; import { dirname } from 'path'; diff --git a/packages/devkit/src/utils/move-dir.ts b/packages/devkit/src/utils/move-dir.ts index 87f0230d78..0ff349b169 100644 --- a/packages/devkit/src/utils/move-dir.ts +++ b/packages/devkit/src/utils/move-dir.ts @@ -1,8 +1,9 @@ -import { Tree } from 'nx/src/generators/tree'; +import type { Tree } from 'nx/src/generators/tree'; import { relative } from 'path'; import { visitNotIgnoredFiles } from '../generators/visit-not-ignored-files'; -import { normalizePath } from 'nx/src/utils/path'; +import { requireNx } from '../../nx'; +const { normalizePath } = requireNx(); /** * Analogous to cp -r oldDir newDir */ diff --git a/packages/devkit/src/utils/package-json.ts b/packages/devkit/src/utils/package-json.ts index c2e9ef61f7..2cf180408b 100644 --- a/packages/devkit/src/utils/package-json.ts +++ b/packages/devkit/src/utils/package-json.ts @@ -1,12 +1,15 @@ import { execSync } from 'child_process'; -import { readJson, updateJson } from 'nx/src/generators/utils/json'; + import type { Tree } from 'nx/src/generators/tree'; -import { GeneratorCallback } from 'nx/src/config/misc-interfaces'; + +import type { GeneratorCallback } from 'nx/src/config/misc-interfaces'; import { clean, coerce, gt, satisfies } from 'semver'; -import { getPackageManagerCommand } from 'nx/src/utils/package-manager'; -import { workspaceRoot } from 'nx/src/utils/workspace-root'; import { installPackagesTask } from '../tasks/install-packages-task'; +import { requireNx } from '../../nx'; + +const { readJson, updateJson, getPackageManagerCommand, workspaceRoot } = + requireNx(); const UNIDENTIFIED_VERSION = 'UNIDENTIFIED_VERSION'; const NON_SEMVER_TAGS = { diff --git a/packages/devkit/testing.ts b/packages/devkit/testing-pre16.ts similarity index 78% rename from packages/devkit/testing.ts rename to packages/devkit/testing-pre16.ts index 4f483d5f16..3f0649d18f 100644 --- a/packages/devkit/testing.ts +++ b/packages/devkit/testing-pre16.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-restricted-imports */ export { createTreeWithEmptyWorkspace, createTreeWithEmptyV1Workspace, diff --git a/packages/devkit/testing.d.ts b/packages/devkit/testing.d.ts new file mode 100644 index 0000000000..e59b962568 --- /dev/null +++ b/packages/devkit/testing.d.ts @@ -0,0 +1,2 @@ +// eslint-disable-next-line @typescript-eslint/no-restricted-imports +export * from 'nx/src/devkit-testing-exports'; diff --git a/packages/devkit/testing.js b/packages/devkit/testing.js new file mode 100644 index 0000000000..c2865973dc --- /dev/null +++ b/packages/devkit/testing.js @@ -0,0 +1,9 @@ +try { + // TODO(v17): We will not need to maintain this file anymore, change this to a regular export statement + // This file was introduced in the nx package in v15.7 but devkit is compatible down to v14.1 which doesn't have this file. + module.exports = require('nx/src/devkit-testing-exports'); +} catch { + // These are the nx-reexports from before v16 + // TODO(v17): This can be removed once the above is done. + module.exports = require('./testing-pre16'); +} diff --git a/packages/devkit/tsconfig.lib.json b/packages/devkit/tsconfig.lib.json index 1d2ddef3c1..74960efbae 100644 --- a/packages/devkit/tsconfig.lib.json +++ b/packages/devkit/tsconfig.lib.json @@ -13,5 +13,6 @@ "**/*_test.ts", "jest.config.ts" ], + "files": ["./index.d.ts"], "include": ["**/*.ts"] } diff --git a/packages/js/src/index.ts b/packages/js/src/index.ts index d97e88dfd1..70cd02c72c 100644 --- a/packages/js/src/index.ts +++ b/packages/js/src/index.ts @@ -5,3 +5,6 @@ export * from './utils/package-json'; export * from './utils/assets'; export * from './utils/package-json/update-package-json'; export { libraryGenerator } from './generators/library/library'; + +export { createLockFile } from 'nx/src/lock-file/lock-file'; +export { createPackageJson } from 'nx/src/utils/create-package-json'; diff --git a/packages/js/src/utils/package-json/update-package-json.ts b/packages/js/src/utils/package-json/update-package-json.ts index 885309bda1..f1e89c46e3 100644 --- a/packages/js/src/utils/package-json/update-package-json.ts +++ b/packages/js/src/utils/package-json/update-package-json.ts @@ -1,6 +1,6 @@ +import { createLockFile } from 'nx/src/lock-file/lock-file'; +import { createPackageJson } from 'nx/src/utils/create-package-json'; import { - createLockFile, - createPackageJson, ExecutorContext, getOutputsForTargetAndConfiguration, joinPathFragments, diff --git a/packages/next/package.json b/packages/next/package.json index e62d637e6b..af5cb5c0fd 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -38,6 +38,7 @@ "@nrwl/cypress": "file:../cypress", "@nrwl/devkit": "file:../devkit", "@nrwl/jest": "file:../jest", + "@nrwl/js": "file:../js", "@nrwl/linter": "file:../linter", "@nrwl/react": "file:../react", "@nrwl/webpack": "file:../webpack", diff --git a/packages/next/src/executors/build/build.impl.ts b/packages/next/src/executors/build/build.impl.ts index 0126696eb0..e47f38ea5b 100644 --- a/packages/next/src/executors/build/build.impl.ts +++ b/packages/next/src/executors/build/build.impl.ts @@ -4,10 +4,9 @@ import { readJsonFile, workspaceLayout, workspaceRoot, - createPackageJson, - createLockFile, writeJsonFile, } from '@nrwl/devkit'; +import { createLockFile, createPackageJson } from '@nrwl/js'; import build from 'next/dist/build'; import { join, resolve } from 'path'; import { copySync, existsSync, mkdir, writeFileSync } from 'fs-extra'; diff --git a/packages/nx/src/devkit-exports.ts b/packages/nx/src/devkit-exports.ts new file mode 100644 index 0000000000..6562c83f5b --- /dev/null +++ b/packages/nx/src/devkit-exports.ts @@ -0,0 +1,243 @@ +/** + * Note to developers: STOP! These exports end up as the public API of @nrwl/devkit. + * Try hard to not add to this API to reduce the surface area we need to maintain. + */ + +/** + * @category Tree + */ +export type { Tree, FileChange } from './generators/tree'; + +/** + * @category Workspace + */ +export type { + WorkspaceJsonConfiguration, + ProjectsConfigurations, + TargetDependencyConfig, + TargetConfiguration, + ProjectConfiguration, + ProjectType, + Workspace, +} from './config/workspace-json-project-json'; + +/** + * @category Workspace + */ +export type { + Generator, + GeneratorCallback, + Executor, + ExecutorContext, + TaskGraphExecutor, + GeneratorsJson, + ExecutorsJson, + MigrationsJson, + CustomHasher, + HasherContext, +} from './config/misc-interfaces'; + +/** + * @category Workspace + */ +export { Workspaces } from './config/workspaces'; + +// TODO (v16): Change this to export from './config/configuration' +export { + readAllWorkspaceConfiguration, + workspaceLayout, +} from './project-graph/file-utils'; + +export type { NxPlugin, ProjectTargetConfigurator } from './utils/nx-plugin'; + +/** + * @category Workspace + */ +export type { Task, TaskGraph } from './config/task-graph'; + +/** + * @category Workspace + */ +export type { + ImplicitDependencyEntry, + ImplicitJsonSubsetDependency, + NxJsonConfiguration, + NxAffectedConfig, +} from './config/nx-json'; + +/** + * @category Logger + */ +export { logger } from './utils/logger'; + +/** + * @category Utils + */ +export { output } from './utils/output'; + +/** + * @category Package Manager + */ +export type { PackageManager } from './utils/package-manager'; + +/** + * @category Package Manager + */ +export { + getPackageManagerCommand, + detectPackageManager, + getPackageManagerVersion, +} from './utils/package-manager'; + +/** + * @category Commands + */ +export type { Target } from './command-line/run'; +/** + * @category Commands + */ +export { runExecutor } from './command-line/run'; + +/** + * @category Generators + */ +export { + addProjectConfiguration, + readProjectConfiguration, + removeProjectConfiguration, + updateProjectConfiguration, + getProjects, +} from './generators/utils/project-configuration'; + +/** + * @category Generators + */ +export { + readWorkspaceConfiguration, + updateWorkspaceConfiguration, + isStandaloneProject, + WorkspaceConfiguration, + getWorkspacePath, +} from './generators/utils/deprecated'; + +export { + readNxJson, + updateNxJson, +} from './generators/utils/project-configuration'; + +/** + * @category Project Graph + */ +export type { + ProjectFileMap, + FileData, + ProjectGraph, + ProjectGraphV4, + ProjectGraphDependency, + ProjectGraphNode, + ProjectGraphProjectNode, + ProjectGraphExternalNode, + ProjectGraphProcessorContext, +} from './config/project-graph'; + +/** + * @category Project Graph + */ +export { DependencyType } from './config/project-graph'; + +/** + * @category Project Graph + */ +export { ProjectGraphBuilder } from './project-graph/project-graph-builder'; + +/** + * @category Utils + */ +export { readJson, writeJson, updateJson } from './generators/utils/json'; + +/** + * @category Utils + */ +export { parseJson, serializeJson, stripJsonComments } from './utils/json'; + +/** + * @category Utils + */ +export type { JsonParseOptions, JsonSerializeOptions } from './utils/json'; + +/** + * @category Utils + */ +export { readJsonFile, writeJsonFile } from './utils/fileutils'; + +/** + * @category Utils + */ +export { stripIndents } from './utils/strip-indents'; + +/** + * @category Utils + */ +export { + joinPathFragments, + normalizePath, + getImportPath, + detectWorkspaceScope, +} from './utils/path'; + +// TODO(v16): Change this to export from './utils/workspace-root' +/** + * @category Utils + */ +export { workspaceRoot, appRootPath } from './utils/app-root'; + +/** + * @category Utils + */ +export { reverse } from './project-graph/operators'; +/** + * @category Utils + */ +export { + createProjectGraphAsync, + readCachedProjectGraph, +} from './project-graph/project-graph'; + +/** + * @category Utils + */ +export { getOutputsForTargetAndConfiguration } from './tasks-runner/utils'; + +/** + * @category Utils + */ +export { + defaultTasksRunner, + DefaultTasksRunnerOptions, + RemoteCache, +} from './tasks-runner/default-tasks-runner'; + +/** + * @category Utils + */ +export { Hash, Hasher } from './hasher/hasher'; + +/** + * @category Utils + */ +export { cacheDir } from './utils/cache-directory'; + +import { createLockFile as _createLockFile } from './lock-file/lock-file'; +import { createPackageJson as _createPackageJson } from './utils/create-package-json'; + +/** + * @category Package Manager + */ +/** + * @deprecated Import this from @nrwl/js instead + */ +export const createLockFile = _createLockFile; +/** + * @deprecated Import this from @nrwl/js instead + */ +export const createPackageJson = _createPackageJson; diff --git a/packages/nx/src/devkit-testing-exports.ts b/packages/nx/src/devkit-testing-exports.ts new file mode 100644 index 0000000000..acbaf4bea6 --- /dev/null +++ b/packages/nx/src/devkit-testing-exports.ts @@ -0,0 +1,5 @@ +export { + createTreeWithEmptyWorkspace, + createTreeWithEmptyV1Workspace, +} from './generators/testing-utils/create-tree-with-empty-workspace'; +export { createTree } from './generators/testing-utils/create-tree'; diff --git a/packages/nx/src/generators/utils/deprecated.ts b/packages/nx/src/generators/utils/deprecated.ts index 848fa604db..b3f4ed5d14 100644 --- a/packages/nx/src/generators/utils/deprecated.ts +++ b/packages/nx/src/generators/utils/deprecated.ts @@ -4,12 +4,14 @@ import { ProjectsConfigurations } from '../../config/workspace-json-project-json import type { Tree } from '../tree'; import { readNxJson, updateNxJson } from './nx-json'; +// TODO(v16): Remove this /** * @deprecated using NxJsonConfiguration */ export type WorkspaceConfiguration = Omit & Partial; +// TODO(v16): Remove this /** * Update general workspace configuration such as the default project or cli settings. * @@ -59,6 +61,7 @@ export function updateWorkspaceConfiguration( updateNxJson(tree, nxJson); } +// TODO(v16): Remove this /** * Returns if a project has a standalone configuration (project.json). * @@ -71,6 +74,7 @@ export function isStandaloneProject(tree: Tree, project: string): boolean { return true; } +// TODO(v16): Remove this /** * Read general workspace configuration such as the default project or cli settings * @@ -81,6 +85,7 @@ export function readWorkspaceConfiguration(tree: Tree): WorkspaceConfiguration { return readNxJson(tree) as any; } +// TODO(v16): Remove this /** * @deprecated all projects are configured using project.json */ diff --git a/packages/nx/src/generators/utils/nx-json.ts b/packages/nx/src/generators/utils/nx-json.ts index af7c558df8..b83526d4cd 100644 --- a/packages/nx/src/generators/utils/nx-json.ts +++ b/packages/nx/src/generators/utils/nx-json.ts @@ -4,19 +4,30 @@ import type { NxJsonConfiguration } from '../../config/nx-json'; import type { Tree } from '../tree'; import { readJson, updateJson } from './json'; +import { readNxJson as readNxJsonFromDisk } from '../../project-graph/file-utils'; + +/** + * @deprecated You must pass a {@link Tree} + */ +export function readNxJson(): NxJsonConfiguration | null; +export function readNxJson(tree: Tree): NxJsonConfiguration | null; /** * Reads nx.json */ -export function readNxJson(tree: Tree): NxJsonConfiguration | null { - if (!tree.exists('nx.json')) { - return null; +export function readNxJson(tree?: Tree): NxJsonConfiguration | null { + if (tree) { + if (!tree.exists('nx.json')) { + return null; + } + let nxJson = readJson(tree, 'nx.json'); + if (nxJson.extends) { + nxJson = { ...readNxJsonExtends(tree, nxJson.extends), ...nxJson }; + } + return nxJson; + } else { + return readNxJsonFromDisk(); } - let nxJson = readJson(tree, 'nx.json'); - if (nxJson.extends) { - nxJson = { ...readNxJsonExtends(tree, nxJson.extends), ...nxJson }; - } - return nxJson; } /** diff --git a/packages/webpack/src/plugins/generate-package-json-plugin.ts b/packages/webpack/src/plugins/generate-package-json-plugin.ts index 4448474784..88c2cfc415 100644 --- a/packages/webpack/src/plugins/generate-package-json-plugin.ts +++ b/packages/webpack/src/plugins/generate-package-json-plugin.ts @@ -1,7 +1,6 @@ import { type Compiler, sources, type WebpackPluginInstance } from 'webpack'; +import { createLockFile, createPackageJson } from '@nrwl/js'; import { - createLockFile, - createPackageJson, ExecutorContext, type ProjectGraph, serializeJson, diff --git a/scripts/documentation/generators/generate-devkit-documentation.ts b/scripts/documentation/generators/generate-devkit-documentation.ts index 5fe395358d..8adf762cef 100644 --- a/scripts/documentation/generators/generate-devkit-documentation.ts +++ b/scripts/documentation/generators/generate-devkit-documentation.ts @@ -12,7 +12,7 @@ export function generateDevkitDocumentation() { execSync('nx build typedoc-theme', execSyncOptions); execSync( - `rm -rf docs/generated/devkit && npx typedoc packages/devkit/index.ts packages/devkit/ngcli-adapter.ts --tsconfig packages/devkit/tsconfig.lib.json --out ./docs/generated/devkit --hideBreadcrumbs true --disableSources --publicPath ../../devkit/ --theme dist/typedoc-theme/src/lib --readme none`, + `rm -rf docs/generated/devkit && npx typedoc packages/devkit/index.d.ts packages/devkit/ngcli-adapter.ts --tsconfig packages/devkit/tsconfig.lib.json --out ./docs/generated/devkit --hideBreadcrumbs true --disableSources --publicPath ../../devkit/ --theme dist/typedoc-theme/src/lib --readme none`, execSyncOptions ); execSync( diff --git a/scripts/patched-jest-resolver.js b/scripts/patched-jest-resolver.js index 31628ed6a1..c365ac167e 100644 --- a/scripts/patched-jest-resolver.js +++ b/scripts/patched-jest-resolver.js @@ -3,6 +3,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); const path_1 = require('path'); const ts = require('typescript'); const fs = require('fs'); +const { relative, join } = require('path'); /** * Custom resolver which will respect package exports (until Jest supports it natively @@ -67,7 +68,9 @@ module.exports = function (path, options) { if (path.startsWith('nx/')) throw new Error('custom resolution'); if (path.indexOf('@nrwl/workspace') > -1) { - throw 'Reference to local Nx package found. Use local version instead.'; + throw new Error( + 'Reference to local Nx package found. Use local version instead.' + ); } // Global modules which must be resolved by defaultResolver @@ -80,6 +83,14 @@ module.exports = function (path, options) { // Fallback to using typescript compilerSetup = compilerSetup || getCompilerSetup(options.rootDir); const { compilerOptions, host } = compilerSetup; + + // TODO(v17): Remove this workaround + // We have some weird d.ts + .js business going on for these 2 imports so this is a workaround + if (path === '@nrwl/devkit') { + return join(__dirname, '../', './packages/devkit/index.js'); + } else if (path === '@nrwl/devkit/testing') { + return join(__dirname, '../', './packages/devkit/testing.js'); + } return ts.resolveModuleName(path, options.basedir, compilerOptions, host) .resolvedModule.resolvedFileName; }