Skip to content

Commit 9a7a82a

Browse files
committed
Initial commit.
0 parents  commit 9a7a82a

19 files changed

+11305
-0
lines changed

.eslintrc.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"parserOptions": {
4+
"sourceType": "module",
5+
"ecmaVersion": 10
6+
},
7+
"env": {
8+
"es6": true,
9+
"node": true,
10+
"browser": true
11+
},
12+
"rules": {
13+
"no-cond-assign": 0,
14+
"no-constant-condition": 0
15+
}
16+
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
dist/
3+
node_modules/

LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2020 Observable, Inc.
2+
3+
Permission to use, copy, modify, and/or distribute this software for any purpose
4+
with or without fee is hereby granted, provided that the above copyright notice
5+
and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13+
THIS SOFTWARE.

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Observable Plot
2+
3+
**Observable Plot** is a JavaScript library for exploratory data visualization.

package.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@observablehq/plot",
3+
"version": "0.0.0",
4+
"author": {
5+
"name": "Observable, Inc.",
6+
"url": "https://observablehq.com"
7+
},
8+
"license": "ISC",
9+
"main": "dist/@observablehq/plot.cjs.js",
10+
"unpkg": "dist/@observablehq/plot.umd.js",
11+
"module": "src/index.js",
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/observablehq/plot.git"
15+
},
16+
"files": [
17+
"dist/**/*.js",
18+
"src/**/*.js"
19+
],
20+
"scripts": {
21+
"pretest": "rollup -c",
22+
"test": "tape 'test/**/*-test.js' && eslint src test",
23+
"prepublishOnly": "rm -rf dist && yarn test",
24+
"postpublish": "git push && git push --tags && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js"
25+
},
26+
"devDependencies": {
27+
"@rollup/plugin-node-resolve": "^10.0.0",
28+
"eslint": "^7.12.1",
29+
"jsdom": "^16.4.0",
30+
"rollup": "^2.32.1",
31+
"rollup-plugin-terser": "^7.0.2",
32+
"tape": "^4.13.3",
33+
"tape-await": "^0.1.2"
34+
},
35+
"dependencies": {
36+
"d3-array": "^2.8.0",
37+
"d3-axis": "^2.0.0",
38+
"d3-interpolate": "^2.0.1",
39+
"d3-scale": "^3.2.3",
40+
"d3-selection": "^2.0.0",
41+
"d3-shape": "^2.0.0"
42+
}
43+
}

rollup.config.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import {terser} from "rollup-plugin-terser";
2+
import * as meta from "./package.json";
3+
4+
const external = Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key));
5+
6+
const config = {
7+
input: "src/index.js",
8+
external,
9+
output: {
10+
indent: false,
11+
banner: `// ${meta.name} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
12+
},
13+
plugins: []
14+
};
15+
16+
export default [
17+
{
18+
...config,
19+
output: {
20+
...config.output,
21+
format: "cjs",
22+
file: `dist/${meta.name}.cjs.js`
23+
}
24+
},
25+
{
26+
...config,
27+
output: {
28+
...config.output,
29+
name: "Plot",
30+
format: "umd",
31+
extend: true,
32+
file: `dist/${meta.name}.umd.js`,
33+
globals: Object.fromEntries(external.map(key => [key, "d3"])),
34+
paths: Object.fromEntries(external.map(key => [key, "d3@6"]))
35+
},
36+
plugins: [
37+
...config.plugins,
38+
terser({
39+
output: {
40+
preamble: config.output.banner
41+
}
42+
})
43+
]
44+
}
45+
];

0 commit comments

Comments
 (0)