lightcraft

0.0.3 • Public • Published

🚀 Lightcraft

Lightcraft is a tool for deploying frontend apps to cloud.

Install

npm install lightcraft

Introduction

To deploy with Lightcraft, you don't need to set up any infrastructure, all you need is an account at some cloud storage service. Currently it supports only Google Cloud Storage, but adding more providers is not hard.

Lightcraft supports rolling releases, so you always can switch back to the previous release if something goes wrong.

To ensure that files that have not changed across deployments remain cached on clients, Lightcraft stores files of all releases in the single directory. Because of this you need to set up your build to:

  • Insert hashes of files content into the filenames.
  • Generate manifest.json file. If you use webpack, you can do it with webpack-manifest-plugin.

Deploy process

During the deploy process Lightcraft performs following steps:

  1. Creates lockfile in the upload directory, so another deploy process can't be started, until current deploy is finished.
  2. Uploads new files. To save time if some of the files was not changed since last release, it will not reupload them.
  3. Uploads manifest and updates releases.json file.
  4. Cleans up. Removes old releases that you no longer want to keep and files remaining after unsuccessful deployments.
  5. Removes lockfile.

Configuration

Lightcraft can load configuration from .lightcraftrc file in JSON/YAML format or lightcraft.config.js file in your project. Configuration has following options:

// lightcraft.config.js
module.exports = {
    // path to directory with files
    filesPath: './build',

    // path to manifest file
    manifestPath: './build/manifest.json',

    // path for deploy on server
    uploadPath: 'releases',

    // number of releases you want to keep
    keepReleases: 3,

    // cloud provider, currently only Google Cloud Storage is supported
    provider: 'GCS',

    // options for Google Cloud Storage
    GCSOptions: {
        projectId: 'project-id',
        bucketName: 'bucket-name',
        keyFilename: './key.json'
    }
}

Commands

deploy [--config file]

Deploy files to cloud.

cleanup [--config file]

Clean files of old and unsuccessfull releases.

unlock [--config file]

Manually unlock. Use when something went wrong.

reset [--config file]

Removes deploy directory.

License

This software is released into the public domain. See the LICENSE file.

Readme

Keywords

none

Package Sidebar

Install

npm i lightcraft

Weekly Downloads

1

Version

0.0.3

License

Unlicense

Last publish

Collaborators

  • sunflowerdeath