0.6.3 • Published 4 months ago

@tailor-platform/dev-cli v0.6.3

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

@tailor-platform/dev-cli

With Tailor Platform dev CLI, you can:

  • install required dependencies for building your own Tailor Platform apps
  • start local devlopment stack, apply your manifest on it

Table of Contents

Installation

npm install -D @tailor-platform/dev-cli@preview

Once after your installation, tailordev command will be available.

$ npx tailordev --help
Usage: tailordev [options] [command]

CLI for Tailor Platform application devs

Options:
  -V, --version                output the version number
  -h, --help                   display help for command

Commands:
  reset [options]              reset local environment
  start [options]              start local development environment
  apply [options]              apply manifest onto local environment
  import [options] <paths...>  import seed manifest (this needs minitailor running by `start` command)
  install:deps [options]       install required dependencies (tailorctl, cuelang)
  uninstall:deps               uninstall dependencies
  help [command]               display help for command

Usage

tailordev CLI expects the following directory structure for example:

yourapp
├── pacakge.json
├── .tailordevenv.json
└── manifest
    └── config
        └── template
            ├── gateway.cue
            ├── pipelines.cue
            ├── stateflow.cue
            └── tailordb.cue

1. Configuration

In this case you will need to have .tailordevenv.json with the following content:

{
  // The project name
  "name": "stock-api",

  // The directory path where contains the files specified by the following `target` array
  "manifest": "manifest/config/template",

  // File names to run cuelang on and apply
  "target": ["gateway.cue", "pipelines.cue", "tailordb.cue", "stateflow.cue"]
}

This is the initial point to start out.

2. Install dependencies

Run npx tailordev install:deps will install required binaries on your local. Those will be placed under ~/.local/share/tailordev.

It is recommended to run this command as postinstall in your package.json. You can remove those downloaded files by npx tailordev uninstall:deps.

3. Spin up local environment

Run npx tailordev start to start your local development envrionment. This needs docker-compose currently under the hood, so make sure it is installed and up on your machine.

start command generates .tailordev directory which has files generated by tailordev CLI. Those files will be generated every time in starting so can be ignored from your VCS.

You can also use --only-file option to generate compose.yml in .tailordev directory. This options is useful if you would like to run docker-compose manually.

4. Apply your manifest

Run npx tailordev apply to apply your application manifest onto your local dev environment next.

This also runs Cuelang evaluation (same as cue eval), and the evaluated files will be generated in .tailordev/generated with the same directory structure as the one you specified in manifest field in .tailordevrc.json.

apply command supports --env <value> option to switch your manifest in evaluation. This internally works as attributes in Cuelang, so you will be able to switch values in manifest files with @if(<value>).

If you would just like to evaluate and generate manifest under .tailordev/generated, you can use --only-eval option that skips applying manifests onto local development environment.

Use as npm scripts

As tailordev CLI is built with Node.js, it will be good fit to have it in your package.json scripts as well as other tools like Next.js.

{
  "name": "yourapp",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "start:backend": "tailordev start",
    "apply": "tailordev apply",
    "reset": "tailordev reset",
    "postinstall": "tailordev install:deps"
  }
}
0.5.3

4 months ago

0.6.3

4 months ago

0.6.2

4 months ago

0.6.1

4 months ago

0.6.0

4 months ago

0.5.0

6 months ago

0.5.2

6 months ago

0.5.1

6 months ago

0.4.0-preview.4

7 months ago

0.4.0-preview.3

7 months ago

0.4.1

7 months ago

0.4.0

7 months ago

0.4.2

7 months ago

0.3.0

11 months ago

0.3.0-preview.0

11 months ago

0.2.2

1 year ago

0.1.0-preview.6

1 year ago

0.1.0-preview.7

1 year ago

0.1.0-preview.8

1 year ago

0.1.0-preview.9

1 year ago

0.1.0-preview.3

1 year ago

0.1.0-preview.4

1 year ago

0.1.0-preview.5

1 year ago

0.1.0-preview.2

1 year ago

0.1.0-preview.1

1 year ago