Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: drop old browsers and umd bundle #423

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .size-limit
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[
{
"path": "dist/index.cjs.js",
"limit": "7.7 KB",
"path": "dist/index.cjs",
"limit": "5.4 KB",
"webpack": false,
"running": false
},
{
"path": "dist/index.cjs.js",
"limit": "5.9 KB",
"path": "dist/index.cjs",
"limit": "4.7 KB",
"import": "{ Chart }"
},
{
"path": "dist/index.esm.js",
"limit": "7.4 KB",
"path": "dist/index.mjs",
"limit": "5.1 KB",
"webpack": false,
"running": false
},
{
"path": "dist/index.esm.js",
"limit": "5.9 KB",
"path": "dist/index.mjs",
"limit": "4.5 KB",
"import": "{ Chart }"
}
]
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@
"name": "react-google-charts",
"version": "3.0.15",
"description": "react-google-charts React component",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"jsnext:main": "dist/index.esm.js",
"umd": "dist/index.umd.js",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"start": "parcel demo/index.html -d demo-build/",
"build": "rollup -c",
"emitDeclarations": "tsc --skipLibCheck --emitDeclarationOnly",
"build": "rollup -c & yarn emitDeclarations",
"format:src": "prettier --write 'src/**/*.{js,jsx,ts,tsx}'",
"format:test": "prettier --write 'test/**/*.{js,jsx,ts,tsx}'",
"format": "yarn format:src && yarn format:test",
"jest": "jest -c jest.config.json",
"test:types": "tsc --skipLibCheck --noEmit",
"test:unit": "yarn jest",
"test:size": "size-limit",
"test": "yarn test:types && yarn test:unit && yarn build",
"test": "yarn test:unit && yarn build",
"prepublishOnly": "yarn build",
"docz:dev": "docz dev",
"docz:build": "docz build && mkdir docs/react-google-charts && cp -r docs/static docs/react-google-charts/static && mkdir docs/assets/ && cp -r assets/ docs/assets/",
Expand All @@ -37,6 +35,7 @@
"devDependencies": {
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@rollup/plugin-node-resolve": "^13.0.6",
"@size-limit/preset-big-lib": "^7.0.0",
"@swc/core": "^1.2.108",
"@swc/helpers": "^0.2.14",
Expand All @@ -47,6 +46,7 @@
"@types/jquery": "^3.3.5",
"@types/react": "^17.0.34",
"@types/react-dom": "^17.0.11",
"browserslist": "^4.18.1",
"clean-publish": "^3.4.3",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
Expand All @@ -64,7 +64,7 @@
"react-component-component": "^1.2.1",
"react-dom": "^16.9.0",
"rollup": "^2.60.0",
"rollup-plugin-typescript2": "^0.31.0",
"rollup-plugin-swc": "^0.2.0",
"simple-git-hooks": "^2.7.0",
"size-limit": "^7.0.0",
"standard-version": "^9.3.2",
Expand Down
77 changes: 53 additions & 24 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,56 @@
import typescript from "rollup-plugin-typescript2";
import swc from "rollup-plugin-swc";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import pkg from "./package.json";

export default {
input: "src/index.tsx",
output: [
{
file: "dist/index.umd.js",
format: "umd",
name: "ReactGoogleCharts"
const extensions = [".js", ".ts", ".tsx"];
const external = (_) => /node_modules/.test(_) && !/@swc\/helpers/.test(_);
const plugins = (targets) => [
nodeResolve({
extensions,
}),
swc({
jsc: {
parser: {
syntax: "typescript",
tsx: true,
},
transform: {
react: {
useBuiltins: true,
},
},
externalHelpers: true,
},
{
file: "dist/index.esm.js",
format: "esm"
env: {
targets,
},
{
file: "dist/index.cjs.js",
format: "cjs"
}
],
external: ["react-load-script", "react"],
plugins: [
typescript({
typescript: require("typescript"),
abortOnError: false
})
]
};
module: {
type: "es6",
},
sourceMaps: true,
}),
];

export default [
{
input: "src/index.tsx",
plugins: plugins("defaults, not ie 11, not ie_mob 11"),
external,
output: {
file: pkg.main,
format: "cjs",
exports: "named",
sourcemap: true,
},
},
{
input: "src/index.tsx",
plugins: plugins("defaults and supports es6-module"),
external,
output: {
file: pkg.module,
format: "es",
sourcemap: true,
},
},
];
20 changes: 12 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
{
"include": ["./src/"],
"compilerOptions": {
"jsx": "react",
"target": "es5",
"module": "ESNext",
"outDir": "dist",
"module": "esnext",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"lib": ["es2018", "dom"],
"outDir": "./build/",
"strict": true,
"jsx": "react",
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"target": "esnext",
"skipLibCheck": true,
"strict": true,
"removeComments": true
}
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
Loading