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
20 changes: 6 additions & 14 deletions azure-pipelines.release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,15 @@ 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 test lint --production --verbose --no-cache
displayName: build, test, lint

- script: |
yarn run:published test --production
displayName: yarn test

- script: |
yarn run:published lint
displayName: yarn lint

- script: |
yarn run:published bundle --production
displayName: yarn bundle
- script: | # Note: --no-cache arg is OMITTED to use build cache from previous step
yarn run:published bundle --production --verbose
displayName: bundle

- script: |
echo Making $(Build.ArtifactStagingDirectory)/api &&
Expand Down
19 changes: 3 additions & 16 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

## only do scoped builds with PRs
- script: |
yarn buildci --no-cache --since $(targetBranch)
yarn run:published build test lint --production --verbose --no-cache
displayName: build, test, lint (pr, scoped)
condition: eq(variables['isPR'], true)
env:
Expand Down Expand Up @@ -74,23 +74,10 @@ jobs:
filePath: yarn-ci.sh
displayName: yarn

## only do scoped bundle with PRs
- script: |
yarn bundle --no-cache --since $(targetBranch)
yarn run:published build --production --verbose --no-cache &&
ecraig12345 marked this conversation as resolved.
Show resolved Hide resolved
yarn run:published bundle --production --verbose
displayName: bundle (pr, scoped)
condition: eq(variables['isPR'], true)
env:
BACKFILL_CACHE_PROVIDER: $(backfillProvider)
BACKFILL_CACHE_PROVIDER_OPTIONS: $(backfillOptions)

## duplicated for master CI builds
- script: |
yarn bundle --no-cache
displayName: bundle (master)
condition: eq(variables['isPR'], false)
env:
BACKFILL_CACHE_PROVIDER: $(backfillProvider)
BACKFILL_CACHE_PROVIDER_OPTIONS: $(backfillOptions)

## This runs regardless of scope, the app will adapt to the scope as well
- script: |
Expand Down
18 changes: 9 additions & 9 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,17 @@ 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);
.map(([packageName]) => `--to=${packageName}`);

// all packages needed for release build
const allPackages = ['@fluentui/public-docsite', ...beachballPackages];
const result = spawnSync(process.execPath, [lageBin, 'run', ...argv, ...beachballPackageScopes], {
stdio: 'inherit',
maxBuffer: 500 * 1024 * 1024,
});

runTo(script, allPackages, rest);
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