Closed vaporvee closed 2 months ago
Nevermind got it fixed by exporting the env variables instead of using an .env
. Also had to edit the public-notion-copier.ts
to make it build because it couldn't get the path correctly. Here is the code i used if someone else ever has that issue:
import fs from 'node:fs'
import path from 'path'
import { fileURLToPath } from 'url'
import type { AstroIntegration } from 'astro'
const copyFiles = (src: string, dest: string) => {
const entries = fs.readdirSync(src, { withFileTypes: true })
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest, { recursive: true })
}
for (let entry of entries) {
const srcPath = path.join(src, entry.name)
const destPath = path.join(dest, entry.name)
if (entry.isDirectory()) {
copyFiles(srcPath, destPath)
} else {
if (!fs.existsSync(destPath)) {
fs.copyFileSync(srcPath, destPath)
}
}
}
}
export default (): AstroIntegration => ({
name: 'public-notion-copier',
hooks: {
'astro:build:done': async ({ dir }) => {
const dirPath = fileURLToPath(dir)
const outDir = path.join(dirPath, 'notion')
if (!fs.existsSync(outDir)) {
fs.mkdirSync(outDir, { recursive: true })
}
copyFiles('public/notion', outDir)
console.log("Finished copying notion files to root!")
},
},
})
Thank you for reporting the issue and giving the great script. I will get your code into the production code.
I will also maybe make a pr tomorrow for google maps embeds. My code currently only supports one url scheme idk if i'll find a solution for that
I can run the dev environment with
npm run dev
and everything runs fine butnpm run build
says its missing the api key. When I'm hardcoding it (for testing) it says the api would be deprecated. And this is one of my favourite github projects thank you so much!