-
-
Notifications
You must be signed in to change notification settings - Fork 39
Home >> if
Many settings like shell commands, packages or targets support an if
property, which contains JavaScript code which indicates if a setting is currently available/usable or not.
{
"deploy.reloaded": {
"executeOnStartup": [
{
"command": "npm install",
"if": " !require('fs').existsSync( $v['workspaceroot'] + '/node_modules' ) "
}
]
}
}
The upper shell command is only executed, if NO node_modules
folder is found in the root directory of the underlying workspace.
A special object of the underlying setting / object.
An object that stores all placeholders, which are available in that context as object.
The values can be accessed by their names in lower case format.
{
"deploy.reloaded": {
"executeOnStartup": [
{
"command": "npm install",
"if": " require('fs').existsSync( $v['workspaceroot'] + '/package.json' ) "
}
]
}
}
Short version of JavaScript's eval.
{
"deploy.reloaded": {
"executeOnStartup": [
{
"command": "npm install",
"if": " $e( \" $r('fs').existsSync( $v['workspaceroot'] + '/composer.json' \" ) "
}
]
}
}
Short version of NodeJS's require, which includes a module the same way, as you are working as extension code. This makes extension modules and modules from package.json also available for you.
{
"deploy.reloaded": {
"executeOnStartup": [
{
"command": "npm install",
"if": " $r('fs').existsSync( $v['workspaceroot'] + '/composer.json' ) "
}
]
}
}
The helper module of that extension.
{
"deploy.reloaded": {
"executeOnStartup": [
{
"command": "npm install",
"if": " 'my_project' === $h.normalizeString( $v['workspace'] ) "
}
]
}
}