- Official Extension
-
-
Maintainer: ApostropheCMS (opens in new tab) - Last updated 2 months ago
- v3.7.0
-
-
- Open Source
README (opens in new tab)
Apostrophe CLI
The Apostrophe CLI is a cross-platform starting point for creating and configuring ApostropheCMS projects, providing a simple boilerplate generator and wrapping other useful functions into an easy to use command line tool.
Requires Node.js 8+
First, install @apostrophecms/cli as a global NPM module:
To view the available commands in a given context, execute the apos command with no arguments:
Note: All Apostrophe CLI commands can also be run with apostrophe, the legacy command, in addition to apos.
Create a project
To create a new project with the tool:
This will create a local copy of the ApostropheCMS public demo.
Astro projects
Hybrid ApostropheCMS + Astro projects are automatically detected by the presence of a backend/ directory. When detected, the CLI will:
- Update the shortname in
backend/app.jsandbackend/package.json - Run
npm installin bothbackend/andfrontend/directories - Create the admin user
Example:
Note: The add commands below are only available for standard ApostropheCMS projects. They are not currently supported in hybrid Astro projects.
Create a widget
To bootstrap the necessary files and basic configuration for a new Apostrophe widget, run the following command from within your Apostrophe project's root directory:
Note: You will then need to register this widget module in app.js so it is available in your project code. The same is true for the commands below when you create a piece module or generic module.
Add a --player option to the command to include the client-side Javascript "player" boilerplate to the new widget module as well.
Create a piece
To bootstrap the necessary files and basic configuration for a new Apostrophe piece type, run the following command from within your Apostrophe project's root directory:
Then remember to register 'vegetable': {} in app.js above.
If you run the add piece command with the --page flag, the command will also set up a corresponding piece-pages module with your new piece type. Similarly, you can run the add piece command with the --widget flag, which will also set up a corresponding piece-widgets module along with your new piece type. These flags can be used together or separately.
Create an empty Apostrophe module
To bootstrap the necessary files and basic configuration for a brand-new Apostrophe module that doesn't extend one of the usual suspects like pieces or widgets:
Remember to register the module in app.js with the other module types.
For more documentation for ApostropheCMS, visit the documentation site.