Skip to content

Commit

Permalink
fix: revert "feat: use microbundle instead of rollup"
Browse files Browse the repository at this point in the history
This reverts commit 5199cdd
  • Loading branch information
lzear committed Dec 12, 2021
1 parent 6a53e27 commit a51737e
Show file tree
Hide file tree
Showing 7 changed files with 1,100 additions and 3,022 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs → .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
},
overrides: [
{
// enable the rule specifically for TypeScript files
files: ['*.ts'],
rules: { '@typescript-eslint/explicit-module-boundary-types': 2 },
},
Expand Down
File renamed without changes.
File renamed without changes.
32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"description": "Implementation of some [electoral systems](https://en.wikipedia.org/wiki/Electoral_system)",
"keywords": [],
"sideEffects": false,
"main": "dist/votes.umd.js",
"module": "dist/votes.es5.js",
"types": "dist/votes.d.ts",
"files": [
"dist",
Expand All @@ -15,20 +17,12 @@
"url": "https://github.com/lzear/votes.git"
},
"license": "MIT",
"source": "src/votes.ts",
"exports": {
"require": "./dist/votes.cjs",
"default": "./dist/votes.modern.js"
},
"type": "module",
"module": "dist/votes.js",
"main": "dist/votes.cjs",
"unpkg": "./dist/votes.umd.js",
"scripts": {
"eslint": "eslint --ext .js --ext .ts .",
"fix:prettier": "prettier --write \"**/*.*\"",
"build": "microbundle",
"build:watch": "microbundle watch",
"prebuild": "rimraf dist",
"build": "rollup -c rollup.config.js && npx typedoc src/votes.ts",
"build:watch": "tsc --module commonjs && rollup -c rollup.config.js -w",
"test": "jest --coverage",
"test:watch": "jest --coverage --watch",
"test:prod": "yarn run eslint && yarn run test -- --no-cache",
Expand All @@ -39,13 +33,14 @@
"travis-deploy-once": "travis-deploy-once",
"updatedeps": "npx npm-check-updates -u"
},
"dependencies": {
"lodash": "^4.17.21"
},
"devDependencies": {
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.0.6",
"@semantic-release/changelog": "^6.0.1",
"@types/bluebird": "^3.5.36",
"@types/jest": "^27.0.3",
"@types/lodash": "^4.14.178",
"@types/node": "^16.11.12",
Expand All @@ -59,18 +54,25 @@
"husky": "^7.0.4",
"jest": "^27.4.4",
"lint-staged": "^12.1.2",
"microbundle": "^0.14.2",
"prettier": "^2.5.1",
"rimraf": "^3.0.2",
"rollup": "^2.61.1",
"rollup-plugin-sizes": "^1.0.4",
"rollup-plugin-sourcemaps": "^0.6.3",
"rollup-plugin-typescript2": "^0.31.1",
"semantic-release": "^18.0.1",
"shelljs": "^0.8.4",
"travis-deploy-once": "^5.0.11",
"ts-jest": "^27.1.1",
"ts-node": "^10.4.0",
"ts-toolbelt": "^9.6.0",
"tslib": "^2.3.1",
"typedoc": "^0.22.10",
"typescript": "4.5.3"
},
"dependencies": {
"lodash": "^4.17.21"
},
"bugs": {
"url": "https://github.com/lzear/votes/issues"
},
Expand Down
47 changes: 47 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import sourceMaps from 'rollup-plugin-sourcemaps'
import typescript from 'rollup-plugin-typescript2'
import json from '@rollup/plugin-json'
import sizes from 'rollup-plugin-sizes'

import pkg from './package.json'

const libraryName = 'votes'

export default {
input: `src/${libraryName}.ts`,
output: [
{
file: pkg.main,
name: 'votes',
format: 'umd',
sourcemap: true,
globals: (a) => {
const split = a.split('/')
return split[split.length - 1]
},
},
{
file: pkg.module,
name: 'votes',
format: 'es',
sourcemap: true,
},
],
external: (id) => Object.keys(pkg.dependencies).some((d) => id.startsWith(d)),
watch: {
include: 'src/**',
},
plugins: [
json(),
typescript(),
commonjs(),
resolve({
jsnext: true,
skip: Object.keys(pkg.dependencies),
}),
sourceMaps(),
sizes(),
],
}
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"compilerOptions": {
"moduleResolution": "node",
"module": "ESNext",
"target": "ESNext",
"target": "es5",
"module": "es2015",
"lib": ["es7", "es2015", "es2016", "es2017", "es2019", "esnext", "dom"],
"strict": true,
"sourceMap": true,
Expand Down
Loading

0 comments on commit a51737e

Please sign in to comment.