0.28.3 • Published 9 days ago

@appsemble/cli v0.28.3

Weekly downloads
66
License
LGPL-3.0-only
Repository
gitlab
Last release
9 days ago

npm.io Appsemble CLI

Manage apps and blocks from the command line.

npm GitLab CI Prettier

Table of Contents

Installation

npm install @appsemble/cli

Usage

A full list of functionalities can be achieved by running the following command:

appsemble --help

Every subcommand also supports the --help flag.

Development server

The development server can create an app from a specified folder containing an app-definition.yml file. It will check what blocks are needed for the app and will try to load them from the local workspaces, listed in the package.json file in the root of the project, if they are present. This way, all default Appsemble blocks shipped with Appsemble are loaded automatically.

Once the development server is started, making a change to a block’s code or styles will reflect in the browser immediately after refreshing the page, without the need of increasing the block’s version. Running docker database containers, creating a user account and creating an organization are not needed.

The Appsemble CLI can be used to start the development server. For example, the following command serves my-app:

appsemble serve <path-to-app-directory>

This will serve the app on http://localhost:9090.

A different port can be specified with the --port parameter.

The following option allows you to view the app with a specified role:

appsemble serve <path-to-app-directory> --user-role test

The following option allows you to view the app as a Manager of a team:

appsemble serve <path-to-app-directory> --team-role Manager

App data is stored within a db.json file in your machine’s cache directory. Each app has their own directory <my-app>.

MacOS - /Users/<my-name>/Library/Caches/appsemble/<my-app>
Linux - /home/<my-name>/.cache/appsemble/<my-app>
Windows - C:\Users\<my-name>\AppData\Local\appsemble\Cache\<my-app>

App assets will be served from the local file system.

The development server will automatically fetch all blocks that are needed for the served app but are missing from the local workspaces. These are typically third-party or proprietary blocks. The development server will use http://localhost:9999 as the default remote server to fetch blocks from. The following option allows you to specify a different remote (e.g. https://appsemble.app):

appsemble serve <path-to-app-directory> --remote <remote>

The development server will use the corresponding block directory in your machine’s cache directory to store and read block manifests and assets.

MacOS - /Users/<my-name>/Library/Caches/appsemble/blocks/<organisation>/<block-name>/<block-version>
Linux - /home/<my-name>/.cache/appsemble/blocks/<organisation>/<block-name>/<block-version>
Windows - C:\Users\<my-name>\AppData\Local\appsemble\Cache\blocks\<organisation>\<block-name>\<block-version>

You can overwrite the existing block cache with the following option:

appsemble serve <path-to-app-directory> --remote <remote> --overwrite-block-cache

Authentication

The Appsemble CLI uses OAuth2 client credentials to authenticate to the Appsemble server.

To login, run the following command and follow the instructions in the output:

appsemble login

To logout, run the following command and select the client credentials to remove:

apsemble logout

The Appsemble CLI also supports authentication using the APPSEMBLE_CLIENT_CREDENTIALS environment variable. This is mostly useful for automation.

Organizations

The Appsemble CLI can be used to create and update organizations. For example:

appsemble organization create my-organization --name 'My Organization' --icon icon.png

Apps

The Appsemble CLI allows you to bootstrap an Appsemble app into a standard Appsemble project layout. The command is followed by a series of interactive questions. You can also pass the values as arguments.

appsemble app create

The Appsemble CLI can be used to create, export, import and update apps. For example, to create an app in the apps/my-app directory, run:

appsemble app publish apps/my-app

Similarly, to update an app using an app directory, run the following command:

appsemble app update --id <app-id> <path/to/updated app>.

If you want to update settings for an app, run the following command:

appsemble app patch --id <app-id>

Use --help flag with the above command to view the supported arguments.


🛈NOTE

The app patch command supports updating the locked property of an app, locked property is updated before other properties. If you set the locked property to fullLock, any other changes won’t be applied unless you are using --force flag.


To delete an app using the CLI use the following command:

appsemble app delete --id <appId>

To export an app as a zip file, run the following:

appsemble app export --id <app-id>

Supported arguments for this command are resources, assets and path. Resources is used to specify whether to include the resources in the exported file, the same can be applied to assets and path is the path of the folder where you want to put your downloaded file. The default path is ./apps, and resources and assets are by default false.

To import an app from a zip file, use the following command:

appsemble app import <path-of-zip-file> --organization <organizationId>

For a more in depth explanation of how to build apps, use our app building guide.

Blocks

The Appsemble CLI allows you to bootstrap an Appsemble block into a standard Appsemble project layout. The command is followed by a series of interactive questions.

appsemble block create

The Appsemble CLI can also be used to publish and delete (although we don’t recommend doing it in production) Appsemble blocks. For example, to publish all blocks in the blocks directory, run:

appsemble block publish blocks/*

or to publish a single block located in some other directory, run

appsemble block publish path/to/block/directory

Blocks can be deleted if they are not in use by any apps. To delete a block, run

appsemble block delete <block-name:block-version>

Organization id can be passed as an argument(default for which is “appsemble”).

To know more about the block related commands, run

appsemble block --help

Building blocks uses npm.io Webpack. To use this, install the additional dependencies webpack and @appsemble/webpack-config

npm install webpack@webpack-4 @appsemble/webpack-config

For a more in-depth explanation of how to build apps, use our block development guide.

Teams

The Appsemble CLI can be used to manage teams for apps. For example, the following command creates a new team named My Team:

appsemble team create 'My Team' --app-id 1 --context development

Assets

The Appsemble CLI can be used to upload assets from disk. For example, the following command creates an asset named example-asset:

appsemble asset publish --app-id 1 path/to/example-asset.png

Resources

The Appsemble CLI can be used to create a resource from a JSON file or directory:

[
  {
    "title": "My Resource",
    "description": "This record is an example."
  }
]
appsemble resource publish --app-id 1 --context development --app path/to/my-app my-resource path/to/resources/my-resource.json
appsemble resource publish --app-id 1 --context development --app path/to/my-app my-resource path/to/resources/*

And resources can also be updated when they contain an id in the JSON file.

[
  {
    "id": 1,
    "title": "My Updated Resource",
    "description": "This will be the updated content of the first my-resource record."
  }
]
appsemble resource update --app-id 1 --context development --app path/to/my-app my-resource path/to/resources/*

Cronjobs

The Appsemble CLI can be used to run app cronjobs. The following command runs all cronjobs that were scheduled to run in the past 5 minutes:

appsemble run-cronjobs

How often jobs are run (more accurately how far back the job can be scheduled for it to run) the time interval (in minutes) can also be set with:

appsemble run-cronjobs --interval 30

License

LGPL-3.0-only © Appsemble

0.28.3

9 days ago

0.28.2

11 days ago

0.28.0

12 days ago

0.27.12

18 days ago

0.27.11

20 days ago

0.27.10

25 days ago

0.27.9

1 month ago

0.27.8

1 month ago

0.27.7

1 month ago

0.27.6

1 month ago

0.27.5

1 month ago

0.27.4

1 month ago

0.27.2

2 months ago

0.27.1

2 months ago

0.27.0

2 months ago

0.27.3

2 months ago

0.26.0

2 months ago

0.25.2

2 months ago

0.25.1

2 months ago

0.25.0

2 months ago

0.24.13

3 months ago

0.24.12

3 months ago

0.24.10

3 months ago

0.24.9

3 months ago

0.24.8

3 months ago

0.24.7

3 months ago

0.24.6

3 months ago

0.24.4

3 months ago

0.24.3

3 months ago

0.24.2

3 months ago

0.24.1

3 months ago

0.24.0

3 months ago

0.23.9

5 months ago

0.23.8

5 months ago

0.23.7

5 months ago

0.23.6

5 months ago

0.23.5

5 months ago

0.23.4

5 months ago

0.23.3

6 months ago

0.23.2

6 months ago

0.23.1

6 months ago

0.23.0

6 months ago

0.22.10

7 months ago

0.21.3

9 months ago

0.21.2

9 months ago

0.21.1

9 months ago

0.21.0

9 months ago

0.22.7

8 months ago

0.22.6

8 months ago

0.22.5

8 months ago

0.22.4

8 months ago

0.22.3

8 months ago

0.22.2

8 months ago

0.22.1

8 months ago

0.22.0

8 months ago

0.22.9

7 months ago

0.22.8

7 months ago

0.20.45

11 months ago

0.20.44

12 months ago

0.20.43

12 months ago

0.20.42

1 year ago

0.20.40

1 year ago

0.20.41

1 year ago

0.20.39

1 year ago

0.20.37

1 year ago

0.20.38

1 year ago

0.20.35

1 year ago

0.20.36

1 year ago

0.20.33

1 year ago

0.20.34

1 year ago

0.20.31

1 year ago

0.20.32

1 year ago

0.20.30

1 year ago

0.20.28

1 year ago

0.20.29

1 year ago

0.20.26

1 year ago

0.20.27

1 year ago

0.20.24

1 year ago

0.20.25

1 year ago

0.20.22

1 year ago

0.20.23

1 year ago

0.20.20

1 year ago

0.20.21

1 year ago

0.20.19

1 year ago

0.20.17

2 years ago

0.20.18

2 years ago

0.20.16

2 years ago

0.20.15

2 years ago

0.20.14

2 years ago

0.20.13

2 years ago

0.20.11

2 years ago

0.20.12

2 years ago

0.20.10

2 years ago

0.20.9

2 years ago

0.20.8

2 years ago

0.20.7

2 years ago

0.20.6

2 years ago

0.20.5

2 years ago

0.20.4

2 years ago

0.20.3

2 years ago

0.20.2

2 years ago

0.20.1

2 years ago

0.20.0

2 years ago

0.19.9

2 years ago

0.19.11

2 years ago

0.19.12

2 years ago

0.19.13

2 years ago

0.19.14

2 years ago

0.19.15

2 years ago

0.19.10

2 years ago

0.19.8

2 years ago

0.19.5

2 years ago

0.19.6

2 years ago

0.19.7

2 years ago

0.19.4

2 years ago

0.19.3

3 years ago

0.19.1

3 years ago

0.19.2

3 years ago

0.19.0

3 years ago

0.18.31

3 years ago

0.18.30

3 years ago

0.18.29

3 years ago

0.18.28

3 years ago

0.18.27

3 years ago

0.18.26

3 years ago

0.18.25

3 years ago

0.18.24

3 years ago

0.18.22

3 years ago

0.18.23

3 years ago

0.18.21

3 years ago

0.18.20

3 years ago

0.18.19

3 years ago

0.18.18

3 years ago

0.18.17

3 years ago

0.18.16

3 years ago

0.18.15

3 years ago

0.18.13

3 years ago

0.18.14

3 years ago

0.18.11

3 years ago

0.18.10

3 years ago

0.18.12

3 years ago

0.18.9

3 years ago

0.18.8

3 years ago

0.18.7

3 years ago

0.18.6

3 years ago

0.18.5

3 years ago

0.18.4

3 years ago

0.18.3

3 years ago

0.18.2

3 years ago

0.18.1

3 years ago

0.18.0

3 years ago

0.17.6

3 years ago

0.17.5

3 years ago

0.17.3

3 years ago

0.17.4

3 years ago

0.17.2

3 years ago

0.17.1

3 years ago

0.17.0

3 years ago

0.16.2

3 years ago

0.16.1

3 years ago

0.16.0

3 years ago

0.15.12

3 years ago

0.15.11

3 years ago

0.15.10

3 years ago

0.15.9

3 years ago

0.15.8

3 years ago

0.15.7

3 years ago

0.15.6

3 years ago

0.15.5

3 years ago

0.15.4

4 years ago

0.15.3

4 years ago

0.15.2

4 years ago

0.15.1

4 years ago

0.15.0

4 years ago

0.14.1

4 years ago

0.14.2

4 years ago

0.14.0

4 years ago

0.13.15

4 years ago

0.13.14

4 years ago

0.13.13

4 years ago

0.13.12

4 years ago

0.13.11

4 years ago

0.13.10

4 years ago

0.13.9

4 years ago

0.13.8

4 years ago

0.13.7

4 years ago

0.13.6

4 years ago

0.13.5

4 years ago

0.13.4

4 years ago

0.13.3

4 years ago

0.13.2

4 years ago

0.13.1

4 years ago

0.13.0

4 years ago

0.12.8

4 years ago

0.12.7

4 years ago

0.12.6

4 years ago

0.12.5

4 years ago

0.12.4

4 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago