Skip to content

Commit

Permalink
Upgrade deps. Convert from webpack to rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdecker committed Jan 6, 2019
1 parent d76ac52 commit 2c1a29c
Show file tree
Hide file tree
Showing 19 changed files with 8,271 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sourceMaps": "inline",
"presets": ["es3", "es2015-mod"],
"presets": ["@babel/preset-env"],
"auxiliaryCommentBefore": "istanbul ignore start",
"auxiliaryCommentAfter": "istanbul ignore end"
}
52 changes: 17 additions & 35 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
{
"parser": "babel-eslint",
"env": {
"browser": true
},
"ecmaFeatures": {
// Enabling features that can be implemented without polyfills. Want to avoid polyfills at this time.
"arrowFunctions": true,
"blockBindings": true,
"classes": false,
"defaultParams": true,
"destructuring": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"regexUFlag": true,
"restParams": true,
"spread": true,
"templateStrings": true
},
"rules": {
// Possible Errors //
//-----------------//
Expand Down Expand Up @@ -63,22 +47,20 @@
"valid-jsdoc": 0,
"valid-typeof": 2,


// Best Practices //
//----------------//
"block-scoped-var": 0,
"complexity": 0,
"consistent-return": 0,
"curly": 2,
"default-case": 1,
"dot-notation": [2, {"allowKeywords": false}],
"dot-notation": [2, { "allowKeywords": false }],
"eqeqeq": 0,
"guard-for-in": 1,
"no-alert": 2,
"no-caller": 2,
"no-div-regex": 1,
"no-else-return": 0,
"no-empty-label": 2,
"no-eq-null": 0,
"no-eval": 2,
"no-extend-native": 2,
Expand Down Expand Up @@ -116,12 +98,10 @@
"wrap-iife": 2,
"yoda": 0,


// Strict //
//--------//
"strict": 0,


// Variables //
//-----------//
"no-catch-shadow": 2,
Expand All @@ -132,31 +112,32 @@
"no-undef": 2,
"no-undef-init": 2,
"no-undefined": 0,
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
"no-unused-vars": [2, { "vars": "all", "args": "after-used" }],
"no-use-before-define": [2, "nofunc"],


// Node.js //
//---------//
// Others left to environment defaults
"no-mixed-requires": 0,


// Stylistic //
//-----------//
"indent": 0,
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"camelcase": 2,
"comma-spacing": [2, {"before": false, "after": true}],
"comma-spacing": [2, { "before": false, "after": true }],
"comma-style": [2, "last"],
"consistent-this": [1, "self"],
"eol-last": 2,
"func-names": 0,
"func-style": [2, "declaration"],
"key-spacing": [2, {
"key-spacing": [
2,
{
"beforeColon": false,
"afterColon": true
}],
}
],
"max-nested-callbacks": 0,
"new-cap": 2,
"new-parens": 2,
Expand All @@ -176,22 +157,23 @@
"one-var": 0,
"operator-assignment": 0,
"padded-blocks": 0,
"quote-props": [2, "as-needed", {"keywords": true}],
"quote-props": [2, "as-needed", { "keywords": true }],
"quotes": [2, "single", "avoid-escape"],
"semi": 2,
"semi-spacing": [2, {"before": false, "after": true}],
"semi-spacing": [2, { "before": false, "after": true }],
"sort-vars": 0,
"space-after-keywords": [2, "always"],
"space-before-blocks": [2, "always"],
"space-before-function-paren": [2, {"anonymous": "never", "named": "never"}],
"space-before-function-paren": [
2,
{ "anonymous": "never", "named": "never" }
],
"space-in-brackets": 0,
"space-in-parens": [2, "never"],
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-ops": 2,
"spaced-comment": [2, "always"],
"wrap-regex": 1,

"no-var": 2
}
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ coverage
node_modules
npm-debug.log
lib
dist
dist
yarn-error.log
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
We also accept [pull requests][pull-request]!

Generally we like to see pull requests that

- Maintain the existing code style
- Are focused on a single change (i.e. avoid large refactoring or style adjustments in untouched code if not the primary goal of the pull request)
- Have [good commit messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
Expand All @@ -16,7 +17,7 @@ Generally we like to see pull requests that
```
npm install
npm test
````
```

The `npm test -- dev` implements watching for tests within Node and `karma start` may be used for manual testing in browsers.

Expand All @@ -32,7 +33,6 @@ A full release may be completed with the following:
```
yo release
npm publish
yo release:publish components jsdiff dist/components/
```

[generator-release]: https://github.com/walmartlabs/generator-release
Expand Down
35 changes: 11 additions & 24 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* eslint-env node */
/* eslint-disable no-process-env, camelcase */
const pkg = require('./package.json');
const babel = require('rollup-plugin-babel');

module.exports = function(grunt) {

grunt.initConfig({
Expand All @@ -26,27 +29,17 @@ module.exports = function(grunt) {
}]
}
},
webpack: {
options: {
context: 'lib/',
output: {
path: 'dist/',
library: 'JsDiff',
libraryTarget: 'umd'
}
},
dist: {
entry: './index.js',
output: {
filename: 'diff.js'
}

exec: {
rollup: {
command: 'rollup -c'
}
},

mochaTest: {
test: {
options: {
require: ['babel-core/register'],
require: ['@babel/register'],
reporter: 'dot'
},
src: ['test/**/*.js']
Expand Down Expand Up @@ -116,12 +109,6 @@ module.exports = function(grunt) {
files: [
{expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/'}
]
},
components: {
files: [
{expand: true, cwd: 'components/', src: ['**'], dest: 'dist/components'},
{expand: true, cwd: 'dist/', src: ['*.js'], dest: 'dist/components'}
]
}
},

Expand All @@ -138,11 +125,11 @@ module.exports = function(grunt) {
});

// Build a new version of the library
this.registerTask('build', 'Builds a distributable version of the current project', ['eslint', 'babel', 'webpack']);
this.registerTask('build', 'Builds a distributable version of the current project', ['eslint', 'babel', 'exec:rollup']);
this.registerTask('test', ['build', 'mochaTest', 'karma:unit']);
this.registerTask('cover', ['mocha_istanbul:coverage', 'istanbul_check_coverage']);

this.registerTask('release', ['clean', 'test', 'uglify', 'copy:dist', 'copy:components']);
this.registerTask('release', ['clean', 'test', 'uglify', 'copy:dist']);

// Load tasks from npm
grunt.loadNpmTasks('grunt-contrib-clean');
Expand All @@ -154,7 +141,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-exec');

grunt.task.loadTasks('tasks');

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ Based on the algorithm proposed in
```bash
npm install diff --save
```
or
```bash
bower install jsdiff --save
```

## API

Expand Down
14 changes: 6 additions & 8 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ module.exports = function(config) {
base: 'SauceLabs',
browserName: 'internet explorer',
version: '11'
},
HeadlessChrome: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
};

Expand All @@ -37,7 +41,7 @@ module.exports = function(config) {
webpack: {
devtool: 'eval',
module: {
loaders: [
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
Expand All @@ -63,12 +67,6 @@ module.exports = function(config) {
autoWatch: true,
singleRun: false,

browsers: ['HeadlessChrome']
customLaunchers: {
HeadlessChrome: {
base: 'ChromeHeadless',
flags: [ '--no-sandbox', ],
},
},
browsers: ['HeadlessChrome'],
});
};
71 changes: 41 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,57 @@
"engines": {
"node": ">=0.3.1"
},
"main": "./lib",
"main": "./lib/index.cjs.js",
"module": "./lib/index.es6.js",
"browser": "./dist/diff.js",
"scripts": {
"clean": "rm -rf lib/ dist/",
"build:node": "yarn babel --out-dir lib --source-maps=inline src",
"test": "grunt"
},
"dependencies": {},
"dependencies": {
"grunt-rollup": "^9.0.0",
"rollup": "^1.0.2"
},
"devDependencies": {
"async": "^1.4.2",
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-es2015-mod": "^6.3.13",
"babel-preset-es3": "^1.0.1",
"chai": "^3.3.0",
"colors": "^1.1.2",
"eslint": "^1.6.0",
"grunt": "^0.4.5",
"grunt-babel": "^6.0.0",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/register": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"chai": "^4.2.0",
"colors": "^1.3.3",
"eslint": "^5.12.0",
"grunt": "^1.0.3",
"grunt-babel": "^8.0.0",
"grunt-clean": "^0.4.0",
"grunt-cli": "^0.1.13",
"grunt-contrib-clean": "^1.0.0",
"grunt-cli": "^1.3.2",
"grunt-contrib-clean": "^2.0.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-uglify": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^17.3.1",
"grunt-karma": "^0.12.1",
"grunt-mocha-istanbul": "^3.0.1",
"grunt-mocha-test": "^0.12.7",
"grunt-webpack": "^1.0.11",
"grunt-contrib-uglify": "^4.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-eslint": "^21.0.0",
"grunt-exec": "^3.0.0",
"grunt-mocha-istanbul": "^5.0.2",
"grunt-mocha-test": "^0.13.3",
"grunt-webpack": "^3.1.3",
"istanbul": "github:kpdecker/istanbul",
"karma": "^2.0.0",
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^2.0.0",
"karma": "^3.1.4",
"karma-chrome-launcher": "^2.2.0",
"karma-sauce-launcher": "^0.3.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.0.0",
"karma-sauce-launcher": "^2.0.2",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.3",
"semver": "^5.0.3",
"webpack": "^1.12.2",
"webpack-dev-server": "^1.12.0"
"karma-webpack": "^3.0.5",
"mocha": "^5.2.0",
"rollup-plugin-babel": "^4.2.0",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"semver": "^5.6.0",
"webpack": "^4.28.3",
"webpack-dev-server": "^3.1.14"
},
"optionalDependencies": {}
}
Loading

0 comments on commit 2c1a29c

Please sign in to comment.