-
Notifications
You must be signed in to change notification settings - Fork 21
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
Bundle assets - expose meta changes #4811
Closed
Closed
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8b528d1
refactor(ui): BundleAssets - combine data extraction
vio 1d22c21
test(ui): Storybook - add QueryStateProvider to the default decorator
vio 8d5a00b
fix(ui): Remove console.log
vio 41331ca
test(ui): BundleAssets - add utils tests
vio 1e53844
feat(ui): BundleAssets - view asset meta changes
vio 2d8255a
fix(ui): Tag - export prop types
vio 69ba36a
refactor(ui): Extract AssetName
vio 2ce3969
refactor(ui): BundleAssets - pass custom component link
vio e670da8
fix(ui): AssetNotPredictive - adjust layout & text
vio 8121e64
test: Correct fixtures
vio a8dccc3
refactor(ui): App - convert stories to tsx
vio 0521223
test(ui): App - add meta change case
vio 3f61c9d
refactor(ui): Extract AssetMetaTag
vio c9d149e
DROP: v4.17.0-beta.0
vio 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
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 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,127 @@ | ||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { createJobs } from '@bundle-stats/utils'; | ||
import merge from 'lodash/merge'; | ||
|
||
/* eslint-disable import/no-unresolved, import/no-relative-packages */ | ||
import currentData from '../../../../fixtures/job.current'; | ||
import baselineData from '../../../../fixtures/job.baseline'; | ||
/* eslint-enable import/no-unresolved, import/no-relative-packages */ | ||
import { App } from '.'; | ||
|
||
const CURRENT_SOURCE = { | ||
webpack: { | ||
...currentData.rawData.webpack, | ||
builtAt: currentData.createdAt, | ||
hash: currentData.commit, | ||
}, | ||
}; | ||
|
||
const BASELINE_SOURCE = { | ||
webpack: { | ||
...baselineData.rawData.webpack, | ||
builtAt: baselineData.createdAt, | ||
hash: baselineData.commit, | ||
}, | ||
}; | ||
|
||
const JOBS = createJobs([CURRENT_SOURCE, BASELINE_SOURCE]); | ||
|
||
const MULTIPLE_JOBS = createJobs([ | ||
CURRENT_SOURCE, | ||
BASELINE_SOURCE, | ||
{ | ||
webpack: { | ||
...baselineData.rawData.webpack, | ||
builtAt: baselineData.createdAt, | ||
hash: 'aaaa1111', | ||
assets: baselineData.rawData.webpack.assets.filter((asset) => asset.name.match(/.(css|js)$/)), | ||
modules: baselineData.rawData.webpack.modules.slice(0, 100), | ||
}, | ||
}, | ||
]); | ||
|
||
const [CURRENT_JOB, BASELINE_JOB] = JOBS; | ||
|
||
const meta: Meta<typeof App> = { | ||
title: 'App', | ||
component: App, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
args: { | ||
version: '1.0', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = { | ||
render: (args) => <App jobs={JOBS} {...args} />, | ||
}; | ||
|
||
export const NoInsights: Story = { | ||
render: (args) => ( | ||
<App | ||
jobs={[ | ||
{ | ||
...CURRENT_JOB, | ||
insights: undefined, | ||
}, | ||
BASELINE_JOB, | ||
]} | ||
{...args} | ||
/> | ||
), | ||
}; | ||
|
||
export const AssetMetaChanges: Story = { | ||
render: (args) => { | ||
const current = merge({}, CURRENT_SOURCE); | ||
const baseline = merge({}, CURRENT_SOURCE); | ||
|
||
current.webpack.assets.push({ | ||
name: 'assets/js/vendors-auth.1a278dc.js', | ||
size: 26364, | ||
}); | ||
current.webpack.chunks.push({ | ||
id: 100, | ||
entry: false, | ||
initial: false, | ||
files: ['assets/js/vendors-auth.1a278dc.js'], | ||
names: ['vendors-auth'], | ||
}); | ||
|
||
baseline.webpack.assets.push({ | ||
name: 'assets/js/vendors-auth.1a278dc.js', | ||
size: 26364, | ||
}); | ||
baseline.webpack.chunks.push({ | ||
id: 100, | ||
entry: false, | ||
initial: true, | ||
files: ['assets/js/vendors-auth.1a278dc.js'], | ||
names: ['vendors-auth'], | ||
}); | ||
|
||
return <App jobs={createJobs([current, baseline])} {...args} />; | ||
}, | ||
}; | ||
|
||
export const NoBaseline: Story = { | ||
render: (args) => <App jobs={createJobs[CURRENT_SOURCE]} {...args} />, | ||
}; | ||
|
||
export const EmptyBaseline: Story = { | ||
render: (args) => <App jobs={createJobs([CURRENT_SOURCE, { webpack: null }])} {...args} />, | ||
}; | ||
|
||
export const MultipleBaselines: Story = { | ||
render: (args) => <App jobs={MULTIPLE_JOBS} {...args} />, | ||
}; | ||
|
||
export const Empty: Story = { | ||
render: (args) => <App {...args} />, | ||
}; |
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.
Check warning
Code scanning / CodeQL
Implicit operand conversion Warning