Skip to content

Commit 2c3585b

Browse files
committed
fix(build): pass report args to render build, fixes #588
1 parent ad05f0f commit 2c3585b

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

__tests__/commands.spec.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ describe('electron:build', () => {
242242
['--legacy'],
243243
['--dashboard'],
244244
['--skipBundle'],
245-
['--dest', 'output']
245+
['--dest', 'output'],
246+
['--report'],
247+
['--report-json']
246248
])('%s argument is removed from electron-builder args', async (...args) => {
247249
await runCommand('electron:build', {}, {}, ['--keep1', ...args, '--keep2'])
248250
// Custom args should have been removed, and other args kept
@@ -279,6 +281,16 @@ describe('electron:build', () => {
279281
expect(serviceRun.mock.calls[0][1].modern).toBe(false)
280282
})
281283

284+
test.each(['report', 'report-json'])(
285+
'--%s arg is passed to renderer build',
286+
async argName => {
287+
const args = {}
288+
args[argName] = true
289+
await runCommand('electron:build', {}, args)
290+
expect(serviceRun.mock.calls[0][1][argName]).toBe(true)
291+
}
292+
)
293+
282294
test('App is not bundled if --skipBundle arg is passed', async () => {
283295
await runCommand('electron:build', {}, { skipBundle: true })
284296
expect(serviceRun).not.toBeCalled()

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ module.exports = (api, options) => {
7272
removeArg('--legacy', 1, rawArgs)
7373
removeArg('--dashboard', 1, rawArgs)
7474
removeArg('--skipBundle', 1, rawArgs)
75+
removeArg('--report', 1, rawArgs)
76+
removeArg('--report-json', 1, rawArgs)
7577
// Parse the raw arguments using electron-builder yargs config
7678
const builderArgs = yargs
7779
.command(['build', '*'], 'Build', configureBuildCommand)
@@ -103,7 +105,10 @@ module.exports = (api, options) => {
103105
// Make sure files are outputted to proper directory
104106
dest: bundleOutputDir,
105107
// Enable modern mode unless --legacy is passed
106-
modern: !args.legacy
108+
modern: !args.legacy,
109+
// --report and --report-json args
110+
report: args.report,
111+
'report-json': args['report-json']
107112
}
108113
// With @vue/cli-service v3.4.1+, we can bypass legacy build
109114
process.env.VUE_CLI_MODERN_BUILD = !args.legacy

0 commit comments

Comments
 (0)