@qui-cli Plugin: Identify the root of the current application
npm install @qui-cli/root@qui-cli Plugin: Identify the root of the current application


``sh`
npm install @qui-cli/root
`ts
import { Root } from '@qui-cli/root';
import path from 'node:path';
// configure Root
Root.configure({ root: path.resolve(import.meta.dirname, '../../..') });
// use Root
console.log(Root.path());
`
`ts`
export type Configuration = Plugin.Configuration & {
root?: string;
cwd?: string | boolean;
};
Specify the desired root to use as a base for relative paths in your application. Can be relative to the package root, or an absolute path. If undefined, defaults to the root of the package.
CAUTION: When working in a monorepo, the package root will be inferred as the root of the monorepo itself, and not the root of the package within which you are working.
Specify whether to also set root as the current working directory. If true, use root as the process.cwd(), if cwd is a path, it is resolved relative to root.
Root adds no user-configurable command line options.
Root requires no initialization
`ts``
import { Root } from '@qui-cli/root';
Get the currently defined root path.