upgraded to webpack 4.x
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
/lib
|
||||
mergely-*.tgz
|
||||
package-lock.json
|
||||
*.log
|
||||
|
||||
21
examples/app.html
Normal file
21
examples/app.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<!--
|
||||
This example demonstrates the minimum amount of code required to use Mergely.
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" /><title>Mergely - Simple Example</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="chrome=1, IE=edge">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<meta name="description" content="Merge and Diff your documents with diff online and share" />
|
||||
<meta name="keywords" content="diff,merge,compare,jsdiff,comparison,difference,file,text,unix,patch,algorithm,saas,longest common subsequence" />
|
||||
<meta name="author" content="Jamie Peabody" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="mergely-full-screen-8">
|
||||
<div class="mergely-resizer">
|
||||
<div id="mergely"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
17
examples/app.js
Normal file
17
examples/app.js
Normal file
@@ -0,0 +1,17 @@
|
||||
require('codemirror/lib/codemirror.css');
|
||||
require('../src/mergely.css');
|
||||
|
||||
$(document).ready(function () {
|
||||
$('#mergely').mergely({
|
||||
license: 'lgpl',
|
||||
cmsettings: {
|
||||
readOnly: false
|
||||
},
|
||||
lhs: function(setValue) {
|
||||
setValue('the quick red fox\njumped over the hairy dog');
|
||||
},
|
||||
rhs: function(setValue) {
|
||||
setValue('the quick brown fox\njumped over the lazy dog');
|
||||
}
|
||||
});
|
||||
});
|
||||
25
package.json
Executable file → Normal file
25
package.json
Executable file → Normal file
@@ -7,11 +7,6 @@
|
||||
"example": "examples",
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf lib && webpack",
|
||||
"test": "karma start",
|
||||
"test:chrome": "karma start --browsers Chrome --singleRun=false"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/wickedest/Mergely.git"
|
||||
@@ -38,11 +33,17 @@
|
||||
},
|
||||
"homepage": "https://github.com/wickedest/Mergely#readme",
|
||||
"devDependencies": {
|
||||
"@webpack-cli/init": "^0.1.2",
|
||||
"babel-core": "^6.26.3",
|
||||
"babel-loader": "^8.0.4",
|
||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"chai": "^4.1.2",
|
||||
"codemirror": "^5.32.0",
|
||||
"css-loader": "^0.28.7",
|
||||
"css-loader": "^0.28.11",
|
||||
"extract-text-webpack-plugin": "^3.0.2",
|
||||
"file-loader": "^1.1.5",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"image-webpack-loader": "^3.4.2",
|
||||
"jquery": "^3.2.1",
|
||||
"karma": "^2.0.0",
|
||||
@@ -53,6 +54,16 @@
|
||||
"karma-mocha-reporter": "^2.2.5",
|
||||
"karma-webpack": "^2.0.9",
|
||||
"mocha": "^4.0.1",
|
||||
"webpack": "^3.8.1"
|
||||
"style-loader": "^0.23.0",
|
||||
"uglifyjs-webpack-plugin": "^2.0.1",
|
||||
"webpack": "^4.20.2",
|
||||
"webpack-cli": "^3.1.2",
|
||||
"webpack-dev-server": "^3.1.9"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rm -rf lib && webpack --config ./webpack.prod.js",
|
||||
"start": "webpack-dev-server -w --debug --progress --colors --config ./webpack.dev.js --content-base ./dist --inline --hot --host 0.0.0.0",
|
||||
"test": "karma start",
|
||||
"test:chrome": "karma start --browsers Chrome --singleRun=false"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
|
||||
require('./mergely.css');
|
||||
// require('./mergely.css');
|
||||
|
||||
(function(jQuery, CodeMirror) {
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
mergely: './src/mergely.js',
|
||||
// 'mergely.min': './src/mergely.js'
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'lib'),
|
||||
filename: './[name].js',
|
||||
library: 'mergely',
|
||||
libraryTarget: 'umd',
|
||||
umdNamedDefine: true
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: ExtractTextPlugin.extract('css-loader') }
|
||||
]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js']
|
||||
},
|
||||
externals: {
|
||||
jquery: 'jQuery',
|
||||
CodeMirror: 'CodeMirror'
|
||||
},
|
||||
plugins: [
|
||||
// new webpack.optimize.UglifyJsPlugin({
|
||||
// sourceMap: true,
|
||||
// include: /\.js$/,
|
||||
// // include: /\.min\.js$/,
|
||||
// exclude: /node_modules/
|
||||
// }),
|
||||
new ExtractTextPlugin('mergely.css')
|
||||
]
|
||||
};
|
||||
73
webpack.dev.js
Normal file
73
webpack.dev.js
Normal file
@@ -0,0 +1,73 @@
|
||||
const webpack = require('webpack')
|
||||
const path = require('path')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
|
||||
module: {
|
||||
rules: [{
|
||||
include: [path.resolve(__dirname, 'src'), path.resolve(__dirname, 'examples')],
|
||||
test: /\.js$/
|
||||
}, {
|
||||
test: /\.css$/,
|
||||
use: [{
|
||||
loader: 'style-loader',
|
||||
options: {
|
||||
sourceMap: true
|
||||
}
|
||||
}, {
|
||||
loader: 'css-loader'
|
||||
}]
|
||||
}]
|
||||
},
|
||||
|
||||
resolve: {
|
||||
extensions: ['.js'],
|
||||
alias: {
|
||||
'CodeMirror': path.join(__dirname, 'node_modules', 'codemirror'),
|
||||
'jQuery': path.join(__dirname, 'node_modules', 'jquery')
|
||||
}
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'examples/app.html',
|
||||
filename: 'mergely.html'
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
$: 'jquery',
|
||||
jQuery: 'jquery'
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
CodeMirror: 'codemirror'
|
||||
})
|
||||
],
|
||||
|
||||
entry: {
|
||||
app: [
|
||||
'./examples/app',
|
||||
'./src/mergely',
|
||||
]
|
||||
},
|
||||
|
||||
output: {
|
||||
filename: 'mergely.js',
|
||||
},
|
||||
|
||||
optimization: {
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
vendors: {
|
||||
priority: -10,
|
||||
test: /[\\/]node_modules[\\/]/
|
||||
}
|
||||
},
|
||||
|
||||
chunks: 'async',
|
||||
minChunks: 1,
|
||||
minSize: 30000,
|
||||
name: true
|
||||
}
|
||||
}
|
||||
}
|
||||
33
webpack.prod.js
Normal file
33
webpack.prod.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: {
|
||||
mergely: './src/mergely.js',
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'lib'),
|
||||
filename: './[name].js',
|
||||
library: 'mergely',
|
||||
libraryTarget: 'umd',
|
||||
umdNamedDefine: true
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.css$/,
|
||||
loader: ExtractTextPlugin.extract('css-loader')
|
||||
}]
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js']
|
||||
},
|
||||
externals: {
|
||||
jquery: 'jQuery',
|
||||
CodeMirror: 'CodeMirror'
|
||||
},
|
||||
plugins: [
|
||||
new ExtractTextPlugin('mergely.css')
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user