@hyperfrontend/workspace/generators/movemove
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.
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
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< void>Resolves when the move is written
Examples
Move a library under another directory
npx hf generate move my-utils libs/utilsMove and rename it
npx hf generate move my-utils libs/utils --newName=dataMove it without changing its names
npx hf generate move my-utils libs/utils --updateName=falseSettles 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
MovePlanThe roots, the names and the offset the move writes from
◈ Interfaces
What the
move generator takes.Properties
§
projectName?:stringThe project's new name, when the names are updated; the directory's name when unset§
packageName?:stringThe package's new name, when the names are updated; the directory's name under the package's current scope when unset§
updateName?:booleanWhether the project's and the package's names follow the new location; true when unsetThe options settled.