4.0.0 • Published 3 days ago

marjory-cli v4.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 days ago

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:

  1. Install the CLI tool globally: npm i -g marjory-cli@beta
  2. 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 tenant API_TestUser-94ia, much easier to find later for the marjory 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"
       }
  3. Login to marjory through the CLI with marjory login, Use the same user for the app creation
  4. Initialize a new Marjory application: marjory init <app_slug>
    • Select the tenant you've created your app earlier. Marjory init
    • From there we can select the app with have created earlier Marjory init
  5. Edit the deployment.yml file to configure his application
  6. Configure the installation variables using the marjory configure command
  • Any variables configured is locally stored : ~/.marjory/<YOUR_APP_NAME>.json
  1. Run the application locally using the marjory local command
  2. Dev & test
  3. Deploy the application using the marjory deploy command
  4. Test the application on the staging environment
  5. Promote the application to production using the marjory promote command

List of commands

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
4.0.0-beta.29

3 days ago

4.0.0

3 days ago

4.0.0-beta.30

3 days ago

4.0.0-beta.28

4 days ago

4.0.0-beta.27

1 month ago

4.0.0-beta.26

1 month ago

4.0.0-beta.25

2 months ago

4.0.0-beta.24

2 months ago

4.0.0-beta.23

2 months ago

4.0.0-beta.22

2 months ago

4.0.0-beta.21

2 months ago

4.0.0-beta.20

2 months ago

4.0.0-beta.19

2 months ago

4.0.0-beta.18

2 months ago

4.0.0-beta.17

2 months ago

4.0.0-beta.16

2 months ago

4.0.0-beta.15

2 months ago

4.0.0-beta.14

2 months ago

4.0.0-beta.13

2 months ago

4.0.0-beta.12

2 months ago

4.0.0-beta.11

3 months ago

4.0.0-beta.10

3 months ago

4.0.0-beta.8

7 months ago

4.0.0-beta.9

6 months ago

4.0.0-beta.7

8 months ago

4.0.0-beta.6

8 months ago

4.0.0-beta.5

8 months ago

3.1.1

1 year ago

3.1.0

1 year ago

2.0.5

2 years ago

2.0.4

2 years ago

3.0.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.12

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago