This repo is under active development and as such, it would be best to wait until a proper release before using it in production. If you're interested in contributing, please read on to get started.
This is the source code for the Grommet CMS boilerplate. To run this application, execute the following commands:
Install NPM modules
$ npm install
Add .env file. The project comes with a .env.example file which can be renamed to .env. These are your enviroment variables. The .env.example file contains most of the setup you will need. If you need more granular control, you have the ability to add / edit these values.
Below are the default .env values:
# Environment variables for database connection.
DB="grommet-cms-dev" // the name of your mongo databas
NODE_ENV="development" // the default NODE_ENV
DB_USER="" // The DB user name
DB_PW="" // the db password
BASE_URL="http://localhost:8003" // base url for your front end
API_URL="http://localhost:8000/api" // base url for your API.
Ensure Mongo is running. Upon starting the server the application will automatically build a hello world post and a temporary dashboard user.
To start the server run:
$ npm run build
$ npm start
To start the development server:
$ npm run dev
To create the website distribution bundle:
$ npm run dist
The projects contains built in code generation tools for easy project scaffolding.
To run the generators with a list of generators, run
npm run generator
Follow the on screen prompts to select the options you wish to use.
For convenience, you can bypass the initial selection and scaffold out containers, components and pages by running
npm run generate:<type_of_component>
where
Container npm run generate:container
Dashboard
./src/js/containers
selectors
file that allows you to create memoized selectors. See here for why this can help your app's performance.Component npm run generate:component
./src/js/components
Post
In order to get the import / export to work, the generator does some pattern matching of the comments in the files to place the new imports. Just don't delete any comment that is prefixed with GENERATOR
and things will work great.