diff --git a/LICENSE b/LICENSE index 721bd22..1d9d875 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2010-2016 Mike Bostock +Copyright 2010-2017 Mike Bostock All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/package.json b/package.json index 97de531..8e49699 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ "url": "https://github.com/d3/d3-time-format.git" }, "scripts": { - "pretest": "rm -rf build && mkdir build && rollup --banner \"$(preamble)\" -f umd -g d3-time:d3 -n d3 -o build/d3-time-format.js -- index.js", + "pretest": "rm -rf build && mkdir build && rollup -c --banner \"$(preamble)\"", "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint index.js src", - "prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-time-format.js -c -m -o build/d3-time-format.min.js", + "prepublishOnly": "npm run test && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3-time-format.js -c -m -o build/d3-time-format.min.js", "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-time-format/build/d3-time-format.js d3-time-format.v2.js && cp ../d3-time-format/build/d3-time-format.min.js d3-time-format.v2.min.js && git add d3-time-format.v2.js d3-time-format.v2.min.js && git commit -m \"d3-time-format ${npm_package_version}\" && git push && cd - && zip -j build/d3-time-format.zip -- LICENSE README.md build/d3-time-format.js build/d3-time-format.min.js" }, "dependencies": { @@ -34,10 +34,10 @@ }, "devDependencies": { "d3-queue": "3", - "eslint": "3", - "package-preamble": "0.0", - "rollup": "0.41", + "eslint": "4", + "package-preamble": "0.1", + "rollup": "0.50", "tape": "4", - "uglify-js": "^2.8.11" + "uglify-js": "3" } } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..7ce337f --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,14 @@ +const definition = require("./package.json"); +const dependencies = Object.keys(definition.dependencies); + +export default { + input: "index", + external: dependencies, + output: { + extend: true, + file: `build/${definition.name}.js`, + format: "umd", + globals: dependencies.reduce((p, v) => (p[v] = "d3", p), {}), + name: "d3" + } +}; diff --git a/src/locale.js b/src/locale.js index 5d3d5be..28d5abd 100644 --- a/src/locale.js +++ b/src/locale.js @@ -364,7 +364,7 @@ export default function formatLocale(locale) { var pads = {"-": "", "_": " ", "0": "0"}, numberRe = /^\s*\d+/, // note: ignores next directive percentRe = /^%/, - requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + requoteRe = /[\\^$*+?|[\]().{}]/g; function pad(value, fill, width) { var sign = value < 0 ? "-" : "", @@ -423,7 +423,7 @@ function parseYear(d, string, i) { } function parseZone(d, string, i) { - var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6)); + var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; }