doing stuff l8r
This commit is contained in:
parent
4ea74c0cb1
commit
57016f4f3f
13 changed files with 28 additions and 7 deletions
|
@ -6,9 +6,9 @@ RUN yarn global add typescript
|
||||||
RUN tsc
|
RUN tsc
|
||||||
RUN mkdir /app
|
RUN mkdir /app
|
||||||
RUN cp -r /tmp/build/* /app
|
RUN cp -r /tmp/build/* /app
|
||||||
RUN cp -r /tmp/default_posts /app/default_posts
|
RUN cp -r /tmp/data/default_posts /app/default_posts
|
||||||
RUN cp -r /tmp/node_modules /app
|
RUN cp -r /tmp/node_modules /app
|
||||||
RUN cp -r /tmp/default_templates /app/default_templates
|
RUN cp -r /tmp/data/default_templates /app/default_templates
|
||||||
COPY ./scripts/docker_run.sh /app/run.sh
|
COPY ./scripts/docker_run.sh /app/run.sh
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
CMD ["/app/run.sh"]
|
CMD ["/app/run.sh"]
|
||||||
|
|
6
index.ts
6
index.ts
|
@ -4,13 +4,13 @@ import ejs from "ejs";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import jsdom from "jsdom";
|
import jsdom from "jsdom";
|
||||||
import config from "./config.json"
|
import config from "./data/config.json"
|
||||||
|
|
||||||
let app = express();
|
let app = express();
|
||||||
|
|
||||||
// set view engine to ejs
|
// set view engine to ejs
|
||||||
app.set("view engine", "ejs")
|
app.set("view engine", "ejs")
|
||||||
app.set('views', path.join(__dirname, 'templates'))
|
app.set('views', path.join(__dirname, 'data','templates'))
|
||||||
|
|
||||||
// type for post object
|
// type for post object
|
||||||
type Post = {
|
type Post = {
|
||||||
|
@ -29,7 +29,7 @@ async function htmlstripper(html: string){
|
||||||
// returns Post array
|
// returns Post array
|
||||||
async function contentScan(){
|
async function contentScan(){
|
||||||
let posts: Post[] = []
|
let posts: Post[] = []
|
||||||
let postsDir = path.join(__dirname, "posts")
|
let postsDir = path.join(__dirname, 'data',"posts")
|
||||||
let files = await fs.readdirSync(postsDir).filter((name: string) => name.toLowerCase().endsWith(".md"))
|
let files = await fs.readdirSync(postsDir).filter((name: string) => name.toLowerCase().endsWith(".md"))
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
let postPath = path.join(postsDir, file)
|
let postPath = path.join(postsDir, file)
|
||||||
|
|
|
@ -1,15 +1,36 @@
|
||||||
# I'm so bad at bash scripting
|
# I'm so bad at bash scripting
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
____ ______________ __
|
||||||
|
/ __ \/ _/ ___/ ___// /
|
||||||
|
/ / / // / \__ \\__ \/ /
|
||||||
|
/ /_/ // / ___/ /__/ /_/
|
||||||
|
/_____/___//____/____(_)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
if [ ! -d data ]; then
|
||||||
|
echo '-------------'
|
||||||
|
echo 'Data folder not found. Did you set up a volume?'
|
||||||
|
echo '-------------'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ ! -f data/config.json ]; then
|
||||||
|
echo '-------------'
|
||||||
|
echo 'Config file not found. Please create one.'
|
||||||
|
echo '-------------'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
if [ -z "$(find posts -mindepth 1 -maxdepth 1)" ]; then
|
if [ -z "$(find posts -mindepth 1 -maxdepth 1)" ]; then
|
||||||
echo '-------------'
|
echo '-------------'
|
||||||
echo 'Posts directory is empty, copying default...'
|
echo 'Posts directory is empty, copying default...'
|
||||||
echo '-------------'
|
echo '-------------'
|
||||||
cp -r default_posts/* posts
|
cp -r default_posts/* data/posts
|
||||||
fi
|
fi
|
||||||
if [ -z "$(find templates -mindepth 1 -maxdepth 1)" ]; then
|
if [ -z "$(find templates -mindepth 1 -maxdepth 1)" ]; then
|
||||||
echo '-------------'
|
echo '-------------'
|
||||||
echo 'Template directory is empty, copying default...'
|
echo 'Template directory is empty, copying default...'
|
||||||
echo '-------------'
|
echo '-------------'
|
||||||
cp -r default_templates/* templates
|
cp -r default_templates/* data/templates
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue