-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: Avoid id changes after storiesof-to-csf
migration
#8856
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
78e0050
storiesof-to-csf: avoid id changes after migration
Hypnosphi 66a79bc
Fix typo
Hypnosphi 24ec9d3
Migrate examples and templates to PascalCase exports
Hypnosphi 2813b2a
Merge remote-tracking branch 'origin/next' into avoid-id-changes
Hypnosphi a7a3f36
Fix error
Hypnosphi 811dd24
Fix stories glob
Hypnosphi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
import { sanitizeName } from './utils'; | ||
|
||
it('should sanitize names', () => { | ||
const testCases = [ | ||
['basic', 'basic'], | ||
['with space', 'withSpace'], | ||
['default', 'defaultStory'], | ||
['w/punctuation', 'wPunctuation'], | ||
]; | ||
testCases.forEach(testCase => { | ||
const [input, out] = testCase; | ||
expect(sanitizeName(input)).toBe(out); | ||
}); | ||
expect(sanitizeName('basic')).toMatchInlineSnapshot(`"Basic"`); | ||
expect(sanitizeName('with space')).toMatchInlineSnapshot(`"WithSpace"`); | ||
expect(sanitizeName('default')).toMatchInlineSnapshot(`"Default"`); | ||
expect(sanitizeName('w/punctuation')).toMatchInlineSnapshot(`"WPunctuation"`); | ||
expect(sanitizeName('5')).toMatchInlineSnapshot(`"_5"`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/collision.input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
export const foo = 1; | ||
const bar = 1; | ||
const barStory = 1; | ||
const baz = 1; | ||
const bazStory1 = 1; | ||
export const Foo = 1; | ||
const Bar = 1; | ||
const _Bar = 1; | ||
const Baz = 1; | ||
const __Baz = 1; | ||
|
||
storiesOf('foo', module) | ||
.add('foo', () => <button />) | ||
.add('bar', () => <button />) | ||
.add('bazStory', () => <button />) | ||
.add('_baz', () => <button />) | ||
.add('baz', () => <button />); |
30 changes: 15 additions & 15 deletions
30
lib/codemod/src/transforms/__testfixtures__/storiesof-to-csf/collision.output.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`storiesof-to-csf transforms correctly using "collision.input.js" data 1`] = ` | ||
"export const foo = 1; | ||
const bar = 1; | ||
const barStory = 1; | ||
const baz = 1; | ||
const bazStory1 = 1; | ||
"export const Foo = 1; | ||
const Bar = 1; | ||
const _Bar = 1; | ||
const Baz = 1; | ||
const __Baz = 1; | ||
|
||
export default { | ||
title: 'foo', | ||
excludeStories: ['foo'], | ||
excludeStories: ['Foo'], | ||
}; | ||
|
||
export const fooStory = () => <button />; | ||
export const _Foo = () => <button />; | ||
|
||
fooStory.story = { | ||
_Foo.story = { | ||
name: 'foo', | ||
}; | ||
|
||
export const barStory1 = () => <button />; | ||
export const __Bar = () => <button />; | ||
|
||
barStory1.story = { | ||
__Bar.story = { | ||
name: 'bar', | ||
}; | ||
|
||
export const bazStory = () => <button />; | ||
export const _Baz = () => <button />; | ||
|
||
bazStory.story = { | ||
name: 'bazStory', | ||
_Baz.story = { | ||
name: '_baz', | ||
}; | ||
|
||
export const bazStory2 = () => <button />; | ||
export const ___Baz = () => <button />; | ||
|
||
bazStory2.story = { | ||
___Baz.story = { | ||
name: 'baz', | ||
};" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to use pipeline operator here, but I'm not sure whether it's OK with other contributors:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 stage 1 ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not use language features that typescript doesn't support?