@procamp/cli
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

Camp CLI - Init Command

The init command allows you to initialize the project configuration for your camp.

Usage

camp init [options]

Description

The init command initializes the project configuration by prompting you to provide information about the camp. It creates a meta.json file with the provided details in the specified directory.

Options

  • -d, --directory <directory>: The directory to initialize the project. If not specified, the current working directory will be used.

Prompts

During the initialization process, the following prompts will be presented:

  1. title: The title of the folder. This will be used as the default if not provided.
  2. author: The author of the camp. Leave it empty if not applicable.
  3. description: The description of the camp. Leave it empty if not applicable.
  4. version: The version of the camp. Defaults to "1.0" if not provided.
  5. courseId: The ID of the course. This field is mandatory and must not be left empty.

Example

To initialize the project configuration for your camp, run the following command:

camp init -d /path/to/project

This will prompt you to provide the required information and create a meta.json file in the specified directory.


Camp CLI - New Command

The new command generates a new course project with the specified name.

Usage

camp new <projectName>

Description

The new command generates a new course project with the given <projectName>. It creates a new directory with the project name and prompts for confirmation before proceeding.

Arguments

  • <projectName>: The name of the project to generate. This will be used as the directory name for the project.

Example

To generate a new course project with the name "myproject", run the following command:

camp new myproject

This will create a new directory named "myproject" and initialize the project configuration within it using the init command.


Camp CLI - Pack Command

The pack command compresses files in the specified directory.

Usage

camp pack [options]

Description

The pack command compresses the files in the specified directory using the ZIP format. It excludes certain files and directories from compression, such as "_MACOSX" and "node_modules".

Options

  • -d, --directory <directory>: The directory to compress. If not specified, the current working directory will be used.

Example

To compress files in the current working directory, run the following command:

camp pack

This will create a compressed ZIP file named ".output.zip" in the same directory.

To compress files in a specific directory, provide the directory path using the -d or --directory option:

camp pack -d /path/to/directory

This will create a compressed ZIP file named ".output.zip" in the specified directory.


Camp CLI - Login Command

The login command allows you to log in to Procamp.

Usage

camp login

Description

The login command prompts you to enter your email and password to log in to Procamp. It then retrieves the access token and stores it securely in the config file.

Example

To log in to Procamp, run the following command:

camp login

This command performs the following steps:

  1. Prompts you to enter your email and password.
  2. Sends a request to the Procamp authentication server to retrieve the access token.
  3. Stores the access token, client ID, and other necessary information securely in the config file.
  4. Displays a success message indicating that you are logged in.

Camp CLI - Publish Command

The publish command publishes the files to the service.

Usage

camp publish

Description

The publish command publishes the files to the service by compressing the files, validating the course, and then sending the compressed file to the service endpoint.

Prerequisites

Before running the publish command, make sure you have completed the following steps:

  1. Ensure that the meta.json file exists in the current directory.
  2. Make sure you are logged in by setting up the config file with your credentials.

Example

To publish the course files to the service, run the following command:

camp publish

This command performs the following steps:

  1. Checks if the meta.json file exists in the current directory.
  2. Validates the course files in the directory.
  3. Compresses the files into a ZIP file.
  4. Sends the ZIP file to the service endpoint using the course ID specified in the meta.json file.
  5. Displays the response from the service.

Note: Make sure you are logged in by setting up the config file with your credentials before running the publish command.


Camp CLI - Validate Command

The validate command validates the course folder structure.

Usage

camp validate

Description

The validate command validates the course folder structure to ensure it meets the required format and structure. It checks for any missing or incorrectly organized files and directories.

Example

To validate the course folder structure, run the following command:

camp validate

This command performs the following steps:

  1. Validates the course folder structure in the current directory.
  2. Checks for any missing or incorrectly organized files and directories.
  3. Displays the validation results.

Camp CLI - Generate Command

The generate command generates a course based on the provided blueprint.yaml file.

Usage

camp generate <key> <value>

Description

The generate command generates a course with the specified structure using the blueprint.yaml file. It creates directories and files based on the blueprint configuration.

Arguments

  • <key>: The key to specify the type of generation. Currently supported key: course.
  • <value>: The value associated with the key.

Example

To generate a course structure based on the blueprint.yaml file, run the following command:

camp generate course .

This command performs the following steps:

  1. Reads the blueprint.yaml file in the current directory.
  2. Creates directories and files based on the blueprint configuration.
  3. Sets the course title, author, description, version, and courseId in the meta.json file.
  4. Creates README.md files in each directory.
  5. Generates the folder structure for chapters, lessons, and assessments based on the blueprint configuration.

Note: Make sure you have the blueprint.yaml file in the current directory before running the generate command.


Camp CLI - Set Command

The set command allows you to set values for specific keys.

Usage

camp set <key> <value>

Description

The set command sets values for specific keys in the configuration files.

Available Keys

  • courseId: Sets the course ID in the meta.json file.
  • clientId: Sets the client ID in the config file.
  • clientSecret: Sets the client secret in the config file.

Examples

To set the course ID, run the following command:

camp set courseId <courseId>

This command sets the provided <courseId> in the meta.json file.

To set the client ID, run the following command:

camp set clientId <clientId>

This command sets the provided <clientId> in the config file.

To set the client secret, run the following command:

camp set clientSecret <clientSecret>

This command sets the provided <clientSecret> in the config file.


Readme

Keywords

Package Sidebar

Install

npm i @procamp/cli

Weekly Downloads

24

Version

0.0.9

License

ISC

Unpacked Size

116 kB

Total Files

56

Last publish

Collaborators

  • mahuzedada
  • justkey
  • campadmin