The CLI has moved!
The CLI package is now part of Marcelle's main monorepo at marcellejs/marcelle. This repository is no longer maintained.
Marcelle CLI
A command line interface for Marcelle applications
Installation
The CLI is an npm package that must be installed globally:
npm install -g @marcellejs/cli
Once installed, the marcelle
command should be available:
marcelle --version
Usage
Generating an Application
To generate a new project:
mkdir myproject
cd myproject
marcelle generate app
Several options are available to customize the project. If you don't know what to chose, just hit enter to select the defaults.
This will scaffold a new Marcelle project with the following structure (it might vary according to the build tool, this example is for vite):
.
├── README.md
├── index.html # The main HTML page for your application
├── package.json
├── src
│ ├── index.js # Main application script
│ └── modules # Directory containing local modules bundled with your application
│ └── index.js
└── vite.config.js # Build tool configuration file
To run the application in development mode (with HMR), run:
npm run dev # or yarn dev
Generating a Module
It is possible to use the generator to create new custom modules for an application or a marcelle package.
marcelle generate module
Just enter your module's name (e.g. my-module
) and the generator will create a template module that you can your in your script:
import { myModule } from "./modules";
const m = myModule(opts);
Modules are stored in the src/modules
directory and provide a Svelte view by default:
.
├── src
│ └── modules
│ ├── my-module
│ │ ├── my-module.module.js # Module definition file
│ │ ├── my-module.svelte # Svelte component defining the module's view
│ │ └── index.js # function wrapper
│ └── index.js
Generating a Backend
It is possible to use the generator to add server-side data storage (backend).
marcelle generate backend
Two options are available for the backend:
- The type of database: NeDB and MongoDB are currently supported.
- Whether or not it should use authentication.
To run the server:
npm run backend
The backend configuration files are stored in backend/configuration
.
About
Marcelle CLI's generators are provided by generator-marcelle.