Skip to content

v5 Workflow

Matt Karl edited this page Dec 15, 2017 · 1 revision

This is a work-in-progress document to describe the NPM commands for using the v5 (next) version of PixiJS locally.

Installing

PixiJS now uses Lerna to provide the publishing mechanisms necessary to publishing multiple packages from a single repository. Lerna "bootstraps" all of the packages, meaning it links any internal dependencies using symlinks and other external dependencies are installed at the root-level (Lerna calls this "hoisting"). To install all dependencies, and to bootstrap run:

npm install

If you need to re-bootstrap, because you added, moved, or changed any internal dependencies, run:

npm run bootstrap

Development Build

This will build all packages in development mode. This means the output will be unminified (more readable).

npm run build:dev

To build a specific package in development mode, use the --scope flag.

npm run build:dev -- --scope @pixi/core

The --scope flat supports glob expressions, for instance:

npm run build:dev -- --scope @pixi/*
npm run build:dev -- --scope "{@pixi/core,pixi.js}"

Also, --ignore is also supported to specifically exclude packages. The following example will build all packages except @pixi/core.

npm run build:dev -- --ignore @pixi/core

Production Build

As with development building, this command accepts the use of --scope and --ignore. The difference is that files are building minified, using uglify and are not human-readable.

npm run build:prod

Watching

A watch command is useful for making incremental changes without have to manually rebuild. This command also accepts the use of --scope and --ignore options.

npm run watch

Cleaning

To clean all of the build files (those contained in the lib/ folders) AND remove all of the node_modules in each package (internal symlinks generated by Lerna), run the following:

npm run clean

To ONLY clean the build files:

npm run clean:build

Linting

This will run ESLint for all source files and tests.

npm run lint

If you which to use the "fix" option for ESLint, this will try to fix common errors like whitespacing issues or quote preference.

npm run lintfix

Testing

Running unit-tests headlessly can be done by running:

npm run unit-test

To run the unit-tests in a debugging environment. This allows the use of debugger, DevTools and other helpful development tools.

npm run unit-test -- --debug

If you which to run the unit-tests for a specific packages (and not all packages), you can navigate to the folder and run the test command there. For instance:

cd packages/core
npm test

You can also run individual tests in a debugging environment.

cd packages/core
npm test -- --debug