Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI Implementation #292

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/lib
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["oclif", "oclif-typescript"]
}
30 changes: 0 additions & 30 deletions .eslintrc.js

This file was deleted.

12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/.next
/node_modules
/.vs
.now
*-debug.log
*-error.log
/.nyc_output
/dist
/lib
/package-lock.json
/tmp
node_modules
7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

158 changes: 121 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,144 @@
# **Nitro** - Next.js, Material UI, Auth0 and Typescript
# Nitro

![GitHub stars](https://img.shields.io/github/stars/williamluke4/nitro.svg?style=for-the-badge)
![GitHub issues](https://img.shields.io/github/issues/williamluke4/nitro.svg?style=for-the-badge)
[![Beerpay](https://beerpay.io/williamluke4/Nitro/badge.svg?style=beer)](https://beerpay.io/williamluke4/Nitro)
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/nitro.svg)](https://npmjs.org/package/nitro)
[![Downloads/week](https://img.shields.io/npm/dw/nitro.svg)](https://npmjs.org/package/nitro)
[![License](https://img.shields.io/npm/l/nitro.svg)](https://github.com/williamluke4/nitro/blob/master/package.json)

![NMST](nitro.gif)
Creates NextJS WPAs from templates

##
- PR's are very welcome
<!-- toc -->

- Please add `.env` to `.gitignore` before adding any secrets
- [Templates](#templates)
- [Usage](#usage)
- [Commands](#commands)
<!-- tocstop -->

## Links
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->

- [Auth Setup](#auth)
- [NPM Setup](#npm)
- [YARN Setup](#yarn)
# Templates

## Auth
- [Auth0 Setup](https://github.com/atto-byte/useAuth)
- Video On [Secrets and Environment Variables in Next.js and Now](https://www.youtube.com/watch?v=pRbQcy9f5ew)
| | | |
| :-: | :-: | :-: |

## NPM

### Install and Run Dev Server
| <img src="./templates/basic/nitro.gif" alt="drawing" width="400"/>
[NextJS, Auth0, Material-UI, PWA](./templates/basic/README.md) | | |

```bash
git clone https://github.com/williamluke4/nitro.git
cd nitro
# Usage

<!-- usage -->

```sh-session
$ npm install -g @atto-byte/nitro
$ nitro COMMAND
running command...
$ nitro (-v|--version|version)
@atto-byte/nitro/0.0.2 win32-x64 node-v12.0.0
$ nitro --help [COMMAND]
USAGE
$ nitro COMMAND
...
```

<!-- usagestop -->

```sh-session
$ npm install -g @atto-byte/nitro
$ nitro COMMAND
running command...
$ nitro (-v|--version|version)
@atto-byte/nitro/0.0.1 win32-x64 node-v12.0.0
$ nitro --help [COMMAND]
USAGE
$ nitro COMMAND
...
```

<!-- usagestop -->

# Commands

<!-- commands -->

- [`nitro create [TEMPLATE]`](#nitro-create-template)
- [`nitro help [COMMAND]`](#nitro-help-command)

## `nitro create [TEMPLATE]`

nitro create basic

npm install
npm run dev
```
USAGE
$ nitro create [TEMPLATE]

### Production Build and Start
OPTIONS
-h, --help show CLI help

```bash
npm run build
npm run start
EXAMPLE
$ nitro create basic something-awesome
hello world from ./src/hello.ts!
```

## Yarn
_See code: [src\commands\create.ts](https://github.com/williamluke4/nitro/blob/v0.0.2/src\commands\create.ts)_

### Install and Run Dev Server
## `nitro help [COMMAND]`

```bash
git clone https://github.com/williamluke4/nitro.git
cd nitro
display help for nitro

yarn
yarn dev
```
USAGE
$ nitro help [COMMAND]

### Production Build and Start
ARGUMENTS
COMMAND command to show help for

```bash
yarn build
yarn start
OPTIONS
--all see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.1.0/src\commands\help.ts)_

<!-- commandsstop -->

- [`nitro create [TEMPLATE]`](#nitro-create-template)
- [`nitro help [COMMAND]`](#nitro-help-command)

## `nitro create [TEMPLATE]`

nitro create basic

```
USAGE
$ nitro create [TEMPLATE]

OPTIONS
-h, --help show CLI help

EXAMPLE
$ nitro create basic something-awesome
hello world from ./src/hello.ts!
```

_See code: [src\commands\create.ts](https://github.com/williamluke4/nitro/blob/v0.0.1/src\commands\create.ts)_

## `nitro help [COMMAND]`

display help for nitro

```
USAGE
$ nitro help [COMMAND]

ARGUMENTS
COMMAND command to show help for

OPTIONS
--all see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.1.0/src\commands\help.ts)_

<!-- commandsstop -->
5 changes: 5 additions & 0 deletions bin/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'))
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
76 changes: 0 additions & 76 deletions components/Layout/User.tsx

This file was deleted.

File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions example/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module.exports = {
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
"plugin:react/recommended",
],
env: {
node: true,
commonjs: true,
},
plugins: ["react-hooks"],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: "module", // Allows for the use of imports
},
rules: {
"react/prop-types": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
};
4 changes: 4 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.next
/node_modules
/.vs
.now
7 changes: 7 additions & 0 deletions example/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 120,
tabWidth: 2,
};
Loading