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

Added Support --perf-output in CLI #125

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ yargs(hideBin(process.argv))
describe: 'Override the output directory for unminify (default: out/unminify/)',
type: 'string',
})
.option('perf-output', {
describe: 'Specify the output directory (default: /)',
type: 'string',
})
.option('force', {
alias: 'f',
describe: 'Force overwrite output directory',
Expand Down Expand Up @@ -438,6 +442,7 @@ async function nonInteractive(features: Feature[], {
output: _output,
'unpacker-output': _unpackerOutput,
'unminify-output': _unminifyOutput,
'perf-output': _perfOutput,
force = false,
concurrency = 1,
perf,
Expand All @@ -446,6 +451,7 @@ async function nonInteractive(features: Feature[], {
output: string | undefined
'unpacker-output': string | undefined
'unminify-output': string | undefined
'perf-output': string | undefined
force: boolean | undefined
concurrency: number | undefined
perf: boolean | undefined
Expand Down Expand Up @@ -480,14 +486,15 @@ async function nonInteractive(features: Feature[], {
const unpackerOutput = _unpackerOutput ?? (singleFeature ? outputBase : path.join(outputBase, defaultUnpackerOutputFolder))
const unminifyOutput = _unminifyOutput ?? (singleFeature ? outputBase : path.join(outputBase, defaultUnminifyOutputFolder))

const perfOutputBase = singleFeature
const perfOutputBase = _perfOutput || (singleFeature
? features.includes(Feature.Unpacker) ? unpackerOutput : unminifyOutput
: findCommonBaseDir([unpackerOutput, unminifyOutput]) ?? outputBase
: findCommonBaseDir([unpackerOutput, unminifyOutput]) ?? outputBase)
const perfOutputPath = path.join(perfOutputBase, 'perf.json')

const outputPathsToCheck = []
if (features.includes(Feature.Unpacker)) outputPathsToCheck.push(unpackerOutput)
if (features.includes(Feature.Unminify)) outputPathsToCheck.push(unminifyOutput)
outputPathsToCheck.push(perfOutputPath)

const outputValidationError = getValidateFromPaths(outputPathsToCheck, outputFolderValidation)
if (outputValidationError) {
Expand Down