fixturify-project

  • Version 7.1.1
  • Published
  • 144 kB
  • 13 dependencies
  • MIT license

Install

npm i fixturify-project
yarn add fixturify-project
pnpm add fixturify-project

Overview

[![npm version](https://badge.fury.io/js/fixturify-project.svg)](https://badge.fury.io/js/fixturify-project) [![CI](https://github.com/stefanpenner/node-fixturify-project/workflows/CI/badge.svg)](https://github.com/stefanpenner/node-fixturify-project/acti

Index

Classes

class Project

class Project {}

    constructor

    constructor(
    name?: string,
    version?: string,
    args?: Omit<ProjectArgs, 'name' | 'version'>,
    projectCallback?: ProjectCallback
    );

      constructor

      constructor(
      name?: string,
      version?: string,
      args?: Omit<ProjectArgs, 'name' | 'version'>
      );

        constructor

        constructor(name?: string, version?: string, projectCallback?: ProjectCallback);

          constructor

          constructor(
          name?: string,
          args?: Omit<ProjectArgs, 'name'>,
          projectCallback?: ProjectCallback
          );

            constructor

            constructor(args?: ProjectArgs, projectCallback?: ProjectCallback);

              property baseDir

              baseDir: string;
              • Gets the base directory path, usually a tmp directory unless a baseDir has been explicitly set.

                Project

                Modifiers

                • @readonly

              property files

              files: fixturify.DirJSON;

                property isDependency

                readonly isDependency: boolean;

                  property name

                  name: string;
                  • Gets the package name from the package.json.

                    {string} Project

                  property pkg

                  pkg: any;

                    property version

                    version: string;
                    • Gets the version number from the package.json.

                      {string} Project

                    method addDependency

                    addDependency: {
                    (
                    name?: string,
                    version?: string,
                    args?: Omit<ProjectArgs, 'name' | 'version'>,
                    projectCallback?: ProjectCallback
                    ): Project;
                    (
                    name?: string,
                    version?: string,
                    projectCallback?: ProjectCallback
                    ): Project;
                    (
                    name?: string,
                    args?: Omit<ProjectArgs, 'name'>,
                    projectCallback?: ProjectCallback
                    ): Project;
                    (args?: ProjectArgs, projectCallback?: ProjectCallback): Project;
                    (args?: Project, projectCallback?: ProjectCallback): Project;
                    };

                      method addDevDependency

                      addDevDependency: {
                      (
                      name?: string,
                      version?: string,
                      args?: Omit<ProjectArgs, 'name' | 'version'>,
                      projectCallback?: ProjectCallback
                      ): Project;
                      (
                      name?: string,
                      version?: string,
                      projectCallback?: ProjectCallback
                      ): Project;
                      (
                      name?: string,
                      args?: Omit<ProjectArgs, 'name'>,
                      projectCallback?: ProjectCallback
                      ): Project;
                      (args?: ProjectArgs, projectCallback?: ProjectCallback): Project;
                      (args?: Project, projectCallback?: ProjectCallback): Project;
                      };
                      • Adds a devDependency to the Project's package.json.

                        Returns

                        - The Project instance.

                      method clone

                      clone: () => Project;
                      • Returns

                        - The cloned Project.

                      method dependencyProjects

                      dependencyProjects: () => Project[];
                      • Returns

                        - An array of the dependencies for this Projct.

                      method devDependencyProjects

                      devDependencyProjects: () => Project[];
                      • Returns

                        - An array of the devDependencies for this Projct.

                      method dispose

                      dispose: () => void;
                      • Disposes of the tmp directory that the Project is stored in.

                      method fromDir

                      static fromDir: (baseDir: string, opts?: ReadDirOpts) => Project;
                      • Reads an existing project from the specified base dir.

                        Parameter baseDir

                        The base directory to read the project from.

                        Parameter opts

                        An options object.

                        Parameter

                        opts.linkDeps - Include linking dependencies from the Project's node_modules.

                        Parameter

                        opts.linkDevDeps - Include linking devDependencies from the Project's node_modules.

                        Returns

                        - The deserialized Project.

                      method linkDependency

                      linkDependency: (name: string, opts: LinkParams) => void;
                      • Links a dependency.

                        Parameter name

                        The name of the dependency to link.

                      method linkDevDependency

                      linkDevDependency: (name: string, opts: LinkParams) => void;
                      • Links a devDependency.

                        Parameter name

                        The name of the dependency to link.

                      method mergeFiles

                      mergeFiles: (dirJSON: fixturify.DirJSON) => void;
                      • Merges an object containing a directory represention with the existing files.

                        Parameter dirJSON

                        An object containing a directory representation to merge.

                      method removeDependency

                      removeDependency: (name: string) => void;
                      • Removes a dependency to the Project's package.json.

                        Parameter name

                        The name of the dependency to remove.

                      method removeDevDependency

                      removeDevDependency: (name: string) => void;
                      • Removes a devDependency.

                        Parameter name

                        The name of the devDependency to remove.

                      method write

                      write: (dirJSON?: fixturify.DirJSON) => Promise<void>;
                      • Writes the existing files property containing a directory representation to the tmp directory.

                        Parameter dirJSON

                        ? - An optional object containing a directory representation to write.

                      Interfaces

                      interface ProjectArgs

                      interface ProjectArgs {}

                        property files

                        files?: fixturify.DirJSON;

                          property name

                          name?: string;

                            property requestedRange

                            requestedRange?: string;

                              property version

                              version?: string;

                                Type Aliases

                                type LinkParams

                                type LinkParams =
                                | {
                                baseDir: string;
                                resolveName?: string;
                                requestedRange?: string;
                                }
                                | {
                                target: string;
                                requestedRange?: string;
                                }
                                | {
                                project: Project;
                                requestedRange?: string;
                                };

                                  Package Files (1)

                                  Dependencies (13)

                                  Dev Dependencies (13)

                                  Peer Dependencies (0)

                                  No peer dependencies.

                                  Badge

                                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/fixturify-project.

                                  • Markdown
                                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/fixturify-project)
                                  • HTML
                                    <a href="https://www.jsdocs.io/package/fixturify-project"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>