Skip to content
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

Telemetry: Add portable stories #26764

Merged
merged 8 commits into from
Aug 7, 2024
Merged

Conversation

shilman
Copy link
Member

@shilman shilman commented Apr 7, 2024

Closes N/A

What I did

Count the number of files that use portable stories and add to Storybook metadata

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Run the canary in a test project with STORYBOOK_TELEMETRY_DEBUG=1 and observe portableStoriesFileCount.

  • If there is no git or you can force an error some other way, then it should be null
  • If there are no files with "composeStor" in git then it should be 0
  • Otherwise it should be the number of git included files that contain "composeStor"

NOTE: The results will be cached for 24h. You can clear the cache by removing node_modules/.cache

🦋 Canary release

This pull request has been released as version 0.0.0-pr-26764-sha-e9d28dba. Try it out in a new sandbox by running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-26764-sha-e9d28dba
Triggered by @shilman
Repository storybookjs/storybook
Branch shilman/portable-stories-stats
Commit e9d28dba
Datetime Tue Jul 9 02:58:08 UTC 2024 (1720493888)
Workflow run 9850232585

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=26764

@shilman shilman added maintenance User-facing maintenance tasks ci:normal portable stories labels Apr 7, 2024
Copy link

nx-cloud bot commented Apr 7, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit fee2848. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

Searching the files ourselves seems like a pretty slow way to do it - did you see if there was a file search solution? This package seems like it'd be significantly faster, although it doesn't have many downloads: https://www.npmjs.com/package/fast-find-in-files

Probably having looked around, it's best to do similar to what we have, but perhaps use .read() or createReadStream() to avoid having to read the whole file into memory.

@valentinpalkovic
Copy link
Contributor

@shilman, please consider updating the documentation regarding telemetry.

@shilman shilman changed the title Portable stories: Add telemetry Telemetry: Add portable stories Jul 9, 2024
Copy link
Member

@tmeasday tmeasday left a comment

Choose a reason for hiding this comment

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

LGTM but not sure why there are lockfile changes

describe('getPortableStoriesFileCountUncached', () => {
it('should ignores node_modules, non-source files', async () => {
const usage = await getPortableStoriesFileCountUncached();
// verify git grep -m1 -c composeStor | wc -l
Copy link
Member

Choose a reason for hiding this comment

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

Is this comment indicating something is still TODO?

@shilman shilman merged commit dd05523 into next Aug 7, 2024
52 checks passed
@shilman shilman deleted the shilman/portable-stories-stats branch August 7, 2024 05:26
@github-actions github-actions bot mentioned this pull request Aug 7, 2024
29 tasks
@shilman shilman added the needs qa Indicates that this needs manual QA during the upcoming minor/major release label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants