-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: Improve Storybook packages version management #11342
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6ab9520
chore(cli): refactor script to extract and save versions of all SB pa…
gaetanmaisse c0e00c6
feat(cli): use `versions.json` to get SB packages versions
gaetanmaisse ffb44dc
refactor(cli): remove all Storybook packages listed as devDeps
gaetanmaisse 4664512
fix(docs): use `require.resolve` to ensure Yarn PnP compatibility
gaetanmaisse 4364ee6
fix(cli): add some dependencies to be able to run addon-docs with Yar…
gaetanmaisse 0dabfc5
test(e2e): add a simple test for viewport addon
gaetanmaisse 3e13343
fix(cli): replace `storybook` by `Storybook` for consistency across a…
gaetanmaisse 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
describe('addon-viewport', () => { | ||
before(() => { | ||
cy.visitStorybook(); | ||
}); | ||
|
||
it('should have viewport button in the toolbar', () => { | ||
cy.navigateToStory('button', 'Text'); | ||
|
||
// Click on viewport button and select small mobile | ||
cy.get('[title="Change the size of the preview"]').click(); | ||
cy.get('#mobile1').click(); | ||
|
||
// Check that Welcome story is still displayed | ||
cy.getStoryElement().should('contain.text', 'Button'); | ||
}); | ||
}); |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { writeJson, readJson } from 'fs-extra'; | ||
import path from 'path'; | ||
import globby from 'globby'; | ||
|
||
const rootDirectory = path.join(__dirname, '..', '..', '..'); | ||
|
||
const logger = console; | ||
|
||
const run = async () => { | ||
const storybookPackagesPaths = await globby( | ||
`${rootDirectory}/@(app|addons|lib)/**/package.json`, | ||
{ | ||
ignore: '**/node_modules/**/*', | ||
} | ||
); | ||
|
||
const packageToVersionMap = ( | ||
await Promise.all( | ||
storybookPackagesPaths.map(async (storybookPackagePath) => { | ||
const { name, version } = await readJson(storybookPackagePath); | ||
|
||
return { | ||
name, | ||
version, | ||
}; | ||
}) | ||
) | ||
) | ||
// Remove non-`@storybook/XXX` package (like: `cli-sb`, `cli-storybook`) | ||
.filter(({ name }) => /@storybook/.test(name)) | ||
// As some previous steps are asynchronous order is not always the same so sort them to avoid that | ||
.sort((package1, package2) => package1.name.localeCompare(package2.name)) | ||
.reduce((acc, { name, version }) => ({ ...acc, [name]: version }), {}); | ||
|
||
await writeJson(path.join(__dirname, '..', 'versions.json'), packageToVersionMap, { spaces: 2 }); | ||
}; | ||
|
||
run().catch((e) => { | ||
logger.error(e); | ||
process.exit(1); | ||
}); |
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.
@shilman can you confirm that with these 2 lines,
versions.json
will be recreated during the release process (after the version bump) and then committed to the repo?