diff --git a/package.json b/package.json index 6f44983..34531dc 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,12 @@ "name": "projects-repository", "version": "0.1.0", "private": true, + "type": "module", + "scripts": { "dev": "next dev --turbopack", - "build": "next build", + "move-project-images": "node scripts/move-project-images.js", + "build": "npm run move-project-images && next build", "start": "next start", "lint": "next lint", "check": "prettier --check '{src,tests}/**/*.{css,scss,html,js,tsx}'", diff --git a/public/project-images/another-project/index.md b/public/project-images/another-project/index.md new file mode 100644 index 0000000..01fbd48 --- /dev/null +++ b/public/project-images/another-project/index.md @@ -0,0 +1,12 @@ +--- +id: "another-project" +title: "Another Project" +description: "This is a description of another project that showcases my skills in React Native and AR technology." +author: "Matthew MacRae-Bovell" +tags: + - Example Tag + - React Native + - AR +hasUI: true +githubUrl: "https://github.com/sarahchen/campus-nav" +--- diff --git a/public/project-images/smart-campus-app/index.md b/public/project-images/smart-campus-app/index.md new file mode 100644 index 0000000..f23655b --- /dev/null +++ b/public/project-images/smart-campus-app/index.md @@ -0,0 +1,16 @@ +--- +id: "smart-campus-app" +title: "Smart Campus Navigation App" +description: "A React Native mobile app that helps students navigate Carleton's campus using AR and real-time location services." +author: "Sarah Chen" +tags: + - React Native + - AR + - Mobile + - TypeScript + - Firebase +hasUI: true +previewImageUrl: "./placeholder.svg" +githubUrl: "https://github.com/sarahchen/campus-nav" +liveUrl: "https://campus-nav.app" +--- diff --git a/scripts/move-project-images.js b/scripts/move-project-images.js new file mode 100644 index 0000000..9811575 --- /dev/null +++ b/scripts/move-project-images.js @@ -0,0 +1,42 @@ +import fs from "fs"; +import path from "path"; +import { fileURLToPath } from "url"; + +// Get the current file URL and convert it to a path +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + + +const srcDir = path.join(__dirname, "..", "content", "projects"); +const destDir = path.join(__dirname, "..", "public", "project-images"); + +function copyImages(srcPath) { + fs.readdir(srcPath, (err, projects) => { + if (err) throw err; + + projects.forEach((project) => { + const projectPath = path.join(srcPath, project); + + const srcImagePath = path.join(projectPath, "index.md"); + const destImagePath = path.join( + destDir, + project, + "index.md", + ); + + // Check if image.png exists + if (fs.existsSync(srcImagePath)) { + // Create destination directory if it doesn't exist + fs.mkdirSync(path.dirname(destImagePath), { recursive: true }); + + // Copy the image + fs.copyFile(srcImagePath, destImagePath, (err) => { + if (err) throw err; + console.log(`Copied: ${srcImagePath} to ${destImagePath}`); + }); + } + }); + }); +} + +copyImages(srcDir); \ No newline at end of file