@qui-cli/root
v3.1.0
Published
@qui-cli Plugin: Identify the root of the current application
Readme
@qui-cli/root
@qui-cli Plugin: Identify the root of the current application
Install
npm install @qui-cli/rootUsage
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());Configuration
export type Configuration = Plugin.Configuration & {
root?: string;
cwd?: string | boolean;
};root
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.
cwd
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.
Options
Root adds no user-configurable command line options.
Initialization
Root requires no initialization
API
import { Root } from '@qui-cli/root';Root.path(): string
Get the currently defined root path.
