JSPM

@architect/sandbox

1.4.17
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4895
  • Score
    100M100P100Q129324F
  • License Apache-2.0

Architect dev server: run full Architect projects locally & offline

Package Exports

  • @architect/sandbox
  • @architect/sandbox/src/cli/arc

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@architect/sandbox) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@architect/sandbox

Architect dev server: run full Architect projects locally & offline in a sandbox

GitHub CI status

Install

npm i @architect/sandbox

Run locally

npx sandbox

API

sandbox.cli({ver}, callback)

Invokes sandbox.start() to start a sandbox instance, passing the parameter object in. Then sets up a filesystem watcher for changes to:

  1. Files within shared folders (src/shared/, src/views/, etc.), in which case it will re-hydrate all functions with the new files, and
  2. The Architect project manifest file, in which case it will re-start the HTTP server by calling into http().

Prints the specified ver on init, or falls back to the version string defined in this project's package.json.

sandbox.db.start(callback)

Starts a singleton local in-memory DynamoDB server, automatically creating any tables or indexes defined in the project manifest's @tables pragma. Also creates a local session table.

Returns an object with a close() method that gracefully shuts the server down.

Invokes callback once the DB is up and listening.

sandbox.events.start(callback)

If Architect project manifest defines @queues or @events, sets up interprocess communication between your events and queues via a tiny web server.

Returns an object with a close() method that gracefully shuts the server down.

Invokes callback once the server is up and listening.

sandbox.http.start(callback)

If Architect project manifest defines defines @http or [@websocket][websocket] routes, starts the necessary servers and sets up routes as defined in the project manifest.

Invokes callback once the server is up and listening.

sandbox.http.close()

Closes any servers started via sandbox.http.start().

sandbox.start({port, options}, callback)

Initializes the sandbox; first checks that ports are available to consume, prints a banner, loading basic environment variables and necessary AWS credentials, and sets up any local DBs via sandbox.db.start(), events or queues via sandbox.events.start(), HTTP handlers via sandbox.http.start().

Invokes callback once everything is ready, passing null as the first parameter and end as the second parameter to callback, where end is a function that closes all servers down.

Returns a promise if callback is falsy.

Example Usage

let sandbox = require('@architect/sandbox')