Skip to content

Commit 70da350

Browse files
authored
Merge pull request #13 from saucecodee/develop
Develop
2 parents cef0241 + 93315a3 commit 70da350

File tree

7 files changed

+67
-17
lines changed

7 files changed

+67
-17
lines changed

lib/cmd/help.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const help = {}
22

33
help.default =
44
`
5-
Build ExpressJS applications with speed and efficiency with BangaJS
5+
Build ExpressJS applications with speed and efficiency with BàngáJS
66
77
88
Usage:
@@ -71,6 +71,8 @@ Usage:
7171
Options:
7272
--force\t\tReplace file if it already exists
7373
--no-auth\t\tDo not include User and authentication files
74+
--no-dep\t\tDo not install packges
75+
--no-git\t\tDo not initialize git
7476
`
7577

7678

lib/cmd/new.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const projectFiles = [
1313
{ path: ".env", template: ".env", options: [] },
1414
{ path: ".gitignore", template: ".gitignore", options: [] },
1515
{ path: "package.json", template: ".package", options: [] },
16+
{ path: "README.md", template: ".readme", options: [] },
1617
{ path: "server.js", template: ".server", options: [] },
1718

1819
{ path: "src/config/env/dev.env.json", template: "config-env-dev", options: [] },
@@ -43,9 +44,10 @@ const projectFiles = [
4344
{ path: "src/utils/multer.js", template: "uti-multer", options: [] },
4445
{ path: "src/utils/response.js", template: "uti-response", options: [] },
4546

47+
{ path: "src/validators/", template: null, options: [] },
48+
4649
{ path: "public/", template: null, options: [] },
4750
{ path: "uploads/", template: null, options: [] },
48-
{ path: "views/", template: null, options: [] },
4951
]
5052

5153
function runCommand(command = "banga", args = []) {
@@ -90,15 +92,19 @@ module.exports = async () => {
9092
}
9193
console.log(chalk.cyan("Created project files ✅"))
9294

93-
// Run npm install
94-
console.log(chalk.bold("\nInstalling packages..."))
95-
runCommand("npm", ["install"])
96-
console.log(chalk.cyan("Packages installed ✅"))
95+
if(ARGS.dep){
96+
// Run npm install
97+
console.log(chalk.bold("\nInstalling packages..."))
98+
runCommand("npm", ["install"])
99+
console.log(chalk.cyan("Packages installed ✅"))
100+
}
97101

98-
// Initialize Git
99-
console.log(chalk.bold("\nInitialising git..."))
100-
runCommand("git", ["init"])
101-
console.log(chalk.cyan("Git initialised ✅"))
102+
if(ARGS.git){
103+
// Initialize Git
104+
console.log(chalk.bold("\nInitialising git..."))
105+
runCommand("git", ["init"])
106+
console.log(chalk.cyan("Git initialised ✅"))
107+
}
102108

103109
// All set
104110
console.log(chalk.cyan("\n\nYou're good to go! ✅\n"))

lib/cmd/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ const chalk = require("chalk")
22
const package = require("../../package.json")
33

44
module.exports = () => {
5-
console.log(`${chalk.yellowBright("\nBangaJS")} v${package.version}\n`)
5+
console.log(`${chalk.yellowBright("\nBàngáJS")} v${package.version}\n`)
66
}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
node_modules
22

3+
# production env files
34
.env
4-
src/config/config.json
5+
src/config/env/prod.env.json
56

6-
# exclude everything
7+
# exclude files in uploads
78
uploads/*
8-
9-
# exception to the rule
109
!uploads/.gitkeep

lib/templates/project/.readme.ejs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# <%= $projectName %>
2+
3+
This project was generated with [BàngáJS](https://bangajs.netlify.app/) v<%= $version %>.
4+
5+
## Installation
6+
7+
1. Install dependencies - `npm install`
8+
9+
2. Create a new file `.env` if it doesn't exist and copy the contents of `env.dev` into it to be able to run your server on production environment.
10+
11+
3. Then you need to provide values for the configuration env files at the `src/config/env directory`.
12+
13+
14+
## Running the server locally
15+
16+
1. Start up the server - Run `npm start` | `npm run dev`
17+
18+
2. Server should be running on http://localhost:2020/ by default
19+
20+
## Code scaffolding
21+
22+
Run `banga generate <type> <name>` to generate a new file types. Visit [here](https://bangajs.netlify.app/#banga-generate) for more info.
23+
24+
## Routes
25+
26+
| Routes | Description | Auth roles |
27+
| -----------------------------------------------------------------|----------------------------------------- | ------------------------------------- |
28+
| [POST] &nbsp; /api/auth/sign-up | Create a new account | none
29+
| [POST] &nbsp; /api/auth/sign-in | User sign in | none
30+
| [POST] &nbsp; /api/auth/request-email-verification | Resend verfication email | none
31+
| [POST] &nbsp; /api/auth/verify-email | Email verification | none
32+
| [POST] &nbsp; /api/auth/request-password-reset | Sends a request password email | none
33+
| [POST] &nbsp; /api/auth/reset-password | Reset password form handler | none
34+
| [POST] &nbsp; /api/users | Create a user | User
35+
| [GET] &nbsp; /api/users | Get all users | Admin
36+
| [GET] &nbsp; /api/users/:userId | Get a user | User
37+
| [UPDATE] &nbsp; /api/users/::userId | Update a user | User
38+
| [DELETE] &nbsp; /api/users/:userId | Delete a user | Admin

lib/utils/app.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ const yargs = require("yargs-parser")
22
const app = {}
33
const { cmdAlias } = require("./../config")
44
const help = require("./../cmd/help")
5+
const package = require("./../../package.json")
56

67
const options = {
78
new: {
89
auth: true,
10+
dep: true,
11+
force: false,
12+
git: true
913
},
1014
generate: {
1115
auth: false,
@@ -20,7 +24,7 @@ const options = {
2024
root: false,
2125
route: true,
2226
service: true,
23-
update: true,
27+
update: true
2428
}
2529
}
2630

@@ -32,6 +36,7 @@ app.parse = () => {
3236
if (!cmdAlias[cmd]) throw new Error(`banga: "${cmd}" is not a recognised command or alias`)
3337

3438
args.$cmd = cmdAlias[cmd]
39+
args.$version = package.version
3540

3641
process.ARGS = { ...options[args.$cmd], ...args }
3742
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)