Skip to content

Commit

Permalink
Merge remote-tracking branch 'pmndrs/v5' into v5-remove-deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
charkour committed Dec 10, 2023
2 parents 7caba56 + 8030aee commit 437994e
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 331 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ you can use this suggested workflow:
- Create failing tests for your fix or new feature;
- Implement your changes and confirm that all test are passing.
You can run the tests continuously during development
with the `yarn test:dev` command.
with the `yarn test` command.
- If you want to test it in a React project:
- Either use `yarn link`, or
- Use the `yalc` package.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,15 @@
"vitest": "^0.34.6"
},
"peerDependencies": {
"immer": ">=9.0",
"@types/react": ">=16.8",
"immer": ">=9.0.6",
"react": ">=16.8"
},
"peerDependenciesMeta": {
"immer": {
"@types/react": {
"optional": true
},
"@types/react": {
"immer": {
"optional": true
},
"react": {
Expand Down
24 changes: 2 additions & 22 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,22 +78,13 @@ function createESMConfig(input, output) {
}
}

function createCommonJSConfig(input, output, options) {
function createCommonJSConfig(input, output) {
return {
input,
output: {
file: `${output}.js`,
format: 'cjs',
esModule: false,
outro: options.addModuleExport
? [
`module.exports = ${options.addModuleExport.default};`,
...Object.entries(options.addModuleExport)
.filter(([key]) => key !== 'default')
.map(([key, value]) => `module.exports.${key} = ${value};`),
`exports.default = module.exports;`,
].join('\n')
: '',
},
external,
plugins: [
Expand Down Expand Up @@ -176,18 +167,7 @@ module.exports = function (args) {
}
return [
...(c === 'index' ? [createDeclarationConfig(`src/${c}.ts`, 'dist')] : []),
createCommonJSConfig(`src/${c}.ts`, `dist/${c}`, {
addModuleExport: {
index: {
default: 'react',
create: 'create',
useStore: 'useStore',
createStore: 'vanilla.createStore',
},
vanilla: { default: 'vanilla', createStore: 'createStore' },
shallow: { default: 'shallow', shallow: 'shallow$1' },
}[c],
}),
createCommonJSConfig(`src/${c}.ts`, `dist/${c}`),
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.js`),
createESMConfig(`src/${c}.ts`, `dist/esm/${c}.mjs`),
createUMDConfig(`src/${c}.ts`, `dist/umd/${c}`, 'development'),
Expand Down
Loading

0 comments on commit 437994e

Please sign in to comment.