Skip to content

Commit

Permalink
Extract rollup plugins and base config to top level
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcetinkaya committed Dec 6, 2021
1 parent 65b334e commit ad82d8c
Show file tree
Hide file tree
Showing 15 changed files with 365 additions and 154 deletions.
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,16 @@
"version:push": "yarn version:create && git add -A && git push && git push --tags"
},
"devDependencies": {
"@babel/core": "^7.13.15",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"husky": "^4.3.8",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1"
"prettier": "^2.2.1",
"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.2.4"
},
"husky": {
"hooks": {
Expand Down
3 changes: 0 additions & 3 deletions packages/embla-carousel-autoplay/.babelrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/embla-carousel-autoplay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
"eslint:fix": "eslint \"src/**/*.{js,tsx,ts}\" --fix"
},
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/jest": "^26.0.22",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
Expand All @@ -55,8 +50,6 @@
"jest": "^26.6.3",
"prettier": "^2.2.1",
"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.5",
"typescript": "^4.2.4"
},
Expand Down
26 changes: 10 additions & 16 deletions packages/embla-carousel-autoplay/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import babel from '@rollup/plugin-babel'
import typescript from 'rollup-plugin-typescript2'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import localTypescript from 'typescript'
import packageJson from './package.json'

const CONFIG_BABEL = {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}
const CONFIG_TYPESCRIPT = {
tsconfig: 'tsconfig.json',
typescript: localTypescript,
}
import {
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
babel,
typescript,
resolve,
terser,
kebabCaseToPascalCase,
} from '../../rollup.config'

export default [
{
Expand All @@ -37,7 +31,7 @@ export default [
format: 'umd',
strict: true,
sourcemap: false,
name: 'EmblaCarouselAutoplay',
name: kebabCaseToPascalCase(packageJson.name),
plugins: [terser()],
},
],
Expand Down
3 changes: 0 additions & 3 deletions packages/embla-carousel-class-names/.babelrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/embla-carousel-class-names/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
"eslint:fix": "eslint \"src/**/*.{js,tsx,ts}\" --fix"
},
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/jest": "^26.0.22",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
Expand All @@ -55,8 +50,6 @@
"jest": "^26.6.3",
"prettier": "^2.2.1",
"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.5",
"typescript": "^4.2.4"
},
Expand Down
26 changes: 10 additions & 16 deletions packages/embla-carousel-class-names/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import babel from '@rollup/plugin-babel'
import typescript from 'rollup-plugin-typescript2'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import localTypescript from 'typescript'
import packageJson from './package.json'

const CONFIG_BABEL = {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}
const CONFIG_TYPESCRIPT = {
tsconfig: 'tsconfig.json',
typescript: localTypescript,
}
import {
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
babel,
typescript,
resolve,
terser,
kebabCaseToPascalCase,
} from '../../rollup.config'

export default [
{
Expand All @@ -37,7 +31,7 @@ export default [
format: 'umd',
strict: true,
sourcemap: false,
name: 'EmblaCarouselClassNames',
name: kebabCaseToPascalCase(packageJson.name),
plugins: [terser()],
},
],
Expand Down
4 changes: 0 additions & 4 deletions packages/embla-carousel-react/.babelrc.js

This file was deleted.

8 changes: 0 additions & 8 deletions packages/embla-carousel-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@
"eslint:fix": "eslint \"src/**/*.{js,tsx,ts}\" --fix"
},
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/plugin-transform-object-assign": "^7.12.13",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/jest": "^26.0.22",
"@types/react": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^4.22.0",
Expand All @@ -57,8 +51,6 @@
"jest": "^26.6.3",
"prettier": "^2.2.1",
"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.5",
"typescript": "^4.2.4"
},
Expand Down
26 changes: 10 additions & 16 deletions packages/embla-carousel-react/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import babel from '@rollup/plugin-babel'
import typescript from 'rollup-plugin-typescript2'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import localTypescript from 'typescript'
import packageJson from './package.json'

const CONFIG_BABEL = {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}
const CONFIG_TYPESCRIPT = {
tsconfig: 'tsconfig.json',
typescript: localTypescript,
}
import {
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
babel,
typescript,
resolve,
terser,
kebabCaseToPascalCase,
} from '../../rollup.config'

export default [
{
Expand All @@ -40,7 +34,7 @@ export default [
globals: { react: 'React' },
strict: true,
sourcemap: false,
name: 'useEmblaCarousel',
name: kebabCaseToPascalCase(packageJson.name),
plugins: [terser()],
},
],
Expand Down
3 changes: 0 additions & 3 deletions packages/embla-carousel/.babelrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/embla-carousel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
"eslint:fix": "eslint \"src/**/*.{js,tsx,ts}\" --fix"
},
"devDependencies": {
"@babel/core": "^7.13.15",
"@babel/preset-env": "^7.13.15",
"@babel/preset-typescript": "^7.13.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@types/jest": "^26.0.22",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
Expand All @@ -55,8 +50,6 @@
"jest": "^26.6.3",
"prettier": "^2.2.1",
"rollup": "^2.45.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"ts-jest": "^26.5.5",
"typescript": "^4.2.4"
}
Expand Down
26 changes: 10 additions & 16 deletions packages/embla-carousel/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import babel from '@rollup/plugin-babel'
import typescript from 'rollup-plugin-typescript2'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import localTypescript from 'typescript'
import packageJson from './package.json'

const CONFIG_BABEL = {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}
const CONFIG_TYPESCRIPT = {
tsconfig: 'tsconfig.json',
typescript: localTypescript,
}
import {
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
babel,
typescript,
resolve,
terser,
kebabCaseToPascalCase,
} from '../../rollup.config'

export default [
{
Expand All @@ -37,7 +31,7 @@ export default [
format: 'umd',
strict: true,
sourcemap: false,
name: 'EmblaCarousel',
name: kebabCaseToPascalCase(packageJson.name),
plugins: [terser()],
},
],
Expand Down
32 changes: 32 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import babel from '@rollup/plugin-babel'
import typescript from 'rollup-plugin-typescript2'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import localTypescript from 'typescript'

const CONFIG_BABEL = {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}

const CONFIG_TYPESCRIPT = {
tsconfig: 'tsconfig.json',
typescript: localTypescript,
}

const kebabCaseToPascalCase = (string = '') => {
return string.replace(/(^\w|-\w)/g, (replaceString) =>
replaceString.replace(/-/, '').toUpperCase(),
)
}

export {
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
babel,
typescript,
resolve,
terser,
kebabCaseToPascalCase,
}
Loading

0 comments on commit ad82d8c

Please sign in to comment.