Skip to content

Commit

Permalink
Update dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Aug 24, 2018
1 parent 4d2f32a commit e09c2dd
Show file tree
Hide file tree
Showing 8 changed files with 1,047 additions and 38 deletions.
11 changes: 0 additions & 11 deletions .eslintrc

This file was deleted.

15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
"env": {
"es6": true,
"node": true,
"browser": true
},
"rules": {
"no-cond-assign": 0
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.sublime-workspace
.DS_Store
build/
dist/
node_modules
npm-debug.log
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.sublime-*
build/*.zip
dist/*.zip
img/
test/
16 changes: 10 additions & 6 deletions d3-zoom.sublime-project
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@
"folders": [
{
"path": ".",
"file_exclude_patterns": [
"*.sublime-workspace"
],
"folder_exclude_patterns": [
"build"
]
"file_exclude_patterns": ["*.sublime-workspace"],
"folder_exclude_patterns": ["dist"]
}
],
"build_systems": [
{
"name": "yarn test",
"cmd": ["yarn", "test"],
"file_regex": "\\((...*?):([0-9]*):([0-9]*)\\)",
"working_dir": "$project_path"
}
]
}
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
"name": "Mike Bostock",
"url": "http://bost.ocks.org/mike"
},
"main": "build/d3-zoom.js",
"main": "dist/d3-zoom.min.js",
"module": "index",
"jsnext:main": "index",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-zoom.git"
},
"scripts": {
"pretest": "rm -rf build && mkdir build && rollup -c --banner \"$(preamble)\"",
"pretest": "rollup -c",
"test": "tape 'test/**/*-test.js' && eslint index.js src",
"prepublishOnly": "npm run test && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3-zoom.js -c -m -o build/d3-zoom.min.js",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-zoom/build/d3-zoom.js d3-zoom.v1.js && cp ../d3-zoom/build/d3-zoom.min.js d3-zoom.v1.min.js && git add d3-zoom.v1.js d3-zoom.v1.min.js && git commit -m \"d3-zoom ${npm_package_version}\" && git push && cd - && zip -j build/d3-zoom.zip -- LICENSE README.md build/d3-zoom.js build/d3-zoom.min.js"
"prepublishOnly": "rm -rf dist && yarn test",
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v1.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v1.min.js && git add ${npm_package_name}.v1.js ${npm_package_name}.v1.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
},
"dependencies": {
"d3-dispatch": "1",
Expand All @@ -36,10 +36,9 @@
"d3-transition": "1"
},
"devDependencies": {
"eslint": "4",
"package-preamble": "0.1",
"rollup": "0.50",
"tape": "4",
"uglify-js": "3"
"eslint": "5",
"rollup": "0.64",
"rollup-plugin-terser": "1",
"tape": "4"
}
}
42 changes: 32 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
const definition = require("./package.json");
const dependencies = Object.keys(definition.dependencies);
import {terser} from "rollup-plugin-terser";
import * as meta from "./package.json";

export default {
input: "index",
external: dependencies,
const config = {
input: "index.js",
external: Object.keys(meta.dependencies || {}),
output: {
extend: true,
file: `build/${definition.name}.js`,
file: `dist/${meta.name}.js`,
name: "d3",
format: "umd",
globals: dependencies.reduce((p, v) => (p[v] = "d3", p), {}),
name: "d3"
}
indent: false,
extend: true,
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).map(key => ({[key]: "d3"})))
},
plugins: []
};

export default [
config,
{
...config,
output: {
...config.output,
file: `dist/${meta.name}.min.js`
},
plugins: [
...config.plugins,
terser({
output: {
preamble: config.output.banner
}
})
]
}
];
Loading

0 comments on commit e09c2dd

Please sign in to comment.