1.2.2 • Published 3 years ago

darwincli v1.2.2

Weekly downloads
1
License
Apache-2.0
Repository
-
Last release
3 years ago

Darwin Command Line Interface

Installing

Install this package by running:

npm install -g darwincli

or with yarn:

yarn global add darwincli

Setup & Credentials

You'll need to provide some credentials in order to use this command line interface. You can set the following as environment variables or you can create a file in your project directory called .env with the following content replacing ??? with your credentials:

DARWIN_CLIENT_ID=???
DARWIN_CLIENT_SECRET=???

To test and make sure darwincli is setup properly, run the command darwincli info. This will let you know if your credentials could be found and are proper.

Actions

Note that \<param> means the parameter is required. Note that [param] means the parameter is optional.

Basic Actions

Basic actions used

- darwincli info

Used to test and make sure your client credentials are setup properly. Will show you an error if there is an issue and your client credentials are invalid.

Site

Commands for managing Darwin Websites

- darwincli site list

Lists out all of the sites for which you have access.

- darwincli site versions \<siteID>

Lists out all of the versions of a particular site. You can use this to get the id of a specific version for rollabck.

- darwincli site rollback \<siteID> \<versionID>

Rollback your site to the specified version.

- darwincli site upload \<siteID> \<dir> [name] [description]

Uploads a new version of your website using the provided directory. Note that directory is relative to your current directory. Also, if name is unset then name and description will be taken from the last .git commit if the directory is under source control. If the project doesn't have source control and name is unset, then an error will occur. You can use a site.darwinignore file to list out the files you don't want uploaded for your site if any.

Developing This Package

This project uses yarn instead of npm. To develop for this app, you can run yarn start in place of darwincli and pass in arguments after like so -> yarn start info instead of darwincli info.

Once you have tested the app, you can install it globally by running:

yarn global add file:$PWD

This will install the app as its own command so now you can call darwincli {arguments}. Where {arguments} are the command line arguments you are passing to darwincli.

To remove the app globally, you can call:

yarn global remove darwincli

Project Structure

The yarn start command will transpile jsx files into js files placing them in bin/dist. You can look at the package.json entry for more details on how that works. If your file is not being transpiled look at the scripts->start entry for details (from now on, we will refer to .jsx files instead of .js files; know though that jsx files are never called, but are the files you should be editing as the js files are dynamically generated).

The entrypoint to the app is bin/sources/index.jsx. You'll see that this file is an index to other commands. Those commands are under /bin/sources/cmds. To create a new command, just create a new file under the cmds folder. info.jsx is a good example to copy. If your command is another index, look at site.jsx for a good example to copy as it indexes cmds/site_cmds files.

Publishing

To publish a new version of this package, run the command:

yarn publish

You'll be asked to provide a new package version and that's it! It's now available to the world. If you are not logged in, you can run yarn login or npm login whichever you prefer to login to npm for publishing.

Test Commands

The following is a command you can use to test uploading a new version of your website - make sure to replace x with some new number so you can tell the difference between sites:

yarn start site upload 4 /Users/Blane/Library/Mobile\ Documents/com~apple~CloudDocs/Darwin/Clients/InterfaceOp/Site\ Files/TestSiteX "cli-x" "Testing out the command line interface, should say version x"
1.2.2

3 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.2.1

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago