# ProjectPackageJson Service

Module
import { ProjectPackageJson } from "@tsed/cli-core"
Source/packages/cli-core/src/services/ProjectPackageJson.ts

# Overview

class ProjectPackageJson {
    rewrite: boolean;
    reinstall: boolean;
    protected cliExeca: CliExeca;
    protected npmRegistryClient: NpmRegistryClient;
    protected fs: CliFs;
    constructor(configuration: Configuration);
    get path(): string;
    get dir(): string;
    set dir(dir: string);
    get name(): string;
    set name(name: string);
    get version(): string;
    get description(): string;
    get scripts(): {
        [key: string]: string;
    };
    get dependencies(): {
        [key: string]: string;
    };
    get devDependencies(): {
        [key: string]: string;
    };
    get allDependencies(): {
        [key: string]: string;
    };
    addDevDependency(pkg: string, version?: string): this;
    addDevDependencies(modules: {
        [key: string]: string | undefined;
    }, scope?: object): this;
    addDependency(pkg: string, version?: string): this;
    addDependencies(modules: {
        [key: string]: string | undefined;
    }, ctx?: any): this;
    addScript(task: string, cmd: string): this;
    addScripts(scripts: {
        [key: string]: string;
    }): this;
    add(key: string, data: any): this;
    set(key: string, value: any): void;
    get(key: string): any;
    write(): void;
    hasYarn(): boolean;
    install(options?: InstallOptions): Listr<any>;
    importModule(mod: string): Promise<any>;
    runScript(npmTask: string, ignoreError?: boolean): any;
    protected resolve(): Observable<unknown>;
    protected installWithYarn(): ({
        title: string;
        skip: () => boolean;
        task: () => any;
    } | {
        title: string;
        task(): void;
        skip?: undefined;
    })[];
    protected installWithNpm(): ({
        title: string;
        enabled: () => boolean;
        skip: () => boolean;
        task: () => any;
    } | {
        title: string;
        skip: () => boolean;
        task: () => any;
        enabled?: undefined;
    } | {
        title: string;
        task(): void;
        enabled?: undefined;
        skip?: undefined;
    })[];
}

# Members

rewrite: boolean

reinstall: boolean

protected cliExeca: CliExeca

protected npmRegistryClient: NpmRegistryClient

protected fs: CliFs

get path(): string

get dir(): string

set dir(dir: string)

get name(): string

set name(name: string)

get version(): string

get description(): string

get scripts(): {
     [key: string]: string;
 };

get dependencies(): {
     [key: string]: string;
 };

get devDependencies(): {
     [key: string]: string;
 };

get allDependencies(): {
     [key: string]: string;
 };

addDevDependency(pkg: string, version?: string): this

addDevDependencies(modules: {
     [key: string]: string | undefined;
 }, scope?: object): this;

addDependency(pkg: string, version?: string): this

addDependencies(modules: {
     [key: string]: string | undefined;
 }, ctx?: any): this;

addScript(task: string, cmd: string): this

addScripts(scripts: {
     [key: string]: string;
 }): this;

add(key: string, data: any): this

set(key: string, value: any): void

get(key: string): any

write(): void

hasYarn(): boolean

install(options?: InstallOptions): Listr<any>

importModule(mod: string): Promise<any>

Import a module from the project workspace


runScript(npmTask: string, ignoreError?: boolean): any

protected resolve(): Observable<unknown>

protected installWithYarn(): ({
     title: string;
     skip: () => boolean;
     task: () => any;
 } | {
     title: string;
     task(): void;
     skip?: undefined;
 })[];

protected installWithNpm(): ({
     title: string;
     enabled: () => boolean;
     skip: () => boolean;
     task: () => any;
 } | {
     title: string;
     skip: () => boolean;
     task: () => any;
     enabled?: undefined;
 } | {
     title: string;
     task(): void;
     enabled?: undefined;
     skip?: undefined;
 })[];