The build script now uses `yargs` rather than `minimist`. The CLI is
now better documented, and we have additional validation for each
option.
A patch for `yargs` was required because it would blow up on the line
`Error.captureStackTrace`. For some reason when running under LavaMoat,
that property did not exist.
Closes#12766
'Whether to use LavaMoat. Setting this to `false` can be useful during development if you want to handle LavaMoat errors later.',
type:'boolean',
})
.option('build-type',{
default:BuildType.main,
description:'The type of build to create.',
choices:Object.keys(BuildType),
})
.option('build-version',{
default:0,
description:
'The build version. This is set only for non-main build types. The build version is used in the "prerelease" segment of the extension version, e.g. `[major].[minor].[patch]-[build-type].[build-version]`',
type:'number',
})
.option('lint-fence-files',{
description:
'Whether files with code fences should be linted after fences have been removed. The build will fail if linting fails. This defaults to `false` if the entry task is `dev` or `testDev`. Otherwise this defaults to `true`.',
type:'boolean',
})
.option('lockdown',{
default:true,
description:
'Whether to include SES lockdown files in the extension bundle. Setting this to `false` can be useful during development if you want to handle lockdown errors later.',
type:'boolean',
})
.option('policy-only',{
default:false,
description:
'Stop the build after generating the LavaMoat policy, skipping any writes to disk other than the LavaMoat policy itself.',
type:'boolean',
})
.option('skip-stats',{
default:false,
description:
'Whether to skip logging the time to completion for each task to the console. This is meant primarily for internal use, to prevent duplicate logging.',
hidden:true,
type:'boolean',
})
.check((args)=>{
if(!Number.isInteger(args.buildVersion)){
thrownewError(
`Expected integer for 'build-version', got '${args.buildVersion}'`,