Skip to content

Commit

Permalink
Fix OccurrenceOrderPlugin spelling (kriasoft#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
athomann authored and frenzzy committed Jun 14, 2016
1 parent 47c7156 commit 087e389
Show file tree
Hide file tree
Showing 19 changed files with 490 additions and 415 deletions.
43 changes: 31 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"private": true,
"engines": {
"node": ">=5.0 <7",
"npm": ">=3.3 <4"
"node": ">=6 <7",
"npm": ">=3.8 <4"
},
"dependencies": {
"babel-polyfill": "6.9.1",
Expand Down Expand Up @@ -46,14 +46,15 @@
"babel-core": "^6.9.0",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-plugin-external-helpers": "^6.8.0",
"babel-plugin-react-transform": "^2.0.2",
"babel-plugin-rewire": "^1.0.0-rc-3",
"babel-plugin-transform-es2015-modules-commonjs": "^6.8.0",
"babel-plugin-transform-react-constant-elements": "^6.8.0",
"babel-plugin-transform-react-inline-elements": "^6.8.0",
"babel-plugin-transform-react-remove-prop-types": "^0.2.7",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-node5": "^11.1.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.9.0",
Expand All @@ -62,7 +63,6 @@
"browser-sync": "^2.12.8",
"chai": "^3.5.0",
"css-loader": "^0.23.1",
"del": "^2.2.0",
"enzyme": "^2.3.0",
"eslint": "^2.10.2",
"eslint-config-airbnb": "^9.0.1",
Expand All @@ -79,7 +79,6 @@
"json-loader": "^0.5.4",
"mkdirp": "^0.5.1",
"mocha": "^2.5.3",
"ncp": "^2.0.0",
"pixrem": "^3.0.1",
"pleeease-filters": "^3.0.0",
"postcss": "^5.0.21",
Expand All @@ -97,23 +96,42 @@
"postcss-selector-not": "^2.0.0",
"raw-loader": "^0.5.1",
"react-addons-test-utils": "^15.1.0",
"react-hot-loader": "^3.0.0-beta.2",
"react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.4",
"redbox-react": "^1.2.6",
"rimraf": "^2.5.2",
"sinon": "^2.0.0-pre",
"stylelint": "^6.5.1",
"stylelint-config-standard": "^8.0.0",
"url-loader": "^0.5.7",
"webpack": "^1.13.1",
"webpack-hot-middleware": "^2.10.0",
"webpack-middleware": "^1.5.1"
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.10.0"
},
"babel": {
"presets": [
"react",
"node5",
"stage-0"
],
"plugins": [
[
"transform-es2015-modules-commonjs",
{
"loose": true
}
],
[
"transform-es2015-destructuring",
{
"loose": true
}
],
"transform-es2015-function-name",
"transform-es2015-parameters",
"external-helpers",
"transform-runtime"
],
"env": {
"test": {
"plugins": [
Expand Down Expand Up @@ -163,10 +181,11 @@
"test:watch": "npm run test -- --reporter min --watch",
"clean": "babel-node tools/run clean",
"copy": "babel-node tools/run copy",
"bundle": "babel-node tools/run bundle",
"build": "babel-node tools/run build",
"deploy": "babel-node tools/run deploy",
"compile": "babel-node tools/run compile",
"build": "babel-node tools/run build --release",
"build:debug": "babel-node tools/run build",
"render": "babel-node tools/run render",
"start": "babel-node tools/run start"
"start": "babel-node tools/run start",
"deploy": "babel-node tools/run deploy"
}
}
2 changes: 1 addition & 1 deletion src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* LICENSE.txt file in the root directory of this source tree.
*/

import 'babel-polyfill';
import 'source-map-support/register';
import path from 'path';
import express from 'express';
import cookieParser from 'cookie-parser';
Expand Down
12 changes: 6 additions & 6 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

* Cleans up the output `/build` directory (`clean.js`)
* Copies static files to the output folder (`copy.js`)
* Launches [Webpack](https://webpack.github.io/) compiler in a watch mode (via [webpack-middleware](https://github.com/kriasoft/webpack-middleware))
* Launches [Webpack](https://webpack.github.io/) compiler in a watch mode (via [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware))
* Launches Node.js server from the compiled output folder (`runServer.js`)
* Launches [Browsersync](https://browsersync.io/),
[HMR](https://webpack.github.io/docs/hot-module-replacement), and
[React Transform](https://github.com/gaearon/babel-plugin-react-transform)
[Hot Module Replacement](https://webpack.github.io/docs/hot-module-replacement), and
[React Hot Loader](https://github.com/gaearon/react-hot-loader)

##### `npm run build` (`build.js`)

* Cleans up the output `/build` folder (`clean.js`)
* Copies static files to the output folder (`copy.js`)
* Creates application bundles with Webpack (`bundle.js`, `webpack.config.js`)
* Compiles application (`compile.js`, `compileClient.js`, `compileServer.js`, `webpack.config.js`)

##### `npm run deploy` (`deploy.js`)

Expand All @@ -32,7 +32,7 @@ Flag | Description
For example:

```sh
$ npm run build -- --release --verbose # Build the app in production mode
$ npm run build -- --static --verbose # Build the app with static html files
```

or
Expand All @@ -43,6 +43,6 @@ $ npm start -- --release # Launch dev server in production mode

#### Misc

* `webpack.config.js` - Webpack configuration for both client-side and server-side bundles
* `webpack.config.js` - Webpack configuration for client-side bundle
* `run.js` - Helps to launch other scripts with `babel-node` (e.g. `babel-node tools/run build`)
* `.eslintrc` - ESLint overrides for built automation scripts
10 changes: 6 additions & 4 deletions tools/build.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
Expand All @@ -10,7 +10,7 @@
import run from './run';
import clean from './clean';
import copy from './copy';
import bundle from './bundle';
import compile from './compile';
import render from './render';

/**
Expand All @@ -19,8 +19,10 @@ import render from './render';
*/
async function build() {
await run(clean);
await run(copy);
await run(bundle);
await Promise.all([
run(copy),
run(compile),
]);

if (process.argv.includes('--static')) {
await run(render);
Expand Down
22 changes: 16 additions & 6 deletions tools/clean.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/

import del from 'del';
import fs from './lib/fs';
import { cleanDir } from './lib/fs';

/**
* Cleans up the output (build) directory.
*/
async function clean() {
await del(['.tmp', 'build/*', '!build/.git'], { dot: true });
await fs.makeDir('build/public');
function clean() {
return Promise.all([
cleanDir('build/*', {
nosort: true,
dot: true,
ignore: ['build/.git', 'build/public'],
}),

cleanDir('build/public/*', {
nosort: true,
dot: true,
ignore: ['build/public/.git'],
}),
]);
}

export default clean;
21 changes: 21 additions & 0 deletions tools/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/

import run from './run';
import compileClient from './compileClient';
import compileServer from './compileServer';

function compile() {
return Promise.all([
run(compileClient),
run(compileServer),
]);
}

export default compile;
10 changes: 5 additions & 5 deletions tools/bundle.js → tools/compileClient.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
Expand All @@ -11,19 +11,19 @@ import webpack from 'webpack';
import webpackConfig from './webpack.config';

/**
* Creates application bundles from the source files.
* Creates client-side application bundle from the source files.
*/
function bundle() {
function compileClient() {
return new Promise((resolve, reject) => {
webpack(webpackConfig).run((err, stats) => {
if (err) {
return reject(err);
}

console.log(stats.toString(webpackConfig[0].stats));
console.log(stats.toString(webpackConfig.stats));
return resolve();
});
});
}

export default bundle;
export default compileClient;
49 changes: 49 additions & 0 deletions tools/compileServer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/

import path from 'path';
const babel = require('babel-core');
import { readFile, writeFile, copyFile, readDir, makeDir } from './lib/fs';

/**
* Compile server-side application from the source files.
*/
async function compileServer() {
const dirs = await readDir('**/*.*', {
cwd: 'src',
nosort: true,
dot: false,
ignore: [
'client.js',
'public/*',
'**/*.css',
'**/*.client.js',
'**/*.test.js',
],
});

await Promise.all(dirs.map(async dir => {
const from = path.resolve('src', dir);
const to = path.resolve('build', dir);
const ext = path.extname(dir);
await makeDir(path.dirname(to));
if (ext === '.js') {
const file = await readFile(from);
const result = babel.transform(file, {
filename: dir,
filenameRelative: from,
sourceMaps: 'inline',
});
return await writeFile(to, result.code);
}
return await copyFile(from, to);
}));
}

export default compileServer;
Loading

0 comments on commit 087e389

Please sign in to comment.