From 2379fc187c340a90f9531c7ce08f4135cb1e1e4f Mon Sep 17 00:00:00 2001 From: Boopathi Rajaa Date: Fri, 17 Mar 2017 23:45:58 +0100 Subject: [PATCH] Update Contributing.md [skip ci] (#480) * Update Contributing.md [skip ci] * Fix wording [skip ci] * Remove $ [skip ci] --- CONTRIBUTING.md | 70 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 68a9cb3f6..b2566baeb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,54 +8,90 @@ $ npm install $ npm run bootstrap ``` -Then you can either run: +#### Build + +To build **once**: ```sh -$ npm run build +npm run build ``` -to build Babel **once** or: +Or to do an incremental build in watch mode: ```sh -$ npm run watch +npm run watch +``` + +#### Lint + +This project uses [prettier](https://github.com/prettier/prettier) for formatting code and [eslint](https://github.com/eslint/eslint) for other linting. + +To check both: + +```sh +npm run lint +``` + +You can also run them each individually: + + ```sh +# prettier +npm run format-check + +# eslint +npm run eslint ``` -to have Babel build itself then incrementally build files on change. +##### Lint Fix -To run all tests: +To fix formatting and auto-fixable eslint errors, ```sh -$ npm test +npm run fix ``` -or run tests for a specific package: +You can also run them each individually: ```sh -$ npm test packages/babel-preset-babili +# prettier +npm run format + +# eslint +npm run eslint-fix ``` -To run lint: +#### Test + +To run all tests, ```sh -$ npm run lint +npm test ``` -To run lint autofixes: +To run tests for a specific package, + +```sh +npm test packages/babel-preset-babili +``` + +#### Benchmarks + +[benchmark.js](scripts/benchmark.js) compares Babili with [Uglify](https://github.com/mishoo/UglifyJS2), [Closure Compiler](https://github.com/google/closure-compiler) and [Closure Compiler JS](https://github.com/google/closure-compiler-js) ```sh -$ npm run fix +./scripts/benchmark.js [file...] ``` -To run current benchmarks on a file: +[plugin-timing.js](scripts/plugin-timing.js) is used to calculate and compare the time spent in each plugin. ```sh -$ ./scripts/benchmark.js [file...] +./scripts/plugin-timing.js file.js ``` -To run current plugin timing on a file: +[plugin-contribution.js](scripts/plugin-contribution.js) calculates how much each plugin of babili contributes to size reduction. ```sh -$ ./scripts/plugin-timing.js file.js +./scripts/plugin-contribution.js file.js ``` ### Debugging