Skip to content

Commit

Permalink
Merge pull request #389 from vega/next
Browse files Browse the repository at this point in the history
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
domoritz and dependabot[bot] authored Sep 30, 2022
2 parents e0b5608 + 916049d commit bb38276
Show file tree
Hide file tree
Showing 8 changed files with 1,722 additions and 253 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ jobs:
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"

name: Make a release and publish to NPM

steps:
- uses: actions/checkout@v3

- name: Prepare repository
run: git fetch --unshallow --tags
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Install Node dependencies
run: yarn --frozen-lockfile

- run: yarn build

- run: npm run release
# don't use yarn run to avoid using yarnpkg registry
- name: Create release
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:

- name: Setup Node
uses: actions/setup-node@v3
with:
cache: 'yarn'

- name: Install Node dependencies
run: yarn --frozen-lockfile
Expand Down
11 changes: 0 additions & 11 deletions .npmignore

This file was deleted.

41 changes: 25 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"version": "2.4.0",
"description": "Common repository for example datasets used by Vega related projects.",
"license": "BSD-3-Clause",
"main": "build/vega-datasets",
"module": "build/src/data",
"main": "build/vega-datasets.js",
"module": "build/vega-datasets.module.js",
"unpkg": "build/vega-datasets.min.js",
"jsdelivr": "build/vega-datasets.min.js",
"typings": "build/src/data.d.ts",
"types": "build/vega-datasets.module.d.ts",
"repository": {
"type": "git",
"url": "http://github.com/vega/vega-datasets.git"
Expand All @@ -16,26 +16,35 @@
"name": "UW Interactive Data Lab",
"url": "http://idl.cs.washington.edu"
},
"files": [
"src",
"build"
],
"devDependencies": {
"@auto-it/conventional-commits": "^10.37.1",
"@auto-it/first-time-contributor": "^10.37.1",
"@auto-it/conventional-commits": "^10.37.6",
"@auto-it/first-time-contributor": "^10.37.6",
"@babel/core": "^7.19.3",
"@babel/plugin-transform-runtime": "^7.19.1",
"@babel/preset-env": "^7.19.3",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.19.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/d3-dsv": "^2.0.0",
"auto": "^10.37.1",
"d3-dsv": "^2.0.0",
"@types/d3-dsv": "^3.0.0",
"auto": "^10.37.6",
"d3-dsv": "^3.0.1",
"datalib": "^1.9.3",
"rollup": "^2.76.0",
"terser": "^5.14.1",
"typescript": "^4.7.4"
"rollup": "^2.79.1",
"rollup-plugin-bundle-size": "^1.0.3",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-ts": "^3.0.2",
"terser": "^5.15.0",
"typescript": "^4.8.4"
},
"scripts": {
"index": "./scripts/make-url-index.sh > src/urls.ts",
"prebuild": "npm run index && tsc",
"prebuild": "./scripts/make-url-index.sh > src/urls.ts",
"build": "rollup -c",
"postbuild": "terser build/vega-datasets.js -cm > build/vega-datasets.min.js",
"flights": "node scripts/flights.js",
"github": "python scripts/github.py",
"release": "auto shipit"
"release": "yarn build && auto shipit"
}
}
61 changes: 50 additions & 11 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,52 @@
import resolve from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import json from "@rollup/plugin-json";
import ts from "rollup-plugin-ts";
import bundleSize from "rollup-plugin-bundle-size";
import { terser } from "rollup-plugin-terser";

export default {
input: "build/src/index.js",
output: {
file: "build/vega-datasets.js",
format: "umd",
sourcemap: true,
name: "vegaDatasets"
const plugins = (browserslist, declaration) => [
json(),
ts({
tsconfig: (resolvedConfig) => ({
...resolvedConfig,
declaration,
declarationMap: declaration,
}),
transpiler: "babel",
babelConfig: { presets: ["@babel/preset-env"] },
browserslist,
}),
bundleSize(),
];

const outputs = [
{
input: "src/index.ts",
output: {
file: "build/vega-datasets.module.js",
format: "esm",
sourcemap: true,
},
plugins: plugins(undefined, true)
},
{
input: "src/index.ts",
output: [
{
file: "build/vega-datasets.js",
format: "umd",
sourcemap: true,
name: "vegaDatasets",
},
{
file: "build/vega-datasets.min.js",
format: "iife",
sourcemap: true,
name: "vegaDatasets",
plugins: [terser()],
},
],
plugins: plugins("defaults and not IE 11", false)
},
plugins: [resolve(), json()]
};
];

export default outputs;
3 changes: 1 addition & 2 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ for (const name of Object.keys(urls) as Name[]) {
if (name.endsWith(".json")) {
return await result.json();
} else if (name.endsWith(".csv")) {
// TODO: remove "as any" once @types/d3-dsv has been updated
return d3.csvParse(await result.text(), (d3 as any).autoType);
return d3.csvParse(await result.text(), d3.autoType);
} else {
return await result.text();
}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
"strict": true,
"outDir": "./build",
"inlineSourceMap": true,
Expand Down
Loading

0 comments on commit bb38276

Please sign in to comment.