From bfc3372846a82991e40a0b1ec90eaccd3155ad83 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Fri, 24 Aug 2018 13:43:35 -0700 Subject: [PATCH] Move index; add unpkg & jsdelivr fields. --- index.js | 4 ---- package.json | 9 +++++---- rollup.config.js | 6 +++--- src/index.js | 4 ++++ 4 files changed, 12 insertions(+), 11 deletions(-) delete mode 100644 index.js create mode 100644 src/index.js diff --git a/index.js b/index.js deleted file mode 100644 index a56f571..0000000 --- a/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export {default as timeFormatDefaultLocale, timeFormat, timeParse, utcFormat, utcParse} from "./src/defaultLocale"; -export {default as timeFormatLocale} from "./src/locale"; -export {default as isoFormat} from "./src/isoFormat"; -export {default as isoParse} from "./src/isoParse"; diff --git a/package.json b/package.json index 75ea507..4e835b9 100644 --- a/package.json +++ b/package.json @@ -16,16 +16,17 @@ "name": "Mike Bostock", "url": "http://bost.ocks.org/mike" }, - "main": "dist/d3-time-format.min.js", - "module": "index", - "jsnext:main": "index", + "main": "dist/d3-time-format.js", + "unpkg": "dist/d3-time-format.min.js", + "jsdelivr": "dist/d3-time-format.min.js", + "module": "src/index.js", "repository": { "type": "git", "url": "https://github.com/d3/d3-time-format.git" }, "scripts": { "pretest": "rollup -c", - "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint index.js src", + "test": "TZ=America/Los_Angeles tape 'test/**/*-test.js' && eslint src", "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}.v${npm_package_version%%.*}.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v${npm_package_version%%.*}.min.js && git add ${npm_package_name}.v${npm_package_version%%.*}.js ${npm_package_name}.v${npm_package_version%%.*}.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" }, diff --git a/rollup.config.js b/rollup.config.js index 564ecba..804bba8 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,8 +2,8 @@ import {terser} from "rollup-plugin-terser"; import * as meta from "./package.json"; const config = { - input: "index.js", - external: Object.keys(meta.dependencies || {}), + input: "src/index.js", + external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)), output: { file: `dist/${meta.name}.js`, name: "d3", @@ -11,7 +11,7 @@ const config = { 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"}))) + globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) }, plugins: [] }; diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..2db6314 --- /dev/null +++ b/src/index.js @@ -0,0 +1,4 @@ +export {default as timeFormatDefaultLocale, timeFormat, timeParse, utcFormat, utcParse} from "./defaultLocale"; +export {default as timeFormatLocale} from "./locale"; +export {default as isoFormat} from "./isoFormat"; +export {default as isoParse} from "./isoParse";