Skip to content

Commit 16cf438

Browse files
committed
rollup done
1 parent ef8b004 commit 16cf438

File tree

5 files changed

+275
-6
lines changed

5 files changed

+275
-6
lines changed

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
preset: 'ts-jest',
33
testEnvironment: 'node',
44
transform: {

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
{
22
"name": "@includedaniel/fibonacci",
3-
"version": "1.0.14",
3+
"version": "1.0.15",
44
"description": "📦 package who finds a correspondent fibonacci term",
55
"main": "dist/index.js",
6+
"module": "dist/index.mjs",
67
"types": "dist/index.d.ts",
8+
"type": "module",
79
"scripts": {
810
"test": "jest --coverage",
911
"lint": "eslint . --ext ts --ext tsx --ext js --ext snap",
1012
"type-check": "tsc --pretty --noEmit",
1113
"format": "prettier --write .",
12-
"build": "tsc --project tsconfig.build.json"
14+
"build": "rollup -c"
1315
},
1416
"files": [
1517
"dist"
@@ -37,6 +39,7 @@
3739
"devDependencies": {
3840
"@types/jest": "^29.5.2",
3941
"@typescript-eslint/eslint-plugin": "^5.43.0",
42+
"esbuild": "^0.18.17",
4043
"eslint": "^8.0.1",
4144
"eslint-config-standard-with-typescript": "^34.0.1",
4245
"eslint-plugin-import": "^2.25.2",
@@ -45,6 +48,9 @@
4548
"eslint-plugin-promise": "^6.0.0",
4649
"jest": "^29.5.0",
4750
"prettier": "^2.8.8",
51+
"rollup": "^3.27.0",
52+
"rollup-plugin-dts": "^5.3.0",
53+
"rollup-plugin-esbuild": "^5.0.0",
4854
"ts-jest": "^29.1.0",
4955
"typescript": "*"
5056
}

rollup.config.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import dts from 'rollup-plugin-dts'
2+
import esbuild from 'rollup-plugin-esbuild'
3+
import packageJson from './package.json' assert { type: 'json' }
4+
5+
const name = packageJson.main.replace(/\.js$/, '')
6+
7+
const bundle = config => ({
8+
...config,
9+
input: 'src/index.ts',
10+
external: id => !/^[./]/.test(id)
11+
})
12+
13+
export default [
14+
bundle({
15+
plugins: [esbuild()],
16+
output: [
17+
{
18+
file: `${name}.js`,
19+
format: 'cjs',
20+
sourcemap: true
21+
},
22+
{
23+
file: `${name}.mjs`,
24+
format: 'es',
25+
sourcemap: true
26+
}
27+
]
28+
}),
29+
bundle({
30+
plugins: [dts()],
31+
output: {
32+
file: `${name}.d.ts`,
33+
format: 'es'
34+
}
35+
})
36+
]

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
1010
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
1111
/* Language and Environment */
12-
"target": "ES5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
12+
"target": "esnext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
1313
"lib": [
1414
"es6",
1515
"dom",

0 commit comments

Comments
 (0)