Node.js CLI app that is responsible for scaffolding React/Next.js project with headless CMS, data fetching, styling, reusable components, and pre-commit hooks.
- inquirer for complex input prompts.
- arg to parse our CLI arguments
- listr for progress lists.
- ncp Asynchronous recursive file & directory copying.
- esm ECMAScript module loader.
- Installing
Next.js
app. - Restructuring files system.
- Add layouts and generic components.
- Setup styling library with
SASS
for typography, colors, and media queries. - Add
TailwindCSS
as a utility-first CSS framework. - Setup
Contentful CMS
by installing dependencies, creating GraphQl client, automating types generation for content models usinggraphql-codegen
, and adding utilities to map rich text JSON formatted to reusable typography components. - Setup path aliases in
tsconfig
. - Setup
eslint
and pre-commit hooks withHusky
. - Create env variables public config using
dotenv
.
-y / --yes
: Skip prompts and init project with TS and CTF-t / --typescript
: Init Typescript-c / --contentful
: Init Contentful
-
bin :
— CLI entry point
-
src :
— CLI logic
-
templates :
— Language-specific templates
Clone this repo, then cd
into it and run npm link
to create a global symlink to this project.
The output should be something like this:
[ '/usr/local/Cellar/node/11.6.0/bin/node',
'/Users/sobhi_alkhuder/dev/create-sl-app/bin/create-sl-app' ]
Note: paths will be different for you depending on where your project lies and where you have Node.js
installed.
Then you will be able to run create-sl-app
globally.
- Create
.env.local
file and add the needed credentials. - Add fonts to the public folder and load them in global.css.
MIT