@storybook/codemod 8.3.0-alpha.6 → 8.3.0-alpha.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,17 +3,16 @@
|
|
3
3
|
*
|
4
4
|
* For example:
|
5
5
|
*
|
6
|
-
*
|
7
|
-
*
|
6
|
+
* Input { Button } from './Button'; storiesOf('Button', module).add('story', () => <Button
|
7
|
+
* label="The Button" />);
|
8
8
|
*
|
9
9
|
* Becomes:
|
10
10
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
* .addParameters({ component: Button })
|
14
|
-
* .add('story', () => <Button label="The Button" />);
|
11
|
+
* Input { Button } from './Button'; storiesOf('Button', module) .addParameters({ component: Button
|
12
|
+
* }) .add('story', () => <Button label="The Button" />);
|
15
13
|
*
|
16
14
|
* Heuristics:
|
15
|
+
*
|
17
16
|
* - The storiesOf "kind" name must be Button
|
18
17
|
* - Button must be imported in the file
|
19
18
|
*/
|
@@ -1,24 +1,24 @@
|
|
1
1
|
/**
|
2
2
|
* Hoist CSF .story annotations
|
3
3
|
*
|
4
|
-
*
|
4
|
+
* @example
|
5
5
|
*
|
6
|
-
* ```
|
6
|
+
* ```jsx
|
7
7
|
* export const Basic = () => <Button />
|
8
8
|
* Basic.story = {
|
9
9
|
* name: 'foo',
|
10
|
-
* parameters: {
|
11
|
-
* decorators = [
|
10
|
+
* parameters: { },
|
11
|
+
* decorators = [ ],
|
12
12
|
* };
|
13
13
|
* ```
|
14
14
|
*
|
15
15
|
* Becomes:
|
16
16
|
*
|
17
17
|
* ```
|
18
|
-
* export const Basic = () => <Button
|
18
|
+
* export const Basic = () => <Button />;
|
19
19
|
* Basic.storyName = 'foo';
|
20
|
-
* Basic.parameters = {
|
21
|
-
* Basic.decorators = [
|
20
|
+
* Basic.parameters = {};
|
21
|
+
* Basic.decorators = [];
|
22
22
|
* ```
|
23
23
|
*/
|
24
24
|
declare function transformer(file: any, api: any): any;
|
@@ -1,26 +1,22 @@
|
|
1
1
|
/**
|
2
|
-
* Takes the deprecated addon-info API, addWithInfo, and
|
3
|
-
* converts to the new withInfo API.
|
2
|
+
* Takes the deprecated addon-info API, addWithInfo, and converts to the new withInfo API.
|
4
3
|
*
|
5
|
-
*
|
4
|
+
* @example Of deprecated addWithInfo API:
|
6
5
|
*
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
* <Button label="The Button" />
|
13
|
-
* )
|
14
|
-
* )
|
6
|
+
* ```jsx
|
7
|
+
* storiesOf('Button').addWithInfo('story name', 'Story description.', () => (
|
8
|
+
* <Button label="The Button" />
|
9
|
+
* ));
|
10
|
+
* ```
|
15
11
|
*
|
16
12
|
* Converts to the new withInfo API:
|
17
13
|
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
* )(() =>
|
22
|
-
*
|
23
|
-
*
|
14
|
+
* ```jsx
|
15
|
+
* storiesOf('Button').add(
|
16
|
+
* 'story name',
|
17
|
+
* withInfo('Story description.')(() => <Button label="The Button" />)
|
18
|
+
* );
|
19
|
+
* ```
|
24
20
|
*/
|
25
21
|
declare function transformer(file: any, api: any): any;
|
26
22
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@storybook/codemod",
|
3
|
-
"version": "8.3.0-alpha.
|
3
|
+
"version": "8.3.0-alpha.8",
|
4
4
|
"description": "A collection of codemod scripts written with JSCodeshift",
|
5
5
|
"keywords": [
|
6
6
|
"storybook"
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"@babel/core": "^7.24.4",
|
58
58
|
"@babel/preset-env": "^7.24.4",
|
59
59
|
"@babel/types": "^7.24.0",
|
60
|
-
"@storybook/core": "8.3.0-alpha.
|
60
|
+
"@storybook/core": "8.3.0-alpha.8",
|
61
61
|
"@storybook/csf": "^0.1.11",
|
62
62
|
"@types/cross-spawn": "^6.0.2",
|
63
63
|
"cross-spawn": "^7.0.3",
|