Skip to content

Commit

Permalink
feat: developers README generator
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoulloao committed Apr 9, 2022
1 parent 0e1704c commit 53a5379
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
43 changes: 43 additions & 0 deletions src/README-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<p align="center"><img src="https://bananasplit.js.org/assets/images/bananasplit-logo.png" width="100"></p>
<h1 style="margin:25px" align="center"><a href="https://bananasplit.js.org/">Bananasplit-js</a> / @project-name</h1>

<p align="center">
<img src="https://img.shields.io/badge/language-typescript-blue?logo=typescript">
<img src="https://img.shields.io/badge/server-express-lightgray">
<!-- <img src="https://img.shields.io/badge/graphql-apollo-blue?logo=graphql"> -->
<img src="https://img.shields.io/badge/orm-sequelize-blue">
<img src="https://img.shields.io/badge/test-jest-green?logo=jest">
<img src="https://img.shields.io/badge/version-v2.0.0-orange">
<img src="https://img.shields.io/badge/license-MIT-blue">
</p>

# Start to develop!

### 1. Build the stack
**Add your database access to `.env`**
<sub><sup><a href="https://github.com/bananasplit-js/bananasplit-client/blob/master/README.md" target="_blank"> (example)</a></sup></sub>

```bash
yarn build:stack | npm run build:stack
```

### 2. Run the development server :rocket:&nbsp;
```bash
yarn dev | npm run dev
```

**Read more about configuration:** https://bananasplit.js.org/docs/#config

<a href="http://gitpod.io/#https://github.com/buskerone/nocv-backend/" target="_blank">
<img src="https://gitpod.io/button/open-in-gitpod.svg" alt="">
</a>

# Read the docs

### Check the documentation: https://bananasplit.js.org/docs

# License
**Bananasplit-js** is licensed under **[MIT](https://github.com/bananasplit-js/bananasplit-js/blob/main/template/LICENSE)**

---
![label](https://img.shields.io/badge/2022-bananasplit--js-yellow?style=for-the-badge)
28 changes: 27 additions & 1 deletion src/lib/create-project.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/

import shell from 'shelljs'
import path from "path"
import fs from "fs"

import chalk from 'chalk'
import boxen from 'boxen'
Expand All @@ -18,6 +20,9 @@ export default function ({ action, project_name, apollo=false, git }) {
switch (action) {
case 'new':
if (project_name) {
project_name = project_name.toLowerCase()

// Just an empty space at the bgginning
console.log()

const branch = !apollo ? 'main/template':'main/apollo'
Expand All @@ -28,12 +33,33 @@ export default function ({ action, project_name, apollo=false, git }) {
shell.cd(project_name)

shell.mv('.env.example', '.env')
shell.exec('echo "" > README.md')
shell.rm('-rf', '.git')
shell.rm('-rf', '.github')
shell.rm("public/.gitignore")
shell.rm("src/providers/addons/.gitignore")

try {
// Write README for developers
let readmeTemplateData = fs.readFileSync(
path.resolve(__dirname, "../README-template.md"),
{ encoding:'utf8', flag:'r' }
)

// Replace project name
readmeTemplateData = readmeTemplateData.replace("@project-name", project_name)

// Write changes into new README.md in project directory
fs.writeFileSync(
path.resolve(process.cwd(), "README.md"),
readmeTemplateData
)

} catch (e) {
console.log(chalk.red("\nCould not create README.md file\n"))
console.log(e)
}

// Create main branch, then commit
if (git) {
shell.exec(`git init`)
shell.exec('git checkout -b main')
Expand Down

0 comments on commit 53a5379

Please sign in to comment.