Skip to content

Commit

Permalink
Merge pull request #605 from davidjerleke/feature/#481
Browse files Browse the repository at this point in the history
Add "type: module" (nodenext) support alongside commonjs
  • Loading branch information
davidjerleke authored Oct 31, 2023
2 parents 258b4b5 + 0832e07 commit df115ea
Show file tree
Hide file tree
Showing 29 changed files with 2,193 additions and 1,417 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
packages/embla-carousel*/index.d.ts
packages/embla-carousel*/embla-carousel*
packages/embla-carousel*/components
packages/embla-carousel*/esm
packages/embla-carousel*/cjs
public

# yarn
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
packages/embla-carousel*/index.d.ts
packages/embla-carousel*/embla-carousel*
packages/embla-carousel*/components
packages/embla-carousel*/esm
packages/embla-carousel*/cjs
public
static
docs
Expand Down
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,22 @@
"version:push": "yarn install && yarn version:create && git add -A && git push && git push --tags"
},
"devDependencies": {
"@babel/core": "7.17.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-node-resolve": "13.1.3",
"@babel/core": "7.23.2",
"@octokit/types": "^11.1.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"husky": "^4.3.8",
"npm-run-all": "^4.1.5",
"prettier": "2.5.1",
"rollup": "^2.68.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.2",
"typescript": "^4.5.5"
"prettier": "2.8.8",
"rollup": "^4.1.5",
"typescript": "^5.2.2"
},
"husky": {
"hooks": {
"pre-push": "npm-run-all test lint"
}
},
"packageManager": "[email protected]",
"dependencies": {
"@octokit/types": "^11.1.0"
}
"packageManager": "[email protected]"
}
42 changes: 29 additions & 13 deletions packages/embla-carousel-auto-height/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,44 @@
"files": [
"embla-carousel-auto-height*",
"components/**/*",
"index.d.ts"
"index.d.ts",
"esm/**/*",
"cjs/**/*"
],
"scripts": {
"test": "echo \"Info: no tests specified\" && exit 0",
"build": "rollup -c",
"start": "rollup -c --watch",
"build": "rollup --bundleConfigAsCjs -c",
"start": "rollup --bundleConfigAsCjs -c --watch",
"eslint:report": "eslint \"src/**/*.{js,tsx,ts}\""
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.0",
"prettier": "2.5.1",
"rollup": "^2.68.0",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"peerDependencies": {
"embla-carousel": "8.0.0-rc14"
},
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./esm/index.d.ts",
"default": "./esm/embla-carousel-auto-height.esm.js"
},
"require": {
"types": "./cjs/index.d.ts",
"default": "./cjs/embla-carousel-auto-height.cjs.js"
}
}
}
}
14 changes: 8 additions & 6 deletions packages/embla-carousel-auto-height/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import packageJson from './package.json'
import {
PACKAGE_FORMATS,
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
CONFIG_GLOBALS,
babel,
typescript,
resolve,
terser,
createBuildPath,
kebabToPascalCase
} from '../../rollup.config'

Expand All @@ -15,23 +17,23 @@ export default [
input: 'src/index.ts',
output: [
{
file: `${packageJson.name}.cjs.js`,
format: 'cjs',
file: createBuildPath(packageJson, PACKAGE_FORMATS.CJS),
format: PACKAGE_FORMATS.CJS,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: true,
exports: 'auto'
},
{
file: `${packageJson.name}.esm.js`,
format: 'esm',
file: createBuildPath(packageJson, PACKAGE_FORMATS.ESM),
format: PACKAGE_FORMATS.ESM,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: true
},
{
file: `${packageJson.name}.umd.js`,
format: 'umd',
file: createBuildPath(packageJson, PACKAGE_FORMATS.UMD),
format: PACKAGE_FORMATS.UMD,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: false,
Expand Down
42 changes: 29 additions & 13 deletions packages/embla-carousel-autoplay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,44 @@
"files": [
"embla-carousel-autoplay*",
"components/**/*",
"index.d.ts"
"index.d.ts",
"esm/**/*",
"cjs/**/*"
],
"scripts": {
"test": "echo \"Info: no tests specified\" && exit 0",
"build": "rollup -c",
"start": "rollup -c --watch",
"build": "rollup --bundleConfigAsCjs -c",
"start": "rollup --bundleConfigAsCjs -c --watch",
"eslint:report": "eslint \"src/**/*.{js,tsx,ts}\""
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.0",
"prettier": "2.5.1",
"rollup": "^2.68.0",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"peerDependencies": {
"embla-carousel": "8.0.0-rc14"
},
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./esm/index.d.ts",
"default": "./esm/embla-carousel-autoplay.esm.js"
},
"require": {
"types": "./cjs/index.d.ts",
"default": "./cjs/embla-carousel-autoplay.cjs.js"
}
}
}
}
14 changes: 8 additions & 6 deletions packages/embla-carousel-autoplay/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import packageJson from './package.json'
import {
PACKAGE_FORMATS,
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
CONFIG_GLOBALS,
babel,
typescript,
resolve,
terser,
createBuildPath,
kebabToPascalCase
} from '../../rollup.config'

Expand All @@ -15,23 +17,23 @@ export default [
input: 'src/index.ts',
output: [
{
file: `${packageJson.name}.cjs.js`,
format: 'cjs',
file: createBuildPath(packageJson, PACKAGE_FORMATS.CJS),
format: PACKAGE_FORMATS.CJS,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: true,
exports: 'auto'
},
{
file: `${packageJson.name}.esm.js`,
format: 'esm',
file: createBuildPath(packageJson, PACKAGE_FORMATS.ESM),
format: PACKAGE_FORMATS.ESM,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: true
},
{
file: `${packageJson.name}.umd.js`,
format: 'umd',
file: createBuildPath(packageJson, PACKAGE_FORMATS.UMD),
format: PACKAGE_FORMATS.UMD,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: false,
Expand Down
42 changes: 29 additions & 13 deletions packages/embla-carousel-class-names/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,44 @@
"files": [
"embla-carousel-class-names*",
"components/**/*",
"index.d.ts"
"index.d.ts",
"esm/**/*",
"cjs/**/*"
],
"scripts": {
"test": "echo \"Info: no tests specified\" && exit 0",
"build": "rollup -c",
"start": "rollup -c --watch",
"build": "rollup --bundleConfigAsCjs -c",
"start": "rollup --bundleConfigAsCjs -c --watch",
"eslint:report": "eslint \"src/**/*.{js,tsx,ts}\""
},
"devDependencies": {
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"@types/jest": "^29.5.6",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.0",
"prettier": "2.5.1",
"rollup": "^2.68.0",
"ts-jest": "^27.1.3",
"typescript": "^4.5.5"
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "2.8.8",
"rollup": "^4.1.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
},
"peerDependencies": {
"embla-carousel": "8.0.0-rc14"
},
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./esm/index.d.ts",
"default": "./esm/embla-carousel-class-names.esm.js"
},
"require": {
"types": "./cjs/index.d.ts",
"default": "./cjs/embla-carousel-class-names.cjs.js"
}
}
}
}
14 changes: 8 additions & 6 deletions packages/embla-carousel-class-names/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import packageJson from './package.json'
import {
PACKAGE_FORMATS,
CONFIG_BABEL,
CONFIG_TYPESCRIPT,
CONFIG_GLOBALS,
babel,
typescript,
resolve,
terser,
createBuildPath,
kebabToPascalCase
} from '../../rollup.config'

Expand All @@ -15,23 +17,23 @@ export default [
input: 'src/index.ts',
output: [
{
file: `${packageJson.name}.cjs.js`,
format: 'cjs',
file: createBuildPath(packageJson, PACKAGE_FORMATS.CJS),
format: PACKAGE_FORMATS.CJS,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: true,
exports: 'auto'
},
{
file: `${packageJson.name}.esm.js`,
format: 'esm',
file: createBuildPath(packageJson, PACKAGE_FORMATS.ESM),
format: PACKAGE_FORMATS.ESM,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: true
},
{
file: `${packageJson.name}.umd.js`,
format: 'umd',
file: createBuildPath(packageJson, PACKAGE_FORMATS.UMD),
format: PACKAGE_FORMATS.UMD,
globals: CONFIG_GLOBALS,
strict: true,
sourcemap: false,
Expand Down
Loading

0 comments on commit df115ea

Please sign in to comment.