Skip to content

Commit

Permalink
fix(build-tools): Make the default bundle directory deterministic in …
Browse files Browse the repository at this point in the history
…docs (#12325)

The `run bundleStats` command was using oclifs default argument feature
for a default directory, but this causes the help and readme for the
command to be based on the path of the user's machine. This fixes the
logic to handle setting a default without using oclif.

[AB#1961](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/1961)
  • Loading branch information
tylerbutler authored Oct 7, 2022
1 parent 5d8ddfd commit 9617d1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 1 addition & 3 deletions build-tools/packages/build-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,7 @@ USAGE
FLAGS
-v, --verbose Verbose logging.
--dirname=<value> [default:
C:\Users\sdeshpande\Documents\FluidFramework\build-tools\packages\build-cli\lib\commands\run]
Directory
--dirname=<value> [default: current directory] Directory containing bundle stats input
DESCRIPTION
Generate a report from input bundle stats collected through the collect bundleStats command.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ export default class RunBundlestats extends BaseCommand<typeof RunBundlestats.fl

static flags = {
dirname: Flags.string({
description: "Directory",
// eslint-disable-next-line unicorn/prefer-module
default: __dirname,
description: "[default: current directory] Directory containing bundle stats input",
required: false,
}),
...BaseCommand.flags,
};

public async run(): Promise<void> {
const flags = this.processedFlags;
execSync(`npx danger ci -d ${flags.dirname}/lib/dangerfile.js`, { stdio: "inherit" });
// eslint-disable-next-line unicorn/prefer-module
const dirname = flags.dirname ?? __dirname;

execSync(`npx danger ci -d ${dirname}/lib/dangerfile.js`, { stdio: "inherit" });
}
}

0 comments on commit 9617d1a

Please sign in to comment.