CLI

Refactoring

Rename a workspace package, turn a local module into a folder module, or move a module or package, with every reference fixed.

These commands change many files at once. Each takes --dry-run to print what would change and write nothing.

package:rename

pnpx @frigear-nu/cli package:rename <package> <new-name> [--dir] [--dry-run]
ArgumentDefaultPurpose
packagerequiredThe package: its current name, or its folder (relative to --cwd or the workspace root).
new-namerequiredThe new name. A bare name keeps the old scope: forms renames @acme/old to @acme/forms.
--dirfalseAlso rename the folder to the new unscoped name, and fix paths that point into it.
--dry-runPrint what would change; write nothing.

It changes, across the workspace (skipping node_modules, .nuxt, .output, .data, dist, hidden folders and changelogs):

  • the package's own name;
  • the key in the dependencies, devDependencies, peerDependencies, optionalDependencies and peerDependenciesMeta of every package.json, keeping the spec (workspace:* stays workspace:*);
  • keys and list items of pnpm-workspace.yaml (catalog, overrides, minimumReleaseAgeExclude), edited as text so comments stay;
  • string literals equal to the name or starting with <name>/ in .ts, .mts, .js, .mjs, .vue and .json files: imports, import('…'), nuxt.config modules entries, tsconfig paths; and mentions in Markdown.

An unscoped name is too common a word to replace in every string, so for one only manifests and import, export and require specifiers change, and the command says so. Lockfiles are never edited: run pnpm install afterwards, then nuxi prepare in the apps that use the package.

module folder

pnpx @frigear-nu/cli module folder <module> [--app <app>] [--runtime] [--dry-run]
ArgumentDefaultPurpose
modulerequiredA path to modules/<name>.ts in an app or layer, or a bare name looked up in the app's modules/.
--appas for module addThe app a bare name is looked up in: a path, or a folder under apps/.
--runtimefalseAlso create runtime/plugin.ts, a plugin stub.
--dry-runPrint what would change; write nothing.

Nuxt registers both modules/*.ts and modules/*/index.ts, so modules/foo.ts can become modules/foo/index.ts with a runtime/ folder next to it. The command moves the file, rewrites its relative imports (./x becomes ../x) and updates imports of it that name the file with its extension; an extensionless ../modules/foo still resolves, so it stays. It refuses when modules/foo/ exists. When the module has no createResolver(import.meta.url), it prints how to add one and register runtime files with resolve('./runtime/…').

module move

pnpx @frigear-nu/cli module move <module> <destination> [--name <name>] [--app <app>] [--dry-run]
ArgumentDefaultPurpose
modulerequiredA module file (modules/foo.ts), a folder module (modules/foo/), a package folder, or a bare name in the app's modules/.
destinationrequiredThe directory to move it into. For a local module, an app or layer folder (one with a nuxt.config) means its modules/.
--namethe current nameNew file or folder name. A package keeps its name: use package:rename for that.
--appas for module addThe app a bare module name is looked up in.
--dry-runPrint what would change; write nothing.

It refuses to overwrite. Relative paths inside the moved files that point outside them are made relative to the new place, and relative or ~~/ paths elsewhere in the workspace that point into it (imports, nuxt.config extends and modules entries, tsconfig extends, Markdown links) follow it. Paths that do not resolve to an existing file are left alone. It warns when:

  • a moved file uses a Nuxt alias (~/, ~~/) that now resolves against another app;
  • the module imports a package the source app depends on and the destination does not;
  • a package folder lands outside the packages: globs of pnpm-workspace.yaml, where pnpm will not link it.

Restart nuxi dev in both apps after moving a local module, and run pnpm install after moving a package.

Copyright © 2026