Skip to content

Commit

Permalink
fix: use main&module instead of exports
Browse files Browse the repository at this point in the history
  • Loading branch information
confidence-bot authored and nicklasl committed Aug 13, 2024
1 parent 98c9f14 commit 555cc35
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 48 deletions.
13 changes: 4 additions & 9 deletions packages/openfeature-server-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
"name": "@spotify-confidence/openfeature-server-provider",
"license": "Apache-2.0",
"version": "0.2.10",
"type": "module",
"types": "build/types/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"devDependencies": {
"@microsoft/api-extractor": "7.43.1",
"@openfeature/core": "^1.1.0",
Expand All @@ -25,7 +18,8 @@
"registry": "https://registry.npmjs.org/",
"access": "public",
"types": "dist/index.d.ts",
"main": "dist/index.js"
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
},
"scripts": {
"build": "tsc -b",
Expand All @@ -35,5 +29,6 @@
"files": [
"dist/index.*"
],
"main": "dist/index.js"
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
}
13 changes: 4 additions & 9 deletions packages/openfeature-web-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "@spotify-confidence/openfeature-web-provider",
"license": "Apache-2.0",
"version": "0.2.10",
"type": "module",
"types": "build/types/index.d.ts",
"dependencies": {
"fast-deep-equal": "^3.1.3"
Expand All @@ -22,7 +21,8 @@
"registry": "https://registry.npmjs.org/",
"access": "public",
"types": "dist/index.d.ts",
"main": "dist/index.js"
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
},
"scripts": {
"build": "tsc -b",
Expand All @@ -32,11 +32,6 @@
"files": [
"dist/index.*"
],
"main": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
}
13 changes: 4 additions & 9 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"registry": "https://registry.npmjs.org/",
"access": "public",
"types": "dist/index.d.ts",
"main": "dist/index.js"
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
},
"peerDependencies": {
"@spotify-confidence/sdk": "^0.1.5",
Expand All @@ -31,12 +32,6 @@
"react": "^18.2.0",
"rollup": "4.14.2"
},
"type": "module",
"main": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
}
13 changes: 4 additions & 9 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"registry": "https://registry.npmjs.org/",
"access": "public",
"types": "dist/index.d.ts",
"main": "dist/index.js"
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
},
"dependencies": {
"web-vitals": "^3.5.2"
Expand All @@ -31,12 +32,6 @@
"rollup": "4.14.2",
"ts-proto": "^1.171.0"
},
"type": "module",
"main": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js"
}
4 changes: 2 additions & 2 deletions rollup.base.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ export default {
},
output: [
{
file: 'dist/index.js',
file: 'dist/index.esm.js',
format: 'es',
sourcemap: true,
generatedCode: 'es2015',
},
{
file: 'dist/index.cjs',
file: 'dist/index.cjs.js',
format: 'cjs',
sourcemap: true,
generatedCode: 'es2015',
Expand Down
16 changes: 6 additions & 10 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,21 @@ module.exports = defineConfig({
}

// package.json invariants
workspace.set('type', 'module');
workspace.set('main', 'dist/index.js');
workspace.unset('module');
workspace.set('main', 'dist/index.cjs.js');
workspace.set('module', 'dist/index.esm.js');
workspace.unset('type');
workspace.set('types', 'build/types/index.d.ts');
workspace.set('files', ['dist/index.*']);
workspace.set('scripts.build', 'tsc -b');
workspace.set('scripts.bundle', 'rollup -c && api-extractor run');
workspace.set('scripts.prepack', 'yarn build && yarn bundle');
workspace.set('exports', {
'.': {
import: './dist/index.js',
require: './dist/index.cjs',
},
});
workspace.unset('exports');
workspace.set('publishConfig', {
registry: 'https://registry.npmjs.org/',
access: 'public',
types: 'dist/index.d.ts',
main: 'dist/index.js',
main: 'dist/index.cjs.js',
module: 'dist/index.esm.js',
});
// dev deps that should all share the same version (from root package.json)
for (const id of ['@microsoft/api-extractor', 'rollup']) {
Expand Down

0 comments on commit 555cc35

Please sign in to comment.