Skip to content
This repository was archived by the owner on Feb 7, 2022. It is now read-only.

Commit 0a692ed

Browse files
author
Efe Gürkan YALAMAN
committed
Modernize code base and add prettier
Modernize code base to es6, add prettier. Create build and watch scripts. -Add build script. Transforms files to dist folder if they are JS files otherwise it copies the file. -Add watch script. Watches changes on source files and runs build accordingly. -Move tests and index file to src. -Change babelrc to use on build. -Rearrange config files to not include tests and irrelevant files while packing for release. -Change code base to ES6 imports. -Add yarn.lock file. -Add yarn scripts to build and test before release. More refactoring Refactor parts that found during review. Change worker-farm with jest-worker Refactor index, drop support for watch mode
1 parent 2c50d31 commit 0a692ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+5183
-1439
lines changed

.babelrc

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
{
2-
"presets": [
3-
["env", {
4-
"targets": {"node": 4}
5-
}
6-
]]
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"targets": { "node": 6 }
7+
}
8+
]
9+
],
10+
"plugins": [
11+
"syntax-trailing-function-commas",
12+
"transform-es2015-destructuring",
13+
"transform-es2015-parameters",
14+
"transform-async-to-generator",
15+
"transform-strict-mode",
16+
"transform-object-rest-spread",
17+
"transform-es2015-modules-commonjs",
18+
"transform-async-to-generator"
19+
],
20+
"retainLines": true
721
}

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ jobs:
44
docker:
55
# specify the version you desire here
66
- image: circleci/node:6
7+
- image: circleci/node:8
78
- image: circleci/node:latest
89

910
working_directory: ~/repo
@@ -13,6 +14,6 @@ jobs:
1314

1415
- run: npm install
1516

16-
- run: npm run test-only
17+
- run: npm run test-only
1718

1819

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules/
2+
coverage/
3+
dist/

.npmignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Do not pack irrelevant dirs
2+
node_modules/
3+
coverage/
4+
__mocks__/
5+
__tests__/
6+
build/
7+
8+
# Do not pack configs
9+
jest.config.js
10+
.circleci/
11+
.github/
12+
.babelrc
13+
.editorconfig
14+
.gitignore
15+
.prettierrc
16+
.travis.yml
17+
yarn.lock

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.prettierrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4,
4+
"trailingComma": "all",
5+
"overrides": [
6+
{
7+
"files": "**/build/**",
8+
"options": {
9+
"trailingComma": "es5"
10+
}
11+
}
12+
]
13+
}

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: node_js
22
node_js:
33
- "node"
44
- "6"
5+
- "8"
56

67
install:
78
- npm install

README.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[![npm version](https://badge.fury.io/js/parallel-webpack.svg)](https://badge.fury.io/js/parallel-webpack)
2-
[![Build Status](https://travis-ci.org/trivago/parallel-webpack.svg?branch=master)](https://travis-ci.org/trivago/parallel-webpack) [![CircleCI](https://circleci.com/gh/trivago/parallel-webpack.svg?style=svg)](https://circleci.com/gh/trivago/parallel-webpack) [![Coverage Status](https://coveralls.io/repos/github/trivago/parallel-webpack/badge.svg?branch=coverage)](https://coveralls.io/github/trivago/parallel-webpack?branch=coverage)
2+
[![Build Status](https://travis-ci.org/trivago/parallel-webpack.svg?branch=master)](https://travis-ci.org/trivago/parallel-webpack)
3+
[![CircleCI](https://circleci.com/gh/trivago/parallel-webpack.svg?style=svg)](https://circleci.com/gh/trivago/parallel-webpack)
4+
[![Coverage Status](https://coveralls.io/repos/github/trivago/parallel-webpack/badge.svg?branch=coverage)](https://coveralls.io/github/trivago/parallel-webpack?branch=coverage)
35
# parallel-webpack - Building multi-configs in parallel
46

57
`parallel-webpack` allows you to run multiple webpack builds in parallel,
@@ -8,10 +10,18 @@ up your build. For us at [trivago](http://www.trivago.com) it has reduced
810
the build from 16 minutes to just 2 minutes - for 32 variants. That performance
911
improvement naturally comes at the expense of utilizing all available CPU cores.
1012

13+
# IMPORTANT: Starting from 3.x watch mode will be dropped
14+
Starting from 3.x series we will drop support for watch mode. If you need it
15+
keep using ^2.2.0.
16+
1117
## Installation
1218

1319
```sh
1420
npm install parallel-webpack --save-dev
21+
22+
# or
23+
24+
yarn add --dev parallel-webpack
1525
```
1626

1727
You can choose whether to install `parallel-webpack` globally or locally.
@@ -127,17 +137,6 @@ The above configuration will create 16 variations of the build for you, which
127137
[WEBPACK] Started building MyLib.var.min.debug.js
128138
```
129139

130-
## Running the watcher
131-
132-
One of the features that made webpack so popular is certainly its watcher which
133-
continously rebuilds your application.
134-
135-
When using `parallel-webpack`, you can easily use the same feature as well by
136-
specifying the `--watch` option on the command line:
137-
138-
```
139-
parallel-webpack --watch
140-
```
141140

142141
## Specifying retry limits
143142

@@ -212,7 +211,8 @@ are no differences between various ways of invoking the `webpack.config.js`.
212211
## Node.js API
213212

214213
Just like webpack, you can also use `parallel-webpack` as an API from node.js
215-
(You can specify any other option used in [worker-farm](https://www.npmjs.com/package/worker-farm)):
214+
(For 2.x : you can specify any other option used in [worker-farm](https://www.npmjs.com/package/worker-farm)):
215+
(For 3.x : you can specify any other option used in [jest-worker](https://www.npmjs.com/package/jest-worker)):
216216

217217
```javascript
218218
var run = require('parallel-webpack').run,
@@ -222,7 +222,8 @@ run(configPath, {
222222
watch: false,
223223
maxRetries: 1,
224224
stats: true, // defaults to false
225-
maxConcurrentWorkers: 2 // use 2 workers
225+
maxConcurrentWorkers: 2, // use 2 workers if you are on 2.x version
226+
maxWorkers: 2 // use 2 workers if you are in 3.x version
226227
});
227228
```
228229

__mocks__/bluebird.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

__mocks__/worker-farm.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)