Skip to content

Commit c6d650c

Browse files
author
An Phan
committed
First set of working revamp
1 parent ab34a44 commit c6d650c

Some content is hidden

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

41 files changed

+808
-2894
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015"]
3+
}

.editorconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
indent_style = space
2+
indent_size = 2

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.DS_Store
2+
node_modules/
3+
dist/
4+
npm-debug.log

README.md

Lines changed: 11 additions & 460 deletions
Large diffs are not rendered by default.

app/lib/parser.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import fs from 'fs'
2+
import path from 'path'
3+
import yaml from 'js-yaml'
4+
import somebody from 'somebody'
5+
import chalk from 'chalk'
6+
7+
const opts = {
8+
root: `${process.cwd()}/awesomeness`,
9+
output: `${process.cwd()}/app/site/dist/data.js`
10+
}
11+
12+
const json = JSON.stringify(parseDir(opts.root).children)
13+
fs.writeFile(opts.output, `window.data = ${json};`, {}, err => {
14+
if (err) {
15+
console.log(chalk.red(err))
16+
return
17+
}
18+
19+
console.log(chalk.green(`Data generated at ${opts.output}.`))
20+
})
21+
22+
function parseDir(filename) {
23+
if (filename[0] === '.') {
24+
return
25+
}
26+
27+
const stats = fs.lstatSync(filename)
28+
const info = {
29+
name: path.basename(filename)
30+
}
31+
32+
if (stats.isDirectory()) {
33+
info.type = 'group'
34+
info.children = fs.readdirSync(filename).map(child => {
35+
return parseDir(`${filename}/${child}`)
36+
})
37+
38+
return info
39+
}
40+
41+
if (stats.isFile() && path.extname(filename) === '.md') {
42+
info.type = 'item'
43+
info.content = yaml.safeLoad(fs.readFileSync(filename, 'utf8'))
44+
if (info.content.author) {
45+
info.content.author = somebody.parse(info.content.author)
46+
}
47+
}
48+
49+
return info
50+
}

app/site/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Awesome Vue</title>
6+
<meta name="description" content="A curated list of awesome things related to Vue.js">
7+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
8+
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-T8Gy5hrqNKT+hzMclPo118YTQO6cYprQmhrYwIiQ/3axmI1hQomh7Ud2hPOy8SP1" crossorigin="anonymous">
9+
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'>
10+
</head>
11+
<body>
12+
<div id="app"></div>
13+
<script src="dist/data.js"></script>
14+
<script src="dist/build.js"></script>
15+
</body>
16+
</html>

0 commit comments

Comments
 (0)