This repository has been archived by the owner on Jul 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
values
Marcel Kloubert edited this page Jun 7, 2017
·
43 revisions
Defines one or more values that can be accessed via placeholders.
{
"deploy": {
"values": [
{
"name": "outputDir",
"type": "code",
"code": "require('os').homedir() + '/' + 'myOutputDir'"
}
],
"targets": [
{
"name": "My local target",
"type": "local",
"dir": "${outputDir}"
}
]
}
}
Name | Description |
---|---|
description |
An optional description for the value. |
isFor |
A list of one or more (host)names that value is for. |
name |
The name of the value. |
platforms |
One or more platform names the value is for. s. process.platform |
type |
The type. Default: static
|
The extension provides the following pre-defined values:
Name | Description |
---|---|
cwd |
The current directory of the process. |
EOL |
The string that represents an End-Of-Line. |
homeDir |
The home directory of the current user. |
hostName |
The hostname of the running machine. |
tempDir |
The path to the directory for the temporary files. |
userName |
The name of the current logged in user. |
workspaceRoot |
The root directory of the workspace. |
code [↑]
A value generated by (JavaScript) code.
{
"deploy": {
"values": [
{
"name": "outputDir",
"type": "code",
"code": "require('os').homedir() + '/' + 'myOutputDir'"
}
],
"targets": [
{
"name": "My local target",
"type": "local",
"dir": "${outputDir}"
}
]
}
}
Name | Description |
---|---|
code |
The (JavaScript) code to execute. |
Inside the code, you can access the following variables:
Name | Description |
---|---|
$cwd |
The current directory of the process. |
$globalState |
The object that shares data between code / script based values. |
$homeDir |
The home directory of the current user. |
$me |
The value object. |
$others |
The object that can access the other values via properties with the same name(s). |
$require |
An extended require function that can also access the modules inside that extension. |
$workspaceRoot |
The root directory of the workspace. |
env [↑]
A value that accesses an environment variable.
{
"deploy": {
"values": [
{
"name": "USERPROFILE",
"alias": "myHomeDir",
"type": "env"
}
],
"targets": [
{
"name": "My local target",
"type": "local",
"dir": "${myHomeDir}/myOutputDir"
}
]
}
}
Name | Description |
---|---|
alias |
An optional, custom alias for the value name. If not define: name is used. |
name |
The name of the environment variable. |
file [↑]
A value from a file.
{
"deploy": {
"values": [
{
"name": "outputDir",
"type": "file",
"file": "${homeDir}/outdir.txt"
}
],
"targets": [
{
"name": "My local target",
"type": "local",
"dir": "${outputDir}"
}
]
}
}
Name | Description |
---|---|
asBinary |
Returns as binary / buffer or not. Default: (false)
|
encoding |
The text encoding to use. Default: utf8
|
file *
|
The path to the file to load. |
usePlaceholders |
Also use placeholders for the (string) content or not. Default: (false)
|
* supports placeholders
script [↑]
A value from a script.
{
"deploy": {
"values": [
{
"name": "outputDir",
"type": "script",
"script": "./getOutputDir.js"
}
],
"targets": [
{
"name": "My local target",
"type": "local",
"dir": "${outputDir}"
}
]
}
}
A script must contain a public / exported getValue()
function:
exports.getValue = function(args) {
// return the value at the end of the execution
}
args
uses the ScriptValueProviderArguments interface.
Name | Description |
---|---|
options |
Additional data for the script. |
script *
|
The path to the script. |
* supports placeholders
static [↑]
A static value.
{
"deploy": {
"values": [
{
"name": "outputDir",
"description": "Output directory for Microsoft Windows",
"value": "C:/Users/mkloubert/myOutputDir",
"platforms": "win32"
},
{
"name": "outputDir",
"description": "Output directory for MacOS",
"value": "/Applications/MyWebServer/etc/apps/MyApp",
"platforms": [ "darwin" ]
},
{
"name": "outputDir",
"description": "Output directory for Linux",
"value": "/home/mkloubert/myOutputDir",
"platforms": "linux"
}
],
"targets": [
{
"name": "My local target",
"type": "local",
"dir": "${outputDir}"
}
]
}
}
Name | Description |
---|---|
value |
The value. |