0.0.7 • Published 6 years ago

respresso-node-client v0.0.7

Weekly downloads
9
License
-
Repository
-
Last release
6 years ago

Respresso Node.js client

A Node.js client for synchronizing Respresso resources

Getting Started

Prerequisites

  • You need Java (version 7 or higher) installed on your machine!
  • You need a Respresso project token (you can copy it from the project's main page)

TODO link to flow documentation

Installing

npm install respresso-node-client

Initializing

To initialize the client, run the following command in your project directory

respresso init

Here you can change the name of the config file and set the project token

Note: If you don't set the token here, you have to set it in the config file before you can synchronize your resources

Usage

Adding resources

You can add a new resource to be synchronized using the command line

respresso install category:group@version

Note: You have to specify the version

For example:

respresso install localization:android@1.0.0

Alternatively you can add new resources by modifying the config file

{
  "resources": [
    {
      "category": "localization",
      "group": "android",
      "version": "1.0.0"
    },
    {
      "category": "color",
      "group": "android",
      "version": "1.0.1"
    }
  ]
}

TODO link to the versioning documentation

Synchronizing resources

To update your local resources from the server, use the following command

respresso sync

Cleaning up

To remove all files generated by this client, use the following command

respresso clean

Note: This will remove all files synchronized from the server, as well as the files generated by this client. The configuration file will not be removed.

API Reference

Command line

You can use the client from the command line

respresso <command> [arguments]
Available commands
  • initialize (alias: init)
  • install <resource> (alias: i)
    • resource: category:group@version (example: localization:android@1.0.0)
  • synchronize (alias: sync)
  • clean

You can use --help after each command to print out the usage of that command

If you changed the name of the config file, you can specify it after each command (except for initialize)

respresso sync --config my-config-file.json

Alternatively

respresso sync -c my-config-file.json

You can also print out the version of the client

respresso --version

From Javascript

You can also use the client from Javascript

For example

const respresso = require("respresso-node-client");

respresso.synchronize().then(function() {
  console.log("Synchronized");
});

Or

import {synchronize} from "respresso-node-client";

synchronize().then(function() {
  console.log("Synchronized");
});
Available methods
Initialize
initialize(options)

options:

{
  configFile: string (optional) (default: "respresso.json"),
  projectToken: string (optional)
}
Install
install(resource, configFile)

resource:

{
  category: string,
  version: string,
  group: string
}

configFile:

string (optional) (default: "respresso.json")

returns an empty Promise

Synchronize
synchronize(configFile)

configFile:

string (optional) (default: "respresso.json")

returns an empty Promise

Clean
clean(configFile)

configFile:

string (optional) (default: "respresso.json")

returns an empty Promise

Note: Typescript type definitions are included in the package

Config file

Example config file

{
  "projectToken": "60a50cf9-818e-4c46-aeb1-8b50169a5354",
  "serverUrl": "https://app.respresso.io",
  "targetDirectory": "./respresso",
  "lockFile": "./respresso-lock.json",
  "changesFile": "./respresso-changes.json",
  "logFile": "./respresso.log",
  "strictMode": true,
  "resources": [
    {
      "category": "localization",
      "group": "android",
      "version": "1.0.0"
    },
    {
      "category": "color",
      "group": "android",
      "version": "1.0.1"
    }
  ]
}

The only required field is the projectToken

TODO link to the core java library documentation