Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added storybook to venia concept for scaffolding #2355

Merged

Conversation

niklaswolf
Copy link
Contributor

Description

Added storybook capabilities back to venia-concept as this is the template for the scaffolding command. Like this users of a new scaffolded app are able to see all stories from venia-ui and defined custom ones in their own src.
Storybook than can be run using yarn storybook/ npm run storybook

Related Issue

Closes #2352.

Acceptance

Verification Steps

I don't have any clue how to test an app scaffold locally, definetly need some help here.
I tested this by creating a new app using the scaffolding tool and applying the changes there. This worked and if I saw this correctly, the scaffolding copys every directory/file besides those ignored explicitly in the create.js.

@fooman
Copy link
Contributor

fooman commented Apr 23, 2020

DEBUG_PROJECT_CREATION=1 packages/create-pwa/bin/create-pwa this is what I believe the core team uses to do a test run for the scaffolding process.

@niklaswolf
Copy link
Contributor Author

Thanks @fooman I'll try that :)

@niklaswolf
Copy link
Contributor Author

niklaswolf commented Apr 23, 2020

Using the command @fooman suggested I can verify the changes also in a scaffolded app. :)
@larsroettig I also made changes according to your requests

@niklaswolf niklaswolf requested a review from larsroettig April 23, 2020 15:40
larsroettig
larsroettig previously approved these changes Apr 23, 2020
@luke-denton-aligent
Copy link
Contributor

Great work Niklas!

@dpatil-magento dpatil-magento added the CI_APPROVED This PR should be included in the CI process. label Apr 24, 2020
@PWAStudioBot
Copy link
Contributor

PWAStudioBot commented Apr 24, 2020

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).

Generated by 🚫 dangerJS against 7905bcb

larsroettig
larsroettig previously approved these changes May 8, 2020
@sirugh sirugh requested a review from zetlen May 11, 2020 19:01
@jimbo jimbo added the version: Minor This changeset includes functionality added in a backwards compatible manner. label May 13, 2020
@jimbo
Copy link
Contributor

jimbo commented May 13, 2020

It's taken us too long to get to this PR, but the value here makes sense to me and I think the approach is straightforward. We'll do a QA pass and make sure it works for us as well, but from my perspective I don't see any reason to hold this up.

Thanks for your contribution and your patience.

jimbo
jimbo previously approved these changes May 13, 2020
Copy link
Contributor

@jimbo jimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zetlen Sanity check, if you would, please. 👍

@devops-pwa-codebuild
Copy link
Collaborator

devops-pwa-codebuild commented May 19, 2020

Performance Test Results

The following fails have been reported by WebpageTest. These numbers indicates a possible performance issue with the PR which requires further manual testing to validate.

https://pr-2355.pwa-venia.com : LH Performance Expected 0.85 Actual 0.52, LH Best Practices Expected 1 Actual 0.92
https://pr-2355.pwa-venia.com/venia-tops.html : LH Performance Expected 0.75 Actual 0.34, LH Best Practices Expected 1 Actual 0.92
https://pr-2355.pwa-venia.com/valeria-two-layer-tank.html : LH Performance Expected 0.8 Actual 0.49, LH Accessibility Expected 0.9 Actual 0.89, LH Best Practices Expected 1 Actual 0.92

@dpatil-magento
Copy link
Contributor

Would it be nice to provide info to user in console that yarn storybook (when client is yarn) npm run storybook (when client is npm) also available?

  ⚠  Created new PWA project testdir6. Next steps:

     - cd testdir6 before running the below commands.

     - npm run buildpack -- create-custom-origin . to generate a unique, secure custom domain for your new project. Highly recommended.

     - npm run watch to start the dev server and do real-time development.

     - npm run build to build the project into optimized assets in the '/dist' directory

     - npm start after build to preview the app on a local staging server.

@zetlen
Copy link
Contributor

zetlen commented May 20, 2020

@dpatil-magento Nice catch! @niklaswolf Would you like to add that to this pull request? Those log messages come from https://github.com/magento/pwa-studio/blob/develop/packages/pwa-buildpack/lib/cli/create-project.js near the end of the file.

James Zetlen and others added 2 commits May 20, 2020 10:16
- Move script commands out of venia-concept
- Add post-install CLI message about storybook
Comment on lines +32 to +33
storybook: 'start-storybook -p 9001 -c src/.storybook',
'storybook:build': 'build-storybook -c src/.storybook -o storybook-dist'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zetlen - I opted to move these scripts here from package.json in venia-concept, since they weren't executable if attempting to run inside the mono (this assumes venia-ui is in node_modules). This set off some snapshot failures and I didn't feel confident in which method is best. Couple clarifying questions:

  1. Was it okay to have failing scripts in venia-concept?
  2. Am I using scriptsToInsert as intended?

@supernova-at
Copy link
Contributor

I ran the following verification steps:

  1. DEBUG_PROJECT_CREATION=1 packages/create-pwa/bin/create-pwa
  2. cd into your newly created scaffolded project folder
  3. Run yarn storybook
  4. Verify that the stories defined in Venia UI appear in the Storybook
  5. Add a components/MyComponent/myComponent.js file in src of the scaffolded project and have it return some content
  6. Add a __stories__/myComponent.js that adds a story for the component
  7. Verify that this new story appears in the Storybook alongside the Venia UI stories

@dpatil-magento
Copy link
Contributor

Verified from sibling dir as well, looks good. ( Steps mentioned here - #2363 )

@dpatil-magento dpatil-magento merged commit 73758d6 into magento:develop May 26, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
CI_APPROVED This PR should be included in the CI process. pkg:pwa-buildpack pkg:venia-concept pkg:venia-ui version: Minor This changeset includes functionality added in a backwards compatible manner.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use storybook in scaffolded app