-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
2,154 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ dist/ | |
**/build/ | ||
.gradle/ | ||
run/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,19 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build with Docker | ||
- name: Build docs | ||
run: cd docs && ./build.sh | ||
|
||
- name: Deploy docs | ||
#if: github.ref == 'refs/heads/master' | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: docs/dist | ||
|
||
- name: Build mod | ||
run: ./build.sh | ||
|
||
|
||
- name: Set deployment variables | ||
id: variables | ||
uses: actions/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ run/ | |
tools/.cached-pages/ | ||
tools/.debug/ | ||
.env | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import * as R from 'ramda'; | ||
import * as glob from 'glob'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as mkdirp from 'mkdirp'; | ||
import * as jsyaml from 'js-yaml'; | ||
import * as handlebars from 'handlebars'; | ||
import { promisify } from 'util'; | ||
|
||
const baseDir = __dirname; | ||
const distDir = path.join(__dirname, 'dist'); | ||
const globAsync = promisify(glob); | ||
|
||
const readData = async (): Promise<{}> => { | ||
return await R.reduce( | ||
async (acc, filePath) => { | ||
const contents = await fs.promises.readFile(filePath, 'utf-8'); | ||
const data = jsyaml.safeLoad(contents) as object; | ||
return { ...(await acc), ...data }; | ||
}, | ||
{}, | ||
await globAsync(path.join(baseDir, 'src/data/*.yaml')) | ||
); | ||
}; | ||
|
||
const render = async () => { | ||
const hbs = handlebars.create(); | ||
|
||
// read yaml data | ||
const data = await readData(); | ||
|
||
// register partials | ||
await R.forEach(async (filePath) => { | ||
const fileName = path.basename(filePath, '.html'); | ||
hbs.registerPartial(fileName, await fs.promises.readFile(filePath, 'utf-8')); | ||
}, await globAsync(path.join(baseDir, 'src/partials/*.html'))); | ||
|
||
// render handlebars templates | ||
await fs.promises.mkdir(distDir) | ||
await R.forEach(async (filePath) => { | ||
const contents = await fs.promises.readFile(filePath, 'utf-8'); | ||
const rendered = hbs.compile(contents)(data); | ||
|
||
const distFilePath = path.join(distDir, path.relative('src', filePath)); | ||
await mkdirp(path.dirname(distFilePath)); | ||
await fs.promises.writeFile(distFilePath, rendered, 'utf-8'); | ||
}, await globAsync(path.join(baseDir, 'src/*.md'))); | ||
|
||
await fs.promises.copyFile(path.join(baseDir, 'src/index.html'), path.join(distDir, 'index.html')); | ||
}; | ||
|
||
render(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM node:10-alpine as build | ||
WORKDIR /app | ||
|
||
COPY package*.json . | ||
RUN npm ci | ||
|
||
COPY . . | ||
RUN npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
docker build . -t luckyblock-docs | ||
container_id=$(docker create luckyblock-docs) | ||
docker cp $container_id:/app/dist/. ./dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import * as R from 'ramda'; | ||
import * as glob from 'glob'; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as mkdirp from 'mkdirp'; | ||
import * as jsyaml from 'js-yaml'; | ||
import * as handlebars from 'handlebars'; | ||
import { promisify } from 'util'; | ||
|
||
const baseDir = __dirname; | ||
const distDir = path.join(__dirname, 'dist'); | ||
const globAsync = promisify(glob); | ||
|
||
const readData = async (): Promise<{}> => { | ||
return await R.reduce( | ||
async (acc, filePath) => { | ||
const contents = await fs.promises.readFile(filePath, 'utf-8'); | ||
const data = jsyaml.safeLoad(contents) as object; | ||
return { ...(await acc), ...data }; | ||
}, | ||
{}, | ||
await globAsync(path.join(baseDir, 'src/data/*.yaml')) | ||
); | ||
}; | ||
|
||
const render = async () => { | ||
const hbs = handlebars.create(); | ||
|
||
// read yaml data | ||
const data = await readData(); | ||
|
||
// register partials | ||
await R.forEach(async (filePath) => { | ||
const fileName = path.basename(filePath, '.html'); | ||
hbs.registerPartial(fileName, await fs.promises.readFile(filePath, 'utf-8')); | ||
}, await globAsync(path.join(baseDir, 'src/partials/*.html'))); | ||
|
||
await fs.promises.mkdir(distDir) | ||
|
||
// render handlebars templates | ||
await R.forEach(async (filePath) => { | ||
const contents = await fs.promises.readFile(filePath, 'utf-8'); | ||
const rendered = hbs.compile(contents)(data); | ||
|
||
const distFilePath = path.join(distDir, path.relative('src', filePath)); | ||
await mkdirp(path.dirname(distFilePath)); | ||
await fs.promises.writeFile(distFilePath, rendered, 'utf-8'); | ||
}, await globAsync(path.join(baseDir, 'src/*.md'))); | ||
|
||
await fs.promises.copyFile(path.join(baseDir, 'src/index.html'), path.join(distDir, 'index.html')); | ||
}; | ||
|
||
render(); |
Oops, something went wrong.