diff --git a/docs/generated/devkit/index.md b/docs/generated/devkit/index.md index 005a65014f04e3..b66632af68a11f 100644 --- a/docs/generated/devkit/index.md +++ b/docs/generated/devkit/index.md @@ -141,12 +141,15 @@ It only uses language primitives and immutable objects - [applyAdditionalShared](../../devkit/index#applyadditionalshared) - [applyChangesToString](../../devkit/index#applychangestostring) - [applySharedFunction](../../devkit/index#applysharedfunction) +- [combineAsyncIterableIterators](../../devkit/index#combineasynciterableiterators) - [convertNxExecutor](../../devkit/index#convertnxexecutor) - [convertNxGenerator](../../devkit/index#convertnxgenerator) +- [createAsyncIterable](../../devkit/index#createasynciterable) - [createProjectGraphAsync](../../devkit/index#createprojectgraphasync) - [defaultTasksRunner](../../devkit/index#defaulttasksrunner) - [detectPackageManager](../../devkit/index#detectpackagemanager) - [detectWorkspaceScope](../../devkit/index#detectworkspacescope) +- [ensurePackage](../../devkit/index#ensurepackage) - [extractLayoutDirectory](../../devkit/index#extractlayoutdirectory) - [formatFiles](../../devkit/index#formatfiles) - [generateFiles](../../devkit/index#generatefiles) @@ -162,6 +165,7 @@ It only uses language primitives and immutable objects - [installPackagesTask](../../devkit/index#installpackagestask) - [isStandaloneProject](../../devkit/index#isstandaloneproject) - [joinPathFragments](../../devkit/index#joinpathfragments) +- [mapAsyncIterable](../../devkit/index#mapasynciterable) - [mapRemotes](../../devkit/index#mapremotes) - [mapRemotesForSSR](../../devkit/index#mapremotesforssr) - [moveFilesToNewDirectory](../../devkit/index#movefilestonewdirectory) @@ -188,6 +192,7 @@ It only uses language primitives and immutable objects - [shareWorkspaceLibraries](../../devkit/index#shareworkspacelibraries) - [stripIndents](../../devkit/index#stripindents) - [stripJsonComments](../../devkit/index#stripjsoncomments) +- [tapAsyncIterable](../../devkit/index#tapasynciterable) - [targetToTargetString](../../devkit/index#targettotargetstring) - [toJS](../../devkit/index#tojs) - [updateJson](../../devkit/index#updatejson) @@ -992,6 +997,22 @@ of the dependencies for the Module Federation build. --- +### combineAsyncIterableIterators + +▸ **combineAsyncIterableIterators**(...`iterators`): `AsyncGenerator`<`any`, `void`, `unknown`\> + +#### Parameters + +| Name | Type | +| :------------- | :--------------------------------------------------------------------------- | +| `...iterators` | { `0`: `AsyncIterableIterator`<`any`\> } & `AsyncIterableIterator`<`any`\>[] | + +#### Returns + +`AsyncGenerator`<`any`, `void`, `unknown`\> + +--- + ### convertNxExecutor ▸ **convertNxExecutor**(`executor`): `any` @@ -1062,6 +1083,28 @@ Convert an Nx Generator into an Angular Devkit Schematic. --- +### createAsyncIterable + +▸ **createAsyncIterable**<`T`\>(`listener`): `AsyncIterable`<`T`\> + +#### Type parameters + +| Name | Type | +| :--- | :-------- | +| `T` | `unknown` | + +#### Parameters + +| Name | Type | +| :--------- | :------------------------------------------- | +| `listener` | (`ls`: `AsyncPushCallbacks`<`T`\>) => `void` | + +#### Returns + +`AsyncIterable`<`T`\> + +--- + ### createProjectGraphAsync ▸ **createProjectGraphAsync**(`opts?`): `Promise`<[`ProjectGraph`](../../devkit/index#projectgraph)\> @@ -1164,6 +1207,44 @@ Detect workspace scope from the package.json name --- +### ensurePackage + +▸ **ensurePackage**(`tree`, `pkg`, `requiredVersion`, `options?`): `Promise`<`void`\> + +Ensure that dependencies and devDependencies from package.json are installed at the required versions. + +For example: + +```typescript +ensureDependencies(tree, {}, { '@nrwl/jest': nxVersion }); +``` + +This will check that @nrwl/jest@ exists in devDependencies. +If it exists then function returns, otherwise it will install the package before continuing. +When running with --dryRun, the function will throw when dependencies are missing. + +#### Parameters + +| Name | Type | Description | +| :------------------------- | :-------------------------------- | :--------------------- | +| `tree` | [`Tree`](../../devkit/index#tree) | The Tree to check with | +| `pkg` | `string` | The package to check | +| `requiredVersion` | `string` | The version to check | +| `options` | `Object` | | +| `options.cwd?` | `string` | - | +| `options.dev?` | `boolean` | - | +| `options.dryRun?` | `boolean` | - | +| `options.packageJsonPath?` | `string` | - | +| `options.packageManager?` | `"yarn"` \| `"pnpm"` \| `"npm"` | - | + +#### Returns + +`Promise`<`void`\> + +void + +--- + ### extractLayoutDirectory ▸ **extractLayoutDirectory**(`directory`): `Object` @@ -1499,6 +1580,31 @@ Normalized path fragments and joins them --- +### mapAsyncIterable + +▸ **mapAsyncIterable**<`T`, `I`, `O`\>(`data`, `transform`): `AsyncGenerator`<`Awaited`<`O`\>, `void`, `unknown`\> + +#### Type parameters + +| Name | Type | +| :--- | :---- | +| `T` | `any` | +| `I` | `any` | +| `O` | `any` | + +#### Parameters + +| Name | Type | +| :---------- | :--------------------------------------------------------------------------------------------------------- | +| `data` | `AsyncIterable`<`T`\> \| `AsyncIterableIterator`<`T`\> | +| `transform` | (`input`: `I`, `index?`: `number`, `data?`: `AsyncIterable`<`T`\> \| `AsyncIterableIterator`<`T`\>) => `O` | + +#### Returns + +`AsyncGenerator`<`Awaited`<`O`\>, `void`, `unknown`\> + +--- + ### mapRemotes ▸ **mapRemotes**(`remotes`, `remoteEntryExt`, `determineRemoteUrl`): `Record`<`string`, `string`\> @@ -2114,6 +2220,31 @@ of comments with a replaceCharacter --- +### tapAsyncIterable + +▸ **tapAsyncIterable**<`T`, `I`, `O`\>(`data`, `fn`): `AsyncGenerator`<`any`, `void`, `unknown`\> + +#### Type parameters + +| Name | Type | +| :--- | :---- | +| `T` | `any` | +| `I` | `any` | +| `O` | `any` | + +#### Parameters + +| Name | Type | +| :----- | :----------------------------------------------------- | +| `data` | `AsyncIterable`<`T`\> \| `AsyncIterableIterator`<`T`\> | +| `fn` | (`input`: `I`) => `void` | + +#### Returns + +`AsyncGenerator`<`any`, `void`, `unknown`\> + +--- + ### targetToTargetString ▸ **targetToTargetString**(`target`): `string` diff --git a/docs/generated/packages/devkit.json b/docs/generated/packages/devkit.json index 24295ddc0cd4a9..97c46d87e9064d 100644 --- a/docs/generated/packages/devkit.json +++ b/docs/generated/packages/devkit.json @@ -10,7 +10,7 @@ "id": "index", "name": "Overview", "file": "generated/devkit/index", - "content": "# Module: index\n\nThe Nx Devkit is the underlying technology used to customize Nx to support\ndifferent technologies and custom use-cases. It contains many utility\nfunctions for reading and writing files, updating configuration,\nworking with Abstract Syntax Trees(ASTs), and more.\n\nAs with most things in Nx, the core of Nx Devkit is very simple.\nIt only uses language primitives and immutable objects\n(the tree being the only exception).\n\n## Table of contents\n\n### Project Graph Enumerations\n\n- [DependencyType](../../devkit/index#dependencytype)\n\n### Utils Enumerations\n\n- [ChangeType](../../devkit/index#changetype)\n\n### Project Graph Classes\n\n- [ProjectGraphBuilder](../../devkit/index#projectgraphbuilder)\n\n### Utils Classes\n\n- [Hasher](../../devkit/index#hasher)\n\n### Workspace Classes\n\n- [Workspaces](../../devkit/index#workspaces)\n\n### Commands Interfaces\n\n- [Target](../../devkit/index#target)\n\n### Other Interfaces\n\n- [NxPlugin](../../devkit/index#nxplugin)\n\n### Project Graph Interfaces\n\n- [FileData](../../devkit/index#filedata)\n- [ProjectFileMap](../../devkit/index#projectfilemap)\n- [ProjectGraph](../../devkit/index#projectgraph)\n- [ProjectGraphDependency](../../devkit/index#projectgraphdependency)\n- [ProjectGraphExternalNode](../../devkit/index#projectgraphexternalnode)\n- [ProjectGraphProcessorContext](../../devkit/index#projectgraphprocessorcontext)\n- [ProjectGraphProjectNode](../../devkit/index#projectgraphprojectnode)\n- [ProjectGraphV4](../../devkit/index#projectgraphv4)\n\n### Tree Interfaces\n\n- [FileChange](../../devkit/index#filechange)\n- [Tree](../../devkit/index#tree)\n\n### Utils Interfaces\n\n- [DefaultTasksRunnerOptions](../../devkit/index#defaulttasksrunneroptions)\n- [Hash](../../devkit/index#hash)\n- [JsonParseOptions](../../devkit/index#jsonparseoptions)\n- [JsonSerializeOptions](../../devkit/index#jsonserializeoptions)\n- [ModuleFederationConfig](../../devkit/index#modulefederationconfig)\n- [RemoteCache](../../devkit/index#remotecache)\n- [SharedLibraryConfig](../../devkit/index#sharedlibraryconfig)\n- [StringDeletion](../../devkit/index#stringdeletion)\n- [StringInsertion](../../devkit/index#stringinsertion)\n\n### Workspace Interfaces\n\n- [ExecutorContext](../../devkit/index#executorcontext)\n- [ExecutorsJson](../../devkit/index#executorsjson)\n- [GeneratorsJson](../../devkit/index#generatorsjson)\n- [HasherContext](../../devkit/index#hashercontext)\n- [ImplicitJsonSubsetDependency](../../devkit/index#implicitjsonsubsetdependency)\n- [MigrationsJson](../../devkit/index#migrationsjson)\n- [NxAffectedConfig](../../devkit/index#nxaffectedconfig)\n- [NxJsonConfiguration](../../devkit/index#nxjsonconfiguration)\n- [ProjectConfiguration](../../devkit/index#projectconfiguration)\n- [ProjectsConfigurations](../../devkit/index#projectsconfigurations)\n- [TargetConfiguration](../../devkit/index#targetconfiguration)\n- [TargetDependencyConfig](../../devkit/index#targetdependencyconfig)\n- [Task](../../devkit/index#task)\n- [TaskGraph](../../devkit/index#taskgraph)\n- [Workspace](../../devkit/index#workspace)\n\n### Generators Type aliases\n\n- [WorkspaceConfiguration](../../devkit/index#workspaceconfiguration)\n\n### Other Type aliases\n\n- [ProjectTargetConfigurator](../../devkit/index#projecttargetconfigurator)\n\n### Package Manager Type aliases\n\n- [PackageManager](../../devkit/index#packagemanager)\n\n### Project Graph Type aliases\n\n- [ProjectGraphNode](../../devkit/index#projectgraphnode)\n\n### Utils Type aliases\n\n- [AdditionalSharedConfig](../../devkit/index#additionalsharedconfig)\n- [ModuleFederationLibrary](../../devkit/index#modulefederationlibrary)\n- [Remotes](../../devkit/index#remotes)\n- [SharedFunction](../../devkit/index#sharedfunction)\n- [SharedWorkspaceLibraryConfig](../../devkit/index#sharedworkspacelibraryconfig)\n- [StringChange](../../devkit/index#stringchange)\n- [WorkspaceLibrary](../../devkit/index#workspacelibrary)\n- [WorkspaceLibrarySecondaryEntryPoint](../../devkit/index#workspacelibrarysecondaryentrypoint)\n\n### Workspace Type aliases\n\n- [CustomHasher](../../devkit/index#customhasher)\n- [Executor](../../devkit/index#executor)\n- [Generator](../../devkit/index#generator)\n- [GeneratorCallback](../../devkit/index#generatorcallback)\n- [ImplicitDependencyEntry](../../devkit/index#implicitdependencyentry)\n- [ProjectType](../../devkit/index#projecttype)\n- [TaskGraphExecutor](../../devkit/index#taskgraphexecutor)\n- [WorkspaceJsonConfiguration](../../devkit/index#workspacejsonconfiguration)\n\n### Logger Variables\n\n- [logger](../../devkit/index#logger)\n\n### Utils Variables\n\n- [appRootPath](../../devkit/index#approotpath)\n- [cacheDir](../../devkit/index#cachedir)\n- [output](../../devkit/index#output)\n- [workspaceRoot](../../devkit/index#workspaceroot)\n\n### Functions\n\n- [addDependenciesToPackageJson](../../devkit/index#adddependenciestopackagejson)\n- [addProjectConfiguration](../../devkit/index#addprojectconfiguration)\n- [applyAdditionalShared](../../devkit/index#applyadditionalshared)\n- [applyChangesToString](../../devkit/index#applychangestostring)\n- [applySharedFunction](../../devkit/index#applysharedfunction)\n- [convertNxExecutor](../../devkit/index#convertnxexecutor)\n- [convertNxGenerator](../../devkit/index#convertnxgenerator)\n- [createProjectGraphAsync](../../devkit/index#createprojectgraphasync)\n- [defaultTasksRunner](../../devkit/index#defaulttasksrunner)\n- [detectPackageManager](../../devkit/index#detectpackagemanager)\n- [detectWorkspaceScope](../../devkit/index#detectworkspacescope)\n- [extractLayoutDirectory](../../devkit/index#extractlayoutdirectory)\n- [formatFiles](../../devkit/index#formatfiles)\n- [generateFiles](../../devkit/index#generatefiles)\n- [getDependentPackagesForProject](../../devkit/index#getdependentpackagesforproject)\n- [getImportPath](../../devkit/index#getimportpath)\n- [getNpmPackageSharedConfig](../../devkit/index#getnpmpackagesharedconfig)\n- [getOutputsForTargetAndConfiguration](../../devkit/index#getoutputsfortargetandconfiguration)\n- [getPackageManagerCommand](../../devkit/index#getpackagemanagercommand)\n- [getPackageManagerVersion](../../devkit/index#getpackagemanagerversion)\n- [getProjects](../../devkit/index#getprojects)\n- [getWorkspaceLayout](../../devkit/index#getworkspacelayout)\n- [getWorkspacePath](../../devkit/index#getworkspacepath)\n- [installPackagesTask](../../devkit/index#installpackagestask)\n- [isStandaloneProject](../../devkit/index#isstandaloneproject)\n- [joinPathFragments](../../devkit/index#joinpathfragments)\n- [mapRemotes](../../devkit/index#mapremotes)\n- [mapRemotesForSSR](../../devkit/index#mapremotesforssr)\n- [moveFilesToNewDirectory](../../devkit/index#movefilestonewdirectory)\n- [names](../../devkit/index#names)\n- [normalizePath](../../devkit/index#normalizepath)\n- [offsetFromRoot](../../devkit/index#offsetfromroot)\n- [parseJson](../../devkit/index#parsejson)\n- [parseTargetString](../../devkit/index#parsetargetstring)\n- [readAllWorkspaceConfiguration](../../devkit/index#readallworkspaceconfiguration)\n- [readCachedProjectGraph](../../devkit/index#readcachedprojectgraph)\n- [readJson](../../devkit/index#readjson)\n- [readJsonFile](../../devkit/index#readjsonfile)\n- [readNxJson](../../devkit/index#readnxjson)\n- [readProjectConfiguration](../../devkit/index#readprojectconfiguration)\n- [readRootPackageJson](../../devkit/index#readrootpackagejson)\n- [readTargetOptions](../../devkit/index#readtargetoptions)\n- [readWorkspaceConfiguration](../../devkit/index#readworkspaceconfiguration)\n- [removeDependenciesFromPackageJson](../../devkit/index#removedependenciesfrompackagejson)\n- [removeProjectConfiguration](../../devkit/index#removeprojectconfiguration)\n- [reverse](../../devkit/index#reverse)\n- [runExecutor](../../devkit/index#runexecutor)\n- [serializeJson](../../devkit/index#serializejson)\n- [sharePackages](../../devkit/index#sharepackages)\n- [shareWorkspaceLibraries](../../devkit/index#shareworkspacelibraries)\n- [stripIndents](../../devkit/index#stripindents)\n- [stripJsonComments](../../devkit/index#stripjsoncomments)\n- [targetToTargetString](../../devkit/index#targettotargetstring)\n- [toJS](../../devkit/index#tojs)\n- [updateJson](../../devkit/index#updatejson)\n- [updateProjectConfiguration](../../devkit/index#updateprojectconfiguration)\n- [updateTsConfigsToJs](../../devkit/index#updatetsconfigstojs)\n- [updateWorkspaceConfiguration](../../devkit/index#updateworkspaceconfiguration)\n- [visitNotIgnoredFiles](../../devkit/index#visitnotignoredfiles)\n- [workspaceLayout](../../devkit/index#workspacelayout)\n- [writeJson](../../devkit/index#writejson)\n- [writeJsonFile](../../devkit/index#writejsonfile)\n\n## Project Graph Enumerations\n\n### DependencyType\n\n• **DependencyType**: `Object`\n\n---\n\n## Utils Enumerations\n\n### ChangeType\n\n• **ChangeType**: `Object`\n\n## Project Graph Classes\n\n### ProjectGraphBuilder\n\n• **ProjectGraphBuilder**: `Object`\n\n---\n\n## Utils Classes\n\n### Hasher\n\n• **Hasher**: `Object`\n\n---\n\n## Workspace Classes\n\n### Workspaces\n\n• **Workspaces**: `Object`\n\n## Commands Interfaces\n\n### Target\n\n• **Target**: `Object`\n\n---\n\n## Other Interfaces\n\n### NxPlugin\n\n• **NxPlugin**: `Object`\n\nA plugin for Nx\n\n---\n\n## Project Graph Interfaces\n\n### FileData\n\n• **FileData**: `Object`\n\n---\n\n### ProjectFileMap\n\n• **ProjectFileMap**: `Object`\n\n---\n\n### ProjectGraph\n\n• **ProjectGraph**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n### ProjectGraphDependency\n\n• **ProjectGraphDependency**: `Object`\n\n---\n\n### ProjectGraphExternalNode\n\n• **ProjectGraphExternalNode**: `Object`\n\n---\n\n### ProjectGraphProcessorContext\n\n• **ProjectGraphProcessorContext**: `Object`\n\n---\n\n### ProjectGraphProjectNode\n\n• **ProjectGraphProjectNode**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n### ProjectGraphV4\n\n• **ProjectGraphV4**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n## Tree Interfaces\n\n### FileChange\n\n• **FileChange**: `Object`\n\n---\n\n### Tree\n\n• **Tree**: `Object`\n\n---\n\n## Utils Interfaces\n\n### DefaultTasksRunnerOptions\n\n• **DefaultTasksRunnerOptions**: `Object`\n\n---\n\n### Hash\n\n• **Hash**: `Object`\n\n---\n\n### JsonParseOptions\n\n• **JsonParseOptions**: `Object`\n\n---\n\n### JsonSerializeOptions\n\n• **JsonSerializeOptions**: `Object`\n\n---\n\n### ModuleFederationConfig\n\n• **ModuleFederationConfig**: `Object`\n\n---\n\n### RemoteCache\n\n• **RemoteCache**: `Object`\n\n---\n\n### SharedLibraryConfig\n\n• **SharedLibraryConfig**: `Object`\n\n---\n\n### StringDeletion\n\n• **StringDeletion**: `Object`\n\n---\n\n### StringInsertion\n\n• **StringInsertion**: `Object`\n\n---\n\n## Workspace Interfaces\n\n### ExecutorContext\n\n• **ExecutorContext**: `Object`\n\n---\n\n### ExecutorsJson\n\n• **ExecutorsJson**: `Object`\n\n---\n\n### GeneratorsJson\n\n• **GeneratorsJson**: `Object`\n\n---\n\n### HasherContext\n\n• **HasherContext**: `Object`\n\n---\n\n### ImplicitJsonSubsetDependency\n\n• **ImplicitJsonSubsetDependency**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :------------------ |\n| `T` | `\"*\"` \\| `string`[] |\n\n---\n\n### MigrationsJson\n\n• **MigrationsJson**: `Object`\n\n---\n\n### NxAffectedConfig\n\n• **NxAffectedConfig**: `Object`\n\n---\n\n### NxJsonConfiguration\n\n• **NxJsonConfiguration**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :------------------ |\n| `T` | `\"*\"` \\| `string`[] |\n\n---\n\n### ProjectConfiguration\n\n• **ProjectConfiguration**: `Object`\n\n---\n\n### ProjectsConfigurations\n\n• **ProjectsConfigurations**: `Object`\n\n---\n\n### TargetConfiguration\n\n• **TargetConfiguration**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n### TargetDependencyConfig\n\n• **TargetDependencyConfig**: `Object`\n\n---\n\n### Task\n\n• **Task**: `Object`\n\n---\n\n### TaskGraph\n\n• **TaskGraph**: `Object`\n\n---\n\n### Workspace\n\n• **Workspace**: `Object`\n\n## Generators Type aliases\n\n### WorkspaceConfiguration\n\nƬ **WorkspaceConfiguration**: `Omit`<[`ProjectsConfigurations`](../../devkit/index#projectsconfigurations), `\"projects\"`\\> & `Partial`<[`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\\>\n\n---\n\n## Other Type aliases\n\n### ProjectTargetConfigurator\n\nƬ **ProjectTargetConfigurator**: (`file`: `string`) => `Record`<`string`, [`TargetConfiguration`](../../devkit/index#targetconfiguration)\\>\n\n#### Type declaration\n\n▸ (`file`): `Record`<`string`, [`TargetConfiguration`](../../devkit/index#targetconfiguration)\\>\n\n##### Parameters\n\n| Name | Type |\n| :----- | :------- |\n| `file` | `string` |\n\n##### Returns\n\n`Record`<`string`, [`TargetConfiguration`](../../devkit/index#targetconfiguration)\\>\n\n---\n\n## Package Manager Type aliases\n\n### PackageManager\n\nƬ **PackageManager**: `\"yarn\"` \\| `\"pnpm\"` \\| `\"npm\"`\n\n---\n\n## Project Graph Type aliases\n\n### ProjectGraphNode\n\nƬ **ProjectGraphNode**<`T`\\>: [`ProjectGraphProjectNode`](../../devkit/index#projectgraphprojectnode)<`T`\\> \\| [`ProjectGraphExternalNode`](../../devkit/index#projectgraphexternalnode)\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n## Utils Type aliases\n\n### AdditionalSharedConfig\n\nƬ **AdditionalSharedConfig**: (`string` \\| [libraryName: string, sharedConfig: SharedLibraryConfig] \\| { `libraryName`: `string` ; `sharedConfig`: [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) })[]\n\n---\n\n### ModuleFederationLibrary\n\nƬ **ModuleFederationLibrary**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :----- | :------- |\n| `name` | `string` |\n| `type` | `string` |\n\n---\n\n### Remotes\n\nƬ **Remotes**: `string`[] \\| [remoteName: string, remoteUrl: string][]\n\n---\n\n### SharedFunction\n\nƬ **SharedFunction**: (`libraryName`: `string`, `sharedConfig`: [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)) => `undefined` \\| `false` \\| [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\n\n#### Type declaration\n\n▸ (`libraryName`, `sharedConfig`): `undefined` \\| `false` \\| [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\n\n##### Parameters\n\n| Name | Type |\n| :------------- | :-------------------------------------------------------------- |\n| `libraryName` | `string` |\n| `sharedConfig` | [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) |\n\n##### Returns\n\n`undefined` \\| `false` \\| [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\n\n---\n\n### SharedWorkspaceLibraryConfig\n\nƬ **SharedWorkspaceLibraryConfig**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :--------------------- | :------------------------------------------------------------------------------------------------------------ |\n| `getAliases` | () => `Record`<`string`, `string`\\> |\n| `getLibraries` | (`eager?`: `boolean`) => `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\> |\n| `getReplacementPlugin` | () => `NormalModuleReplacementPlugin` |\n\n---\n\n### StringChange\n\nƬ **StringChange**: [`StringInsertion`](../../devkit/index#stringinsertion) \\| [`StringDeletion`](../../devkit/index#stringdeletion)\n\n---\n\n### WorkspaceLibrary\n\nƬ **WorkspaceLibrary**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :---------- | :---------------------- |\n| `importKey` | `string` \\| `undefined` |\n| `name` | `string` |\n| `root` | `string` |\n\n---\n\n### WorkspaceLibrarySecondaryEntryPoint\n\nƬ **WorkspaceLibrarySecondaryEntryPoint**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :----- | :------- |\n| `name` | `string` |\n| `path` | `string` |\n\n---\n\n## Workspace Type aliases\n\n### CustomHasher\n\nƬ **CustomHasher**: (`task`: [`Task`](../../devkit/index#task), `context`: [`HasherContext`](../../devkit/index#hashercontext)) => `Promise`<[`Hash`](../../devkit/index#hash)\\>\n\n#### Type declaration\n\n▸ (`task`, `context`): `Promise`<[`Hash`](../../devkit/index#hash)\\>\n\n##### Parameters\n\n| Name | Type |\n| :-------- | :-------------------------------------------------- |\n| `task` | [`Task`](../../devkit/index#task) |\n| `context` | [`HasherContext`](../../devkit/index#hashercontext) |\n\n##### Returns\n\n`Promise`<[`Hash`](../../devkit/index#hash)\\>\n\n---\n\n### Executor\n\nƬ **Executor**<`T`\\>: (`options`: `T`, `context`: [`ExecutorContext`](../../devkit/index#executorcontext)) => `Promise`<`Object`\\> \\| `AsyncIterableIterator`<`Object`\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Type declaration\n\n▸ (`options`, `context`): `Promise`<`Object`\\> \\| `AsyncIterableIterator`<`Object`\\>\n\nImplementation of a target of a project\n\n##### Parameters\n\n| Name | Type |\n| :-------- | :------------------------------------------------------ |\n| `options` | `T` |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n##### Returns\n\n`Promise`<`Object`\\> \\| `AsyncIterableIterator`<`Object`\\>\n\n---\n\n### Generator\n\nƬ **Generator**<`T`\\>: (`tree`: `any`, `schema`: `T`) => `void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback) \\| `Promise`<`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback)\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------- |\n| `T` | `unknown` |\n\n#### Type declaration\n\n▸ (`tree`, `schema`): `void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback) \\| `Promise`<`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback)\\>\n\nA function that schedules updates to the filesystem to be done atomically\n\n##### Parameters\n\n| Name | Type |\n| :------- | :---- |\n| `tree` | `any` |\n| `schema` | `T` |\n\n##### Returns\n\n`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback) \\| `Promise`<`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback)\\>\n\n---\n\n### GeneratorCallback\n\nƬ **GeneratorCallback**: () => `void` \\| `Promise`<`void`\\>\n\n#### Type declaration\n\n▸ (): `void` \\| `Promise`<`void`\\>\n\nA callback function that is executed after changes are made to the file system\n\n##### Returns\n\n`void` \\| `Promise`<`void`\\>\n\n---\n\n### ImplicitDependencyEntry\n\nƬ **ImplicitDependencyEntry**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :------------------ |\n| `T` | `\"*\"` \\| `string`[] |\n\n#### Index signature\n\n▪ [key: `string`]: `T` \\| [`ImplicitJsonSubsetDependency`](../../devkit/index#implicitjsonsubsetdependency)<`T`\\>\n\n---\n\n### ProjectType\n\nƬ **ProjectType**: `\"library\"` \\| `\"application\"`\n\n---\n\n### TaskGraphExecutor\n\nƬ **TaskGraphExecutor**<`T`\\>: (`taskGraph`: [`TaskGraph`](../../devkit/index#taskgraph), `options`: `Record`<`string`, `T`\\>, `overrides`: `T`, `context`: [`ExecutorContext`](../../devkit/index#executorcontext)) => `Promise`<`Record`<`string`, `Object`\\>\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Type declaration\n\n▸ (`taskGraph`, `options`, `overrides`, `context`): `Promise`<`Record`<`string`, `Object`\\>\\>\n\nImplementation of a target of a project that handles multiple projects to be batched\n\n##### Parameters\n\n| Name | Type |\n| :---------- | :------------------------------------------------------ |\n| `taskGraph` | [`TaskGraph`](../../devkit/index#taskgraph) |\n| `options` | `Record`<`string`, `T`\\> |\n| `overrides` | `T` |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n##### Returns\n\n`Promise`<`Record`<`string`, `Object`\\>\\>\n\n---\n\n### WorkspaceJsonConfiguration\n\nƬ **WorkspaceJsonConfiguration**: [`ProjectsConfigurations`](../../devkit/index#projectsconfigurations)\n\n## Logger Variables\n\n### logger\n\n• **logger**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :------ | :-------------------------- |\n| `debug` | (...`s`: `any`[]) => `void` |\n| `error` | (`s`: `any`) => `void` |\n| `fatal` | (...`s`: `any`[]) => `void` |\n| `info` | (`s`: `any`) => `void` |\n| `log` | (...`s`: `any`[]) => `void` |\n| `warn` | (`s`: `any`) => `void` |\n\n---\n\n## Utils Variables\n\n### appRootPath\n\n• **appRootPath**: `string` = `workspaceRoot`\n\n---\n\n### cacheDir\n\n• **cacheDir**: `string`\n\n---\n\n### output\n\n• **output**: `CLIOutput`\n\n---\n\n### workspaceRoot\n\n• **workspaceRoot**: `string`\n\n## Functions\n\n### addDependenciesToPackageJson\n\n▸ **addDependenciesToPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nAdd Dependencies and Dev Dependencies to package.json\n\nFor example:\n\n```typescript\naddDependenciesToPackageJson(tree, { react: 'latest' }, { jest: 'latest' });\n```\n\nThis will **add** `react` and `jest` to the dependencies and devDependencies sections of package.json respectively.\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :---------------- | :-------------------------------- | :--------------- | :---------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` | Tree representing file system to modify |\n| `dependencies` | `Record`<`string`, `string`\\> | `undefined` | Dependencies to be added to the dependencies section of package.json |\n| `devDependencies` | `Record`<`string`, `string`\\> | `undefined` | Dependencies to be added to the devDependencies section of package.json |\n| `packageJsonPath` | `string` | `'package.json'` | Path to package.json |\n\n#### Returns\n\n[`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nCallback to install dependencies only if necessary, no-op otherwise\n\n---\n\n### addProjectConfiguration\n\n▸ **addProjectConfiguration**(`tree`, `projectName`, `projectConfiguration`, `standalone?`): `void`\n\nAdds project configuration to the Nx workspace.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will update either files.\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------------------- | :---------------------------------------------------------------- | :----------------------------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) |\n| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/index#projectconfiguration) | project configuration |\n| `standalone?` | `boolean` | should the project use package.json? If false, the project config is inside workspace.json |\n\n#### Returns\n\n`void`\n\n---\n\n### applyAdditionalShared\n\n▸ **applyAdditionalShared**(`sharedConfig`, `additionalShared`, `projectGraph`): `void`\n\nAdd additional dependencies to the shared package that may not have been\ndiscovered by the project graph.\n\nThis can be useful for applications that use a Dependency Injection system\nthat expects certain Singleton values to be present in the shared injection\nhierarchy.\n\n#### Parameters\n\n| Name | Type | Description |\n| :----------------- | :----------------------------------------------------------------------------------- | :--------------------------------- |\n| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\> | The original Shared Config |\n| `additionalShared` | [`AdditionalSharedConfig`](../../devkit/index#additionalsharedconfig) | The additional dependencies to add |\n| `projectGraph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> | The Nx project graph |\n\n#### Returns\n\n`void`\n\n---\n\n### applyChangesToString\n\n▸ **applyChangesToString**(`text`, `changes`): `string`\n\nApplies a list of changes to a string's original value.\n\nThis is useful when working with ASTs.\n\nFor Example, to rename a property in a method's options:\n\n```typescript\nconst code = `bootstrap({\n target: document.querySelector('#app')\n})`;\n\nconst indexOfPropertyName = 13; // Usually determined by analyzing an AST.\nconst updatedCode = applyChangesToString(code, [\n {\n type: ChangeType.Insert,\n index: indexOfPropertyName,\n text: 'element',\n },\n {\n type: ChangeType.Delete,\n start: indexOfPropertyName,\n length: 6,\n },\n]);\n\nbootstrap({\n element: document.querySelector('#app'),\n});\n```\n\n#### Parameters\n\n| Name | Type |\n| :-------- | :-------------------------------------------------- |\n| `text` | `string` |\n| `changes` | [`StringChange`](../../devkit/index#stringchange)[] |\n\n#### Returns\n\n`string`\n\n---\n\n### applySharedFunction\n\n▸ **applySharedFunction**(`sharedConfig`, `sharedFn`): `void`\n\nApply a custom function provided by the user that will modify the Shared Config\nof the dependencies for the Module Federation build.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------- | :----------------------------------------------------------------------------------- | :---------------------------------------- |\n| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\> | The original Shared Config to be modified |\n| `sharedFn` | [`SharedFunction`](../../devkit/index#sharedfunction) | The custom function to run |\n\n#### Returns\n\n`void`\n\n---\n\n### convertNxExecutor\n\n▸ **convertNxExecutor**(`executor`): `any`\n\nConvert an Nx Executor into an Angular Devkit Builder\n\nUse this to expose a compatible Angular Builder\n\n#### Parameters\n\n| Name | Type |\n| :--------- | :------------------------------------------------ |\n| `executor` | [`Executor`](../../devkit/index#executor)<`any`\\> |\n\n#### Returns\n\n`any`\n\n---\n\n### convertNxGenerator\n\n▸ **convertNxGenerator**<`T`\\>(`generator`, `skipWritingConfigInOldFormat?`): (`generatorOptions`: `T`) => (`tree`: `any`, `context`: `any`) => `Promise`<`any`\\>\n\nConvert an Nx Generator into an Angular Devkit Schematic.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :----------------------------- | :------------------------------------------------ | :------------ | :------------------------------------------------------------------------------------------------ |\n| `generator` | [`Generator`](../../devkit/index#generator)<`T`\\> | `undefined` | The Nx generator to convert to an Angular Devkit Schematic. |\n| `skipWritingConfigInOldFormat` | `boolean` | `false` | Whether to skip writing the configuration in the old format (the one used by the Angular DevKit). |\n\n#### Returns\n\n`fn`\n\n▸ (`generatorOptions`): (`tree`: `any`, `context`: `any`) => `Promise`<`any`\\>\n\n##### Parameters\n\n| Name | Type |\n| :----------------- | :--- |\n| `generatorOptions` | `T` |\n\n##### Returns\n\n`fn`\n\n▸ (`tree`, `context`): `Promise`<`any`\\>\n\n##### Parameters\n\n| Name | Type |\n| :-------- | :---- |\n| `tree` | `any` |\n| `context` | `any` |\n\n##### Returns\n\n`Promise`<`any`\\>\n\n---\n\n### createProjectGraphAsync\n\n▸ **createProjectGraphAsync**(`opts?`): `Promise`<[`ProjectGraph`](../../devkit/index#projectgraph)\\>\n\nComputes and returns a ProjectGraph.\n\nNx will compute the graph either in a daemon process or in the current process.\n\nNx will compute it in the current process if:\n\n- The process is running in CI (CI env variable is to true or other common variables used by CI providers are set).\n- It is running in the docker container.\n- The daemon process is disabled because of the previous error when starting the daemon.\n- `NX_DAEMON` is set to `false`.\n- `useDaemon` is set to false in `nx.json`\n\n`NX_DAEMON` env variable takes precedence:\n\n- If it is set to true, the daemon will always be used.\n- If it is set to false, the graph will always be computed in the current process.\n\nTip: If you want to debug project graph creation, run your command with NX_DAEMON=false.\n\nNx uses two layers of caching: the information about explicit dependencies stored on the disk and the information\nstored in the daemon process. To reset both run: `nx reset`.\n\n#### Parameters\n\n| Name | Type |\n| :------------------------ | :-------- |\n| `opts` | `Object` |\n| `opts.exitOnError` | `boolean` |\n| `opts.resetDaemonClient?` | `boolean` |\n\n#### Returns\n\n`Promise`<[`ProjectGraph`](../../devkit/index#projectgraph)\\>\n\n---\n\n### defaultTasksRunner\n\n▸ `Const` **defaultTasksRunner**(`tasks`, `options`, `context?`): `any`\n\n#### Parameters\n\n| Name | Type |\n| :--------------------------- | :------------------------------------------------------------------------------------ |\n| `tasks` | [`Task`](../../devkit/index#task)[] |\n| `options` | [`DefaultTasksRunnerOptions`](../../devkit/index#defaulttasksrunneroptions) |\n| `context?` | `Object` |\n| `context.daemon?` | `DaemonClient` |\n| `context.hasher?` | [`Hasher`](../../devkit/index#hasher) |\n| `context.initiatingProject?` | `string` |\n| `context.nxArgs` | `NxArgs` |\n| `context.nxJson` | [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)<`string`[] \\| `\"*\"`\\> |\n| `context.projectGraph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> |\n| `context.target?` | `string` |\n| `context.taskGraph?` | [`TaskGraph`](../../devkit/index#taskgraph) |\n\n#### Returns\n\n`any`\n\n---\n\n### detectPackageManager\n\n▸ **detectPackageManager**(`dir?`): [`PackageManager`](../../devkit/index#packagemanager)\n\nDetects which package manager is used in the workspace based on the lock file.\n\n#### Parameters\n\n| Name | Type | Default value |\n| :---- | :------- | :------------ |\n| `dir` | `string` | `''` |\n\n#### Returns\n\n[`PackageManager`](../../devkit/index#packagemanager)\n\n---\n\n### detectWorkspaceScope\n\n▸ **detectWorkspaceScope**(`packageName`): `string`\n\nDetect workspace scope from the package.json name\n\n#### Parameters\n\n| Name | Type |\n| :------------ | :------- |\n| `packageName` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### extractLayoutDirectory\n\n▸ **extractLayoutDirectory**(`directory`): `Object`\n\nExperimental\n\n#### Parameters\n\n| Name | Type |\n| :---------- | :------- |\n| `directory` | `string` |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :----------------- | :------- |\n| `layoutDirectory` | `string` |\n| `projectDirectory` | `string` |\n\n---\n\n### formatFiles\n\n▸ **formatFiles**(`tree`): `Promise`<`void`\\>\n\nFormats all the created or updated files using Prettier\n\n#### Parameters\n\n| Name | Type | Description |\n| :----- | :-------------------------------- | :------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n\n#### Returns\n\n`Promise`<`void`\\>\n\n---\n\n### generateFiles\n\n▸ **generateFiles**(`tree`, `srcFolder`, `target`, `substitutions`): `void`\n\nGenerates a folder of files based on provided templates.\n\nWhile doing so it performs two substitutions:\n\n- Substitutes segments of file names surrounded by \\_\\_\n- Uses ejs to substitute values in templates\n\nExamples:\n\n```typescript\ngenerateFiles(tree, path.join(__dirname, 'files'), './tools/scripts', {\n tmpl: '',\n name: 'myscript',\n});\n```\n\nThis command will take all the files from the `files` directory next to the place where the command is invoked from.\nIt will replace all `__tmpl__` with '' and all `__name__` with 'myscript' in the file names, and will replace all\n`<%= name %>` with `myscript` in the files themselves.\n`tmpl: ''` is a common pattern. With it you can name files like this: `index.ts__tmpl__`, so your editor\ndoesn't get confused about incorrect TypeScript files.\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------------- | :-------------------------------- | :-------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `srcFolder` | `string` | the source folder of files (absolute path) |\n| `target` | `string` | the target folder (relative to the tree root) |\n| `substitutions` | `Object` | an object of key-value pairs |\n\n#### Returns\n\n`void`\n\n---\n\n### getDependentPackagesForProject\n\n▸ **getDependentPackagesForProject**(`projectGraph`, `name`): `Object`\n\n#### Parameters\n\n| Name | Type |\n| :------------- | :-------------------------------------------------------- |\n| `projectGraph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> |\n| `name` | `string` |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :------------------- | :---------------------------------------------------------- |\n| `npmPackages` | `string`[] |\n| `workspaceLibraries` | [`WorkspaceLibrary`](../../devkit/index#workspacelibrary)[] |\n\n---\n\n### getImportPath\n\n▸ **getImportPath**(`npmScope`, `projectDirectory`): `string`\n\nPrefixes project name with npm scope\n\n#### Parameters\n\n| Name | Type |\n| :----------------- | :------- |\n| `npmScope` | `string` |\n| `projectDirectory` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### getNpmPackageSharedConfig\n\n▸ **getNpmPackageSharedConfig**(`pkgName`, `version`): [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) \\| `undefined`\n\nBuild the Module Federation Share Config for a specific package and the\nspecified version of that package.\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------- | :------- | :----------------------------------------------------------------------------- |\n| `pkgName` | `string` | Name of the package to share |\n| `version` | `string` | Version of the package to require by other apps in the Module Federation setup |\n\n#### Returns\n\n[`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) \\| `undefined`\n\n---\n\n### getOutputsForTargetAndConfiguration\n\n▸ **getOutputsForTargetAndConfiguration**(`task`, `node`): `string`[]\n\nReturns the list of outputs that will be cached.\n\n#### Parameters\n\n| Name | Type | Description |\n| :----- | :------------------------------------------------------------------------------ | :-------------------------------------------------------- |\n| `task` | `Pick`<[`Task`](../../devkit/index#task), `\"overrides\"` \\| `\"target\"`\\> | target + overrides |\n| `node` | [`ProjectGraphProjectNode`](../../devkit/index#projectgraphprojectnode)<`any`\\> | ProjectGraphProjectNode object that the task runs against |\n\n#### Returns\n\n`string`[]\n\n---\n\n### getPackageManagerCommand\n\n▸ **getPackageManagerCommand**(`packageManager?`): `PackageManagerCommands`\n\nReturns commands for the package manager used in the workspace.\nBy default, the package manager is derived based on the lock file,\nbut it can also be passed in explicitly.\n\nExample:\n\n```javascript\nexecSync(`${getPackageManagerCommand().addDev} my-dev-package`);\n```\n\n#### Parameters\n\n| Name | Type |\n| :--------------- | :---------------------------------------------------- |\n| `packageManager` | [`PackageManager`](../../devkit/index#packagemanager) |\n\n#### Returns\n\n`PackageManagerCommands`\n\n---\n\n### getPackageManagerVersion\n\n▸ **getPackageManagerVersion**(`packageManager?`): `string`\n\nReturns the version of the package manager used in the workspace.\nBy default, the package manager is derived based on the lock file,\nbut it can also be passed in explicitly.\n\n#### Parameters\n\n| Name | Type |\n| :--------------- | :---------------------------------------------------- |\n| `packageManager` | [`PackageManager`](../../devkit/index#packagemanager) |\n\n#### Returns\n\n`string`\n\n---\n\n### getProjects\n\n▸ **getProjects**(`tree`): `Map`<`string`, [`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\nGet a map of all projects in a workspace.\n\nUse [readProjectConfiguration](../../devkit/index#readprojectconfiguration) if only one project is needed.\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n`Map`<`string`, [`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\n---\n\n### getWorkspaceLayout\n\n▸ **getWorkspaceLayout**(`tree`): `Object`\n\nReturns workspace defaults. It includes defaults folders for apps and libs,\nand the default scope.\n\nExample:\n\n```typescript\n{ appsDir: 'apps', libsDir: 'libs', npmScope: 'myorg' }\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :----- | :-------------------------------- | :--------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | file system tree |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :-------------------- | :-------- |\n| `appsDir` | `string` |\n| `libsDir` | `string` |\n| `npmScope` | `string` |\n| `standaloneAsDefault` | `boolean` |\n\n---\n\n### getWorkspacePath\n\n▸ **getWorkspacePath**(`tree`): `\"/angular.json\"` \\| `\"/workspace.json\"` \\| `null`\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n`\"/angular.json\"` \\| `\"/workspace.json\"` \\| `null`\n\n---\n\n### installPackagesTask\n\n▸ **installPackagesTask**(`tree`, `alwaysRun?`, `cwd?`, `packageManager?`): `void`\n\nRuns `npm install` or `yarn install`. It will skip running the install if\n`package.json` hasn't changed at all or it hasn't changed since the last invocation.\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :--------------- | :---------------------------------------------------- | :------------ | :------------------------------------------------------------ |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` | the file system tree |\n| `alwaysRun` | `boolean` | `false` | always run the command even if `package.json` hasn't changed. |\n| `cwd` | `string` | `''` | - |\n| `packageManager` | [`PackageManager`](../../devkit/index#packagemanager) | `undefined` | - |\n\n#### Returns\n\n`void`\n\n---\n\n### isStandaloneProject\n\n▸ **isStandaloneProject**(`tree`, `project`): `boolean`\n\nReturns if a project has a standalone configuration (project.json).\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------- | :-------------------------------- | :------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `project` | `string` | the project name |\n\n#### Returns\n\n`boolean`\n\n---\n\n### joinPathFragments\n\n▸ **joinPathFragments**(...`fragments`): `string`\n\nNormalized path fragments and joins them\n\n#### Parameters\n\n| Name | Type |\n| :------------- | :--------- |\n| `...fragments` | `string`[] |\n\n#### Returns\n\n`string`\n\n---\n\n### mapRemotes\n\n▸ **mapRemotes**(`remotes`, `remoteEntryExt`, `determineRemoteUrl`): `Record`<`string`, `string`\\>\n\nMap remote names to a format that can be understood and used by Module\nFederation.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------------- | :-------------------------------------- | :------------------------------------------------------- |\n| `remotes` | [`Remotes`](../../devkit/index#remotes) | The remotes to map |\n| `remoteEntryExt` | `\"js\"` \\| `\"mjs\"` | The file extension of the remoteEntry file |\n| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote |\n\n#### Returns\n\n`Record`<`string`, `string`\\>\n\n---\n\n### mapRemotesForSSR\n\n▸ **mapRemotesForSSR**(`remotes`, `remoteEntryExt`, `determineRemoteUrl`): `Record`<`string`, `string`\\>\n\nMap remote names to a format that can be understood and used by Module\nFederation.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------------- | :-------------------------------------- | :------------------------------------------------------- |\n| `remotes` | [`Remotes`](../../devkit/index#remotes) | The remotes to map |\n| `remoteEntryExt` | `\"js\"` \\| `\"mjs\"` | The file extension of the remoteEntry file |\n| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote |\n\n#### Returns\n\n`Record`<`string`, `string`\\>\n\n---\n\n### moveFilesToNewDirectory\n\n▸ **moveFilesToNewDirectory**(`tree`, `oldDir`, `newDir`): `void`\n\nAnalogous to cp -r oldDir newDir\n\n#### Parameters\n\n| Name | Type |\n| :------- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `oldDir` | `string` |\n| `newDir` | `string` |\n\n#### Returns\n\n`void`\n\n---\n\n### names\n\n▸ **names**(`name`): `Object`\n\nUtil function to generate different strings based off the provided name.\n\nExamples:\n\n```typescript\nnames('my-name'); // {name: 'my-name', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}\nnames('myName'); // {name: 'myName', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}\n```\n\n#### Parameters\n\n| Name | Type |\n| :----- | :------- |\n| `name` | `string` |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :------------- | :------- |\n| `className` | `string` |\n| `constantName` | `string` |\n| `fileName` | `string` |\n| `name` | `string` |\n| `propertyName` | `string` |\n\n---\n\n### normalizePath\n\n▸ **normalizePath**(`osSpecificPath`): `string`\n\nCoverts an os specific path to a unix style path\n\n#### Parameters\n\n| Name | Type |\n| :--------------- | :------- |\n| `osSpecificPath` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### offsetFromRoot\n\n▸ **offsetFromRoot**(`fullPathToDir`): `string`\n\nCalculates an offset from the root of the workspace, which is useful for\nconstructing relative URLs.\n\nExamples:\n\n```typescript\noffsetFromRoot('apps/mydir/myapp/'); // returns \"../../../\"\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------------- | :------- | :------------- |\n| `fullPathToDir` | `string` | directory path |\n\n#### Returns\n\n`string`\n\n---\n\n### parseJson\n\n▸ **parseJson**<`T`\\>(`input`, `options?`): `T`\n\nParses the given JSON string and returns the object the JSON content represents.\nBy default javascript-style comments are allowed.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :-------------------------------------------------------- | :--------------------- |\n| `input` | `string` | JSON content as string |\n| `options?` | [`JsonParseOptions`](../../devkit/index#jsonparseoptions) | JSON parse options |\n\n#### Returns\n\n`T`\n\nObject the JSON content represents\n\n---\n\n### parseTargetString\n\n▸ **parseTargetString**(`targetString`): [`Target`](../../devkit/index#target)\n\nParses a target string into {project, target, configuration}\n\nExamples:\n\n```typescript\nparseTargetString('proj:test'); // returns { project: \"proj\", target: \"test\" }\nparseTargetString('proj:test:production'); // returns { project: \"proj\", target: \"test\", configuration: \"production\" }\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------- | :------- | :--------------- |\n| `targetString` | `string` | target reference |\n\n#### Returns\n\n[`Target`](../../devkit/index#target)\n\n---\n\n### readAllWorkspaceConfiguration\n\n▸ **readAllWorkspaceConfiguration**(): [`ProjectsConfigurations`](../../devkit/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n**`deprecated`** Use readProjectsConfigurationFromProjectGraph(await createProjectGraphAsync())\n\n#### Returns\n\n[`ProjectsConfigurations`](../../devkit/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n---\n\n### readCachedProjectGraph\n\n▸ **readCachedProjectGraph**(): [`ProjectGraph`](../../devkit/index#projectgraph)<[`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\nSynchronously reads the latest cached copy of the workspace's ProjectGraph.\n\n**`throws`** {Error} if there is no cached ProjectGraph to read from\n\n#### Returns\n\n[`ProjectGraph`](../../devkit/index#projectgraph)<[`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\n---\n\n### readJson\n\n▸ **readJson**<`T`\\>(`tree`, `path`, `options?`): `T`\n\nReads a json file, removes all comments and parses JSON.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :-------------------------------------------------------- | :-------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | file system tree |\n| `path` | `string` | file path |\n| `options?` | [`JsonParseOptions`](../../devkit/index#jsonparseoptions) | Optional JSON Parse Options |\n\n#### Returns\n\n`T`\n\n---\n\n### readJsonFile\n\n▸ **readJsonFile**<`T`\\>(`path`, `options?`): `T`\n\nReads a JSON file and returns the object the JSON content represents.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------- | :----------------- |\n| `path` | `string` | A path to a file. |\n| `options?` | `JsonReadOptions` | JSON parse options |\n\n#### Returns\n\n`T`\n\nObject the JSON content of the file represents\n\n---\n\n### readNxJson\n\n▸ **readNxJson**(): [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n#### Returns\n\n[`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n---\n\n### readProjectConfiguration\n\n▸ **readProjectConfiguration**(`tree`, `projectName`): [`ProjectConfiguration`](../../devkit/index#projectconfiguration)\n\nReads a project configuration.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will read from either file.\n\n**`throws`** If supplied projectName cannot be found\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------ | :-------------------------------- | :---------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) |\n\n#### Returns\n\n[`ProjectConfiguration`](../../devkit/index#projectconfiguration)\n\n---\n\n### readRootPackageJson\n\n▸ **readRootPackageJson**(): `Object`\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :----------------- | :------- |\n| `dependencies?` | `Object` |\n| `devDependencies?` | `Object` |\n\n---\n\n### readTargetOptions\n\n▸ **readTargetOptions**<`T`\\>(`__namedParameters`, `context`): `T`\n\nReads and combines options for a given target.\n\nWorks as if you invoked the target yourself without passing any command lint overrides.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Parameters\n\n| Name | Type |\n| :------------------ | :------------------------------------------------------ |\n| `__namedParameters` | [`Target`](../../devkit/index#target) |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n#### Returns\n\n`T`\n\n---\n\n### readWorkspaceConfiguration\n\n▸ **readWorkspaceConfiguration**(`tree`): [`WorkspaceConfiguration`](../../devkit/index#workspaceconfiguration)\n\nRead general workspace configuration such as the default project or cli settings\n\nThis does _not_ provide projects configuration, use [readProjectConfiguration](../../devkit/index#readprojectconfiguration) instead.\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n[`WorkspaceConfiguration`](../../devkit/index#workspaceconfiguration)\n\n---\n\n### removeDependenciesFromPackageJson\n\n▸ **removeDependenciesFromPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nRemove Dependencies and Dev Dependencies from package.json\n\nFor example:\n\n```typescript\nremoveDependenciesFromPackageJson(tree, ['react'], ['jest']);\n```\n\nThis will **remove** `react` and `jest` from the dependencies and devDependencies sections of package.json respectively.\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :---------------- | :-------------------------------- | :--------------- | :-------------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` | - |\n| `dependencies` | `string`[] | `undefined` | Dependencies to be removed from the dependencies section of package.json |\n| `devDependencies` | `string`[] | `undefined` | Dependencies to be removed from the devDependencies section of package.json |\n| `packageJsonPath` | `string` | `'package.json'` | - |\n\n#### Returns\n\n[`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nCallback to uninstall dependencies only if necessary. undefined is returned if changes are not necessary.\n\n---\n\n### removeProjectConfiguration\n\n▸ **removeProjectConfiguration**(`tree`, `projectName`): `void`\n\nRemoves the configuration of an existing project.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will update either file.\n\n#### Parameters\n\n| Name | Type |\n| :------------ | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `projectName` | `string` |\n\n#### Returns\n\n`void`\n\n---\n\n### reverse\n\n▸ **reverse**(`graph`): [`ProjectGraph`](../../devkit/index#projectgraph)\n\nReturns a new project graph where all the edges are reversed.\n\nFor instance, if project A depends on B, in the reversed graph\nB will depend on A.\n\n#### Parameters\n\n| Name | Type |\n| :------ | :-------------------------------------------------------- |\n| `graph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> |\n\n#### Returns\n\n[`ProjectGraph`](../../devkit/index#projectgraph)\n\n---\n\n### runExecutor\n\n▸ **runExecutor**<`T`\\>(`targetDescription`, `overrides`, `context`): `Promise`<`AsyncIterableIterator`<`T`\\>\\>\n\nLoads and invokes executor.\n\nThis is analogous to invoking executor from the terminal, with the exception\nthat the params aren't parsed from the string, but instead provided parsed already.\n\nApart from that, it works the same way:\n\n- it will load the workspace configuration\n- it will resolve the target\n- it will load the executor and the schema\n- it will load the options for the appropriate configuration\n- it will run the validations and will set the default\n- and, of course, it will invoke the executor\n\nExample:\n\n```typescript\nfor await (const s of await runExecutor(\n { project: 'myproj', target: 'serve' },\n { watch: true },\n context\n)) {\n // s.success\n}\n```\n\nNote that the return value is a promise of an iterator, so you need to await before iterating over it.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :--------------- |\n| `T` | extends `Object` |\n\n#### Parameters\n\n| Name | Type |\n| :--------------------------------- | :------------------------------------------------------ |\n| `targetDescription` | `Object` |\n| `targetDescription.configuration?` | `string` |\n| `targetDescription.project` | `string` |\n| `targetDescription.target` | `string` |\n| `overrides` | `Object` |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n#### Returns\n\n`Promise`<`AsyncIterableIterator`<`T`\\>\\>\n\n---\n\n### serializeJson\n\n▸ **serializeJson**<`T`\\>(`input`, `options?`): `string`\n\nSerializes the given data to a JSON string.\nBy default the JSON string is formatted with a 2 space intendation to be easy readable.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------------------------- |\n| `T` | extends `object` = `object` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------------------------------------------------------- | :---------------------------------------- |\n| `input` | `T` | Object which should be serialized to JSON |\n| `options?` | [`JsonSerializeOptions`](../../devkit/index#jsonserializeoptions) | JSON serialize options |\n\n#### Returns\n\n`string`\n\nthe formatted JSON representation of the object\n\n---\n\n### sharePackages\n\n▸ **sharePackages**(`packages`): `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\>\n\nCreate a dictionary of packages and their Module Federation Shared Config\nfrom an array of package names.\n\nLookup the versions of the packages from the root package.json file in the\nworkspace.\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :--------- | :-------------------------------- |\n| `packages` | `string`[] | Array of package names as strings |\n\n#### Returns\n\n`Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\>\n\n---\n\n### shareWorkspaceLibraries\n\n▸ **shareWorkspaceLibraries**(`libraries`, `tsConfigPath?`): [`SharedWorkspaceLibraryConfig`](../../devkit/index#sharedworkspacelibraryconfig)\n\nBuild an object of functions to be used with the ModuleFederationPlugin to\nshare Nx Workspace Libraries between Hosts and Remotes.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------- | :---------------------------------------------------------- | :--------------------------------------------------------------------------- |\n| `libraries` | [`WorkspaceLibrary`](../../devkit/index#workspacelibrary)[] | The Nx Workspace Libraries to share |\n| `tsConfigPath` | `string` | The path to TS Config File that contains the Path Mappings for the Libraries |\n\n#### Returns\n\n[`SharedWorkspaceLibraryConfig`](../../devkit/index#sharedworkspacelibraryconfig)\n\n---\n\n### stripIndents\n\n▸ **stripIndents**(`strings`, ...`values`): `string`\n\nRemoves indents, which is useful for printing warning and messages.\n\nExample:\n\n```typescript\nstripIndents`\n Options:\n - option1\n - option2\n`;\n```\n\n#### Parameters\n\n| Name | Type |\n| :---------- | :--------------------- |\n| `strings` | `TemplateStringsArray` |\n| `...values` | `any`[] |\n\n#### Returns\n\n`string`\n\n---\n\n### stripJsonComments\n\n▸ `Const` **stripJsonComments**(`text`, `replaceCh?`): `string`\n\nTakes JSON with JavaScript-style comments and remove\nthem. Optionally replaces every none-newline character\nof comments with a replaceCharacter\n\n#### Parameters\n\n| Name | Type |\n| :----------- | :------- |\n| `text` | `string` |\n| `replaceCh?` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### targetToTargetString\n\n▸ **targetToTargetString**(`target`): `string`\n\nReturns a string in the format \"project:target[:configuration]\" for the target\n\n#### Parameters\n\n| Name | Type | Description |\n| :------- | :------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `target` | [`Target`](../../devkit/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\" ` |\n\n#### Returns\n\n`string`\n\n---\n\n### toJS\n\n▸ **toJS**(`tree`): `void`\n\nRename and transpile any new typescript files created to javascript files\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n`void`\n\n---\n\n### updateJson\n\n▸ **updateJson**<`T`, `U`\\>(`tree`, `path`, `updater`, `options?`): `void`\n\nUpdates a JSON value to the file system tree\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n| `U` | extends `object` = `T` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | File system tree |\n| `path` | `string` | Path of JSON file in the Tree |\n| `updater` | (`value`: `T`) => `U` | Function that maps the current value of a JSON document to a new value to be written to the document |\n| `options?` | [`JsonParseOptions`](../../devkit/index#jsonparseoptions) & [`JsonSerializeOptions`](../../devkit/index#jsonserializeoptions) | Optional JSON Parse and Serialize Options |\n\n#### Returns\n\n`void`\n\n---\n\n### updateProjectConfiguration\n\n▸ **updateProjectConfiguration**(`tree`, `projectName`, `projectConfiguration`): `void`\n\nUpdates the configuration of an existing project.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will update either files.\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------------------- | :---------------------------------------------------------------- | :---------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) |\n| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/index#projectconfiguration) | project configuration |\n\n#### Returns\n\n`void`\n\n---\n\n### updateTsConfigsToJs\n\n▸ **updateTsConfigsToJs**(`tree`, `options`): `void`\n\n#### Parameters\n\n| Name | Type |\n| :-------------------- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `options` | `Object` |\n| `options.projectRoot` | `string` |\n\n#### Returns\n\n`void`\n\n---\n\n### updateWorkspaceConfiguration\n\n▸ **updateWorkspaceConfiguration**(`tree`, `workspaceConfig`): `void`\n\nUpdate general workspace configuration such as the default project or cli settings.\n\nThis does _not_ update projects configuration, use [updateProjectConfiguration](../../devkit/index#updateprojectconfiguration) or [addProjectConfiguration](../../devkit/index#addprojectconfiguration) instead.\n\n#### Parameters\n\n| Name | Type |\n| :---------------- | :-------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `workspaceConfig` | [`WorkspaceConfiguration`](../../devkit/index#workspaceconfiguration) |\n\n#### Returns\n\n`void`\n\n---\n\n### visitNotIgnoredFiles\n\n▸ **visitNotIgnoredFiles**(`tree`, `dirPath?`, `visitor`): `void`\n\nUtility to act on all files in a tree that are not ignored by git.\n\n#### Parameters\n\n| Name | Type | Default value |\n| :-------- | :-------------------------------- | :------------ |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` |\n| `dirPath` | `string` | `tree.root` |\n| `visitor` | (`path`: `string`) => `void` | `undefined` |\n\n#### Returns\n\n`void`\n\n---\n\n### workspaceLayout\n\n▸ **workspaceLayout**(): `Object`\n\nReturns information about where apps and libs will be created.\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :-------- | :------- |\n| `appsDir` | `string` |\n| `libsDir` | `string` |\n\n---\n\n### writeJson\n\n▸ **writeJson**<`T`\\>(`tree`, `path`, `value`, `options?`): `void`\n\nWrites a JSON value to the file system tree\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------------------------- |\n| `T` | extends `object` = `object` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------------------------------------------------------- | :------------------------------ |\n| `tree` | [`Tree`](../../devkit/index#tree) | File system tree |\n| `path` | `string` | Path of JSON file in the Tree |\n| `value` | `T` | Serializable value to write |\n| `options?` | [`JsonSerializeOptions`](../../devkit/index#jsonserializeoptions) | Optional JSON Serialize Options |\n\n#### Returns\n\n`void`\n\n---\n\n### writeJsonFile\n\n▸ **writeJsonFile**<`T`\\>(`path`, `data`, `options?`): `void`\n\nSerializes the given data to JSON and writes it to a file.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------------------------- |\n| `T` | extends `object` = `object` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :----------------- | :-------------------------------------------------------------- |\n| `path` | `string` | A path to a file. |\n| `data` | `T` | data which should be serialized to JSON and written to the file |\n| `options?` | `JsonWriteOptions` | JSON serialize options |\n\n#### Returns\n\n`void`\n" + "content": "# Module: index\n\nThe Nx Devkit is the underlying technology used to customize Nx to support\ndifferent technologies and custom use-cases. It contains many utility\nfunctions for reading and writing files, updating configuration,\nworking with Abstract Syntax Trees(ASTs), and more.\n\nAs with most things in Nx, the core of Nx Devkit is very simple.\nIt only uses language primitives and immutable objects\n(the tree being the only exception).\n\n## Table of contents\n\n### Project Graph Enumerations\n\n- [DependencyType](../../devkit/index#dependencytype)\n\n### Utils Enumerations\n\n- [ChangeType](../../devkit/index#changetype)\n\n### Project Graph Classes\n\n- [ProjectGraphBuilder](../../devkit/index#projectgraphbuilder)\n\n### Utils Classes\n\n- [Hasher](../../devkit/index#hasher)\n\n### Workspace Classes\n\n- [Workspaces](../../devkit/index#workspaces)\n\n### Commands Interfaces\n\n- [Target](../../devkit/index#target)\n\n### Other Interfaces\n\n- [NxPlugin](../../devkit/index#nxplugin)\n\n### Project Graph Interfaces\n\n- [FileData](../../devkit/index#filedata)\n- [ProjectFileMap](../../devkit/index#projectfilemap)\n- [ProjectGraph](../../devkit/index#projectgraph)\n- [ProjectGraphDependency](../../devkit/index#projectgraphdependency)\n- [ProjectGraphExternalNode](../../devkit/index#projectgraphexternalnode)\n- [ProjectGraphProcessorContext](../../devkit/index#projectgraphprocessorcontext)\n- [ProjectGraphProjectNode](../../devkit/index#projectgraphprojectnode)\n- [ProjectGraphV4](../../devkit/index#projectgraphv4)\n\n### Tree Interfaces\n\n- [FileChange](../../devkit/index#filechange)\n- [Tree](../../devkit/index#tree)\n\n### Utils Interfaces\n\n- [DefaultTasksRunnerOptions](../../devkit/index#defaulttasksrunneroptions)\n- [Hash](../../devkit/index#hash)\n- [JsonParseOptions](../../devkit/index#jsonparseoptions)\n- [JsonSerializeOptions](../../devkit/index#jsonserializeoptions)\n- [ModuleFederationConfig](../../devkit/index#modulefederationconfig)\n- [RemoteCache](../../devkit/index#remotecache)\n- [SharedLibraryConfig](../../devkit/index#sharedlibraryconfig)\n- [StringDeletion](../../devkit/index#stringdeletion)\n- [StringInsertion](../../devkit/index#stringinsertion)\n\n### Workspace Interfaces\n\n- [ExecutorContext](../../devkit/index#executorcontext)\n- [ExecutorsJson](../../devkit/index#executorsjson)\n- [GeneratorsJson](../../devkit/index#generatorsjson)\n- [HasherContext](../../devkit/index#hashercontext)\n- [ImplicitJsonSubsetDependency](../../devkit/index#implicitjsonsubsetdependency)\n- [MigrationsJson](../../devkit/index#migrationsjson)\n- [NxAffectedConfig](../../devkit/index#nxaffectedconfig)\n- [NxJsonConfiguration](../../devkit/index#nxjsonconfiguration)\n- [ProjectConfiguration](../../devkit/index#projectconfiguration)\n- [ProjectsConfigurations](../../devkit/index#projectsconfigurations)\n- [TargetConfiguration](../../devkit/index#targetconfiguration)\n- [TargetDependencyConfig](../../devkit/index#targetdependencyconfig)\n- [Task](../../devkit/index#task)\n- [TaskGraph](../../devkit/index#taskgraph)\n- [Workspace](../../devkit/index#workspace)\n\n### Generators Type aliases\n\n- [WorkspaceConfiguration](../../devkit/index#workspaceconfiguration)\n\n### Other Type aliases\n\n- [ProjectTargetConfigurator](../../devkit/index#projecttargetconfigurator)\n\n### Package Manager Type aliases\n\n- [PackageManager](../../devkit/index#packagemanager)\n\n### Project Graph Type aliases\n\n- [ProjectGraphNode](../../devkit/index#projectgraphnode)\n\n### Utils Type aliases\n\n- [AdditionalSharedConfig](../../devkit/index#additionalsharedconfig)\n- [ModuleFederationLibrary](../../devkit/index#modulefederationlibrary)\n- [Remotes](../../devkit/index#remotes)\n- [SharedFunction](../../devkit/index#sharedfunction)\n- [SharedWorkspaceLibraryConfig](../../devkit/index#sharedworkspacelibraryconfig)\n- [StringChange](../../devkit/index#stringchange)\n- [WorkspaceLibrary](../../devkit/index#workspacelibrary)\n- [WorkspaceLibrarySecondaryEntryPoint](../../devkit/index#workspacelibrarysecondaryentrypoint)\n\n### Workspace Type aliases\n\n- [CustomHasher](../../devkit/index#customhasher)\n- [Executor](../../devkit/index#executor)\n- [Generator](../../devkit/index#generator)\n- [GeneratorCallback](../../devkit/index#generatorcallback)\n- [ImplicitDependencyEntry](../../devkit/index#implicitdependencyentry)\n- [ProjectType](../../devkit/index#projecttype)\n- [TaskGraphExecutor](../../devkit/index#taskgraphexecutor)\n- [WorkspaceJsonConfiguration](../../devkit/index#workspacejsonconfiguration)\n\n### Logger Variables\n\n- [logger](../../devkit/index#logger)\n\n### Utils Variables\n\n- [appRootPath](../../devkit/index#approotpath)\n- [cacheDir](../../devkit/index#cachedir)\n- [output](../../devkit/index#output)\n- [workspaceRoot](../../devkit/index#workspaceroot)\n\n### Functions\n\n- [addDependenciesToPackageJson](../../devkit/index#adddependenciestopackagejson)\n- [addProjectConfiguration](../../devkit/index#addprojectconfiguration)\n- [applyAdditionalShared](../../devkit/index#applyadditionalshared)\n- [applyChangesToString](../../devkit/index#applychangestostring)\n- [applySharedFunction](../../devkit/index#applysharedfunction)\n- [combineAsyncIterableIterators](../../devkit/index#combineasynciterableiterators)\n- [convertNxExecutor](../../devkit/index#convertnxexecutor)\n- [convertNxGenerator](../../devkit/index#convertnxgenerator)\n- [createAsyncIterable](../../devkit/index#createasynciterable)\n- [createProjectGraphAsync](../../devkit/index#createprojectgraphasync)\n- [defaultTasksRunner](../../devkit/index#defaulttasksrunner)\n- [detectPackageManager](../../devkit/index#detectpackagemanager)\n- [detectWorkspaceScope](../../devkit/index#detectworkspacescope)\n- [ensurePackage](../../devkit/index#ensurepackage)\n- [extractLayoutDirectory](../../devkit/index#extractlayoutdirectory)\n- [formatFiles](../../devkit/index#formatfiles)\n- [generateFiles](../../devkit/index#generatefiles)\n- [getDependentPackagesForProject](../../devkit/index#getdependentpackagesforproject)\n- [getImportPath](../../devkit/index#getimportpath)\n- [getNpmPackageSharedConfig](../../devkit/index#getnpmpackagesharedconfig)\n- [getOutputsForTargetAndConfiguration](../../devkit/index#getoutputsfortargetandconfiguration)\n- [getPackageManagerCommand](../../devkit/index#getpackagemanagercommand)\n- [getPackageManagerVersion](../../devkit/index#getpackagemanagerversion)\n- [getProjects](../../devkit/index#getprojects)\n- [getWorkspaceLayout](../../devkit/index#getworkspacelayout)\n- [getWorkspacePath](../../devkit/index#getworkspacepath)\n- [installPackagesTask](../../devkit/index#installpackagestask)\n- [isStandaloneProject](../../devkit/index#isstandaloneproject)\n- [joinPathFragments](../../devkit/index#joinpathfragments)\n- [mapAsyncIterable](../../devkit/index#mapasynciterable)\n- [mapRemotes](../../devkit/index#mapremotes)\n- [mapRemotesForSSR](../../devkit/index#mapremotesforssr)\n- [moveFilesToNewDirectory](../../devkit/index#movefilestonewdirectory)\n- [names](../../devkit/index#names)\n- [normalizePath](../../devkit/index#normalizepath)\n- [offsetFromRoot](../../devkit/index#offsetfromroot)\n- [parseJson](../../devkit/index#parsejson)\n- [parseTargetString](../../devkit/index#parsetargetstring)\n- [readAllWorkspaceConfiguration](../../devkit/index#readallworkspaceconfiguration)\n- [readCachedProjectGraph](../../devkit/index#readcachedprojectgraph)\n- [readJson](../../devkit/index#readjson)\n- [readJsonFile](../../devkit/index#readjsonfile)\n- [readNxJson](../../devkit/index#readnxjson)\n- [readProjectConfiguration](../../devkit/index#readprojectconfiguration)\n- [readRootPackageJson](../../devkit/index#readrootpackagejson)\n- [readTargetOptions](../../devkit/index#readtargetoptions)\n- [readWorkspaceConfiguration](../../devkit/index#readworkspaceconfiguration)\n- [removeDependenciesFromPackageJson](../../devkit/index#removedependenciesfrompackagejson)\n- [removeProjectConfiguration](../../devkit/index#removeprojectconfiguration)\n- [reverse](../../devkit/index#reverse)\n- [runExecutor](../../devkit/index#runexecutor)\n- [serializeJson](../../devkit/index#serializejson)\n- [sharePackages](../../devkit/index#sharepackages)\n- [shareWorkspaceLibraries](../../devkit/index#shareworkspacelibraries)\n- [stripIndents](../../devkit/index#stripindents)\n- [stripJsonComments](../../devkit/index#stripjsoncomments)\n- [tapAsyncIterable](../../devkit/index#tapasynciterable)\n- [targetToTargetString](../../devkit/index#targettotargetstring)\n- [toJS](../../devkit/index#tojs)\n- [updateJson](../../devkit/index#updatejson)\n- [updateProjectConfiguration](../../devkit/index#updateprojectconfiguration)\n- [updateTsConfigsToJs](../../devkit/index#updatetsconfigstojs)\n- [updateWorkspaceConfiguration](../../devkit/index#updateworkspaceconfiguration)\n- [visitNotIgnoredFiles](../../devkit/index#visitnotignoredfiles)\n- [workspaceLayout](../../devkit/index#workspacelayout)\n- [writeJson](../../devkit/index#writejson)\n- [writeJsonFile](../../devkit/index#writejsonfile)\n\n## Project Graph Enumerations\n\n### DependencyType\n\n• **DependencyType**: `Object`\n\n---\n\n## Utils Enumerations\n\n### ChangeType\n\n• **ChangeType**: `Object`\n\n## Project Graph Classes\n\n### ProjectGraphBuilder\n\n• **ProjectGraphBuilder**: `Object`\n\n---\n\n## Utils Classes\n\n### Hasher\n\n• **Hasher**: `Object`\n\n---\n\n## Workspace Classes\n\n### Workspaces\n\n• **Workspaces**: `Object`\n\n## Commands Interfaces\n\n### Target\n\n• **Target**: `Object`\n\n---\n\n## Other Interfaces\n\n### NxPlugin\n\n• **NxPlugin**: `Object`\n\nA plugin for Nx\n\n---\n\n## Project Graph Interfaces\n\n### FileData\n\n• **FileData**: `Object`\n\n---\n\n### ProjectFileMap\n\n• **ProjectFileMap**: `Object`\n\n---\n\n### ProjectGraph\n\n• **ProjectGraph**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n### ProjectGraphDependency\n\n• **ProjectGraphDependency**: `Object`\n\n---\n\n### ProjectGraphExternalNode\n\n• **ProjectGraphExternalNode**: `Object`\n\n---\n\n### ProjectGraphProcessorContext\n\n• **ProjectGraphProcessorContext**: `Object`\n\n---\n\n### ProjectGraphProjectNode\n\n• **ProjectGraphProjectNode**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n### ProjectGraphV4\n\n• **ProjectGraphV4**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n## Tree Interfaces\n\n### FileChange\n\n• **FileChange**: `Object`\n\n---\n\n### Tree\n\n• **Tree**: `Object`\n\n---\n\n## Utils Interfaces\n\n### DefaultTasksRunnerOptions\n\n• **DefaultTasksRunnerOptions**: `Object`\n\n---\n\n### Hash\n\n• **Hash**: `Object`\n\n---\n\n### JsonParseOptions\n\n• **JsonParseOptions**: `Object`\n\n---\n\n### JsonSerializeOptions\n\n• **JsonSerializeOptions**: `Object`\n\n---\n\n### ModuleFederationConfig\n\n• **ModuleFederationConfig**: `Object`\n\n---\n\n### RemoteCache\n\n• **RemoteCache**: `Object`\n\n---\n\n### SharedLibraryConfig\n\n• **SharedLibraryConfig**: `Object`\n\n---\n\n### StringDeletion\n\n• **StringDeletion**: `Object`\n\n---\n\n### StringInsertion\n\n• **StringInsertion**: `Object`\n\n---\n\n## Workspace Interfaces\n\n### ExecutorContext\n\n• **ExecutorContext**: `Object`\n\n---\n\n### ExecutorsJson\n\n• **ExecutorsJson**: `Object`\n\n---\n\n### GeneratorsJson\n\n• **GeneratorsJson**: `Object`\n\n---\n\n### HasherContext\n\n• **HasherContext**: `Object`\n\n---\n\n### ImplicitJsonSubsetDependency\n\n• **ImplicitJsonSubsetDependency**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :------------------ |\n| `T` | `\"*\"` \\| `string`[] |\n\n---\n\n### MigrationsJson\n\n• **MigrationsJson**: `Object`\n\n---\n\n### NxAffectedConfig\n\n• **NxAffectedConfig**: `Object`\n\n---\n\n### NxJsonConfiguration\n\n• **NxJsonConfiguration**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :------------------ |\n| `T` | `\"*\"` \\| `string`[] |\n\n---\n\n### ProjectConfiguration\n\n• **ProjectConfiguration**: `Object`\n\n---\n\n### ProjectsConfigurations\n\n• **ProjectsConfigurations**: `Object`\n\n---\n\n### TargetConfiguration\n\n• **TargetConfiguration**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n### TargetDependencyConfig\n\n• **TargetDependencyConfig**: `Object`\n\n---\n\n### Task\n\n• **Task**: `Object`\n\n---\n\n### TaskGraph\n\n• **TaskGraph**: `Object`\n\n---\n\n### Workspace\n\n• **Workspace**: `Object`\n\n## Generators Type aliases\n\n### WorkspaceConfiguration\n\nƬ **WorkspaceConfiguration**: `Omit`<[`ProjectsConfigurations`](../../devkit/index#projectsconfigurations), `\"projects\"`\\> & `Partial`<[`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\\>\n\n---\n\n## Other Type aliases\n\n### ProjectTargetConfigurator\n\nƬ **ProjectTargetConfigurator**: (`file`: `string`) => `Record`<`string`, [`TargetConfiguration`](../../devkit/index#targetconfiguration)\\>\n\n#### Type declaration\n\n▸ (`file`): `Record`<`string`, [`TargetConfiguration`](../../devkit/index#targetconfiguration)\\>\n\n##### Parameters\n\n| Name | Type |\n| :----- | :------- |\n| `file` | `string` |\n\n##### Returns\n\n`Record`<`string`, [`TargetConfiguration`](../../devkit/index#targetconfiguration)\\>\n\n---\n\n## Package Manager Type aliases\n\n### PackageManager\n\nƬ **PackageManager**: `\"yarn\"` \\| `\"pnpm\"` \\| `\"npm\"`\n\n---\n\n## Project Graph Type aliases\n\n### ProjectGraphNode\n\nƬ **ProjectGraphNode**<`T`\\>: [`ProjectGraphProjectNode`](../../devkit/index#projectgraphprojectnode)<`T`\\> \\| [`ProjectGraphExternalNode`](../../devkit/index#projectgraphexternalnode)\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n---\n\n## Utils Type aliases\n\n### AdditionalSharedConfig\n\nƬ **AdditionalSharedConfig**: (`string` \\| [libraryName: string, sharedConfig: SharedLibraryConfig] \\| { `libraryName`: `string` ; `sharedConfig`: [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) })[]\n\n---\n\n### ModuleFederationLibrary\n\nƬ **ModuleFederationLibrary**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :----- | :------- |\n| `name` | `string` |\n| `type` | `string` |\n\n---\n\n### Remotes\n\nƬ **Remotes**: `string`[] \\| [remoteName: string, remoteUrl: string][]\n\n---\n\n### SharedFunction\n\nƬ **SharedFunction**: (`libraryName`: `string`, `sharedConfig`: [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)) => `undefined` \\| `false` \\| [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\n\n#### Type declaration\n\n▸ (`libraryName`, `sharedConfig`): `undefined` \\| `false` \\| [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\n\n##### Parameters\n\n| Name | Type |\n| :------------- | :-------------------------------------------------------------- |\n| `libraryName` | `string` |\n| `sharedConfig` | [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) |\n\n##### Returns\n\n`undefined` \\| `false` \\| [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\n\n---\n\n### SharedWorkspaceLibraryConfig\n\nƬ **SharedWorkspaceLibraryConfig**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :--------------------- | :------------------------------------------------------------------------------------------------------------ |\n| `getAliases` | () => `Record`<`string`, `string`\\> |\n| `getLibraries` | (`eager?`: `boolean`) => `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\> |\n| `getReplacementPlugin` | () => `NormalModuleReplacementPlugin` |\n\n---\n\n### StringChange\n\nƬ **StringChange**: [`StringInsertion`](../../devkit/index#stringinsertion) \\| [`StringDeletion`](../../devkit/index#stringdeletion)\n\n---\n\n### WorkspaceLibrary\n\nƬ **WorkspaceLibrary**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :---------- | :---------------------- |\n| `importKey` | `string` \\| `undefined` |\n| `name` | `string` |\n| `root` | `string` |\n\n---\n\n### WorkspaceLibrarySecondaryEntryPoint\n\nƬ **WorkspaceLibrarySecondaryEntryPoint**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :----- | :------- |\n| `name` | `string` |\n| `path` | `string` |\n\n---\n\n## Workspace Type aliases\n\n### CustomHasher\n\nƬ **CustomHasher**: (`task`: [`Task`](../../devkit/index#task), `context`: [`HasherContext`](../../devkit/index#hashercontext)) => `Promise`<[`Hash`](../../devkit/index#hash)\\>\n\n#### Type declaration\n\n▸ (`task`, `context`): `Promise`<[`Hash`](../../devkit/index#hash)\\>\n\n##### Parameters\n\n| Name | Type |\n| :-------- | :-------------------------------------------------- |\n| `task` | [`Task`](../../devkit/index#task) |\n| `context` | [`HasherContext`](../../devkit/index#hashercontext) |\n\n##### Returns\n\n`Promise`<[`Hash`](../../devkit/index#hash)\\>\n\n---\n\n### Executor\n\nƬ **Executor**<`T`\\>: (`options`: `T`, `context`: [`ExecutorContext`](../../devkit/index#executorcontext)) => `Promise`<`Object`\\> \\| `AsyncIterableIterator`<`Object`\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Type declaration\n\n▸ (`options`, `context`): `Promise`<`Object`\\> \\| `AsyncIterableIterator`<`Object`\\>\n\nImplementation of a target of a project\n\n##### Parameters\n\n| Name | Type |\n| :-------- | :------------------------------------------------------ |\n| `options` | `T` |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n##### Returns\n\n`Promise`<`Object`\\> \\| `AsyncIterableIterator`<`Object`\\>\n\n---\n\n### Generator\n\nƬ **Generator**<`T`\\>: (`tree`: `any`, `schema`: `T`) => `void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback) \\| `Promise`<`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback)\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------- |\n| `T` | `unknown` |\n\n#### Type declaration\n\n▸ (`tree`, `schema`): `void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback) \\| `Promise`<`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback)\\>\n\nA function that schedules updates to the filesystem to be done atomically\n\n##### Parameters\n\n| Name | Type |\n| :------- | :---- |\n| `tree` | `any` |\n| `schema` | `T` |\n\n##### Returns\n\n`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback) \\| `Promise`<`void` \\| [`GeneratorCallback`](../../devkit/index#generatorcallback)\\>\n\n---\n\n### GeneratorCallback\n\nƬ **GeneratorCallback**: () => `void` \\| `Promise`<`void`\\>\n\n#### Type declaration\n\n▸ (): `void` \\| `Promise`<`void`\\>\n\nA callback function that is executed after changes are made to the file system\n\n##### Returns\n\n`void` \\| `Promise`<`void`\\>\n\n---\n\n### ImplicitDependencyEntry\n\nƬ **ImplicitDependencyEntry**<`T`\\>: `Object`\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :------------------ |\n| `T` | `\"*\"` \\| `string`[] |\n\n#### Index signature\n\n▪ [key: `string`]: `T` \\| [`ImplicitJsonSubsetDependency`](../../devkit/index#implicitjsonsubsetdependency)<`T`\\>\n\n---\n\n### ProjectType\n\nƬ **ProjectType**: `\"library\"` \\| `\"application\"`\n\n---\n\n### TaskGraphExecutor\n\nƬ **TaskGraphExecutor**<`T`\\>: (`taskGraph`: [`TaskGraph`](../../devkit/index#taskgraph), `options`: `Record`<`string`, `T`\\>, `overrides`: `T`, `context`: [`ExecutorContext`](../../devkit/index#executorcontext)) => `Promise`<`Record`<`string`, `Object`\\>\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Type declaration\n\n▸ (`taskGraph`, `options`, `overrides`, `context`): `Promise`<`Record`<`string`, `Object`\\>\\>\n\nImplementation of a target of a project that handles multiple projects to be batched\n\n##### Parameters\n\n| Name | Type |\n| :---------- | :------------------------------------------------------ |\n| `taskGraph` | [`TaskGraph`](../../devkit/index#taskgraph) |\n| `options` | `Record`<`string`, `T`\\> |\n| `overrides` | `T` |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n##### Returns\n\n`Promise`<`Record`<`string`, `Object`\\>\\>\n\n---\n\n### WorkspaceJsonConfiguration\n\nƬ **WorkspaceJsonConfiguration**: [`ProjectsConfigurations`](../../devkit/index#projectsconfigurations)\n\n## Logger Variables\n\n### logger\n\n• **logger**: `Object`\n\n#### Type declaration\n\n| Name | Type |\n| :------ | :-------------------------- |\n| `debug` | (...`s`: `any`[]) => `void` |\n| `error` | (`s`: `any`) => `void` |\n| `fatal` | (...`s`: `any`[]) => `void` |\n| `info` | (`s`: `any`) => `void` |\n| `log` | (...`s`: `any`[]) => `void` |\n| `warn` | (`s`: `any`) => `void` |\n\n---\n\n## Utils Variables\n\n### appRootPath\n\n• **appRootPath**: `string` = `workspaceRoot`\n\n---\n\n### cacheDir\n\n• **cacheDir**: `string`\n\n---\n\n### output\n\n• **output**: `CLIOutput`\n\n---\n\n### workspaceRoot\n\n• **workspaceRoot**: `string`\n\n## Functions\n\n### addDependenciesToPackageJson\n\n▸ **addDependenciesToPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nAdd Dependencies and Dev Dependencies to package.json\n\nFor example:\n\n```typescript\naddDependenciesToPackageJson(tree, { react: 'latest' }, { jest: 'latest' });\n```\n\nThis will **add** `react` and `jest` to the dependencies and devDependencies sections of package.json respectively.\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :---------------- | :-------------------------------- | :--------------- | :---------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` | Tree representing file system to modify |\n| `dependencies` | `Record`<`string`, `string`\\> | `undefined` | Dependencies to be added to the dependencies section of package.json |\n| `devDependencies` | `Record`<`string`, `string`\\> | `undefined` | Dependencies to be added to the devDependencies section of package.json |\n| `packageJsonPath` | `string` | `'package.json'` | Path to package.json |\n\n#### Returns\n\n[`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nCallback to install dependencies only if necessary, no-op otherwise\n\n---\n\n### addProjectConfiguration\n\n▸ **addProjectConfiguration**(`tree`, `projectName`, `projectConfiguration`, `standalone?`): `void`\n\nAdds project configuration to the Nx workspace.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will update either files.\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------------------- | :---------------------------------------------------------------- | :----------------------------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) |\n| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/index#projectconfiguration) | project configuration |\n| `standalone?` | `boolean` | should the project use package.json? If false, the project config is inside workspace.json |\n\n#### Returns\n\n`void`\n\n---\n\n### applyAdditionalShared\n\n▸ **applyAdditionalShared**(`sharedConfig`, `additionalShared`, `projectGraph`): `void`\n\nAdd additional dependencies to the shared package that may not have been\ndiscovered by the project graph.\n\nThis can be useful for applications that use a Dependency Injection system\nthat expects certain Singleton values to be present in the shared injection\nhierarchy.\n\n#### Parameters\n\n| Name | Type | Description |\n| :----------------- | :----------------------------------------------------------------------------------- | :--------------------------------- |\n| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\> | The original Shared Config |\n| `additionalShared` | [`AdditionalSharedConfig`](../../devkit/index#additionalsharedconfig) | The additional dependencies to add |\n| `projectGraph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> | The Nx project graph |\n\n#### Returns\n\n`void`\n\n---\n\n### applyChangesToString\n\n▸ **applyChangesToString**(`text`, `changes`): `string`\n\nApplies a list of changes to a string's original value.\n\nThis is useful when working with ASTs.\n\nFor Example, to rename a property in a method's options:\n\n```typescript\nconst code = `bootstrap({\n target: document.querySelector('#app')\n})`;\n\nconst indexOfPropertyName = 13; // Usually determined by analyzing an AST.\nconst updatedCode = applyChangesToString(code, [\n {\n type: ChangeType.Insert,\n index: indexOfPropertyName,\n text: 'element',\n },\n {\n type: ChangeType.Delete,\n start: indexOfPropertyName,\n length: 6,\n },\n]);\n\nbootstrap({\n element: document.querySelector('#app'),\n});\n```\n\n#### Parameters\n\n| Name | Type |\n| :-------- | :-------------------------------------------------- |\n| `text` | `string` |\n| `changes` | [`StringChange`](../../devkit/index#stringchange)[] |\n\n#### Returns\n\n`string`\n\n---\n\n### applySharedFunction\n\n▸ **applySharedFunction**(`sharedConfig`, `sharedFn`): `void`\n\nApply a custom function provided by the user that will modify the Shared Config\nof the dependencies for the Module Federation build.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------- | :----------------------------------------------------------------------------------- | :---------------------------------------- |\n| `sharedConfig` | `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\> | The original Shared Config to be modified |\n| `sharedFn` | [`SharedFunction`](../../devkit/index#sharedfunction) | The custom function to run |\n\n#### Returns\n\n`void`\n\n---\n\n### combineAsyncIterableIterators\n\n▸ **combineAsyncIterableIterators**(...`iterators`): `AsyncGenerator`<`any`, `void`, `unknown`\\>\n\n#### Parameters\n\n| Name | Type |\n| :------------- | :--------------------------------------------------------------------------- |\n| `...iterators` | { `0`: `AsyncIterableIterator`<`any`\\> } & `AsyncIterableIterator`<`any`\\>[] |\n\n#### Returns\n\n`AsyncGenerator`<`any`, `void`, `unknown`\\>\n\n---\n\n### convertNxExecutor\n\n▸ **convertNxExecutor**(`executor`): `any`\n\nConvert an Nx Executor into an Angular Devkit Builder\n\nUse this to expose a compatible Angular Builder\n\n#### Parameters\n\n| Name | Type |\n| :--------- | :------------------------------------------------ |\n| `executor` | [`Executor`](../../devkit/index#executor)<`any`\\> |\n\n#### Returns\n\n`any`\n\n---\n\n### convertNxGenerator\n\n▸ **convertNxGenerator**<`T`\\>(`generator`, `skipWritingConfigInOldFormat?`): (`generatorOptions`: `T`) => (`tree`: `any`, `context`: `any`) => `Promise`<`any`\\>\n\nConvert an Nx Generator into an Angular Devkit Schematic.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :----------------------------- | :------------------------------------------------ | :------------ | :------------------------------------------------------------------------------------------------ |\n| `generator` | [`Generator`](../../devkit/index#generator)<`T`\\> | `undefined` | The Nx generator to convert to an Angular Devkit Schematic. |\n| `skipWritingConfigInOldFormat` | `boolean` | `false` | Whether to skip writing the configuration in the old format (the one used by the Angular DevKit). |\n\n#### Returns\n\n`fn`\n\n▸ (`generatorOptions`): (`tree`: `any`, `context`: `any`) => `Promise`<`any`\\>\n\n##### Parameters\n\n| Name | Type |\n| :----------------- | :--- |\n| `generatorOptions` | `T` |\n\n##### Returns\n\n`fn`\n\n▸ (`tree`, `context`): `Promise`<`any`\\>\n\n##### Parameters\n\n| Name | Type |\n| :-------- | :---- |\n| `tree` | `any` |\n| `context` | `any` |\n\n##### Returns\n\n`Promise`<`any`\\>\n\n---\n\n### createAsyncIterable\n\n▸ **createAsyncIterable**<`T`\\>(`listener`): `AsyncIterable`<`T`\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------- |\n| `T` | `unknown` |\n\n#### Parameters\n\n| Name | Type |\n| :--------- | :------------------------------------------- |\n| `listener` | (`ls`: `AsyncPushCallbacks`<`T`\\>) => `void` |\n\n#### Returns\n\n`AsyncIterable`<`T`\\>\n\n---\n\n### createProjectGraphAsync\n\n▸ **createProjectGraphAsync**(`opts?`): `Promise`<[`ProjectGraph`](../../devkit/index#projectgraph)\\>\n\nComputes and returns a ProjectGraph.\n\nNx will compute the graph either in a daemon process or in the current process.\n\nNx will compute it in the current process if:\n\n- The process is running in CI (CI env variable is to true or other common variables used by CI providers are set).\n- It is running in the docker container.\n- The daemon process is disabled because of the previous error when starting the daemon.\n- `NX_DAEMON` is set to `false`.\n- `useDaemon` is set to false in `nx.json`\n\n`NX_DAEMON` env variable takes precedence:\n\n- If it is set to true, the daemon will always be used.\n- If it is set to false, the graph will always be computed in the current process.\n\nTip: If you want to debug project graph creation, run your command with NX_DAEMON=false.\n\nNx uses two layers of caching: the information about explicit dependencies stored on the disk and the information\nstored in the daemon process. To reset both run: `nx reset`.\n\n#### Parameters\n\n| Name | Type |\n| :------------------------ | :-------- |\n| `opts` | `Object` |\n| `opts.exitOnError` | `boolean` |\n| `opts.resetDaemonClient?` | `boolean` |\n\n#### Returns\n\n`Promise`<[`ProjectGraph`](../../devkit/index#projectgraph)\\>\n\n---\n\n### defaultTasksRunner\n\n▸ `Const` **defaultTasksRunner**(`tasks`, `options`, `context?`): `any`\n\n#### Parameters\n\n| Name | Type |\n| :--------------------------- | :------------------------------------------------------------------------------------ |\n| `tasks` | [`Task`](../../devkit/index#task)[] |\n| `options` | [`DefaultTasksRunnerOptions`](../../devkit/index#defaulttasksrunneroptions) |\n| `context?` | `Object` |\n| `context.daemon?` | `DaemonClient` |\n| `context.hasher?` | [`Hasher`](../../devkit/index#hasher) |\n| `context.initiatingProject?` | `string` |\n| `context.nxArgs` | `NxArgs` |\n| `context.nxJson` | [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)<`string`[] \\| `\"*\"`\\> |\n| `context.projectGraph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> |\n| `context.target?` | `string` |\n| `context.taskGraph?` | [`TaskGraph`](../../devkit/index#taskgraph) |\n\n#### Returns\n\n`any`\n\n---\n\n### detectPackageManager\n\n▸ **detectPackageManager**(`dir?`): [`PackageManager`](../../devkit/index#packagemanager)\n\nDetects which package manager is used in the workspace based on the lock file.\n\n#### Parameters\n\n| Name | Type | Default value |\n| :---- | :------- | :------------ |\n| `dir` | `string` | `''` |\n\n#### Returns\n\n[`PackageManager`](../../devkit/index#packagemanager)\n\n---\n\n### detectWorkspaceScope\n\n▸ **detectWorkspaceScope**(`packageName`): `string`\n\nDetect workspace scope from the package.json name\n\n#### Parameters\n\n| Name | Type |\n| :------------ | :------- |\n| `packageName` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### ensurePackage\n\n▸ **ensurePackage**(`tree`, `pkg`, `requiredVersion`, `options?`): `Promise`<`void`\\>\n\nEnsure that dependencies and devDependencies from package.json are installed at the required versions.\n\nFor example:\n\n```typescript\nensureDependencies(tree, {}, { '@nrwl/jest': nxVersion });\n```\n\nThis will check that @nrwl/jest@ exists in devDependencies.\nIf it exists then function returns, otherwise it will install the package before continuing.\nWhen running with --dryRun, the function will throw when dependencies are missing.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------------------- | :-------------------------------- | :--------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | The Tree to check with |\n| `pkg` | `string` | The package to check |\n| `requiredVersion` | `string` | The version to check |\n| `options` | `Object` | |\n| `options.cwd?` | `string` | - |\n| `options.dev?` | `boolean` | - |\n| `options.dryRun?` | `boolean` | - |\n| `options.packageJsonPath?` | `string` | - |\n| `options.packageManager?` | `\"yarn\"` \\| `\"pnpm\"` \\| `\"npm\"` | - |\n\n#### Returns\n\n`Promise`<`void`\\>\n\nvoid\n\n---\n\n### extractLayoutDirectory\n\n▸ **extractLayoutDirectory**(`directory`): `Object`\n\nExperimental\n\n#### Parameters\n\n| Name | Type |\n| :---------- | :------- |\n| `directory` | `string` |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :----------------- | :------- |\n| `layoutDirectory` | `string` |\n| `projectDirectory` | `string` |\n\n---\n\n### formatFiles\n\n▸ **formatFiles**(`tree`): `Promise`<`void`\\>\n\nFormats all the created or updated files using Prettier\n\n#### Parameters\n\n| Name | Type | Description |\n| :----- | :-------------------------------- | :------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n\n#### Returns\n\n`Promise`<`void`\\>\n\n---\n\n### generateFiles\n\n▸ **generateFiles**(`tree`, `srcFolder`, `target`, `substitutions`): `void`\n\nGenerates a folder of files based on provided templates.\n\nWhile doing so it performs two substitutions:\n\n- Substitutes segments of file names surrounded by \\_\\_\n- Uses ejs to substitute values in templates\n\nExamples:\n\n```typescript\ngenerateFiles(tree, path.join(__dirname, 'files'), './tools/scripts', {\n tmpl: '',\n name: 'myscript',\n});\n```\n\nThis command will take all the files from the `files` directory next to the place where the command is invoked from.\nIt will replace all `__tmpl__` with '' and all `__name__` with 'myscript' in the file names, and will replace all\n`<%= name %>` with `myscript` in the files themselves.\n`tmpl: ''` is a common pattern. With it you can name files like this: `index.ts__tmpl__`, so your editor\ndoesn't get confused about incorrect TypeScript files.\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------------- | :-------------------------------- | :-------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `srcFolder` | `string` | the source folder of files (absolute path) |\n| `target` | `string` | the target folder (relative to the tree root) |\n| `substitutions` | `Object` | an object of key-value pairs |\n\n#### Returns\n\n`void`\n\n---\n\n### getDependentPackagesForProject\n\n▸ **getDependentPackagesForProject**(`projectGraph`, `name`): `Object`\n\n#### Parameters\n\n| Name | Type |\n| :------------- | :-------------------------------------------------------- |\n| `projectGraph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> |\n| `name` | `string` |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :------------------- | :---------------------------------------------------------- |\n| `npmPackages` | `string`[] |\n| `workspaceLibraries` | [`WorkspaceLibrary`](../../devkit/index#workspacelibrary)[] |\n\n---\n\n### getImportPath\n\n▸ **getImportPath**(`npmScope`, `projectDirectory`): `string`\n\nPrefixes project name with npm scope\n\n#### Parameters\n\n| Name | Type |\n| :----------------- | :------- |\n| `npmScope` | `string` |\n| `projectDirectory` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### getNpmPackageSharedConfig\n\n▸ **getNpmPackageSharedConfig**(`pkgName`, `version`): [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) \\| `undefined`\n\nBuild the Module Federation Share Config for a specific package and the\nspecified version of that package.\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------- | :------- | :----------------------------------------------------------------------------- |\n| `pkgName` | `string` | Name of the package to share |\n| `version` | `string` | Version of the package to require by other apps in the Module Federation setup |\n\n#### Returns\n\n[`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig) \\| `undefined`\n\n---\n\n### getOutputsForTargetAndConfiguration\n\n▸ **getOutputsForTargetAndConfiguration**(`task`, `node`): `string`[]\n\nReturns the list of outputs that will be cached.\n\n#### Parameters\n\n| Name | Type | Description |\n| :----- | :------------------------------------------------------------------------------ | :-------------------------------------------------------- |\n| `task` | `Pick`<[`Task`](../../devkit/index#task), `\"overrides\"` \\| `\"target\"`\\> | target + overrides |\n| `node` | [`ProjectGraphProjectNode`](../../devkit/index#projectgraphprojectnode)<`any`\\> | ProjectGraphProjectNode object that the task runs against |\n\n#### Returns\n\n`string`[]\n\n---\n\n### getPackageManagerCommand\n\n▸ **getPackageManagerCommand**(`packageManager?`): `PackageManagerCommands`\n\nReturns commands for the package manager used in the workspace.\nBy default, the package manager is derived based on the lock file,\nbut it can also be passed in explicitly.\n\nExample:\n\n```javascript\nexecSync(`${getPackageManagerCommand().addDev} my-dev-package`);\n```\n\n#### Parameters\n\n| Name | Type |\n| :--------------- | :---------------------------------------------------- |\n| `packageManager` | [`PackageManager`](../../devkit/index#packagemanager) |\n\n#### Returns\n\n`PackageManagerCommands`\n\n---\n\n### getPackageManagerVersion\n\n▸ **getPackageManagerVersion**(`packageManager?`): `string`\n\nReturns the version of the package manager used in the workspace.\nBy default, the package manager is derived based on the lock file,\nbut it can also be passed in explicitly.\n\n#### Parameters\n\n| Name | Type |\n| :--------------- | :---------------------------------------------------- |\n| `packageManager` | [`PackageManager`](../../devkit/index#packagemanager) |\n\n#### Returns\n\n`string`\n\n---\n\n### getProjects\n\n▸ **getProjects**(`tree`): `Map`<`string`, [`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\nGet a map of all projects in a workspace.\n\nUse [readProjectConfiguration](../../devkit/index#readprojectconfiguration) if only one project is needed.\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n`Map`<`string`, [`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\n---\n\n### getWorkspaceLayout\n\n▸ **getWorkspaceLayout**(`tree`): `Object`\n\nReturns workspace defaults. It includes defaults folders for apps and libs,\nand the default scope.\n\nExample:\n\n```typescript\n{ appsDir: 'apps', libsDir: 'libs', npmScope: 'myorg' }\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :----- | :-------------------------------- | :--------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | file system tree |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :-------------------- | :-------- |\n| `appsDir` | `string` |\n| `libsDir` | `string` |\n| `npmScope` | `string` |\n| `standaloneAsDefault` | `boolean` |\n\n---\n\n### getWorkspacePath\n\n▸ **getWorkspacePath**(`tree`): `\"/angular.json\"` \\| `\"/workspace.json\"` \\| `null`\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n`\"/angular.json\"` \\| `\"/workspace.json\"` \\| `null`\n\n---\n\n### installPackagesTask\n\n▸ **installPackagesTask**(`tree`, `alwaysRun?`, `cwd?`, `packageManager?`): `void`\n\nRuns `npm install` or `yarn install`. It will skip running the install if\n`package.json` hasn't changed at all or it hasn't changed since the last invocation.\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :--------------- | :---------------------------------------------------- | :------------ | :------------------------------------------------------------ |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` | the file system tree |\n| `alwaysRun` | `boolean` | `false` | always run the command even if `package.json` hasn't changed. |\n| `cwd` | `string` | `''` | - |\n| `packageManager` | [`PackageManager`](../../devkit/index#packagemanager) | `undefined` | - |\n\n#### Returns\n\n`void`\n\n---\n\n### isStandaloneProject\n\n▸ **isStandaloneProject**(`tree`, `project`): `boolean`\n\nReturns if a project has a standalone configuration (project.json).\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------- | :-------------------------------- | :------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `project` | `string` | the project name |\n\n#### Returns\n\n`boolean`\n\n---\n\n### joinPathFragments\n\n▸ **joinPathFragments**(...`fragments`): `string`\n\nNormalized path fragments and joins them\n\n#### Parameters\n\n| Name | Type |\n| :------------- | :--------- |\n| `...fragments` | `string`[] |\n\n#### Returns\n\n`string`\n\n---\n\n### mapAsyncIterable\n\n▸ **mapAsyncIterable**<`T`, `I`, `O`\\>(`data`, `transform`): `AsyncGenerator`<`Awaited`<`O`\\>, `void`, `unknown`\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n| `I` | `any` |\n| `O` | `any` |\n\n#### Parameters\n\n| Name | Type |\n| :---------- | :--------------------------------------------------------------------------------------------------------- |\n| `data` | `AsyncIterable`<`T`\\> \\| `AsyncIterableIterator`<`T`\\> |\n| `transform` | (`input`: `I`, `index?`: `number`, `data?`: `AsyncIterable`<`T`\\> \\| `AsyncIterableIterator`<`T`\\>) => `O` |\n\n#### Returns\n\n`AsyncGenerator`<`Awaited`<`O`\\>, `void`, `unknown`\\>\n\n---\n\n### mapRemotes\n\n▸ **mapRemotes**(`remotes`, `remoteEntryExt`, `determineRemoteUrl`): `Record`<`string`, `string`\\>\n\nMap remote names to a format that can be understood and used by Module\nFederation.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------------- | :-------------------------------------- | :------------------------------------------------------- |\n| `remotes` | [`Remotes`](../../devkit/index#remotes) | The remotes to map |\n| `remoteEntryExt` | `\"js\"` \\| `\"mjs\"` | The file extension of the remoteEntry file |\n| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote |\n\n#### Returns\n\n`Record`<`string`, `string`\\>\n\n---\n\n### mapRemotesForSSR\n\n▸ **mapRemotesForSSR**(`remotes`, `remoteEntryExt`, `determineRemoteUrl`): `Record`<`string`, `string`\\>\n\nMap remote names to a format that can be understood and used by Module\nFederation.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------------- | :-------------------------------------- | :------------------------------------------------------- |\n| `remotes` | [`Remotes`](../../devkit/index#remotes) | The remotes to map |\n| `remoteEntryExt` | `\"js\"` \\| `\"mjs\"` | The file extension of the remoteEntry file |\n| `determineRemoteUrl` | (`remote`: `string`) => `string` | The function used to lookup the URL of the served remote |\n\n#### Returns\n\n`Record`<`string`, `string`\\>\n\n---\n\n### moveFilesToNewDirectory\n\n▸ **moveFilesToNewDirectory**(`tree`, `oldDir`, `newDir`): `void`\n\nAnalogous to cp -r oldDir newDir\n\n#### Parameters\n\n| Name | Type |\n| :------- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `oldDir` | `string` |\n| `newDir` | `string` |\n\n#### Returns\n\n`void`\n\n---\n\n### names\n\n▸ **names**(`name`): `Object`\n\nUtil function to generate different strings based off the provided name.\n\nExamples:\n\n```typescript\nnames('my-name'); // {name: 'my-name', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}\nnames('myName'); // {name: 'myName', className: 'MyName', propertyName: 'myName', constantName: 'MY_NAME', fileName: 'my-name'}\n```\n\n#### Parameters\n\n| Name | Type |\n| :----- | :------- |\n| `name` | `string` |\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :------------- | :------- |\n| `className` | `string` |\n| `constantName` | `string` |\n| `fileName` | `string` |\n| `name` | `string` |\n| `propertyName` | `string` |\n\n---\n\n### normalizePath\n\n▸ **normalizePath**(`osSpecificPath`): `string`\n\nCoverts an os specific path to a unix style path\n\n#### Parameters\n\n| Name | Type |\n| :--------------- | :------- |\n| `osSpecificPath` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### offsetFromRoot\n\n▸ **offsetFromRoot**(`fullPathToDir`): `string`\n\nCalculates an offset from the root of the workspace, which is useful for\nconstructing relative URLs.\n\nExamples:\n\n```typescript\noffsetFromRoot('apps/mydir/myapp/'); // returns \"../../../\"\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :-------------- | :------- | :------------- |\n| `fullPathToDir` | `string` | directory path |\n\n#### Returns\n\n`string`\n\n---\n\n### parseJson\n\n▸ **parseJson**<`T`\\>(`input`, `options?`): `T`\n\nParses the given JSON string and returns the object the JSON content represents.\nBy default javascript-style comments are allowed.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :-------------------------------------------------------- | :--------------------- |\n| `input` | `string` | JSON content as string |\n| `options?` | [`JsonParseOptions`](../../devkit/index#jsonparseoptions) | JSON parse options |\n\n#### Returns\n\n`T`\n\nObject the JSON content represents\n\n---\n\n### parseTargetString\n\n▸ **parseTargetString**(`targetString`): [`Target`](../../devkit/index#target)\n\nParses a target string into {project, target, configuration}\n\nExamples:\n\n```typescript\nparseTargetString('proj:test'); // returns { project: \"proj\", target: \"test\" }\nparseTargetString('proj:test:production'); // returns { project: \"proj\", target: \"test\", configuration: \"production\" }\n```\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------- | :------- | :--------------- |\n| `targetString` | `string` | target reference |\n\n#### Returns\n\n[`Target`](../../devkit/index#target)\n\n---\n\n### readAllWorkspaceConfiguration\n\n▸ **readAllWorkspaceConfiguration**(): [`ProjectsConfigurations`](../../devkit/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n**`deprecated`** Use readProjectsConfigurationFromProjectGraph(await createProjectGraphAsync())\n\n#### Returns\n\n[`ProjectsConfigurations`](../../devkit/index#projectsconfigurations) & [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n---\n\n### readCachedProjectGraph\n\n▸ **readCachedProjectGraph**(): [`ProjectGraph`](../../devkit/index#projectgraph)<[`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\nSynchronously reads the latest cached copy of the workspace's ProjectGraph.\n\n**`throws`** {Error} if there is no cached ProjectGraph to read from\n\n#### Returns\n\n[`ProjectGraph`](../../devkit/index#projectgraph)<[`ProjectConfiguration`](../../devkit/index#projectconfiguration)\\>\n\n---\n\n### readJson\n\n▸ **readJson**<`T`\\>(`tree`, `path`, `options?`): `T`\n\nReads a json file, removes all comments and parses JSON.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :-------------------------------------------------------- | :-------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | file system tree |\n| `path` | `string` | file path |\n| `options?` | [`JsonParseOptions`](../../devkit/index#jsonparseoptions) | Optional JSON Parse Options |\n\n#### Returns\n\n`T`\n\n---\n\n### readJsonFile\n\n▸ **readJsonFile**<`T`\\>(`path`, `options?`): `T`\n\nReads a JSON file and returns the object the JSON content represents.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------- | :----------------- |\n| `path` | `string` | A path to a file. |\n| `options?` | `JsonReadOptions` | JSON parse options |\n\n#### Returns\n\n`T`\n\nObject the JSON content of the file represents\n\n---\n\n### readNxJson\n\n▸ **readNxJson**(): [`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n#### Returns\n\n[`NxJsonConfiguration`](../../devkit/index#nxjsonconfiguration)\n\n---\n\n### readProjectConfiguration\n\n▸ **readProjectConfiguration**(`tree`, `projectName`): [`ProjectConfiguration`](../../devkit/index#projectconfiguration)\n\nReads a project configuration.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will read from either file.\n\n**`throws`** If supplied projectName cannot be found\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------ | :-------------------------------- | :---------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) |\n\n#### Returns\n\n[`ProjectConfiguration`](../../devkit/index#projectconfiguration)\n\n---\n\n### readRootPackageJson\n\n▸ **readRootPackageJson**(): `Object`\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :----------------- | :------- |\n| `dependencies?` | `Object` |\n| `devDependencies?` | `Object` |\n\n---\n\n### readTargetOptions\n\n▸ **readTargetOptions**<`T`\\>(`__namedParameters`, `context`): `T`\n\nReads and combines options for a given target.\n\nWorks as if you invoked the target yourself without passing any command lint overrides.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n\n#### Parameters\n\n| Name | Type |\n| :------------------ | :------------------------------------------------------ |\n| `__namedParameters` | [`Target`](../../devkit/index#target) |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n#### Returns\n\n`T`\n\n---\n\n### readWorkspaceConfiguration\n\n▸ **readWorkspaceConfiguration**(`tree`): [`WorkspaceConfiguration`](../../devkit/index#workspaceconfiguration)\n\nRead general workspace configuration such as the default project or cli settings\n\nThis does _not_ provide projects configuration, use [readProjectConfiguration](../../devkit/index#readprojectconfiguration) instead.\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n[`WorkspaceConfiguration`](../../devkit/index#workspaceconfiguration)\n\n---\n\n### removeDependenciesFromPackageJson\n\n▸ **removeDependenciesFromPackageJson**(`tree`, `dependencies`, `devDependencies`, `packageJsonPath?`): [`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nRemove Dependencies and Dev Dependencies from package.json\n\nFor example:\n\n```typescript\nremoveDependenciesFromPackageJson(tree, ['react'], ['jest']);\n```\n\nThis will **remove** `react` and `jest` from the dependencies and devDependencies sections of package.json respectively.\n\n#### Parameters\n\n| Name | Type | Default value | Description |\n| :---------------- | :-------------------------------- | :--------------- | :-------------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` | - |\n| `dependencies` | `string`[] | `undefined` | Dependencies to be removed from the dependencies section of package.json |\n| `devDependencies` | `string`[] | `undefined` | Dependencies to be removed from the devDependencies section of package.json |\n| `packageJsonPath` | `string` | `'package.json'` | - |\n\n#### Returns\n\n[`GeneratorCallback`](../../devkit/index#generatorcallback)\n\nCallback to uninstall dependencies only if necessary. undefined is returned if changes are not necessary.\n\n---\n\n### removeProjectConfiguration\n\n▸ **removeProjectConfiguration**(`tree`, `projectName`): `void`\n\nRemoves the configuration of an existing project.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will update either file.\n\n#### Parameters\n\n| Name | Type |\n| :------------ | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `projectName` | `string` |\n\n#### Returns\n\n`void`\n\n---\n\n### reverse\n\n▸ **reverse**(`graph`): [`ProjectGraph`](../../devkit/index#projectgraph)\n\nReturns a new project graph where all the edges are reversed.\n\nFor instance, if project A depends on B, in the reversed graph\nB will depend on A.\n\n#### Parameters\n\n| Name | Type |\n| :------ | :-------------------------------------------------------- |\n| `graph` | [`ProjectGraph`](../../devkit/index#projectgraph)<`any`\\> |\n\n#### Returns\n\n[`ProjectGraph`](../../devkit/index#projectgraph)\n\n---\n\n### runExecutor\n\n▸ **runExecutor**<`T`\\>(`targetDescription`, `overrides`, `context`): `Promise`<`AsyncIterableIterator`<`T`\\>\\>\n\nLoads and invokes executor.\n\nThis is analogous to invoking executor from the terminal, with the exception\nthat the params aren't parsed from the string, but instead provided parsed already.\n\nApart from that, it works the same way:\n\n- it will load the workspace configuration\n- it will resolve the target\n- it will load the executor and the schema\n- it will load the options for the appropriate configuration\n- it will run the validations and will set the default\n- and, of course, it will invoke the executor\n\nExample:\n\n```typescript\nfor await (const s of await runExecutor(\n { project: 'myproj', target: 'serve' },\n { watch: true },\n context\n)) {\n // s.success\n}\n```\n\nNote that the return value is a promise of an iterator, so you need to await before iterating over it.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :--------------- |\n| `T` | extends `Object` |\n\n#### Parameters\n\n| Name | Type |\n| :--------------------------------- | :------------------------------------------------------ |\n| `targetDescription` | `Object` |\n| `targetDescription.configuration?` | `string` |\n| `targetDescription.project` | `string` |\n| `targetDescription.target` | `string` |\n| `overrides` | `Object` |\n| `context` | [`ExecutorContext`](../../devkit/index#executorcontext) |\n\n#### Returns\n\n`Promise`<`AsyncIterableIterator`<`T`\\>\\>\n\n---\n\n### serializeJson\n\n▸ **serializeJson**<`T`\\>(`input`, `options?`): `string`\n\nSerializes the given data to a JSON string.\nBy default the JSON string is formatted with a 2 space intendation to be easy readable.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------------------------- |\n| `T` | extends `object` = `object` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------------------------------------------------------- | :---------------------------------------- |\n| `input` | `T` | Object which should be serialized to JSON |\n| `options?` | [`JsonSerializeOptions`](../../devkit/index#jsonserializeoptions) | JSON serialize options |\n\n#### Returns\n\n`string`\n\nthe formatted JSON representation of the object\n\n---\n\n### sharePackages\n\n▸ **sharePackages**(`packages`): `Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\>\n\nCreate a dictionary of packages and their Module Federation Shared Config\nfrom an array of package names.\n\nLookup the versions of the packages from the root package.json file in the\nworkspace.\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :--------- | :-------------------------------- |\n| `packages` | `string`[] | Array of package names as strings |\n\n#### Returns\n\n`Record`<`string`, [`SharedLibraryConfig`](../../devkit/index#sharedlibraryconfig)\\>\n\n---\n\n### shareWorkspaceLibraries\n\n▸ **shareWorkspaceLibraries**(`libraries`, `tsConfigPath?`): [`SharedWorkspaceLibraryConfig`](../../devkit/index#sharedworkspacelibraryconfig)\n\nBuild an object of functions to be used with the ModuleFederationPlugin to\nshare Nx Workspace Libraries between Hosts and Remotes.\n\n#### Parameters\n\n| Name | Type | Description |\n| :------------- | :---------------------------------------------------------- | :--------------------------------------------------------------------------- |\n| `libraries` | [`WorkspaceLibrary`](../../devkit/index#workspacelibrary)[] | The Nx Workspace Libraries to share |\n| `tsConfigPath` | `string` | The path to TS Config File that contains the Path Mappings for the Libraries |\n\n#### Returns\n\n[`SharedWorkspaceLibraryConfig`](../../devkit/index#sharedworkspacelibraryconfig)\n\n---\n\n### stripIndents\n\n▸ **stripIndents**(`strings`, ...`values`): `string`\n\nRemoves indents, which is useful for printing warning and messages.\n\nExample:\n\n```typescript\nstripIndents`\n Options:\n - option1\n - option2\n`;\n```\n\n#### Parameters\n\n| Name | Type |\n| :---------- | :--------------------- |\n| `strings` | `TemplateStringsArray` |\n| `...values` | `any`[] |\n\n#### Returns\n\n`string`\n\n---\n\n### stripJsonComments\n\n▸ `Const` **stripJsonComments**(`text`, `replaceCh?`): `string`\n\nTakes JSON with JavaScript-style comments and remove\nthem. Optionally replaces every none-newline character\nof comments with a replaceCharacter\n\n#### Parameters\n\n| Name | Type |\n| :----------- | :------- |\n| `text` | `string` |\n| `replaceCh?` | `string` |\n\n#### Returns\n\n`string`\n\n---\n\n### tapAsyncIterable\n\n▸ **tapAsyncIterable**<`T`, `I`, `O`\\>(`data`, `fn`): `AsyncGenerator`<`any`, `void`, `unknown`\\>\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :---- |\n| `T` | `any` |\n| `I` | `any` |\n| `O` | `any` |\n\n#### Parameters\n\n| Name | Type |\n| :----- | :----------------------------------------------------- |\n| `data` | `AsyncIterable`<`T`\\> \\| `AsyncIterableIterator`<`T`\\> |\n| `fn` | (`input`: `I`) => `void` |\n\n#### Returns\n\n`AsyncGenerator`<`any`, `void`, `unknown`\\>\n\n---\n\n### targetToTargetString\n\n▸ **targetToTargetString**(`target`): `string`\n\nReturns a string in the format \"project:target[:configuration]\" for the target\n\n#### Parameters\n\n| Name | Type | Description |\n| :------- | :------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `target` | [`Target`](../../devkit/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\" ` |\n\n#### Returns\n\n`string`\n\n---\n\n### toJS\n\n▸ **toJS**(`tree`): `void`\n\nRename and transpile any new typescript files created to javascript files\n\n#### Parameters\n\n| Name | Type |\n| :----- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n\n#### Returns\n\n`void`\n\n---\n\n### updateJson\n\n▸ **updateJson**<`T`, `U`\\>(`tree`, `path`, `updater`, `options?`): `void`\n\nUpdates a JSON value to the file system tree\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :----------------------- |\n| `T` | extends `object` = `any` |\n| `U` | extends `object` = `T` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | File system tree |\n| `path` | `string` | Path of JSON file in the Tree |\n| `updater` | (`value`: `T`) => `U` | Function that maps the current value of a JSON document to a new value to be written to the document |\n| `options?` | [`JsonParseOptions`](../../devkit/index#jsonparseoptions) & [`JsonSerializeOptions`](../../devkit/index#jsonserializeoptions) | Optional JSON Parse and Serialize Options |\n\n#### Returns\n\n`void`\n\n---\n\n### updateProjectConfiguration\n\n▸ **updateProjectConfiguration**(`tree`, `projectName`, `projectConfiguration`): `void`\n\nUpdates the configuration of an existing project.\n\nThe project configuration is stored in workspace.json or the associated project.json file.\nThe utility will update either files.\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------------------- | :---------------------------------------------------------------- | :---------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) | the file system tree |\n| `projectName` | `string` | unique name. Often directories are part of the name (e.g., mydir-mylib) |\n| `projectConfiguration` | [`ProjectConfiguration`](../../devkit/index#projectconfiguration) | project configuration |\n\n#### Returns\n\n`void`\n\n---\n\n### updateTsConfigsToJs\n\n▸ **updateTsConfigsToJs**(`tree`, `options`): `void`\n\n#### Parameters\n\n| Name | Type |\n| :-------------------- | :-------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `options` | `Object` |\n| `options.projectRoot` | `string` |\n\n#### Returns\n\n`void`\n\n---\n\n### updateWorkspaceConfiguration\n\n▸ **updateWorkspaceConfiguration**(`tree`, `workspaceConfig`): `void`\n\nUpdate general workspace configuration such as the default project or cli settings.\n\nThis does _not_ update projects configuration, use [updateProjectConfiguration](../../devkit/index#updateprojectconfiguration) or [addProjectConfiguration](../../devkit/index#addprojectconfiguration) instead.\n\n#### Parameters\n\n| Name | Type |\n| :---------------- | :-------------------------------------------------------------------- |\n| `tree` | [`Tree`](../../devkit/index#tree) |\n| `workspaceConfig` | [`WorkspaceConfiguration`](../../devkit/index#workspaceconfiguration) |\n\n#### Returns\n\n`void`\n\n---\n\n### visitNotIgnoredFiles\n\n▸ **visitNotIgnoredFiles**(`tree`, `dirPath?`, `visitor`): `void`\n\nUtility to act on all files in a tree that are not ignored by git.\n\n#### Parameters\n\n| Name | Type | Default value |\n| :-------- | :-------------------------------- | :------------ |\n| `tree` | [`Tree`](../../devkit/index#tree) | `undefined` |\n| `dirPath` | `string` | `tree.root` |\n| `visitor` | (`path`: `string`) => `void` | `undefined` |\n\n#### Returns\n\n`void`\n\n---\n\n### workspaceLayout\n\n▸ **workspaceLayout**(): `Object`\n\nReturns information about where apps and libs will be created.\n\n#### Returns\n\n`Object`\n\n| Name | Type |\n| :-------- | :------- |\n| `appsDir` | `string` |\n| `libsDir` | `string` |\n\n---\n\n### writeJson\n\n▸ **writeJson**<`T`\\>(`tree`, `path`, `value`, `options?`): `void`\n\nWrites a JSON value to the file system tree\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------------------------- |\n| `T` | extends `object` = `object` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :---------------------------------------------------------------- | :------------------------------ |\n| `tree` | [`Tree`](../../devkit/index#tree) | File system tree |\n| `path` | `string` | Path of JSON file in the Tree |\n| `value` | `T` | Serializable value to write |\n| `options?` | [`JsonSerializeOptions`](../../devkit/index#jsonserializeoptions) | Optional JSON Serialize Options |\n\n#### Returns\n\n`void`\n\n---\n\n### writeJsonFile\n\n▸ **writeJsonFile**<`T`\\>(`path`, `data`, `options?`): `void`\n\nSerializes the given data to JSON and writes it to a file.\n\n#### Type parameters\n\n| Name | Type |\n| :--- | :-------------------------- |\n| `T` | extends `object` = `object` |\n\n#### Parameters\n\n| Name | Type | Description |\n| :--------- | :----------------- | :-------------------------------------------------------------- |\n| `path` | `string` | A path to a file. |\n| `data` | `T` | data which should be serialized to JSON and written to the file |\n| `options?` | `JsonWriteOptions` | JSON serialize options |\n\n#### Returns\n\n`void`\n" }, { "id": "ngcli_adapter", diff --git a/docs/generated/packages/webpack.json b/docs/generated/packages/webpack.json index bcc9900f250c0a..f1b37b11003963 100644 --- a/docs/generated/packages/webpack.json +++ b/docs/generated/packages/webpack.json @@ -18,6 +18,12 @@ "description": "Init Webpack Plugin.", "type": "object", "properties": { + "uiFramework": { + "type": "string", + "description": "UI Framework to use for Vite.", + "enum": ["react", "none"], + "x-prompt": "What UI framework plugin should Webpack use?" + }, "compiler": { "type": "string", "enum": ["babel", "swc", "tsc"], diff --git a/lerna.json b/lerna.json index 204b62e05a0d07..fc579a59d76f33 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "packages": ["build/packages/*"], - "version": "15.2.0", + "version": "999999.0.217", "granularPathspec": false, "command": { "publish": { diff --git a/packages/devkit/index.ts b/packages/devkit/index.ts index 76722b2ca11da2..99472ccb649ede 100644 --- a/packages/devkit/index.ts +++ b/packages/devkit/index.ts @@ -225,6 +225,7 @@ export { readJsonFile, writeJsonFile } from 'nx/src/utils/fileutils'; */ export { addDependenciesToPackageJson, + ensurePackage, removeDependenciesFromPackageJson, } from './src/utils/package-json'; @@ -357,6 +358,14 @@ export { */ export { Hash, Hasher } from 'nx/src/hasher/hasher'; +/** + * @category Utils + */ +export { mapAsyncIterable } from './src/utils/async-iterable/map-async-iteratable'; +export { tapAsyncIterable } from './src/utils/async-iterable/tap-async-iteratable'; +export { combineAsyncIterableIterators } from './src/utils/async-iterable/combine-async-iteratable-iterators'; +export { createAsyncIterable } from './src/utils/async-iterable/create-async-iterable'; + /** * @category Utils */ diff --git a/packages/devkit/src/utils/async-iterable/combine-async-iteratable-iterators.ts b/packages/devkit/src/utils/async-iterable/combine-async-iteratable-iterators.ts new file mode 100644 index 00000000000000..4046de85cae7de --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/combine-async-iteratable-iterators.ts @@ -0,0 +1,50 @@ +export async function* combineAsyncIterableIterators( + ...iterators: { 0: AsyncIterableIterator } & AsyncIterableIterator[] +) { + let [options] = iterators; + if (typeof options.next === 'function') { + options = Object.create(null); + } else { + iterators.shift(); + } + + const getNextAsyncIteratorValue = getNextAsyncIteratorFactory(options); + + try { + const asyncIteratorsValues = new Map( + iterators.map((it, idx) => [idx, getNextAsyncIteratorValue(it, idx)]) + ); + + do { + const { iterator, index } = await Promise.race( + asyncIteratorsValues.values() + ); + if (iterator.done) { + asyncIteratorsValues.delete(index); + } else { + yield iterator.value; + asyncIteratorsValues.set( + index, + getNextAsyncIteratorValue(iterators[index], index) + ); + } + } while (asyncIteratorsValues.size > 0); + } finally { + await Promise.allSettled(iterators.map((it) => it.return())); + } +} + +function getNextAsyncIteratorFactory(options) { + return async (asyncIterator, index) => { + try { + const iterator = await asyncIterator.next(); + + return { index, iterator }; + } catch (err) { + if (options.errorCallback) { + options.errorCallback(err, index); + } + return Promise.reject(err); + } + }; +} diff --git a/packages/devkit/src/utils/async-iterable/combine-async-iteratables-iterators.spec.ts b/packages/devkit/src/utils/async-iterable/combine-async-iteratables-iterators.spec.ts new file mode 100644 index 00000000000000..2c0d5ca02b783e --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/combine-async-iteratables-iterators.spec.ts @@ -0,0 +1,53 @@ +import { combineAsyncIterableIterators } from './combine-async-iteratable-iterators'; + +function delay(ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +describe('combineAsyncIterators', () => { + it('should merge iterators', async () => { + async function* a() { + await delay(20); + yield 'a'; + } + + async function* b() { + await delay(0); + yield 'b'; + } + + const c = combineAsyncIterableIterators(a(), b()); + const results = []; + + for await (const x of c) { + results.push(x); + } + + expect(results).toEqual(['b', 'a']); + }); + + it('should throw when one iterator throws', async () => { + async function* a() { + await delay(20); + yield 'a'; + } + + async function* b() { + throw new Error('threw in b'); + } + + const c = combineAsyncIterableIterators(a(), b()); + + async function* d() { + yield* c; + } + + try { + for await (const x of d()) { + } + throw new Error('should not reach here'); + } catch (e) { + expect(e.message).toMatch(/threw in b/); + } + }); +}); diff --git a/packages/devkit/src/utils/async-iterable/create-async-iterable.spec.ts b/packages/devkit/src/utils/async-iterable/create-async-iterable.spec.ts new file mode 100644 index 00000000000000..faedf38e6224fb --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/create-async-iterable.spec.ts @@ -0,0 +1,58 @@ +import { createAsyncIterable } from './create-async-iterable'; + +describe(createAsyncIterable.name, () => { + test('simple callback', async () => { + const it = createAsyncIterable(({ next, done }) => { + setTimeout(() => next('bye'), 10); + setTimeout(() => next('hello'), 0); + setTimeout(() => done(), 20); + setTimeout(() => next('ignored'), 30); + }); + const results: string[] = []; + for await (const x of it) { + results.push(x); + } + + expect(results).toEqual(['hello', 'bye']); + }); + + test('throwing error', async () => { + const it = createAsyncIterable(({ next, error }) => { + setTimeout(() => next('hello'), 0); + setTimeout(() => error(new Error('Oops')), 10); + }); + + await expect(async () => { + for await (const _x of it) { + // nothing + } + }).rejects.toThrow(/Oops/); + }); + + test('multiple signals in the same macro/microtask', async () => { + const it = createAsyncIterable(({ next, done }) => { + setTimeout(() => { + next('first'); + }); + + setTimeout(() => { + // should pass through in the same macro/microtask + next('second'); + next('third'); + next('fourth'); + done(); + }, 10); + + setTimeout(() => { + next('should be ignored'); + }, 20); + }); + + const results: string[] = []; + for await (const x of it) { + results.push(x); + } + + expect(results).toEqual(['first', 'second', 'third', 'fourth']); + }); +}); diff --git a/packages/devkit/src/utils/async-iterable/create-async-iterable.ts b/packages/devkit/src/utils/async-iterable/create-async-iterable.ts new file mode 100644 index 00000000000000..9df566c660a96c --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/create-async-iterable.ts @@ -0,0 +1,66 @@ +export interface AsyncPushCallbacks { + next: (value: T) => void; + done: () => void; + error: (err: unknown) => void; +} + +export function createAsyncIterable( + listener: (ls: AsyncPushCallbacks) => void +): AsyncIterable { + let done = false; + let error: unknown | null = null; + + const pushQueue: T[] = []; + const pullQueue: Array< + [ + (x: { value: T | undefined; done: boolean }) => void, + (err: unknown) => void + ] + > = []; + + return { + [Symbol.asyncIterator]() { + listener({ + next: (value) => { + if (done || error) return; + if (pullQueue.length > 0) { + pullQueue.shift()?.[0]({ value, done: false }); + } else { + pushQueue.push(value); + } + }, + error: (err) => { + if (done || error) return; + if (pullQueue.length > 0) { + pullQueue.shift()?.[1](err); + } + error = err; + }, + done: () => { + if (pullQueue.length > 0) { + pullQueue.shift()?.[0]({ value: undefined, done: true }); + } + done = true; + }, + }); + + return { + next() { + return new Promise<{ value: T | undefined; done: boolean }>( + (resolve, reject) => { + if (pushQueue.length > 0) { + resolve({ value: pushQueue.shift(), done: false }); + } else if (done) { + resolve({ value: undefined, done: true }); + } else if (error) { + reject(error); + } else { + pullQueue.push([resolve, reject]); + } + } + ); + }, + }; + }, + } as AsyncIterable; +} diff --git a/packages/devkit/src/utils/async-iterable/map-async-iteratable.spec.ts b/packages/devkit/src/utils/async-iterable/map-async-iteratable.spec.ts new file mode 100644 index 00000000000000..c91bf575639445 --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/map-async-iteratable.spec.ts @@ -0,0 +1,20 @@ +import { mapAsyncIterable } from './map-async-iteratable'; + +describe('mapAsyncIterator', () => { + it('should map over values', async () => { + async function* f() { + yield 1; + yield 2; + yield 3; + } + + const c = mapAsyncIterable(f(), (x) => x * 2); + const results = []; + + for await (const x of c) { + results.push(x); + } + + expect(results).toEqual([2, 4, 6]); + }); +}); diff --git a/packages/devkit/src/utils/async-iterable/map-async-iteratable.ts b/packages/devkit/src/utils/async-iterable/map-async-iteratable.ts new file mode 100644 index 00000000000000..6ff58ff44afec6 --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/map-async-iteratable.ts @@ -0,0 +1,22 @@ +export async function* mapAsyncIterable( + data: AsyncIterable | AsyncIterableIterator, + transform: ( + input: I, + index?: number, + data?: AsyncIterable | AsyncIterableIterator + ) => O +) { + async function* f() { + const generator = data[Symbol.asyncIterator] || data[Symbol.iterator]; + const iterator = generator.call(data); + let index = 0; + let item = await iterator.next(); + while (!item.done) { + yield await transform(await item.value, index, data); + index++; + item = await iterator.next(); + } + } + + return yield* f(); +} diff --git a/packages/devkit/src/utils/async-iterable/tap-async-iteratable.spec.ts b/packages/devkit/src/utils/async-iterable/tap-async-iteratable.spec.ts new file mode 100644 index 00000000000000..9018eed22ec8a7 --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/tap-async-iteratable.spec.ts @@ -0,0 +1,25 @@ +import { tapAsyncIterable } from './tap-async-iteratable'; + +describe('tapAsyncIterator', () => { + it('should tap values', async () => { + async function* f() { + yield 1; + yield 2; + yield 3; + } + + const tapped = []; + const results = []; + + const c = tapAsyncIterable(f(), (x) => { + tapped.push(`tap: ${x}`); + }); + + for await (const x of c) { + results.push(x); + } + + expect(tapped).toEqual(['tap: 1', 'tap: 2', 'tap: 3']); + expect(results).toEqual([1, 2, 3]); + }); +}); diff --git a/packages/devkit/src/utils/async-iterable/tap-async-iteratable.ts b/packages/devkit/src/utils/async-iterable/tap-async-iteratable.ts new file mode 100644 index 00000000000000..aa0dff61cb8f3c --- /dev/null +++ b/packages/devkit/src/utils/async-iterable/tap-async-iteratable.ts @@ -0,0 +1,11 @@ +import { mapAsyncIterable } from './map-async-iteratable'; + +export async function* tapAsyncIterable( + data: AsyncIterable | AsyncIterableIterator, + fn: (input: I) => void +) { + return yield* mapAsyncIterable(data, (x) => { + fn(x); + return x; + }); +} diff --git a/packages/devkit/src/utils/package-json.spec.ts b/packages/devkit/src/utils/package-json.spec.ts index 4321333a190563..6a98e371c83417 100644 --- a/packages/devkit/src/utils/package-json.spec.ts +++ b/packages/devkit/src/utils/package-json.spec.ts @@ -1,6 +1,6 @@ import type { Tree } from 'nx/src/generators/tree'; import { readJson, writeJson } from 'nx/src/generators/utils/json'; -import { addDependenciesToPackageJson } from './package-json'; +import { addDependenciesToPackageJson, ensurePackage } from './package-json'; import { createTree } from 'nx/src/generators/testing-utils/create-tree'; describe('addDependenciesToPackageJson', () => { @@ -310,3 +310,31 @@ describe('addDependenciesToPackageJson', () => { expect(installTask).toBeDefined(); }); }); + +describe('ensureDependencies', () => { + let tree: Tree; + + beforeEach(() => { + tree = createTree(); + }); + + it('should throw when dependencies are missing', async () => { + writeJson(tree, 'package.json', {}); + + await expect(() => + ensurePackage(tree, '@nrwl/webpack', '1.0.0', { + dev: true, + packageManager: 'npm', + dryRun: true, + }) + ).rejects.toThrow('npm install -D @nrwl/webpack@1.0.0'); + + await expect(() => + ensurePackage(tree, 'tslib', '2.4.0', { + dev: false, + packageManager: 'npm', + dryRun: true, + }) + ).rejects.toThrow('npm install tslib@2.4.0'); + }); +}); diff --git a/packages/devkit/src/utils/package-json.ts b/packages/devkit/src/utils/package-json.ts index 8430cd76fe9687..3f1142a135b173 100644 --- a/packages/devkit/src/utils/package-json.ts +++ b/packages/devkit/src/utils/package-json.ts @@ -1,8 +1,12 @@ +import * as chalk from 'chalk'; import { readJson, updateJson } from 'nx/src/generators/utils/json'; import { installPackagesTask } from '../tasks/install-packages-task'; import type { Tree } from 'nx/src/generators/tree'; import { GeneratorCallback } from 'nx/src/config/misc-interfaces'; import { coerce, gt } from 'semver'; +import { getPackageManagerCommand } from 'nx/src/utils/package-manager'; +import { execSync } from 'child_process'; +import { join } from 'path'; const NON_SEMVER_TAGS = { '*': 2, @@ -274,3 +278,60 @@ function requiresRemovingOfPackages( return needsDepsUpdate || needsDevDepsUpdate; } + +/** + * Ensure that dependencies and devDependencies from package.json are installed at the required versions. + * + * For example: + * ```typescript + * ensureDependencies(tree, {}, { '@nrwl/jest': nxVersion }) + * ``` + * This will check that @nrwl/jest@ exists in devDependencies. + * If it exists then function returns, otherwise it will install the package before continuing. + * When running with --dryRun, the function will throw when dependencies are missing. + * + * @param tree The Tree to check with + * @param pkg The package to check + * @param requiredVersion The version to check + * @param options + * @returns void + */ +export async function ensurePackage( + tree: Tree, + pkg: string, + requiredVersion: string, + options: { + cwd?: string; + dev?: boolean; + packageJsonPath?: string; + packageManager?: 'npm' | 'yarn' | 'pnpm'; + dryRun?: boolean; + } = {} +): Promise { + const packageJsonPath = options.packageJsonPath ?? 'package.json'; + const packageJson = readJson(tree, packageJsonPath); + const cwd = options.cwd ?? ''; + const dev = options.dev ?? true; + const dryRun = options.dryRun ?? !!process.env.NX_DRY_RUN; // NX_DRY_RUN is set in `packages/nx/src/command-line/generate.ts` + const pmc = getPackageManagerCommand(options.packageManager); + + const field = options.dev ? 'devDependencies' : 'dependencies'; + + if (packageJson[field]?.[pkg] !== requiredVersion) { + const installCmd = `${ + options.dev ? pmc.addDev : pmc.add + } ${pkg}@${requiredVersion}`; + if (dryRun) { + throw new Error( + `Required package ${pkg}@${requiredVersion} is missing. Run ${chalk.bold( + installCmd + )}, and then try again.` + ); + } else { + execSync(installCmd, { + cwd: join(tree.root, cwd), + stdio: [0, 1, 2], + }); + } + } +} diff --git a/packages/linter/package.json b/packages/linter/package.json index a34a04085f3a9d..d9ff9f0838e74a 100644 --- a/packages/linter/package.json +++ b/packages/linter/package.json @@ -34,7 +34,6 @@ }, "dependencies": { "@nrwl/devkit": "file:../devkit", - "@nrwl/jest": "file:../jest", "@phenomnomnominal/tsquery": "4.1.1", "nx": "file:../nx", "tmp": "~0.2.1", diff --git a/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts b/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts index 0a212ce1091bcb..c60a119b11af8a 100644 --- a/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts +++ b/packages/linter/src/generators/workspace-rules-project/workspace-rules-project.ts @@ -2,6 +2,7 @@ import { addDependenciesToPackageJson, addProjectConfiguration, convertNxGenerator, + ensurePackage, formatFiles, generateFiles, joinPathFragments, @@ -11,17 +12,22 @@ import { Tree, updateWorkspaceConfiguration, } from '@nrwl/devkit'; -import { addPropertyToJestConfig, jestProjectGenerator } from '@nrwl/jest'; import { getRelativePathToRootTsConfig } from '@nrwl/workspace/src/utilities/typescript'; import { join } from 'path'; import { workspaceLintPluginDir } from '../../utils/workspace-lint-rules'; import { swcCoreVersion, swcNodeVersion } from 'nx/src/utils/versions'; +import { nxVersion } from '../../utils/versions'; export const WORKSPACE_RULES_PROJECT_NAME = 'eslint-rules'; export const WORKSPACE_PLUGIN_DIR = 'tools/eslint-rules'; export async function lintWorkspaceRulesProjectGenerator(tree: Tree) { + await ensurePackage(tree, '@nrwl/jest/', nxVersion); + const { addPropertyToJestConfig, jestProjectGenerator } = await import( + '@nrwl/jest' + ); + // Noop if the workspace rules project already exists try { readProjectConfiguration(tree, WORKSPACE_RULES_PROJECT_NAME); diff --git a/packages/linter/src/migrations/update-13-3-0/eslint-8-updates.ts b/packages/linter/src/migrations/update-13-3-0/eslint-8-updates.ts index b30ad503e13b46..ea778068f18ff8 100644 --- a/packages/linter/src/migrations/update-13-3-0/eslint-8-updates.ts +++ b/packages/linter/src/migrations/update-13-3-0/eslint-8-updates.ts @@ -4,11 +4,11 @@ import { Tree, visitNotIgnoredFiles, } from '@nrwl/devkit'; -import { addPropertyToJestConfig } from '@nrwl/jest'; import { tsquery } from '@phenomnomnominal/tsquery'; export default async function eslint8Updates(tree: Tree) { try { + const { addPropertyToJestConfig } = await import('@nrwl/jest'); const existingJestConfigPath = normalizePath( 'tools/eslint-rules/jest.config.js' ); diff --git a/packages/nx/src/command-line/generate.ts b/packages/nx/src/command-line/generate.ts index dc0daf72d1c8ab..c16a85ff87be96 100644 --- a/packages/nx/src/command-line/generate.ts +++ b/packages/nx/src/command-line/generate.ts @@ -289,6 +289,9 @@ export async function generate(cwd: string, args: { [k: string]: any }) { 'generate', projectsConfiguration ); + if (opts.dryRun) { + process.env.NX_DRY_RUN = 'true'; + } const { normalizedGeneratorName, schema, implementationFactory, aliases } = ws.readGenerator(opts.collectionName, opts.generatorName); diff --git a/packages/react-native/src/generators/stories/stories.ts b/packages/react-native/src/generators/stories/stories.ts index 637a5f3e494652..0abf25d5b7b9e0 100644 --- a/packages/react-native/src/generators/stories/stories.ts +++ b/packages/react-native/src/generators/stories/stories.ts @@ -22,8 +22,8 @@ export async function createAllStories( const projects = getProjects(tree); const projectConfiguration = projects.get(projectName); - const { sourceRoot, root } = projectConfiguration; - const projectPath = projectRootPath(projectConfiguration); + const { sourceRoot } = projectConfiguration; + const projectPath = await projectRootPath(tree, projectConfiguration); let componentPaths: string[] = []; visitNotIgnoredFiles(tree, projectPath, (path) => { diff --git a/packages/react/package.json b/packages/react/package.json index 60c574f5e4dd87..43ef6306b0112b 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -31,32 +31,12 @@ "migrations": "./migrations.json" }, "dependencies": { - "@babel/core": "^7.15.0", - "@babel/preset-react": "^7.14.5", - "@nrwl/cypress": "file:../cypress", "@nrwl/devkit": "file:../devkit", - "@nrwl/jest": "file:../jest", - "@nrwl/js": "file:../js", "@nrwl/linter": "file:../linter", - "@nrwl/storybook": "file:../storybook", - "@nrwl/vite": "file:../vite", - "@nrwl/web": "file:../web", - "@nrwl/webpack": "file:../webpack", "@nrwl/workspace": "file:../workspace", - "@pmmmwh/react-refresh-webpack-plugin": "^0.5.7", - "@phenomnomnominal/tsquery": "4.1.1", - "@svgr/webpack": "^6.1.2", "chalk": "4.1.0", - "css-loader": "^6.4.0", "minimatch": "3.0.5", - "react-refresh": "^0.10.0", - "semver": "7.3.4", - "style-loader": "^3.3.0", - "stylus": "^0.55.0", - "stylus-loader": "^7.1.0", - "url-loader": "^4.1.1", - "webpack": "^5.75.0", - "webpack-merge": "^5.8.0" + "semver": "7.3.4" }, "publishConfig": { "access": "public" diff --git a/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts b/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts index 39ca1164222e37..ac5de116fe6371 100644 --- a/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts +++ b/packages/react/src/executors/module-federation-dev-server/module-federation-dev-server.impl.ts @@ -3,8 +3,7 @@ import devServerExecutor from '@nrwl/webpack/src/executors/dev-server/dev-server import { WebDevServerOptions } from '@nrwl/webpack/src/executors/dev-server/schema'; import { join } from 'path'; import * as chalk from 'chalk'; -import { combineAsyncIterableIterators } from '@nrwl/js/src/utils/async-iterable/combine-async-iteratable-iterators'; -import { tapAsyncIterator } from '@nrwl/js/src/utils/async-iterable/tap-async-iteratable'; +import { combineAsyncIterableIterators, tapAsyncIterable } from '@nrwl/devkit'; type ModuleFederationDevServerOptions = WebDevServerOptions & { devRemotes?: string | string[]; @@ -65,7 +64,7 @@ export default async function* moduleFederationDevServer( } let numAwaiting = knownRemotes.length + 1; // remotes + host - return yield* tapAsyncIterator(iter, (x) => { + return yield* tapAsyncIterable(iter, (x) => { numAwaiting--; if (numAwaiting === 0) { logger.info( diff --git a/packages/react/src/generators/application/application.ts b/packages/react/src/generators/application/application.ts index 72a3c2055fe3ca..3ca2bd305dc5ac 100644 --- a/packages/react/src/generators/application/application.ts +++ b/packages/react/src/generators/application/application.ts @@ -15,6 +15,7 @@ import { addStyledModuleDependencies } from '../../rules/add-styled-dependencies import { addDependenciesToPackageJson, convertNxGenerator, + ensurePackage, formatFiles, GeneratorCallback, joinPathFragments, @@ -24,10 +25,12 @@ import { import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-serial'; import reactInitGenerator from '../init/init'; import { Linter, lintProjectGenerator } from '@nrwl/linter'; -import { swcCoreVersion } from '@nrwl/js/src/utils/versions'; -import { swcLoaderVersion } from '@nrwl/webpack/src/utils/versions'; -import { viteConfigurationGenerator, vitestGenerator } from '@nrwl/vite'; import { mapLintPattern } from '@nrwl/linter/src/generators/lint-project/lint-project'; +import { + nxVersion, + swcCoreVersion, + swcLoaderVersion, +} from '../../utils/versions'; async function addLinting(host: Tree, options: NormalizedSchema) { const tasks: GeneratorCallback[] = []; @@ -90,6 +93,8 @@ export async function applicationGenerator(host: Tree, schema: Schema) { addProject(host, options); if (options.bundler === 'vite') { + await ensurePackage(host, '@nrwl/vite', nxVersion); + const { viteConfigurationGenerator } = await import('@nrwl/vite'); // We recommend users use `import.meta.env.MODE` and other variables in their code to differentiate between production and development. // See: https://vitejs.dev/guide/env-and-mode.html host.delete(joinPathFragments(options.appProjectRoot, 'src/environments')); @@ -101,9 +106,20 @@ export async function applicationGenerator(host: Tree, schema: Schema) { includeVitest: true, }); tasks.push(viteTask); + } else if (options.bundler === 'webpack') { + await ensurePackage(host, '@nrwl/webpack', nxVersion); + + const { webpackInitGenerator } = await import('@nrwl/webpack'); + const webpackTask = await webpackInitGenerator(host, { + uiFramework: 'react', + }); + tasks.push(webpackTask); } if (options.bundler !== 'vite' && options.unitTestRunner === 'vitest') { + await ensurePackage(host, '@nrwl/vite', nxVersion); + const { vitestGenerator } = await import('@nrwl/vite'); + const vitestTask = await vitestGenerator(host, { uiFramework: 'react', project: options.projectName, diff --git a/packages/react/src/generators/application/lib/add-cypress.ts b/packages/react/src/generators/application/lib/add-cypress.ts index 61fc114528eec2..539576ecaf0134 100644 --- a/packages/react/src/generators/application/lib/add-cypress.ts +++ b/packages/react/src/generators/application/lib/add-cypress.ts @@ -1,11 +1,13 @@ -import { cypressProjectGenerator } from '@nrwl/cypress'; -import { Tree } from '@nrwl/devkit'; +import { ensurePackage, Tree } from '@nrwl/devkit'; +import { nxVersion } from '../../../utils/versions'; import { NormalizedSchema } from '../schema'; export async function addCypress(host: Tree, options: NormalizedSchema) { if (options.e2eTestRunner !== 'cypress') { return () => {}; } + await ensurePackage(host, '@nrwl/cypress', nxVersion); + const { cypressProjectGenerator } = await import('@nrwl/cypress'); return await cypressProjectGenerator(host, { ...options, diff --git a/packages/react/src/generators/application/lib/add-jest.ts b/packages/react/src/generators/application/lib/add-jest.ts index ff23ea0af4de40..56c06f9b972e74 100644 --- a/packages/react/src/generators/application/lib/add-jest.ts +++ b/packages/react/src/generators/application/lib/add-jest.ts @@ -1,8 +1,11 @@ -import { Tree } from '@nrwl/devkit'; -import { jestProjectGenerator } from '@nrwl/jest'; +import { ensurePackage, Tree } from '@nrwl/devkit'; import { NormalizedSchema } from '../schema'; +import { nxVersion } from '../../../utils/versions'; export async function addJest(host: Tree, options: NormalizedSchema) { + await ensurePackage(host, '@nrwl/jest', nxVersion); + const { jestProjectGenerator } = await import('@nrwl/jest'); + if (options.unitTestRunner !== 'jest') { return () => {}; } diff --git a/packages/react/src/generators/component-test/component-test.ts b/packages/react/src/generators/component-test/component-test.ts index 801e3f70cd7cac..26e69f1ca0abfa 100644 --- a/packages/react/src/generators/component-test/component-test.ts +++ b/packages/react/src/generators/component-test/component-test.ts @@ -1,5 +1,5 @@ -import { assertMinimumCypressVersion } from '@nrwl/cypress/src/utils/cypress-version'; import { + ensurePackage, generateFiles, joinPathFragments, readProjectConfiguration, @@ -12,12 +12,17 @@ import { getComponentNode, } from '../../utils/ast-utils'; import { getDefaultsForComponent } from '../../utils/component-props'; +import { nxVersion } from '../../utils/versions'; import { ComponentTestSchema } from './schema'; -export function componentTestGenerator( +export async function componentTestGenerator( tree: Tree, options: ComponentTestSchema ) { + await ensurePackage(tree, '@nrwl/cypress', nxVersion); + const { assertMinimumCypressVersion } = await import( + '@nrwl/cypress/src/utils/cypress-version' + ); assertMinimumCypressVersion(10); const projectConfig = readProjectConfiguration(tree, options.project); diff --git a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.ts b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.ts index ea53edb529b497..9918443e46dc32 100644 --- a/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.ts +++ b/packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.ts @@ -1,5 +1,10 @@ -import { cypressComponentProject } from '@nrwl/cypress'; -import { formatFiles, readProjectConfiguration, Tree } from '@nrwl/devkit'; +import { + ensurePackage, + formatFiles, + readProjectConfiguration, + Tree, +} from '@nrwl/devkit'; +import { nxVersion } from '../../utils/versions'; import { addFiles } from './lib/add-files'; import { updateProjectConfig } from './lib/update-configs'; import { CypressComponentConfigurationSchema } from './schema.d'; @@ -13,6 +18,8 @@ export async function cypressComponentConfigGenerator( tree: Tree, options: CypressComponentConfigurationSchema ) { + await ensurePackage(tree, '@nrwl/cypress', nxVersion); + const { cypressComponentProject } = await import('@nrwl/cypress'); const projectConfig = readProjectConfiguration(tree, options.project); const installTask = await cypressComponentProject(tree, { project: options.project, diff --git a/packages/react/src/generators/cypress-component-configuration/lib/update-configs.ts b/packages/react/src/generators/cypress-component-configuration/lib/update-configs.ts index bd11912df4c610..57d83ba4531ebc 100644 --- a/packages/react/src/generators/cypress-component-configuration/lib/update-configs.ts +++ b/packages/react/src/generators/cypress-component-configuration/lib/update-configs.ts @@ -1,10 +1,6 @@ -import { findBuildConfig } from '@nrwl/cypress/src/utils/find-target-options'; import { - joinPathFragments, - ProjectConfiguration, readProjectConfiguration, Tree, - updateJson, updateProjectConfiguration, } from '@nrwl/devkit'; import { CypressComponentConfigurationSchema } from '../schema'; @@ -13,6 +9,9 @@ export async function updateProjectConfig( tree: Tree, options: CypressComponentConfigurationSchema ) { + const { findBuildConfig } = await import( + '@nrwl/cypress/src/utils/find-target-options' + ); const found = await findBuildConfig(tree, { project: options.project, buildTarget: options.buildTarget, diff --git a/packages/react/src/generators/init/init.spec.ts b/packages/react/src/generators/init/init.spec.ts index 61d1317b5d617c..0d2ed5e92c7f2e 100644 --- a/packages/react/src/generators/init/init.spec.ts +++ b/packages/react/src/generators/init/init.spec.ts @@ -1,4 +1,4 @@ -import { NxJsonConfiguration, readJson, Tree } from '@nrwl/devkit'; +import { readJson, Tree } from '@nrwl/devkit'; import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing'; import reactInitGenerator from './init'; import { InitSchema } from './schema'; @@ -30,4 +30,9 @@ describe('init', () => { await reactInitGenerator(tree, { ...schema, unitTestRunner: 'none' }); expect(tree.exists('jest.config.js')).toEqual(false); }); + + it('should not add babel.config.json if skipBabelConfig is true', async () => { + await reactInitGenerator(tree, { ...schema, skipBabelConfig: true }); + expect(tree.exists('babel.config.json')).toEqual(false); + }); }); diff --git a/packages/react/src/generators/init/init.ts b/packages/react/src/generators/init/init.ts index e5526e4a8320c5..7897ba4b528f87 100755 --- a/packages/react/src/generators/init/init.ts +++ b/packages/react/src/generators/init/init.ts @@ -1,16 +1,17 @@ -import { cypressInitGenerator } from '@nrwl/cypress'; import { addDependenciesToPackageJson, convertNxGenerator, + ensurePackage, GeneratorCallback, readWorkspaceConfiguration, removeDependenciesFromPackageJson, Tree, updateWorkspaceConfiguration, + writeJson, } from '@nrwl/devkit'; -import { webInitGenerator } from '@nrwl/web'; import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-serial'; import { + babelPresetReactVersion, nxVersion, reactDomVersion, reactTestRendererVersion, @@ -66,22 +67,51 @@ function updateDependencies(host: Tree, schema: InitSchema) { }); } +function initRootBabelConfig(tree: Tree, schema: InitSchema) { + if (tree.exists('/babel.config.json') || tree.exists('/babel.config.js')) { + return; + } + + if (!schema.skipBabelConfig) { + writeJson(tree, '/babel.config.json', { + babelrcRoots: ['*'], // Make sure .babelrc files other than root can be loaded in a monorepo + }); + } + + const workspaceConfiguration = readWorkspaceConfiguration(tree); + + if (workspaceConfiguration.namedInputs?.sharedGlobals) { + workspaceConfiguration.namedInputs.sharedGlobals.push( + '{workspaceRoot}/babel.config.json' + ); + } + updateWorkspaceConfiguration(tree, workspaceConfiguration); +} + export async function reactInitGenerator(host: Tree, schema: InitSchema) { const tasks: GeneratorCallback[] = []; setDefault(host); if (!schema.e2eTestRunner || schema.e2eTestRunner === 'cypress') { + await ensurePackage(host, '@nrwl/cypress', nxVersion); + const { cypressInitGenerator } = await import('@nrwl/cypress'); const cypressTask = cypressInitGenerator(host, {}); tasks.push(cypressTask); } - // TODO(jack): We should be able to remove this generator and have react init everything. - const initTask = await webInitGenerator(host, { - ...schema, - skipPackageJson: true, - }); - tasks.push(initTask); + if (!schema.skipBabelConfig) { + const installBabelTask = addDependenciesToPackageJson( + host, + {}, + { + '@babel/preset-react': babelPresetReactVersion, + } + ); + tasks.push(installBabelTask); + initRootBabelConfig(host, schema); + } + if (!schema.skipPackageJson) { const installTask = updateDependencies(host, schema); tasks.push(installTask); diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts index 3dc1dad08091cc..0b14144aa46c70 100644 --- a/packages/react/src/generators/library/library.ts +++ b/packages/react/src/generators/library/library.ts @@ -3,6 +3,7 @@ import { addProjectConfiguration, applyChangesToString, convertNxGenerator, + ensurePackage, formatFiles, generateFiles, GeneratorCallback, @@ -15,8 +16,7 @@ import { updateJson, } from '@nrwl/devkit'; import { getImportPath } from 'nx/src/utils/path'; -import { jestProjectGenerator } from '@nrwl/jest'; -import { swcCoreVersion } from '@nrwl/js/src/utils/versions'; +import { nxVersion, swcCoreVersion } from '../../utils/versions'; import { Linter, lintProjectGenerator } from '@nrwl/linter'; import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-serial'; import { @@ -44,7 +44,6 @@ import componentGenerator from '../component/component'; import initGenerator from '../init/init'; import { Schema } from './schema'; import { updateJestConfigContent } from '../../utils/jest-utils'; -import { viteConfigurationGenerator, vitestGenerator } from '@nrwl/vite'; import { normalizeOptions } from './lib/normalize-options'; export interface NormalizedSchema extends Schema { @@ -94,6 +93,8 @@ export async function libraryGenerator(host: Tree, schema: Schema) { } if (options.buildable && options.bundler === 'vite') { + await ensurePackage(host, '@nrwl/vite', nxVersion); + const { viteConfigurationGenerator } = await import('@nrwl/vite'); const viteTask = await viteConfigurationGenerator(host, { uiFramework: 'react', project: options.name, @@ -106,6 +107,9 @@ export async function libraryGenerator(host: Tree, schema: Schema) { } if (options.unitTestRunner === 'jest') { + await ensurePackage(host, '@nrwl/jest', nxVersion); + const { jestProjectGenerator } = await import('@nrwl/jest'); + const jestTask = await jestProjectGenerator(host, { ...options, project: options.name, @@ -129,6 +133,8 @@ export async function libraryGenerator(host: Tree, schema: Schema) { options.unitTestRunner === 'vitest' && options.bundler !== 'vite' // tests are already configured if bundler is vite ) { + await ensurePackage(host, '@nrwl/vite', nxVersion); + const { vitestGenerator } = await import('@nrwl/vite'); const vitestTask = await vitestGenerator(host, { uiFramework: 'react', project: options.name, diff --git a/packages/react/src/generators/stories/stories.ts b/packages/react/src/generators/stories/stories.ts index 0c228d8f866b2b..c4a6e3e5adc816 100644 --- a/packages/react/src/generators/stories/stories.ts +++ b/packages/react/src/generators/stories/stories.ts @@ -15,10 +15,6 @@ import { visitNotIgnoredFiles, } from '@nrwl/devkit'; import { basename, join } from 'path'; -import { - findStorybookAndBuildTargetsAndCompiler, - isTheFileAStory, -} from '@nrwl/storybook/src/utils/utilities'; import minimatch = require('minimatch'); export interface StorybookStoriesSchema { @@ -29,7 +25,13 @@ export interface StorybookStoriesSchema { ignorePaths?: string[]; } -export function projectRootPath(config: ProjectConfiguration): string { +export async function projectRootPath( + tree: Tree, + config: ProjectConfiguration +): Promise { + const { findStorybookAndBuildTargetsAndCompiler } = await import( + '@nrwl/storybook/src/utils/utilities' + ); let projectDir: string; if (config.projectType === 'application') { const { nextBuildTarget } = findStorybookAndBuildTargetsAndCompiler( @@ -79,12 +81,16 @@ export async function createAllStories( cypressProject?: string, ignorePaths?: string[] ) { + const { isTheFileAStory } = await import( + '@nrwl/storybook/src/utils/utilities' + ); const projects = getProjects(tree); const projectConfiguration = projects.get(projectName); const { sourceRoot, root } = projectConfiguration; let componentPaths: string[] = []; - visitNotIgnoredFiles(tree, projectRootPath(projectConfiguration), (path) => { + const projectPath = await projectRootPath(tree, projectConfiguration); + visitNotIgnoredFiles(tree, projectPath, (path) => { // Ignore private files starting with "_". if (basename(path).startsWith('_')) return; diff --git a/packages/react/src/generators/storybook-configuration/configuration.ts b/packages/react/src/generators/storybook-configuration/configuration.ts index 35d9fb77e20f45..5e4537b85d3d57 100644 --- a/packages/react/src/generators/storybook-configuration/configuration.ts +++ b/packages/react/src/generators/storybook-configuration/configuration.ts @@ -2,14 +2,18 @@ import { StorybookConfigureSchema } from './schema'; import storiesGenerator from '../stories/stories'; import { convertNxGenerator, + ensurePackage, logger, readProjectConfiguration, Tree, } from '@nrwl/devkit'; -import { configurationGenerator } from '@nrwl/storybook'; -import { getE2eProjectName } from '@nrwl/cypress/src/utils/project-name'; +import { nxVersion } from '../../utils/versions'; async function generateStories(host: Tree, schema: StorybookConfigureSchema) { + await ensurePackage(host, '@nrwl/cypress', nxVersion); + const { getE2eProjectName } = await import( + '@nrwl/cypress/src/utils/project-name' + ); const projectConfig = readProjectConfiguration(host, schema.name); const cypressProject = getE2eProjectName( schema.name, @@ -30,6 +34,9 @@ export async function storybookConfigurationGenerator( host: Tree, schema: StorybookConfigureSchema ) { + await ensurePackage(host, '@nrwl/storybook', nxVersion); + const { configurationGenerator } = await import('@nrwl/storybook'); + let bundler = schema.bundler ?? 'webpack'; const projectConfig = readProjectConfiguration(host, schema.name); diff --git a/packages/react/src/migrations/update-14-6-0/add-preset-jest-config.ts b/packages/react/src/migrations/update-14-6-0/add-preset-jest-config.ts index 11e185f355526a..1ad1ebd0b19e5d 100644 --- a/packages/react/src/migrations/update-14-6-0/add-preset-jest-config.ts +++ b/packages/react/src/migrations/update-14-6-0/add-preset-jest-config.ts @@ -4,7 +4,7 @@ import { readProjectConfiguration, Tree, } from '@nrwl/devkit'; -import { JestExecutorOptions } from '@nrwl/jest/src/executors/jest/schema'; +import type { JestExecutorOptions } from '@nrwl/jest/src/executors/jest/schema'; import { forEachExecutorOptions } from '@nrwl/workspace/src/utilities/executor-options-utils'; import { tsquery } from '@phenomnomnominal/tsquery'; import { StringLiteral } from 'typescript'; diff --git a/packages/react/src/utils/versions.ts b/packages/react/src/utils/versions.ts index cc27d4b90f02bf..4ba690860d815a 100755 --- a/packages/react/src/utils/versions.ts +++ b/packages/react/src/utils/versions.ts @@ -3,12 +3,16 @@ export const nxVersion = require('../../package.json').version; export const reactVersion = '18.2.0'; export const reactDomVersion = '18.2.0'; export const reactIsVersion = '18.2.0'; +export const swcLoaderVersion = '0.1.15'; +export const swcCoreVersion = '^1.2.173'; export const typesReactVersion = '18.0.25'; export const typesReactDomVersion = '18.0.9'; export const typesReactIsVersion = '17.0.3'; export const typesNodeVersion = '18.11.9'; +export const babelPresetReactVersion = '^7.14.5'; + export const styledComponentsVersion = '5.3.6'; export const typesStyledComponentsVersion = '5.1.26'; diff --git a/packages/webpack/index.ts b/packages/webpack/index.ts index 2bf324588d8a8e..57e56c9b3afbc1 100644 --- a/packages/webpack/index.ts +++ b/packages/webpack/index.ts @@ -1,4 +1,5 @@ export * from './src/utils/config'; +export * from './src/generators/init/init'; export * from './src/generators/webpack-project/webpack-project'; export type { WebDevServerOptions } from './src/executors/dev-server/schema'; export * from './src/executors/dev-server/dev-server.impl'; diff --git a/packages/webpack/src/generators/init/init.ts b/packages/webpack/src/generators/init/init.ts index 22c74364e95458..a491a02dc03579 100644 --- a/packages/webpack/src/generators/init/init.ts +++ b/packages/webpack/src/generators/init/init.ts @@ -8,23 +8,30 @@ import { updateWorkspaceConfiguration, writeJson, } from '@nrwl/devkit'; -import { Schema } from './schema'; +import { runTasksInSerial } from '@nrwl/workspace/src/utilities/run-tasks-in-serial'; import { swcCoreVersion } from '@nrwl/js/src/utils/versions'; + +import { Schema } from './schema'; import { + reactRefreshVersion, + reactRefreshWebpackPluginVersion, + svgrWebpackVersion, swcHelpersVersion, swcLoaderVersion, tsLibVersion, + tsQueryVersion, + urlLoaderVersion, } from '../../utils/versions'; export async function webpackInitGenerator(tree: Tree, schema: Schema) { - let task: GeneratorCallback; + const tasks: GeneratorCallback[] = []; if (schema.compiler === 'babel') { initRootBabelConfig(tree); } if (schema.compiler === 'swc') { - task = addDependenciesToPackageJson( + const swcInstallTask = addDependenciesToPackageJson( tree, {}, { @@ -33,17 +40,39 @@ export async function webpackInitGenerator(tree: Tree, schema: Schema) { 'swc-loader': swcLoaderVersion, } ); + tasks.push(swcInstallTask); } if (schema.compiler === 'tsc') { - task = addDependenciesToPackageJson(tree, {}, { tslib: tsLibVersion }); + const tscInstallTask = addDependenciesToPackageJson( + tree, + {}, + { tslib: tsLibVersion } + ); + tasks.push(tscInstallTask); + } + + if (schema.uiFramework === 'react') { + const reactInstallTask = addDependenciesToPackageJson( + tree, + {}, + { + '@pmmmwh/react-refresh-webpack-plugin': + reactRefreshWebpackPluginVersion, + '@phenomnomnominal/tsquery': tsQueryVersion, + '@svgr/webpack': svgrWebpackVersion, + 'react-refresh': reactRefreshVersion, + 'url-loader': urlLoaderVersion, + } + ); + tasks.push(reactInstallTask); } if (!schema.skipFormat) { await formatFiles(tree); } - return task; + return runTasksInSerial(...tasks); } function initRootBabelConfig(tree: Tree) { diff --git a/packages/webpack/src/generators/init/schema.d.ts b/packages/webpack/src/generators/init/schema.d.ts index 0b1664d543f2cc..584d1172e2796b 100644 --- a/packages/webpack/src/generators/init/schema.d.ts +++ b/packages/webpack/src/generators/init/schema.d.ts @@ -1,4 +1,5 @@ export interface Schema { compiler?: 'babel' | 'swc' | 'tsc'; + uiFramework?: 'react' | 'none'; skipFormat?: boolean; } diff --git a/packages/webpack/src/generators/init/schema.json b/packages/webpack/src/generators/init/schema.json index 453ac44aee4207..1df1db63d93920 100644 --- a/packages/webpack/src/generators/init/schema.json +++ b/packages/webpack/src/generators/init/schema.json @@ -6,6 +6,12 @@ "description": "Init Webpack Plugin.", "type": "object", "properties": { + "uiFramework": { + "type": "string", + "description": "UI Framework to use for Vite.", + "enum": ["react", "none"], + "x-prompt": "What UI framework plugin should Webpack use?" + }, "compiler": { "type": "string", "enum": ["babel", "swc", "tsc"], diff --git a/packages/webpack/src/utils/versions.ts b/packages/webpack/src/utils/versions.ts index c37ad2fb287e6d..912e1b9c39ce43 100644 --- a/packages/webpack/src/utils/versions.ts +++ b/packages/webpack/src/utils/versions.ts @@ -3,3 +3,10 @@ export const nxVersion = require('../../package.json').version; export const swcLoaderVersion = '0.1.15'; export const swcHelpersVersion = '~0.4.11'; export const tsLibVersion = '^2.3.0'; + +// React apps +export const reactRefreshWebpackPluginVersion = '^0.5.7'; +export const tsQueryVersion = '4.1.1'; +export const svgrWebpackVersion = '^6.1.2'; +export const reactRefreshVersion = '^0.10.0'; +export const urlLoaderVersion = '^4.1.1';