Skip to content

Commit

Permalink
rollup done
Browse files Browse the repository at this point in the history
  • Loading branch information
includeDaniel committed Jul 28, 2023
1 parent ef8b004 commit 16cf438
Show file tree
Hide file tree
Showing 5 changed files with 275 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "@includedaniel/fibonacci",
"version": "1.0.14",
"version": "1.0.15",
"description": "📦 package who finds a correspondent fibonacci term",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"type": "module",
"scripts": {
"test": "jest --coverage",
"lint": "eslint . --ext ts --ext tsx --ext js --ext snap",
"type-check": "tsc --pretty --noEmit",
"format": "prettier --write .",
"build": "tsc --project tsconfig.build.json"
"build": "rollup -c"
},
"files": [
"dist"
Expand Down Expand Up @@ -37,6 +39,7 @@
"devDependencies": {
"@types/jest": "^29.5.2",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"esbuild": "^0.18.17",
"eslint": "^8.0.1",
"eslint-config-standard-with-typescript": "^34.0.1",
"eslint-plugin-import": "^2.25.2",
Expand All @@ -45,6 +48,9 @@
"eslint-plugin-promise": "^6.0.0",
"jest": "^29.5.0",
"prettier": "^2.8.8",
"rollup": "^3.27.0",
"rollup-plugin-dts": "^5.3.0",
"rollup-plugin-esbuild": "^5.0.0",
"ts-jest": "^29.1.0",
"typescript": "*"
}
Expand Down
36 changes: 36 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import dts from 'rollup-plugin-dts'
import esbuild from 'rollup-plugin-esbuild'
import packageJson from './package.json' assert { type: 'json' }

const name = packageJson.main.replace(/\.js$/, '')

const bundle = config => ({
...config,
input: 'src/index.ts',
external: id => !/^[./]/.test(id)
})

export default [
bundle({
plugins: [esbuild()],
output: [
{
file: `${name}.js`,
format: 'cjs',
sourcemap: true
},
{
file: `${name}.mjs`,
format: 'es',
sourcemap: true
}
]
}),
bundle({
plugins: [dts()],
output: {
file: `${name}.d.ts`,
format: 'es'
}
})
]
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "ES5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"target": "esnext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": [
"es6",
"dom",
Expand Down
Loading

0 comments on commit 16cf438

Please sign in to comment.