marjory-cli v4.0.0
Marjory CLI
This package is a CLI tool to help you to manage your Marjory applications.
Instructions for end users
Here is the typical process an end user will follow to use this CLI tool:
- Install the CLI tool globally:
npm i -g marjory-cli@beta
- Create an empty app shell on Marjory with Postman
- Get a token from the env and the user you want to deploy to
- On
staging
you should use this tenantAPI_TestUser-94ia
, much easier to find later for themarjory init
curl --location 'https://staging.api-v2.marjory.io/appCatalog/apps' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <A_TOKEN_OF_ENV_YOU_TO_DEPLOY_YOUR_APP_ON>' \ --data '{ "tenant": "<THE_TENANT_YOU_WANT_TO_DEPLOY_ON>", "name": "Demo V3", "slug": "demoV3", "description": "App demo V3" }'
- If the app creation is successful Postman will output :
{ "id": "0ae52d50-5413-444e-afec-5ae028714cc6" }
- Login to marjory through the CLI with
marjory login
, Use the same user for the app creation - Initialize a new Marjory application:
marjory init <app_slug>
- Select the tenant you've created your app earlier.
- From there we can select the app with have created earlier
- Edit the
deployment.yml
file to configure his application - Configure the installation variables using the
marjory configure
command
- Any variables configured is locally stored :
~/.marjory/<YOUR_APP_NAME>.json
- Run the application locally using the
marjory local
command - Dev & test
- Deploy the application using the
marjory deploy
command - Test the application on the staging environment
- Promote the application to production using the
marjory promote
command
List of commands
- marjory init: Initialize a new Marjory application
- marjory configure: Configure a Marjory application
- marjory local: Run a Marjory application locally
- marjory login: Login to a Marjory application
- marjory deploy: Deploy a Marjory application
- marjory promote: Promote a Marjory application
- marjory logout: Logout from a Marjory application
- marjory oauth: Init a new OAuth process to retrieve an access token
marjory init
This command will initialize a new Marjory application based on the template stored in the src/new_app_template
folder.
If we want to update the template, all changes must be done in this folder.
If we want to update the dependencies' versions, we must update the package.json
file inside the src/new_app_template
folder.
marjory configure
This command will configure the installation variables for a Marjory application. An interactive prompt will ask you to enter the values for each variable, based on the deployment.yml
file.
If you have configured an OAuth 2 variable, this command will automatically open a browser window to start the OAuth process.
You can configure "secrets" variables by creating a .secrets
file (with the same format as a .env
file) in the root folder of your application. This file will be ignored by Git.
Then, you can use the secrets variables in your deployment.yml
file by using the following syntax: {{ secrets.MY_SECRET_VARIABLE }}
.
All settings will be saved locally in the $HOMEDIR/.marjory
folder.
marjory local
This command will run a Marjory application locally. All functions and webhooks will be detected and displayed in the console. If you don't see a freshly created function or webhook, you can check your deployment.yml
file to make sure it's correctly configured.
You can keep this command running while you're developing your application. If you make any change to your code, the application will be automatically reloaded.
marjory login
This command will login to a Marjory application. It'll ask you to enter your email and password. Then, it'll retrieve an access token and save it locally.
All credentials are saved locally in the $HOMEDIR/.marjory
folder.
marjory logout
This command will logout from a Marjory application. It'll delete all credentials saved locally.
marjory deploy
This command will deploy a Marjory application. It'll ask you to enter the target version (as a semver version) and then it'll deploy the application on Marjory. This version will be available for testing only and will need to be promoted to be accessible by your users.
marjory promote
This command will promote a Marjory application. It'll ask you to enter the target version (as a semver version) and then it'll promote the application on Marjory. This version will be available for your users.
marjory oauth
It's better to use the marjory configure
command to configure an OAuth 2 variable. This command is only useful if you want to test an OAuth configuration locally.
To test an OAuth configuration locally, configure the OAuth app inside your deployment.yml
file and then run the following command:
marjory oauth --name [OAuth config name]
This command line will verify your OAuth configuration and init a new OAuth authorization process in order to retrieve the access_token
.
All tokens will be saved locally and the command can be run again: it'll return you the access_token
or will renew it for you. If the token has expired and can't be renewed, the old token will be deleted and the OAuth process will start again.
You can delete manually the cache by cleaning the $HOMEDIR/.marjory/oauth
folder or using the following command:
marjory oauth --name [OAuth config name] --clean
Local development
install the CLI globally
type node index.js
, the list of commands available
Ideally, put the project in a cli-workspace directory, open it from vscode and enter node factory-cli/index.js
in the terminal
NPM Link
To use this package in dev, we must use npm link
Inside this application, run the following command:
npm link
Then, inside the app you want to use this package, make sure to change de devDependencies from marjory-cli
to @marjory/factory-cli
and then run the following command:
npm link @marjory/factory-cli
3 days ago
3 days ago
3 days ago
4 days ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
7 months ago
6 months ago
8 months ago
8 months ago
8 months ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago