ScaleDynamics less-code JavaScript platform documentation

ScaleDynamics less-code JavaScript platform documentation

›Project SDK API Reference

Less-code platform

  • Introduction

Full Stack Playground

  • Playground introduction

Project SDK

  • SDK introduction
  • Quick Start
  • Installation
  • Build, emulate and develop cloud Node.js modules
  • Deploy a module
  • Deploy static public assets
  • Provision servers in your cloud environments
  • From browser using HTML
  • From browser using a builder
  • From Node.js
  • Frameworks integration
  • Glossary

Project SDK API Reference

  • Requirements
  • SDK CLI
  • Configuration file
  • Engine
  • Client module formats

Warp configuration file

Warp Config

The Warp configuration file is optional, the CLI being sufficient but you can configure easily some parameters in the server project. The CLI overrides values from the configuration file.

A Warp configuration file is a module that exports a default object, or an array of objects. Alternatively, the configuration file can export a function, returning these same objects. This function can take a context parameter defined as follows:

{
  serverDir: ".",
  arguments: [],
  env: "myenvironment",
}

serverDir: the root of your project

arguments: config arguments passed to the CLI

environment: the environment you're deploying in

The objects exported by the configuration must be either a module config or a hosting config.

Module config

Example

module.exports = {
  module: "module-name",
  expose: "./src/index.js",
  output: {
    format: "umd",
    filePath: "../client/src/functions.js",
  },
  env: "auto",
  engine: {
    url: "https://cdn.scaledynamics.com/warp-engine",
  },
  variables: 
  emulator: {
    variables:
    host: "localhost",
    port: 3192,
    loggingLevel: "info",
  },
  deployment: {
    include: "/.*/",
    exclude: "/\.git/",
    engine: {
      node: 12,
    },
    variables:
    instances: {
      provider: "scaledynamics",
    },
  }
};

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

See format.

umd

output: {
  format: "umd",
  filePath: "../client/src/functions.js",
},

node-module

output: {
  format: "node-module",
  projectPath: "../client",
},

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: engine 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.provider

Provider can be gcp-functions, scaledynamics or default. gcp-functions uses google cloud functions. By default, scaledynamics will choose the right provider for you.

Default: default

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.

Hosting config

Example

module.exports = {
  hosting: "hosting-name",
  include: "/.*/",
  exclude: "/\.git/",
  public: "public",
  instances: {
    provider: "scaledynamics",
  },
};

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

instances

Hosting service where you client will be hosted. An object with a provider attribute.

instances.provider

Provider can be gcp-storage or scaledynamics. Default is scaledynamics.

Default: default

Variables

You must declare your environment variable in a variables object. The property names of this object will be the name of your variables. Their value can be a string, an empty string or an object. If it is an object, then its possible values are:

{
  local: true,
}

In this case, the value will be taken from the CLI. See the CLI.

{
  empty: true,
}

In this case, the variable will be declared but not assigned a value.

{
  undef: true,
}

In this case, the variable will be undefined.

Aside from WARP_ENV containing the name of the environment where the module is executed, no other variables will be exported to the module by default.

Example

variables: {
  myfirstvar: "value",
  mysecondvar: "",
  mythirdvar: {
    local: true,
  }
}
← SDK CLIEngine →
  • Module config
    • Example
    • Attribute List
  • Hosting config
    • Example
    • Attribute List
  • Variables
    • Example
ScaleDynamics less-code JavaScript platform documentation
Docs
Getting StartedAPI Reference
ScaleDynamics
WebsiteTwitterLinkedIn
More
npmGitHubAbout Us
© ScaleDynamics - 2021