Configuration file
The configuration is a optional Javascript file where you can easily configure some parameters of your project. For example, you can chose the output format and the directory for a node module project, or configure the folder you want to deploy, etc. The file is a module that exports a default object, or an array of objects. Alternatively, you can export a function that return these same objects. If you use the CLI, the configuration file's values are overridden by the CLI's parameters. This file is optional because our SDK can detect a basic configuration (if you have a dockerfile for example).
The objects exported can be:
- a docker configuration
- a server configuration
- a hosting configuration
- a module configuration
Docker config
If there is no docker configuration but there is a dockerfile in your server directory, a default docker configuration will be generated.
Example
module.exports = {
docker: "docker-name",
deployment: {
include: "/.*/",
exclude: "/\.git/",
baseUrlId: "docker",
},
};
Attribute list
docker
The name of your docker. Allowed characters are [a-z], [0-9], underscore (_), dash (-), dot (.).
Default: docker
dockerfile
The path to a dockerfile.
variables
Set environment variables in the deployments.
See variables.
deployment
deployment.include
Include all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.
Default: /.*/
deployment.exclude
Exclude all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.
Default: .dockerignore
file content if it exist, otherwise /\.git/
deployment.variables
Set environment variables in all deployments. If the same variable is declared in the main variables
attribute, then it overrides it.
See variables.
deployment.baseUrlId
The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.
Default: docker
Server config
If there is no server configuration and no dockerfile but there is a scripts.start
attribute in your package.json
, a default server configuration will be generated.
Example
module.exports = {
server: "server-name",
deployment: {
include: "/.*/",
exclude: "/\.git/",
baseUrlId: "server",
engine: {
node: "12",
},
},
};
Attribute list
server
The name of your server. Allowed characters are [a-z], [0-9], underscore (_), dash (-), dot (.).
Default: name
attribute from the package.json
variables
Set environment variables both in the emulator and in the deployments.
See variables.
deployment
deployment.include
Include all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.
Default: /.*/
deployment.exclude
Exclude all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.
Default: /\.git/
deployment.baseUrlId
The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.
Default: server
deployment.engine
A semver range to specify the engine version. The chosen version will be the latest LTS version in your range. If none are LTS, then it will be the latest version in your range.
engine: {
node: "12"
}
Default: engines
attribute from the package.json
. If not defined then default value is the latest LTS version of node.
deployment.variables
Set environment variables in all deployments. If the same variable is declared in the main variables
attribute, then it overrides it.
See variables.
Hosting config
If there is no hosting configuration and no dockerfile, but there is either a public
or a static
directory in your server directory, a default hosting configuration will be generated.
Example
module.exports = {
hosting: "hosting-name",
include: "/.*/",
exclude: "/\.git/",
public: "public",
deployment: {
baseUrlId: "hosting",
},
};
Attribute List
hosting
The name of your hosting. Allowed characters are [a-z], [0-9], underscore (_), dash (-), dot (.).
Default: hosting-[name]
with [name]
being the name
attribute from the package.json
include
Include all files matching any of these conditions. Conditions can be a RegExp, a path, or a function.
Default: /.*/
exclude
Exclude all files matching any of these conditions. Conditions can be a RegExp, a path, or a function.
Default: /\.git/
public
The path to a directory containing your assets.
Default: public
deployment
deployment.baseUrlId
The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.
Default: hosting
Module config
If there is no module configuration, no dockerfile and no scripts.start
attribute but a main
attribute in your package.json
, a default module configuration will be generated.
Example
module.exports = {
module: "module-name",
expose: "./src/index.js",
output: {
format: "umd",
filePath: "../client/src/functions.js",
name: "outputname",
},
env: "auto",
engine: {
url: "https://cdn.scaledynamics.com/warp-engine",
},
variables: {
key: "value",
},
emulator: {
variables: {
key: "value",
},
host: "localhost",
port: 3192,
loggingLevel: "info",
},
deployment: {
include: "/.*/",
exclude: "/\.git/",
engine: {
node: "12",
},
variables: {
key: "value",
},
}
};
Attribute List
module
The name of your module. Allowed characters are [a-z], [0-9], underscore (_), dash (-), dot (.).
Default: name
attribute from the package.json
expose
The entry point to expose an API to the client. It can either be a path to a JavaScript file or an object with 'source' and 'type' as attribute. Source being a path to a JavaScript file, and type the path to a TypeScript declaration file.
This TypeScript declaration file can import any other TypeScript declaration file.
output
Can be an array of outputs.
format.output
See format.
format.name
The name under which your client will be generated. This defines under which name you will import it, for example, if it is a node-module you will use require([format.name]);
.
Default: [module]-client
with [module] being the value of the module attribute.
format.filePath
Only for umd
format.
format.projectPath
Only for node-modules
format. This path has to be the target directory containing the node_modules
directory.
env
The default environment used by the client.
Possible values:
auto
: the environment is chosen according to the URL of the script in a browser, or the environment variable WARP_ENV
for node.
emulator
: use the emulator
Default: auto
variables
Set environment variables both in the emulator and in the deployments.
See variables.
emulator
The Warp emulator starts with the warp emulator run command, and stops with warp emulator stop.
emulator.variables
Set environment variables in the emulator. If the same variable is declared in the main variables
attribute, then it overrides it.
See variables.
emulator.host
The default hostname of the emulator.
Default: localhost
emulator.port
Warp emulator port number.
Default: 3192
or automatically assigned when launching a warp dev
command
emulator.loggingLevel
Available log levels: none
, error
, warn
, info
.
Default: info
engine
The url of the CDN where the loadEngine
can find the warp engine.
engine.url
Default: https://cdn.scaledynamics.com/warp-engine
deployment
deployment.include
Include all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.
Default: /.*/
deployment.exclude
Exclude all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.
Default: /\.git/
deployment.engine
A semver range to specify the engine version. The chosen version will be the latest LTS version in your range. If none are LTS, then it will be the latest version in your range.
engine: {
node: "12"
}
Default: engines
attribute from the package.json
. If not defined then default value is the latest LTS version of node.
deployment.variables
Set environment variables in all deployments. If the same variable is declared in the main variables
attribute, then it overrides it.
See variables.
deployment.instances
Cloud services where your module will be hosted.
deployment.instances.variables
Set environment variables in this instance. If the same variable is declared in the main variables
attribute or the deployment.variables
attribute, then it overrides it.
Variables
The configuration file provides a way to set environment variables in your projects. You can go here to learn more about it.