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

Use Rollup for bundling dependencies #242

Merged
merged 16 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
dist
yarn.lock
20 changes: 15 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./source/index.js"
"default": "./dist/index.js"
tommy-mitchell marked this conversation as resolved.
Show resolved Hide resolved
},
"sideEffects": false,
"engines": {
"node": ">=16.10"
},
"scripts": {
"prepack": "npm run build",
"build": "rollup -c",
tommy-mitchell marked this conversation as resolved.
Show resolved Hide resolved
"test": "xo && ava && tsd"
},
"files": [
"source",
"dist",
"index.d.ts"
],
"keywords": [
Expand Down Expand Up @@ -59,13 +62,20 @@
"yargs-parser": "^21.1.1"
},
"devDependencies": {
"ava": "^5.2.0",
"@rollup/plugin-commonjs": "^25.0.3",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"ava": "^5.3.1",
"common-tags": "^1.8.2",
"execa": "^7.1.1",
"execa": "^7.2.0",
"indent-string": "^5.0.0",
"read-pkg": "^8.0.0",
"rollup": "^3.27.0",
"rollup-plugin-filesize": "^10.0.0",
"rollup-plugin-license": "^3.0.1",
"tsd": "^0.28.1",
"xo": "^0.54.2"
"xo": "^0.55.0"
},
"xo": {
"rules": {
Expand Down
38 changes: 38 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import json from '@rollup/plugin-json';
import commonjs from '@rollup/plugin-commonjs';
import {nodeResolve} from '@rollup/plugin-node-resolve';
import license from 'rollup-plugin-license';
import terser from '@rollup/plugin-terser';
import filesize from 'rollup-plugin-filesize';
import {defineConfig} from 'rollup';

export default defineConfig({
input: 'source/index.js',
output: {
file: 'dist/index.js',
// https://rollupjs.org/configuration-options/#output-interop
interop: 'esModule',
// https://rollupjs.org/configuration-options/#output-generatedcode
generatedCode: {
preset: 'es2015',
},
},
plugins: [
json(),
commonjs(),
nodeResolve(),
license({
thirdParty: {
output: 'dist/dependencies.md',
},
}),
terser({
module: true,
toplevel: true,
format: {
comments: false,
},
}),
filesize(),
],
});