Skip to content

Commit d6d93b5

Browse files
committed
.
0 parents  commit d6d93b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2540
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
package-lock.json

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 周汉成
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<h1 align="center">
2+
boowa
3+
</h1>
4+
<p align="center"><strong> <img src="https://avatars2.githubusercontent.com/u/34954489?s=200&v=4" width="25px"/> = a fun blog generator </strong></p>
5+
6+
<br />
7+
8+
<div align="center">
9+
<!-- Stability -->
10+
<a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
11+
<img src="https://img.shields.io/badge/stability-stable-green.svg?style=flat-square"
12+
alt="API stability" />
13+
</a>
14+
15+
<!-- travis ci -->
16+
<a href="https://travis-ci.org/boowajs/boowa">
17+
<img src="https://img.shields.io/travis/boowajs/boowa.svg?style=flat-square"
18+
alt="test status" />
19+
</a>
20+
21+
<!-- npm version -->
22+
<a href="https://npmjs.org/package/boowa">
23+
<img src="https://img.shields.io/npm/v/boowa.svg?style=flat-square"
24+
alt="npm version" />
25+
</a>
26+
27+
<!-- code style -->
28+
<a href="https://github.com/feross/standard">
29+
<img src="https://img.shields.io/badge/code%20style-standard-blue.svg?style=flat-square"
30+
alt="code style: standard" />
31+
</a>
32+
</div>
33+
<br />
34+
35+
**Table of Contents**
36+
- [Themes](#Themes)
37+
- [Features](#Features)
38+
- [Quick Start](#Quick Start)
39+
- [Why my name is boowa](#Why my name is boowa)
40+
- [API](#API)
41+
42+
## Themes
43+
Let's see some boowa blogs first, will add more themes later:
44+
- [code_theme](https://boowajs.github.io/code_theme/)
45+
- [austere_theme](https://boowajs.github.io/austere_theme/)
46+
47+
## Features
48+
- __colorful:__ provide kinds of styles to take your fancy
49+
- __simple:__ few tips to play your blog
50+
- __support offline:__ keep reading even if there's no wifi
51+
- __very modern:__ works very well with async functions (node 7.6+)
52+
- __fast as lightning:__ it takes almost no time to generate a blog!
53+
54+
## Quick Start
55+
56+
1. Install boowa globally
57+
```sh
58+
npm install boowa -g
59+
```
60+
61+
2. Make a directory to generate your blog
62+
```sh
63+
mkdir myBlog && cd myBlog
64+
boowa
65+
```
66+
67+
3. Select one style from the inquiring list
68+
69+
4. Generate html files from markdown files
70+
```sh
71+
boowa build
72+
```
73+
74+
5. Install the dependencies
75+
```sh
76+
npm install
77+
```
78+
79+
6. Start a development server
80+
```sh
81+
npm run start
82+
```
83+
84+
7. then, you will see a complete blog demo
85+
86+
## Why my name is boowa
87+
boowa is built with:
88+
- [bankai](https://github.com/choojs/bankai) - 🚉 - friendly web compiler
89+
- [choo](https://choo.io/) - 🚂 4kb framework for creating sturdy frontend applications
90+
- [awoo](https://github.com/awoojs/awoo) - 🔸 declarative small site generator
91+
92+
so, boowa
93+
94+
## API
95+
96+
### `boowa`
97+
Generate a new blog app in a empty directory
98+
99+
### app structure
100+
<img src="https://github.com/boowajs/boowa/blob/master/pics/structure.png"/ width="150px">
101+
102+
Actually a choo app yeah~, but you only need to handle markdown files and `_config.json`
103+
104+
### `boowa create`
105+
<img src="https://github.com/boowajs/boowa/blob/master/pics/create.png" width="350px">
106+
107+
Run this command to generate a new markdown file contains the necessary structure, and it will build the html file automatically:
108+
109+
<img src="https://github.com/boowajs/boowa/blob/master/pics/sub_stru.png" width="150px">
110+
111+
⚠️ Put content in `markdown-body`:
112+
113+
<img src="https://github.com/boowajs/boowa/blob/master/pics/md.png" width="250px">
114+
115+
### `_config.json`
116+
This file contains metadatas like name, email etc.
117+
118+
### `boowa build`
119+
Generate new templates after you edit `_config.json` or modify your markdown files
120+
121+
### `npm run start`
122+
Start a development server
123+
124+
### `npm run build`
125+
Compile all files to dist/
126+
127+
### `boowa serve <port | 8080>`
128+
Boowa has a simple built-in server , after `npm run build && cd dist`, run this command to serve the production code.
129+
130+
### update the newest code
131+
After install the newest boowa, run `boowa` in the boowa-existed directory, this update would not rewrite the markdown files and `_config.json`.
132+
133+
### support offline locally
134+
Service-worker normally runs unlocally under https, so if you want to test the offline function, for chrome, run this command first:
135+
```sh
136+
/Applications/Google\ Chrome.app/Conts/MacOS/Google\ Chrome --user-data-dir=/tmp/foo --ignore-certificate-errors --unsafely-treat-insecure-origin-as-secure=http://localhost:port
137+
```
138+
139+
You will see `ServiceWorker registration successful with scope: http://localhost:port/` in the developer tool, if service-worker register successfully.
140+
141+
## License
142+
[MIT](https://tldrlegal.com/license/mit-license)

bin.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#! /usr/bin/env node
2+
var prompt = require('inquirer').createPromptModule()
3+
var fs = require('fs')
4+
var version = require('./package.json').version
5+
var serve = require('./serve')
6+
var log = require('./log')
7+
var action = process.argv[2]
8+
9+
if (!action) {
10+
fs.access(`${process.cwd()}/.boowatheme`, err => {
11+
if (!err) {
12+
var theme = fs.readFileSync(`${process.cwd()}/.boowatheme`, 'utf8').trim()
13+
require(`./lib/generators`)(theme, true)
14+
} else {
15+
log.info('Press ^C at any time to quit.')
16+
prompt([{
17+
type: 'list',
18+
name: 'theme',
19+
message: 'choose a blog theme',
20+
choices: [
21+
'code',
22+
'austere'
23+
]
24+
}]).then(async anwsers => {
25+
require(`./lib/generators`)(anwsers.theme)
26+
})
27+
}
28+
})
29+
} else if (action === 'build') {
30+
var theme = fs.readFileSync(`${process.cwd()}/.boowatheme`, 'utf8').trim()
31+
require(`./lib/generators/build.js`)(theme)
32+
} else if (action === 'create') {
33+
var theme = fs.readFileSync(`${process.cwd()}/.boowatheme`, 'utf8').trim()
34+
var mdName = process.argv[3]
35+
if (mdName) {
36+
require(`./lib/generators/create.js`)(mdName, theme)
37+
} else {
38+
prompt([{
39+
type: 'input',
40+
name: 'mdName',
41+
message: 'markdown file name'
42+
}]).then(async anwsers => {
43+
log.info('Press ^C at any time to quit.')
44+
require(`./lib/generators/create.js`)(anwsers.mdName, theme)
45+
})
46+
}
47+
} else if (action === 'serve') {
48+
var port = process.argv[3]
49+
serve(port)
50+
}

0 commit comments

Comments
 (0)