# move Relocates a project under another directory and brings its names, aliases and references along. By default the project and package take the new directory's name; the e2e project that tests the library is renamed with it and stays where it is. ```bash npx hf generate move my-utils --destination=libs/utils npx hf generate move my-utils \ --destination=packages --newName=utils --updateName=false ``` | Option | What it sets | | --------------- | ----------------------------------------------------------------------------------------------------------- | | `--project` | The project to move (also the first positional argument) | | `--destination` | The directory it moves under, relative to the root | | `--newName` | The directory's new name; defaults to the current one | | `--projectName` | The project's new name when the names are updated; defaults to the directory's name | | `--packageName` | The package's new name when the names are updated; defaults to the directory's name under the current scope | | `--updateName` | Whether the project and package names follow the new location; defaults to true | | `--skipFormat` | Leave the written files unformatted | ## API Reference ### Functions #### moveGenerator ```typescript function moveGenerator(tree: Tree, options: MoveGeneratorOptions): Promise ``` Moves a project: copies its files under the destination, rewrites its manifests and the configuration files that point back at the root, moves its aliases, renames it in the projects that refer to it and in the project that tests it, and deletes the old directory. **Parameters** | Name | Type | Description | | --- | --- | --- | | `tree` | `Tree` | The tree, rooted at the workspace | | `options` | `MoveGeneratorOptions` | Which project, where to, and whether its names follow | **Returns** `Promise`: Resolves when the move is written **Example: Move a library under another directory** ```bash npx hf generate move my-utils libs/utils ``` **Example: Move and rename it** ```bash npx hf generate move my-utils libs/utils --newName=data ``` **Example: Move it without changing its names** ```bash npx hf generate move my-utils libs/utils --updateName=false ``` #### planMove ```typescript function planMove(tree: Tree, options: MoveGeneratorOptions): MovePlan ``` Settles the options: where the project goes and what it and its package are called there. **Parameters** | Name | Type | Description | | --- | --- | --- | | `tree` | `Tree` | The tree the project lives in | | `options` | `MoveGeneratorOptions` | The options as given | **Returns** `MovePlan`: The roots, the names and the offset the move writes from ### Interfaces #### MoveGeneratorOptions What the `move` generator takes. **Properties** | Name | Type | Description | | --- | --- | --- | | `project` | `string` | The project moved | | `destination` | `string` | The directory the project's directory moves under, relative to the root | | `newName?` | `string` | The new name of the project's directory; the current one when unset | | `projectName?` | `string` | The project's new name, when the names are updated; the directory's name when unset | | `packageName?` | `string` | The package's new name, when the names are updated; the directory's name under the package's current scope when unset | | `updateName?` | `boolean` | Whether the project's and the package's names follow the new location; true when unset | | `skipFormat?` | `boolean` | Skip formatting the generated files | #### MovePlan The options settled. **Properties** | Name | Type | Description | | --- | --- | --- | | `projectName` | `string` | The project's current name | | `currentProjectRoot` | `string` | The project's current directory, relative to the root | | `newProjectRoot` | `string` | The project's new directory, relative to the root | | `newProjectName` | `string` | The project's new name; its current one when the names are kept | | `currentPackageName` | `string` | The package's current name, or undefined for a project with no package | | `newPackageName` | `string` | The package's new name, or undefined for a project with no package | | `updateName` | `boolean` | Whether the names follow the new location | | `newOffsetFromRoot` | `string` | The path from the new project root to the workspace root | --- Canonical page: https://www.hyperfrontend.dev/docs/libraries/workspace/generators/move/ This file: https://www.hyperfrontend.dev/docs/libraries/workspace/generators/move.md Documentation index: https://www.hyperfrontend.dev/llms.txt