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

Fix publishing of webpack bundles and docs #17246

Merged
merged 12 commits into from
Mar 2, 2021
7 changes: 4 additions & 3 deletions azure-pipelines.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ steps:

- script: |
yarn generate-version-files
displayName: yarn generate-version-files
displayName: Generate version files

- script: |
yarn run:published build --production
displayName: yarn build (Create production build)
yarn run:published build --production --no-cache
displayName: yarn build

# test, lint, bundle using lage cached build from previous step (omit --no-cache)
- script: |
yarn run:published test --production
displayName: yarn test
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/azure-themes",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/example-data",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/foundation-legacy",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/merge-styles",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/public-docsite",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/public-docsite-resources",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-charting",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-date-time",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-experiments",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-focus",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-hooks",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-icon-provider",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-icons-mdl2",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/react-monaco-editor",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/scheme-utilities",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix webpack bundle",
"packageName": "@fluentui/theme-samples",
"email": "[email protected]",
"dependentChangeType": "patch"
}
31 changes: 20 additions & 11 deletions scripts/monorepo/runPublished.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check
const { spawnSync } = require('child_process');
const getAllPackageInfo = require('./getAllPackageInfo');
const runTo = require('./runTo');
const lageBin = require.resolve('lage/bin/lage.js');

const argv = process.argv.slice(2);

Expand All @@ -15,18 +16,26 @@ This command runs <script> for all beachball-published packages (and their depen
process.exit(0);
}

const script = argv[0];
const rest = argv.slice(1);

// Only include the packages that are published daily by beachball.
// This logic does the same thing as "--scope \"!packages/fluentui/*\"" in the root package.json's
// publishing-related scripts (and excludes private packages, which beachball does internally).
// It will need to be updated if the --scope changes.
const beachballPackages = Object.entries(getAllPackageInfo())
const beachballPackageScopes = Object.entries(getAllPackageInfo())
.filter(([, { packageJson, packagePath }]) => !/[\\/]fluentui[\\/]/.test(packagePath) && packageJson.private !== true)
.map(([packageName]) => packageName);

// all packages needed for release build
const allPackages = ['@fluentui/public-docsite', ...beachballPackages];

runTo(script, allPackages, rest);
.map(([packageName]) => `--to=${packageName}`);

const lageArgs = [
'run',
...argv,
// default to verbose mode unless already/otherwise specified
...(argv.some(arg => /^--(no-)?verbose/.test(arg)) ? [] : ['--verbose']),
...beachballPackageScopes,
];
console.log(`lage ${lageArgs.join(' ')}`); // for debugging

const result = spawnSync(process.execPath, [lageBin, ...lageArgs], {
stdio: 'inherit',
maxBuffer: 500 * 1024 * 1024,
});

process.exit(result.status);
6 changes: 5 additions & 1 deletion scripts/monorepo/runTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function runTo(script, projects, rest) {

// --include-filtered-Dependencies makes the build include dependencies
// --stream allows the build to proceed in parallel but still in order
spawnSync(
const result = spawnSync(
process.execPath,
[
lernaBin,
Expand All @@ -85,6 +85,10 @@ function runTo(script, projects, rest) {
stdio: 'inherit',
},
);

if (result.status !== 0) {
process.exit(result.status);
}
}

module.exports = runTo;
3 changes: 2 additions & 1 deletion scripts/tasks/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ type JustArguments<T extends Record<string, unknown>> = Arguments & T;
export function webpack() {
const args: JustArguments<Partial<{ production: boolean }>> = argv();
return webpackCliTask({
webpackCliArgs: args.production ? ['--production'] : [],
webpackCliArgs: args.production ? ['--mode=production'] : [],
ecraig12345 marked this conversation as resolved.
Show resolved Hide resolved
nodeArgs: ['--max-old-space-size=4096'],
env: process.env,
});
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/webpack/webpack-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ module.exports = {
output,
bundleName = path.basename(process.cwd()),
entry = './lib/index.js',
isProduction = process.argv.indexOf('--production') > -1,
isProduction = process.argv.includes('--mode=production'),
onlyProduction = false,
customConfig = {},
} = options;
Expand Down