@hyperfrontend/workspace/generators/move

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.

npx hf generate move my-utils --destination=libs/utils
npx hf generate move my-utils \
  --destination=packages --newName=utils --updateName=false
OptionWhat it sets
--projectThe project to move (also the first positional argument)
--destinationThe directory it moves under, relative to the root
--newNameThe directory's new name; defaults to the current one
--projectNameThe project's new name when the names are updated; defaults to the directory's name
--packageNameThe package's new name when the names are updated; defaults to the directory's name under the current scope
--updateNameWhether the project and package names follow the new location; defaults to true
--skipFormatLeave the written files unformatted

API Reference§

ƒ Functions

§function

moveGenerator(tree: Tree, options: MoveGeneratorOptions): Promise<void>

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
NameTypeDescription
§tree
TreeThe tree, rooted at the workspace
§options
MoveGeneratorOptionsWhich 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/utils

Move and rename it

npx hf generate move my-utils libs/utils --newName=data

Move it without changing its names

npx hf generate move my-utils libs/utils --updateName=false
§function

planMove(tree: Tree, options: MoveGeneratorOptions): MovePlan

Settles the options: where the project goes and what it and its package are called there.
Parameters
NameTypeDescription
§tree
TreeThe tree the project lives in
§options
MoveGeneratorOptionsThe options as given
Returns
MovePlan
The roots, the names and the offset the move writes from

◈ Interfaces

§interface

MoveGeneratorOptions

What the move generator takes.
Properties
§project:stringThe project moved
§destination:stringThe directory the project's directory moves under, relative to the root
§newName?:stringThe new name of the project's directory; the current one when unset
§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 unset
§skipFormat?:booleanSkip formatting the generated files
§interface

MovePlan

The options settled.
Properties
§projectName:stringThe project's current name
§currentProjectRoot:stringThe project's current directory, relative to the root
§newProjectRoot:stringThe project's new directory, relative to the root
§newProjectName:stringThe project's new name; its current one when the names are kept
§currentPackageName:stringThe package's current name, or undefined for a project with no package
§newPackageName:stringThe package's new name, or undefined for a project with no package
§updateName:booleanWhether the names follow the new location
§newOffsetFromRoot:stringThe path from the new project root to the workspace root