Skip to content

Commit

Permalink
Added script for copying robots file into dist
Browse files Browse the repository at this point in the history
  • Loading branch information
GPeaky committed Jun 6, 2024
1 parent 04327eb commit e958710
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions copy-robots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Todo: Search an easy way to do this with vite

import fs from "fs";
import path from "path";

const __dirname = path.dirname(new URL(import.meta.url).pathname);

const src = path.resolve(__dirname, "public", "robots.txt");
const dest = path.resolve(__dirname, "dist", "robots.txt");

fs.copyFile(src, dest, (err) => {
if (err) {
console.error("Error copiando robots.txt:", err);
} else {
console.log("robots.txt copiado a dist/");
}
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"scripts": {
"dev": "astro dev",
"build": "astro check && astro build",
"build": "astro build && node copy-robots.js",
"astro": "astro"
},
"dependencies": {
Expand Down

0 comments on commit e958710

Please sign in to comment.