Skip to content

Commit 2ec10f0

Browse files
authored
Add secondary exports to extension package (#1075)
* Add secondary exports to extension package * Update documentation * Create dull-cats-end.md
1 parent 37539fc commit 2ec10f0

File tree

7 files changed

+69
-21
lines changed

7 files changed

+69
-21
lines changed

.changeset/dull-cats-end.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@redux-devtools/extension': patch
3+
---
4+
5+
v3.0.0 had an unintentional breaking change of changing the location of the secondary entrypoints. These secondary exports are now exported from the main entrypoint (https://github.com/reduxjs/redux-devtools/pull/1075) and should be imported like so:
6+
7+
```diff
8+
- import { composeWithDevTools, devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';
9+
- import { composeWithDevTools, devToolsEnhancer } from 'redux-devtools-extension/logOnly';
10+
- import { composeWithDevTools, devToolsEnhancer } from 'redux-devtools-extension/logOnlyInProduction';
11+
+ import {
12+
+ composeWithDevToolsDevelopmentOnly,
13+
+ devToolsEnhancerDevelopmentOnly,
14+
+ composeWithDevToolsLogOnly,
15+
+ devToolsEnhancerLogOnly,
16+
+ composeWithDevToolsLogOnlyInProduction,
17+
+ devToolsEnhancerLogOnlyInProduction,
18+
+ } from '@redux-devtools/extension';
19+
```

extension/README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ const store = createStore(reducer, enhancer);
113113

114114
> [See the post for more details](https://medium.com/@zalmoxis/improve-your-development-workflow-with-redux-devtools-extension-f0379227ff83).
115115
116-
### 1.3 Use `redux-devtools-extension` package from npm
116+
### 1.3 Use `@redux-devtools/extension` package from npm
117117

118118
To make things easier, there's an npm package to install:
119119

120120
```
121-
npm install --save redux-devtools-extension
121+
npm install --save @redux-devtools/extension
122122
```
123123

124124
and to use like so:
125125

126126
```js
127127
import { createStore, applyMiddleware } from 'redux';
128-
import { composeWithDevTools } from 'redux-devtools-extension';
128+
import { composeWithDevTools } from '@redux-devtools/extension';
129129

130130
const store = createStore(
131131
reducer,
@@ -140,7 +140,7 @@ To specify [extension’s options](https://github.com/zalmoxisus/redux-devtools-
140140

141141
```js
142142
import { createStore, applyMiddleware } from 'redux';
143-
import { composeWithDevTools } from 'redux-devtools-extension';
143+
import { composeWithDevTools } from '@redux-devtools/extension';
144144

145145
const composeEnhancers = composeWithDevTools({
146146
// Specify name here, actionsDenylist, actionsCreators and other options if needed
@@ -154,13 +154,13 @@ const store = createStore(
154154
);
155155
```
156156

157-
> There’re just [few lines of code](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/npm-package/index.js) added to your bundle.
157+
> There are just a [few lines of code](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/npm-package/index.js) added to your bundle.
158158
159159
In case you don't include other enhancers and middlewares, just use `devToolsEnhancer`:
160160

161161
```js
162162
import { createStore } from 'redux';
163-
import { devToolsEnhancer } from 'redux-devtools-extension';
163+
import { devToolsEnhancer } from '@redux-devtools/extension';
164164

165165
const store = createStore(
166166
reducer,
@@ -173,15 +173,15 @@ const store = createStore(
173173

174174
It's useful to include the extension in production as well. Usually you [can use it for development](https://medium.com/@zalmoxis/using-redux-devtools-in-production-4c5b56c5600f).
175175

176-
If you want to restrict it there, use `redux-devtools-extension/logOnlyInProduction`:
176+
If you want to restrict it there, use `composeWithDevToolsLogOnlyInProduction` or `devToolsEnhancerLogOnlyInProduction`:
177177

178178
```js
179179
import { createStore } from 'redux';
180-
import { devToolsEnhancer } from 'redux-devtools-extension/logOnlyInProduction';
180+
import { devToolsEnhancerLogOnlyInProduction } from '@redux-devtools/extension';
181181

182182
const store = createStore(
183183
reducer,
184-
/* preloadedState, */ devToolsEnhancer()
184+
/* preloadedState, */ devToolsEnhancerLogOnlyInProduction()
185185
// options like actionSanitizer, stateSanitizer
186186
);
187187
```
@@ -190,9 +190,9 @@ or with middlewares and enhancers:
190190

191191
```js
192192
import { createStore, applyMiddleware } from 'redux';
193-
import { composeWithDevTools } from 'redux-devtools-extension/logOnlyInProduction';
193+
import { composeWithDevToolsLogOnlyInProduction } from '@redux-devtools/extension';
194194

195-
const composeEnhancers = composeWithDevTools({
195+
const composeEnhancers = composeWithDevToolsLogOnlyInProduction({
196196
// options like actionSanitizer, stateSanitizer
197197
});
198198
const store = createStore(
@@ -206,9 +206,9 @@ const store = createStore(
206206

207207
> You'll have to add `'process.env.NODE_ENV': JSON.stringify('production')` in your Webpack config for the production bundle ([to envify](https://github.com/gaearon/redux-devtools/blob/master/docs/Walkthrough.md#exclude-devtools-from-production-builds)). If you use `create-react-app`, [it already does it for you.](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/config/webpack.config.prod.js#L253-L257)
208208
209-
If you're already checking `process.env.NODE_ENV` when creating the store, include `redux-devtools-extension/logOnly` for production environment.
209+
If you're already checking `process.env.NODE_ENV` when creating the store, import `composeWithDevToolsLogOnly` or `devToolsEnhancerLogOnly` for production environment.
210210

211-
If you don’t want to allow the extension in production, just use `redux-devtools-extension/developmentOnly`.
211+
If you don’t want to allow the extension in production, just use `composeWithDevToolsDevelopmentOnly` or `devToolsEnhancerDevelopmentOnly`.
212212

213213
> See [the article](https://medium.com/@zalmoxis/using-redux-devtools-in-production-4c5b56c5600f) for more details.
214214

extension/docs/API/Methods.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ devTools.init({ value: 'initial state' });
4242
devTools.send('change state', { value: 'state changed' });
4343
```
4444

45-
See [redux enhancer's example](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/npm-package/logOnly.js), [react example](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/examples/react-counter-messaging/components/Counter.js) and [blog post](https://medium.com/@zalmoxis/redux-devtools-without-redux-or-how-to-have-a-predictable-state-with-any-architecture-61c5f5a7716f) for more details.
45+
See [redux enhancer's example](https://github.com/reduxjs/redux-devtools/blob/main/packages/redux-devtools-extension/src/logOnly.ts), [react example](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/examples/react-counter-messaging/components/Counter.js) and [blog post](https://medium.com/@zalmoxis/redux-devtools-without-redux-or-how-to-have-a-predictable-state-with-any-architecture-61c5f5a7716f) for more details.
4646

4747
### disconnect()
4848

extension/docs/Recipes.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Using in a typescript project
44

5-
The recommended way is to use [`redux-devtools-extension` npm package](/README.md#13-use-redux-devtools-extension-package-from-npm), which contains all typescript definitions. Or you can just use `window as any`:
5+
The recommended way is to use [`@redux-devtools/extension` npm package](/README.md#13-use-redux-devtools-extension-package-from-npm), which contains all typescript definitions. Or you can just use `window as any`:
66

77
```js
88
const store = createStore(
@@ -15,7 +15,7 @@ const store = createStore(
1515

1616
Note that you many need to set `no-any` to false in your `tslint.json` file.
1717

18-
Alternatively you can use typeguard in order to avoid
18+
Alternatively you can use type-guard in order to avoid
1919
casting to any.
2020

2121
```typescript
@@ -54,21 +54,21 @@ The extension is not sharing `store` object, so you should take care of that.
5454

5555
### Applying multiple times with different sets of options
5656

57-
We're [not allowing that from instrumentation part](https://github.com/zalmoxisus/redux-devtools-instrument/blob/master/src/instrument.js#L676), because that would re-dispatch every app action in case we'd have many liftedStores, but there's [a helper for logging only](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/npm-package/logOnly.js), which can be used it like so:
57+
We're [not allowing that from instrumentation part](https://github.com/reduxjs/redux-devtools/blob/main/packages/redux-devtools-extension/src/logOnly.ts), which can be used it like so:
5858

5959
```js
6060
import { createStore, compose } from 'redux';
61-
import { devToolsEnhancer } from 'redux-devtools-extension/logOnly';
61+
import { devToolsEnhancerLogOnly } from '@redux-devtools/extension';
6262

6363
const store = createStore(
6464
reducer,
6565
/* preloadedState, */ compose(
66-
devToolsEnhancer({
66+
devToolsEnhancerLogOnly({
6767
instaceID: 1,
6868
name: 'Denylisted',
6969
actionsDenylist: '...',
7070
}),
71-
devToolsEnhancer({
71+
devToolsEnhancerLogOnly({
7272
instaceID: 2,
7373
name: 'Allowlisted',
7474
actionsAllowlist: '...',

packages/redux-devtools-extension/CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
## 3.0.0
1010

1111
- **BREAKING** Rename `redux-devtools-extension` package to `@redux-devtools/extension` (https://github.com/reduxjs/redux-devtools/pull/948).
12+
- **BREAKING** The secondary exports are now exported from the main entrypoint (https://github.com/reduxjs/redux-devtools/pull/1075) (NOTE: this will only work in `@redux-devtools/[email protected]` or later):
13+
14+
```diff
15+
- import { composeWithDevTools, devToolsEnhancer } from 'redux-devtools-extension/developmentOnly';
16+
- import { composeWithDevTools, devToolsEnhancer } from 'redux-devtools-extension/logOnly';
17+
- import { composeWithDevTools, devToolsEnhancer } from 'redux-devtools-extension/logOnlyInProduction';
18+
+ import {
19+
+ composeWithDevToolsDevelopmentOnly,
20+
+ devToolsEnhancerDevelopmentOnly,
21+
+ composeWithDevToolsLogOnly,
22+
+ devToolsEnhancerLogOnly,
23+
+ composeWithDevToolsLogOnlyInProduction,
24+
+ devToolsEnhancerLogOnlyInProduction,
25+
+ } from '@redux-devtools/extension';
26+
```
27+
1228
- Deprecate `actionsBlacklist` and `actionsWhitelist` in favor of `actionsDenylist` and `actionsAllowlist` (https://github.com/reduxjs/redux-devtools/pull/851).
1329

1430
## 2.13.9 (2021-03-06)

packages/redux-devtools-extension/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const store = createStore(
4343
);
4444
```
4545

46-
There’re just [few lines of code](https://github.com/reduxjs/redux-devtools/blob/main/packages/redux-devtools-extension/src/index.ts). If you don’t want to allow the extension in production, just use @redux-devtools/extension/lib/developmentOnly’ instead of @redux-devtools/extension.
46+
There are just a [few lines of code](https://github.com/reduxjs/redux-devtools/blob/main/packages/redux-devtools-extension/src/index.ts). If you don’t want to allow the extension in production, just use `composeWithDevToolsDevelopmentOnly` instead of `composeWithDevTools`.
4747

4848
## License
4949

packages/redux-devtools-extension/src/index.ts

+13
Original file line numberDiff line numberDiff line change
@@ -229,3 +229,16 @@ export const devToolsEnhancer: (options?: EnhancerOptions) => StoreEnhancer =
229229
return noop;
230230
};
231231
};
232+
233+
export {
234+
composeWithDevTools as composeWithDevToolsDevelopmentOnly,
235+
devToolsEnhancer as devToolsEnhancerDevelopmentOnly,
236+
} from './developmentOnly';
237+
export {
238+
composeWithDevTools as composeWithDevToolsLogOnly,
239+
devToolsEnhancer as devToolsEnhancerLogOnly,
240+
} from './logOnly';
241+
export {
242+
composeWithDevTools as composeWithDevToolsLogOnlyInProduction,
243+
devToolsEnhancer as devToolsEnhancerLogOnlyInProduction,
244+
} from './logOnlyInProduction';

0 commit comments

Comments
 (0)