lightning Commands
force:lightning:app:create
Help for force:lightning:app:create
If not supplied, the apiversion, template, and outputdir use default values.
The outputdir can be an absolute path or relative to the current working directory.
If you don’t specify an outputdir, we create a subfolder in your current working directory with the name of your bundle. For example, if the current working directory is force-app and your Lightning bundle is called myBundle, we create force-app/myBundle/ to store the files in the bundle.
Examples:
1$ sfdx force:lightning:app:create -n myapp1$ sfdx force:lightning:app:create -n myapp -d auraCommand Syntax
- sfdx force:lightning:app:create
- [--json]
- [--loglevel LOGLEVEL]
- -n APPNAME
- [-t TEMPLATE]
- [-d OUTPUTDIR]
- [--apiversion APIVERSION]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -n | --appname APPNAME
- Required
-
The Lightning app name. The name can be up to 40 characters and must start with a letter.
- Type: string
- -t | --template TEMPLATE
- Optional
-
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
- Type: string
- Permissible values are: DefaultLightningApp
- Default value: DefaultLightningApp
- -d | --outputdir OUTPUTDIR
- Optional
-
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The default is the current directory.
- Type: string
- Default value: .
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
force:lightning:component:create
Help for force:lightning:component:create
If not supplied, the apiversion, template, and outputdir use default values.
The outputdir can be an absolute path or relative to the current working directory.
If you don’t specify an outputdir, we create a subfolder in your current working directory with the name of your bundle. For example, if the current working directory is force-app and your Lightning bundle is called myBundle, we create force-app/myBundle/ to store the files in the bundle.
To create a Lightning web component, pass --type lwc to the command. If you don’t include a --type value, Salesforce CLI creates an Aura component by default.
Examples:
1$ sfdx force:lightning:component:create -n mycomponent1$ sfdx force:lightning:component:create -n mycomponent --type lwc1$ sfdx force:lightning:component:create -n mycomponent -d aura1$ sfdx force:lightning:component:create -n mycomponent --type lwc -d lwcCommand Syntax
- sfdx force:lightning:component:create
- [--json]
- [--loglevel LOGLEVEL]
- -n COMPONENTNAME
- [-t TEMPLATE]
- [-d OUTPUTDIR]
- [--apiversion APIVERSION]
- [--type TYPE]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -n | --componentname COMPONENTNAME
- Required
-
The Lightning component name. The name can be up to 40 characters and must start with a letter.
- Type: string
- -t | --template TEMPLATE
- Optional
-
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
- Type: string
- Permissible values are: default, analyticsDashboard, analyticsDashboardWithStep
- Default value: default
- -d | --outputdir OUTPUTDIR
- Optional
-
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The default is the current directory.
- Type: string
- Default value: .
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
- --type TYPE
- Optional
-
The type of the new Lightning component.
- Type: string
- Permissible values are: aura, lwc
- Default value: aura
force:lightning:event:create
Help for force:lightning:event:create
If not supplied, the apiversion, template, and outputdir use default values.
The outputdir can be an absolute path or relative to the current working directory.
If you don’t specify an outputdir, we create a subfolder in your current working directory with the name of your bundle. For example, if the current working directory is force-app and your Lightning bundle is called myBundle, we create force-app/myBundle/ to store the files in the bundle.
Examples:
1$ sfdx force:lightning:event:create -n myevent1$ sfdx force:lightning:event:create -n myevent -d auraCommand Syntax
- sfdx force:lightning:event:create
- [--json]
- [--loglevel LOGLEVEL]
- -n EVENTNAME
- [-t TEMPLATE]
- [-d OUTPUTDIR]
- [--apiversion APIVERSION]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -n | --eventname EVENTNAME
- Required
-
The Lightning event name. The name can be up to 40 characters and must start with a letter.
- Type: string
- -t | --template TEMPLATE
- Optional
-
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
- Type: string
- Permissible values are: DefaultLightningEvt
- Default value: DefaultLightningEvt
- -d | --outputdir OUTPUTDIR
- Optional
-
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The default is the current directory.
- Type: string
- Default value: .
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
force:lightning:interface:create
Help for force:lightning:interface:create
If not supplied, the apiversion, template, and outputdir use default values.
The outputdir can be an absolute path or relative to the current working directory.
If you don’t specify an outputdir, we create a subfolder in your current working directory with the name of your bundle. For example, if the current working directory is force-app and your Lightning bundle is called myBundle, we create force-app/myBundle/ to store the files in the bundle.
Examples:
1$ sfdx force:lightning:interface:create -n myinterface1$ sfdx force:lightning:interface:create -n myinterface -d auraCommand Syntax
- sfdx force:lightning:interface:create
- [--json]
- [--loglevel LOGLEVEL]
- -n INTERFACENAME
- [-t TEMPLATE]
- [-d OUTPUTDIR]
- [--apiversion APIVERSION]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -n | --interfacename INTERFACENAME
- Required
-
The Lightning interface name. The name can be up to 40 characters and must start with a letter.
- Type: string
- -t | --template TEMPLATE
- Optional
-
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
- Type: string
- Permissible values are: DefaultLightningIntf
- Default value: DefaultLightningIntf
- -d | --outputdir OUTPUTDIR
- Optional
-
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The default is the current directory.
- Type: string
- Default value: .
- --apiversion APIVERSION
- Optional
-
Override the API version used for API requests made by this command.
- Type: string
force:lightning:lint (Deprecated)
Examples for force:lightning:lint
<%= config.bin %> <%= command.id %> ./path/to/be/linted/
Command Syntax
- sfdx force:lightning:lint
- [--json]
- [--loglevel LOGLEVEL]
- [-i IGNORE]
- [--files FILES]
- [--config CONFIG]
- [--verbose]
- [--exit]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -i | --ignore IGNORE
- Optional
-
A “glob” pattern used to filter folders (and their contents) out of the analysis. For example: --ignore **/foo/**.
- Type: string
- --files FILES
- Optional
-
A “glob” pattern used to add specific files to the analysis. For example, to only analyse your controller files, use --files **/*Controller.js. When specified, this value overrides the --ignore flag. The default is all .js files.
- Type: string
- --config CONFIG
- Optional
-
Path to a custom ESLint configuration file. Only code style rules are used, while the rest are ignored. For example: --config path/to/.eslintrc.
- Type: string
- --verbose
- Optional
-
Report both warnings and errors. The default is to report only errors.
- Type: boolean
- --exit
- Optional
-
Exit with error code 1 if there are lint issues. The default exits without an error code.
- Type: boolean
force:lightning:lwc:test:create
Examples for force:lightning:lwc:test:create
1$ sfdx force:lightning:lwc:test:create -f force-app/main/default/lwc/myButton/myButton.jsCommand Syntax
- sfdx force:lightning:lwc:test:create
- [--json]
- [--loglevel LOGLEVEL]
- -f FILEPATH
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -f | --filepath FILEPATH
- Required
-
Path to Lightning web component .js file to create a test for.
- Type: string
force:lightning:lwc:test:run
Examples for force:lightning:lwc:test:run
1$ sfdx force:lightning:lwc:test:run1$ sfdx force:lightning:lwc:test:run -wCommand Syntax
- sfdx force:lightning:lwc:test:run
- [--json]
- [--loglevel LOGLEVEL]
- [-d]
- [--watch]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -d | --debug
- Optional
-
Runs tests in a Node process that an external debugger can connect to. The run pauses until the debugger is connected. For more information, see: https://jestjs.io/docs/en/troubleshooting
- Type: boolean
- --watch
- Optional
-
Runs tests when a watched file changes. Watched files include the component under test and any files it references.
- Type: boolean
force:lightning:lwc:test:setup
Examples for force:lightning:lwc:test:setup
1$ sfdx force:lightning:lwc:test:setupCommand Syntax
- sfdx force:lightning:lwc:test:setup
- [--json]
- [--loglevel LOGLEVEL]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
force:lightning:test:create
Help for force:lightning:test:create
If not supplied, the apiversion, template, and outputdir use default values.
The outputdir can be an absolute path or relative to the current working directory.
Examples:
1$ sfdx force:lightning:test:create -n MyLightningTest1$ sfdx force:lightning:test:create -n MyLightningTest -d lightningTestsCommand Syntax
- sfdx force:lightning:test:create
- [--json]
- [--loglevel LOGLEVEL]
- -n TESTNAME
- [-t TEMPLATE]
- [-d OUTPUTDIR]
Parameters
- --json
- Optional
-
Format output as JSON.
- Type: boolean
- --loglevel LOGLEVEL
- Optional
-
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
- Type: enum
- Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
- Default value: warn
- -n | --testname TESTNAME
- Required
-
The name of the new Lightning test. The name can be up to 40 characters and must start with a letter.
- Type: string
- -t | --template TEMPLATE
- Optional
-
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
- Type: string
- Permissible values are: DefaultLightningTest
- Default value: DefaultLightningTest
- -d | --outputdir OUTPUTDIR
- Optional
-
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The default is the current directory.
- Type: string
- Default value: .