Setting up a NextJS project can be just cumbersome enough to distract you from the work at hand. Sometimes, during that process, things can go wrong and now you're stuck debugging an environment that you've set up many times before. What if you could set up a complex, ready to dev project with one command (and a few --flags)? Now you can!
Underneath the hood, leopard-cli is built on oclif and uses shelljs for universal shell commands. When you issue the most basic command --
leopard next project-name -- a new project directory will be created with the following folder structure:
Adding flags to the basic command will change the folder structure to support the specified configuration. For example, if you run
leopard next project-name --css=stylus --server the folder structure will now look like this:
Make sure to have NodeJS installed on your machine.
To check if Node is installed, run:
To install leopard-cli as a global command:
npm i -g leopard-cli
Set up a NextJS project with custom settings. Creates all necessary directories and files to facilitate any options specified via command flags.
USAGE $ leopard next project-name OPTIONS -s, --server Preload and server your project from a custom express server. -c, --css=stylus Preload your project with sass, less or stylus. -g, --googleFont=Roboto:200,400,800+Poppins:400,800 Create a custom _app.js page with Google fonts preloaded at specified weights using a link tag. -n, --normalize Create a custom _app.js page and setup CSS modules to facilitate normalize.css import on _app.js page. -m, -modules Set up CSS modules in a next.config.js file.
See code: src\commands\next.js
display help for leopard
USAGE $ leopard help [COMMAND] ARGUMENTS COMMAND command to show help for OPTIONS --all see all commands in CLI
See code: @oclif/plugin-help
My journey into coding started about 1.5 years ago when I needed a website to showcase music that I had been producing. I wasn't satisfied with Wix or Squarespace at the time and decided that I should learn a little bit of web development so that I could put up a unique website that complimented my music. This lead me down a ginormous rabbit hole. In the following year, I would spend more time learning HTML, CSS, JS, data structures, databases, servers, JS frameworks, testing frameworks libraries, webpack, etc... than in my studio creating music. Currently, I am in the process of switching careers to a developer role and freelancing projects on the side. I still wake up, everyday, excited to learn something new!
???? If you've actually read this far, thank you!
© 2019 Tony Pettigrew
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.