1.2.1 • Published 5 months ago

@teachfloor/teachfloor-cli v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Teachfloor CLI

Teachfloor CLI is a command-line tool designed to help developers create, manage, and deploy apps for the Teachfloor platform. It provides essential commands for authentication, app creation, development, deployment, and permission management, streamlining the app development process.

Installation

To install the Teachfloor CLI, run:

npm install -g @teachfloor/teachfloor-cli

Check Version

teachfloor version

# Example Output
teachfloor version 1.1.0
A newer version of the Teachfloor CLI is available: 1.2.0

Displays the current version of the Teachfloor CLI and checks if a newer version is available.

Authentication

Login

teachfloor login

Logs into your Teachfloor account, allowing you to manage and deploy apps.

Logout

teachfloor logout

Logs out from your Teachfloor account.

Who Am I

teachfloor whoami

Displays details of the currently logged-in user.

App Management

Create a New App

teachfloor apps create <app-name>

Creates a new app on Teachfloor and sets up a local folder named <app-name> with the initial project structure.

Start Development Server

teachfloor apps start

Starts a local development server, allowing you to test and develop your app in a live environment.

Upload an App

teachfloor apps upload

Builds the production bundle and uploads the app. Before the app can be listed in the Teachfloor app marketplace, it must undergo a review process to ensure compliance with platform guidelines. The review process includes checks for functionality, security, and user experience. Once approved, the app will be available in the marketplace for users to discover and install.

View Management

Add a View

teachfloor apps add view

Adds a new view to your app, allowing you to define new interface components. The command will present a list of viewport options for the user to select from.

Remove a View

teachfloor apps remove view

Removes a specific view from your app.

Add a Settings View

teachfloor apps add settings

Adds a settings view to the app, enabling configuration options for users.

Permission Management

Grant Permission

teachfloor apps grant permission

Grants a specific permission to the app.

Revoke Permission

teachfloor apps revoke permission

Revokes a specific permission from the app.

App Distribution

Set Distribution

teachfloor apps set distribution

Sets the distribution of the app, either private or public.

CLI Development

Teachfloor CLI is built using oclif.

Prerequisites

  • Docker: Ensure Docker is installed and running on your local machine.

Setup

1. Clone the Repository

Clone this repository to your local machine and navigate to the project directory:

git clone <repository-url>
cd app-cli

2. Build the Docker Image

Once inside the project directory, build the Docker image:

./execute build --rm --tag app-cli .

3. Use the execute script

The execute script helps manage Docker container interactions and run commands inside the container. To start working on your CLI project, use the following commands:

Start the Development Environment

Run the following command to open a shell in the Docker container where your CLI will be developed:

./execute cli-shell

This will:

  • Ensure Docker is running.
  • Map your current project directory to /workspace inside the container.
  • Open a shell where you can interact with the CLI.

When first started, make sure to install the npm packages needed for the CLI to work by executing the following command within the container:

npm install

4. Developing the CLI

Important oclif Commands

The following commands help you generate and manage new commands within the CLI:

oclif generate command <command-name>
oclif generate command apps:upload
oclif generate command apps:add:view

5 Building and Testing the CLI

To build and test the CLI locally, follow these steps:

Build the CLI: Build the TypeScript source files into executable JavaScript files:

npm run build

Link the CLI: Use npm link to link the CLI globally for testing:

npm link

One-liner command:

npm run build && npm link

Run Other Docker Commands

You can also proxy other Docker commands through the execute script. For example, to list running containers, use:

./execute ps
1.2.1

5 months ago

1.2.0

6 months ago

1.1.1

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.0

6 months ago

1.0.0

6 months ago