Skip to content

Commit

Permalink
[Project] Update to use webpack 2 and Yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyno-zeta committed Feb 16, 2017
1 parent 8e538c6 commit d7c088b
Show file tree
Hide file tree
Showing 16 changed files with 6,507 additions and 143 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,3 @@ tramp
# Project
dist/
dev_build/
yarn.lock
8 changes: 4 additions & 4 deletions dev/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
/* ************************************* */
/* ******** IMPORTS ******** */
/* ************************************* */
import React, { Component } from 'react';
import Header from './components/Header.jsx';
import Footer from './components/Footer.jsx';
import Body from './components/Body.jsx';
import React, {Component} from 'react'
import Header from './components/Header.jsx'
import Footer from './components/Footer.jsx'
import Body from './components/Body.jsx'

/* ************************************* */
/* ******** VARIABLES ******** */
Expand Down
32 changes: 18 additions & 14 deletions dev/components/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
/* ************************************* */
/* ******** IMPORTS ******** */
/* ************************************* */
import React, { Component } from 'react';
import _ from 'lodash';
import { JsonTree } from '../../src/JsonTree.js';
import React, {Component} from 'react'
import _ from 'lodash'
import {JsonTree} from '../../src/JsonTree.js'

/* ************************************* */
/* ******** VARIABLES ******** */
Expand Down Expand Up @@ -103,13 +103,17 @@ class Body extends Component {
}

refReadOnlyFunctionCheckbox(node) {
this.state.readOnlyFunctionRef = node;
this.state.readOnlyFunctionRef.disabled = true;
if (node) {
this.state.readOnlyFunctionRef = node;
this.state.readOnlyFunctionRef.disabled = true;
}
}

refReadOnlyBooleanCheckbox(node) {
this.state.readOnlyBooleanRef = node;
this.state.readOnlyBooleanRef.disabled = true;
if (node) {
this.state.readOnlyBooleanRef = node;
this.state.readOnlyBooleanRef.disabled = true;
}
}

refReadOnlyCheckbox(node) {
Expand All @@ -121,7 +125,7 @@ class Body extends Component {
}

handleChangeMinusMenu() {
const { minusMenuRef } = this.state;
const {minusMenuRef} = this.state;

this.setState({
minusMenu: minusMenuRef.checked,
Expand All @@ -133,15 +137,15 @@ class Body extends Component {
}

handleChangeCustomInput() {
const { customInputRef } = this.state;
const {customInputRef} = this.state;

this.setState({
customInput: customInputRef.checked,
});
}

handleSubmit() {
const { textareaRef } = this.state;
const {textareaRef} = this.state;
// Get data
const jsonString = textareaRef.value;

Expand All @@ -165,7 +169,7 @@ class Body extends Component {
}

handleChangeReadOnly() {
const { readOnlyRef, readOnlyBooleanRef, readOnlyFunctionRef } = this.state;
const {readOnlyRef, readOnlyBooleanRef, readOnlyFunctionRef} = this.state;

this.setState({
readOnlyEnable: readOnlyRef.checked,
Expand All @@ -189,7 +193,7 @@ class Body extends Component {
}

handleChangeReadOnlyBoolean() {
const { readOnlyBooleanRef, readOnlyFunctionRef } = this.state;
const {readOnlyBooleanRef, readOnlyFunctionRef} = this.state;

readOnlyFunctionRef.disabled = readOnlyBooleanRef.checked;

Expand All @@ -199,7 +203,7 @@ class Body extends Component {
}

handleChangeReadOnlyFunction() {
const { readOnlyFunctionRef, readOnlyBooleanRef } = this.state;
const {readOnlyFunctionRef, readOnlyBooleanRef} = this.state;

readOnlyBooleanRef.disabled = readOnlyFunctionRef.checked;

Expand Down Expand Up @@ -228,7 +232,7 @@ class Body extends Component {
}

render() {
const { json, deltaUpdateString, globalUpdateString, readOnly, customInput, minusMenu } = this.state;
const {json, deltaUpdateString, globalUpdateString, readOnly, customInput, minusMenu} = this.state;

const style1 = {
width: '100%',
Expand Down
4 changes: 4 additions & 0 deletions docs/app-a3d7f.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/app-a3d7f.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions docs/app-ed03b.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/app-ed03b.js.map

This file was deleted.

13 changes: 12 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
<!DOCTYPE html> <html lang=en> <head> <meta charset=UTF-8> <title>React Editable Json Tree</title> </head> <body style=margin:0> <div id=app></div> <script type="text/javascript" src="vendor.bundle.js"></script><script type="text/javascript" src="app-ed03b.js"></script></body> </html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>React Editable Json Tree</title>
</head>
<body style="margin: 0;">

<div id="app"></div>

<script type="text/javascript" src="vendor.bundle.js"></script><script type="text/javascript" src="app-a3d7f.js"></script></body>
</html>
44 changes: 22 additions & 22 deletions docs/vendor.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/vendor.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 40 additions & 30 deletions gulp/config/webpack-dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpackCombineLoaders = require('webpack-combine-loaders');
const autoprefixer = require('autoprefixer');

// Constants
Expand All @@ -34,96 +33,107 @@ module.exports = {
vendor: ['react', 'react-hotkeys', 'react-dom', 'lodash'],
},
resolve: {
extensions: ['', '.scss', '.sass', '.css', '.js', '.jsx', '.json'],
extensions: ['.scss', '.sass', '.css', '.js', '.jsx', '.json'],
},
output: {
path: BUILD_DIR,
filename: '[name]-[hash:5].js',
publicPath: '/',
},
module: {
preLoaders: [
rules: [
{
test: /\.js(x|)$/,
loader: 'eslint',
loader: 'eslint-loader',
enforce: 'pre',
include: [
SRC_DIR,
],
options: {
configFile: path.join(ROOT_DIR, '.eslintrc.json'),
failOnWarning: true,
failOnError: true,
},
},
],
loaders: [
{
test: /\.js(x|)?/,
exclude: /node_modules/,
loader: 'babel',
loader: 'babel-loader',
},
{
test: /\.html$/,
loader: 'html',
loader: 'html-loader',
},
{
test: /\.css$/,
loader: webpackCombineLoaders([
use: [
{
loader: 'css',
loader: 'css-loader',
query: {
modules: true,
camelCase: true,
localIdentName: '[path][name]---[local]---[hash:base64:5]',
},
},
{
loader: 'postcss',
loader: 'postcss-loader',
options: {
plugins: () => [
autoprefixer({
browsers: ['last 3 versions', 'ie > 8'],
}),
],
},
},
]),
],
},
{
test: /\.s[ac]ss$/,
loader: webpackCombineLoaders([
use: [
{
loader: 'style',
loader: 'style-loader',
},
{
loader: 'css',
loader: 'css-loader',
query: {
modules: true,
camelCase: true,
localIdentName: '[path][name]---[local]---[hash:base64:5]',
},
},
{
loader: 'postcss',
loader: 'postcss-loader',
options: {
plugins: () => [
autoprefixer({
browsers: ['last 3 versions', 'ie > 8'],
}),
],
},
},
{
loader: 'sass',
loader: 'sass-loader',
query: {
sourceMaps: 'true',
},
},
]),
],
},
{
test: /\.(png|jpe?g|gif|svg|woff2?|eot|ttf|otf|wav)(\?.*)?$/,
loader: 'url',
loader: 'url-loader',
query: {
limit: 10,
name: '[name].[hash:7].[ext]',
},
},
],
},
eslint: {
configFile: path.join(ROOT_DIR, '.eslintrc.json'),
failOnWarning: true,
failOnError: true,
},
postcss: [
autoprefixer({
browsers: ['last 3 versions', 'ie > 8'],
}),
],
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.bundle.js',
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: process.env.NODE_ENV,
Expand Down
Loading

0 comments on commit d7c088b

Please sign in to comment.