@ramses-superapp/ramses-mini-app-cli
v1.0.8
Published
a cli tool for creating mini-app templates
Readme
Ramses Mini-App CLI Tool
Overview
The Ramses Mini-App CLI tool is a command-line utility designed to scaffold MiniApp projects for the Ramses SuperApp ecosystem. It provides pre-defined templates to help developers quickly set up a MiniApp project with the necessary structure and configuration.
Features
- Choose from multiple predefined MiniApp templates.
- Generate a new MiniApp project with a user-specified name.
- Automatically structures the project directory and files based on the selected template.
Installation
Ensure you have Node.js installed (version 14+ recommended).
Install the CLI tool globally using npm:
npm install -g @ramses-superapp/ramses-mini-app-cliAfter installation, you can invoke the CLI using:
create-ramses-mini-appUsage
Running the CLI
Open your terminal.
Run the following command:
create-ramses-mini-appFollow the prompts:
- Project Template: Choose a template from the available options.
- Project Name: Enter a name for your MiniApp. The name should only include letters, numbers, underscores (
_), or hyphens (-).
The CLI will create a new directory with the specified project name and populate it with the chosen template.
Project Structure
Directory Layout
/
├── templates/ # Contains predefined project templates
│ ├── mini-app-hello-world # Example template
│ └── [other templates] # Additional templates
├── index.js # CLI entry point
├── createDirectoryContents.js # Handles directory and file creation
└── package.json # Metadata and configurationFile Breakdown
index.js
The main entry point for the CLI. It:
- Uses
inquirerto prompt the user for input. - Reads available templates from the
templates/directory. - Validates and processes the user’s input.
- Calls
createDirectoryContentsto scaffold the new project.
Key highlights:
- Ensures project names follow a strict naming convention.
- Dynamically lists all available templates in the
templates/directory.
createDirectoryContents.js
Handles the copying of template files and directories into the newly created project.
Key functionality:
- Reads the template directory.
- Recursively copies files and subdirectories to the new project.
- Replaces
.npmignorewith.gitignoreto support version control systems.
package.json
Defines the CLI package, including:
- Entry point (
index.js). - Command (
create-ramses-mini-app). - Dependency (
inquirerfor interactive prompts).
Creating a New Template
To add a new template:
- Create a new folder inside the
templates/directory. - Add the required files and directories for your template.
- The new template will automatically appear in the CLI’s template selection.
Example Workflow
Run the CLI tool:
create-ramses-mini-appSelect the
mini-app-hello-worldtemplate.Enter the project name, e.g.,
my-awesome-mini-app.The CLI creates a folder structure like:
/my-awesome-mini-app/ ├── index.html ├── main.js └── ScreenOne.jsonStart developing your MiniApp!
Troubleshooting
Permission denied error:
Ensure you have the necessary write permissions for the target directory.
sudo create-ramses-mini-appNode.js compatibility issues:
Update to the latest LTS version of Node.js.
Future Enhancements
- Adding custom templates via external repositories.
- Template versioning and updates.
- Interactive preview of templates before selection.
