If you ever created Gulp tasks which made use of arguments to specify certain configuration settings to be used during the execution. You probably made use of a module called yargs.
The yargs module makes it easy to check if arguments are provided and to retrieve their values.
If you are building your own custom Gulp tasks for your SharePoint Framework projects, you do not require this module. The Gulp build engine which is created for SharePoint Framework automatically processes all the provided arguments and provide them with the config object in your task.
By default, if you create a new Gulp task for SPFx, you start with the following code:
|
|
The config object has a property args that contains all your provided arguments. So if you called the following command for example: gulp upload-to-sharepoint --username elio
. You could retrieve the username argument like this in the Gulp task:
|
|
Hope this helps you extending your SharePoint Projects.