We use a Webpackwebpack configuration for building the contents of the NPM package ready for publishing. To build the package, run:
npm run build
This will install dependencies, lint JS files, and then build the package content in the ./dist/ directory.
To perform the package build process above and then run front-end JS tests using Jasminejasmine and Jasmine Browser Runnerjasmine-browser-runner against the processed files:
npm run test
These steps assume you have logged into the NPM CLI and are apart of the @mozmeao organization on NPM
TrafficCop is published to NPM under the @mozmeao/trafficcop namespace/package name. To publish a release to NPM, use the following steps:
- Before you start make sure the project's CHANGELOG.md is up to date.
- Update the package
versionnumber in package.json (use [Semantic Versioning][semver] to determine what the new version number should be). - Update the package README README.md.
- Run
npm installto update the package-lock.json file. - Submit a pull request with your against the
mainbranch. Once the changes have been approved and merged to main: - Run
npm testto run the build script and front-end tests. The package contents will be located in./dist/. - Tag a new release. You can do this either using Git tag, or directly on the GitHub website. (Example:
git tag -a v1.1.0). If you used Git tag, push your tags to the repo usinggit push --tags - If the build is successful and all tests pass, publish to NPM using
npm publish ./dist/.