doing stuff l8r

This commit is contained in:
hexlocation's laptop (asiago) 2024-03-29 09:15:24 -04:00
parent 4ea74c0cb1
commit 57016f4f3f
13 changed files with 28 additions and 7 deletions

View file

@ -6,9 +6,9 @@ RUN yarn global add typescript
RUN tsc
RUN mkdir /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/default_templates /app/default_templates
RUN cp -r /tmp/data/default_templates /app/default_templates
COPY ./scripts/docker_run.sh /app/run.sh
WORKDIR /app
CMD ["/app/run.sh"]

View file

@ -4,13 +4,13 @@ import ejs from "ejs";
import fs from "fs";
import path from "path";
import jsdom from "jsdom";
import config from "./config.json"
import config from "./data/config.json"
let app = express();
// set view engine to 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 Post = {
@ -29,7 +29,7 @@ async function htmlstripper(html: string){
// returns Post array
async function contentScan(){
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"))
for (const file of files) {
let postPath = path.join(postsDir, file)

View file

@ -1,15 +1,36 @@
# 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
echo '-------------'
echo 'Posts directory is empty, copying default...'
echo '-------------'
cp -r default_posts/* posts
cp -r default_posts/* data/posts
fi
if [ -z "$(find templates -mindepth 1 -maxdepth 1)" ]; then
echo '-------------'
echo 'Template directory is empty, copying default...'
echo '-------------'
cp -r default_templates/* templates
cp -r default_templates/* data/templates
fi