forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/drawer-motion
* master: (32 commits) applying package updates feat(react-tags): add styles for size (microsoft#28229) docs(react-dialog): update DialogTriggerOutsideDialog to include focus behavior (microsoft#28176) bugfix: Ensures dialog actions stretches on breakpoints (microsoft#28258) applying package updates fix: TableHeaderCell should not render button when not sortable (microsoft#28097) fix(react-file-type-icons): Map mhtml extension to html icon (microsoft#28112) Fix overlapping axis labels on smaller viewports (microsoft#28239) useArrowNavigationGroup grid-linear axis (microsoft#28253) applying package updates fix: Alert example missing aria-label for icon (microsoft#28234) Overflow divider fix (microsoft#28011) feat(tools): implement `cypress-component-configuration` generator (microsoft#28115) chore: migrate to TS 4.7 (microsoft#28067) fix(scripts-tasks): make generate-api work in deterministic way (microsoft#28215) feat(react-tags): add overflow story (microsoft#28012) Structure and slots for SearchBox, using Input as a slot (microsoft#28090) feat(tokens): Add/update theme tokens (microsoft#27791) feat(react-tags): add a11y role and best practices guide (microsoft#28075) fix: Toast intent should always be present in the context (microsoft#28226) ...
- Loading branch information
Showing
507 changed files
with
10,243 additions
and
1,789 deletions.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
import { preset, task, resolveCwd } from '@fluentui/scripts-tasks'; | ||
import * as path from 'path'; | ||
import { preset, task, series } from '@fluentui/scripts-tasks'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore - parallel-webpack has no types | ||
import { run } from 'parallel-webpack'; | ||
|
||
import { bundleSizeCollect } from './scripts/bundle-size-collect'; | ||
import { mergeBundleSizes } from './scripts/merge-bundlesizes'; | ||
|
||
preset(); | ||
|
||
// This pacakge doesn't currently have any files that are included in the eslint task | ||
// (it only runs on src, not config files) | ||
task('code-style', 'prettier'); | ||
|
||
task('bundle-size-collect', () => { | ||
const packageName = process.env.PACKAGE ?? ''; | ||
bundleSizeCollect({ packageName }); | ||
}); | ||
|
||
task('bundle', done => { | ||
run(resolveCwd('webpack.config.js'), {}, done); | ||
const configPath = path.join(__dirname, 'webpack.config.js'); | ||
const options = {}; | ||
run(configPath, options, done); | ||
}); | ||
|
||
task('bundle-size-merge', () => { | ||
const root = path.join(__dirname, 'dist'); | ||
mergeBundleSizes( | ||
[path.join(root, 'react/bundlesize.json'), path.join(root, 'react-northstar/bundlesize.json')], | ||
path.join(root, 'bundlesizes.json'), | ||
); | ||
}); | ||
|
||
task('bundle-size', series('bundle', 'bundle-size-collect')); |
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,40 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
/** | ||
* | ||
* collates bundle size information from minified files in apps/test-bundles/dist/<packageName> and writes to apps/test-bundles/dist/<packageName>/bundlesizes.json. | ||
* | ||
* It is uploaded as an artifact by the build definition in Azure Dev Ops and used to compare baseline and PR file size information which gets reported by Size Auditor | ||
*/ | ||
export function bundleSizeCollect(config: { packageName: string; filename?: string }) { | ||
const { packageName, filename: outputFilename = 'bundlesize.json' } = config; | ||
|
||
if (!packageName) { | ||
throw new Error('🚨 No packageName provided! Set it via env variable name "PACKAGE"'); | ||
} | ||
|
||
const distRoot = path.join(__dirname, '../dist', packageName.replace('@fluentui/', '')); | ||
|
||
const sizes: Record<string, number> = {}; | ||
|
||
const items = fs.readdirSync(distRoot); | ||
items.forEach(item => { | ||
const file = path.join(distRoot, item); | ||
|
||
const isMinifiedJavascriptFile = item.match(/.min.js$/); | ||
if (isMinifiedJavascriptFile) { | ||
sizes[getComponentName(item)] = getFilesizeInBytes(file); | ||
} | ||
}); | ||
|
||
fs.writeFileSync(path.join(distRoot, outputFilename), JSON.stringify({ sizes })); | ||
|
||
function getFilesizeInBytes(fileName: string) { | ||
return fs.statSync(fileName).size; | ||
} | ||
|
||
function getComponentName(fileName: string) { | ||
return path.basename(fileName, '.min.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as fs from 'fs'; | ||
|
||
export function mergeBundleSizes(configPaths: string[], mergeConfigPath: string) { | ||
const result: { sizes: { [entryName: string]: number } } = { | ||
sizes: {}, | ||
}; | ||
|
||
configPaths.forEach(configPath => { | ||
const json = JSON.parse(fs.readFileSync(configPath, 'utf-8')); | ||
Object.assign(result.sizes, json.sizes); | ||
}); | ||
|
||
fs.writeFileSync(mergeConfigPath, JSON.stringify(result)); | ||
} |
Oops, something went wrong.