Skip to content

Commit

Permalink
Bug fix for davidjerleke#698.
Browse files Browse the repository at this point in the history
Co-authored-by: David Jerleke <david.jerleke@gmail.com>
Co-authored-by: Rui Duarte <9107610+ruijdacd@users.noreply.github.com>
  • Loading branch information
ruijdacd and davidjerleke committed Jan 16, 2024
1 parent 0cd1204 commit 65413fa
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/embla-carousel-auto-height/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-auto-height.umd.js",
"unpkg": "embla-carousel-auto-height.umd.js",
"module": "embla-carousel-auto-height.esm.js",
"module": "./esm/embla-carousel-auto-height.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel-autoplay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-autoplay.umd.js",
"unpkg": "embla-carousel-autoplay.umd.js",
"module": "embla-carousel-autoplay.esm.js",
"module": "./esm/embla-carousel-autoplay.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel-class-names/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-class-names.umd.js",
"unpkg": "embla-carousel-class-names.umd.js",
"module": "embla-carousel-class-names.esm.js",
"module": "./esm/embla-carousel-class-names.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-react.umd.js",
"unpkg": "embla-carousel-react.umd.js",
"module": "embla-carousel-react.esm.js",
"module": "./esm/embla-carousel-react.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel-reactive-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-reactive-utils.umd.js",
"unpkg": "embla-carousel-reactive-utils.umd.js",
"module": "embla-carousel-reactive-utils.esm.js",
"module": "./esm/embla-carousel-reactive-utils.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel-solid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-solid.umd.js",
"unpkg": "embla-carousel-solid.umd.js",
"module": "embla-carousel-solid.esm.js",
"module": "./esm/embla-carousel-solid.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-svelte.umd.js",
"unpkg": "embla-carousel-svelte.umd.js",
"module": "embla-carousel-svelte.esm.js",
"module": "./esm/embla-carousel-svelte.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"main": "embla-carousel-vue.umd.js",
"unpkg": "embla-carousel-vue.umd.js",
"module": "embla-carousel-vue.esm.js",
"module": "./esm/embla-carousel-vue.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
Expand Down
3 changes: 2 additions & 1 deletion packages/embla-carousel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
],
"main": "embla-carousel.umd.js",
"unpkg": "embla-carousel.umd.js",
"module": "embla-carousel.esm.js",
"module": "./esm/embla-carousel.esm.js",
"types": "index.d.ts",
"sideEffects": false,
"files": [
"embla-carousel*",
Expand Down
36 changes: 32 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ function createBuildPath(packageJson, format) {
}

function createNodeNextSupportForPackage() {
if (process.env.BUILD === 'development') return

const workspacePath = process.cwd()
const packageJsonPath = path.join(workspacePath, 'package.json')
const workspacePackageJson = fs.readFileSync(packageJsonPath, 'utf-8')
Expand All @@ -66,13 +64,41 @@ function createNodeNextSupportForPackage() {
const packageJson = JSON.parse(workspacePackageJson)
const packageJsonMain = {
...packageJson,
repository: {
type: 'git',
url: 'git+https://github.com/davidjerleke/embla-carousel'
},
bugs: {
url: 'https://github.com/davidjerleke/embla-carousel/issues'
},
homepage: 'https://www.embla-carousel.com',
license: 'MIT',
keywords: [
'slider',
'carousel',
'slideshow',
'gallery',
'lightweight',
'touch',
'javascript',
'typescript',
'react',
'vue',
'svelte',
'solid'
],
files: [
`${packageJson.name}*`,
'components/**/*',
'index.d.ts',
'esm/**/*',
'cjs/**/*'
],
sideEffects: false,
unpkg: `${packageJson.name}.umd.js`,
main: `${packageJson.name}.umd.js`,
module: `./${FOLDERS.ESM}/${packageJson.name}.${FOLDERS.ESM}.js`,
types: 'index.d.ts',
exports: {
'./package.json': './package.json',
'.': {
Expand All @@ -88,17 +114,19 @@ function createNodeNextSupportForPackage() {
}
}

delete packageJson.scripts
delete packageJson.exports
const propsToDelete = ['scripts', 'exports', 'main', 'unpkg', 'module']
propsToDelete.forEach((prop) => delete packageJson[prop])

const files = [`${packageJson.name}*`, 'components/**/*', 'index.d.ts']
const packageJsonEsm = {
...packageJson,
module: `${packageJson.name}.${FOLDERS.ESM}.js`,
files,
type: 'module'
}
const packageJsonCjs = {
...packageJson,
main: `${packageJson.name}.${FOLDERS.CJS}.js`,
files,
type: 'commonjs'
}
Expand Down

0 comments on commit 65413fa

Please sign in to comment.