Skip to content

Commit

Permalink
Block robots on dev
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed May 8, 2024
1 parent 20efb62 commit 2d530e2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM node:20.12.1-slim
WORKDIR /dxd
COPY . .
RUN rm package-lock.json
RUN which npm
RUN npm install
RUN npm run build
EXPOSE 3000
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ FROM node:20.12.1-slim
WORKDIR /dxd
COPY . .
RUN rm package-lock.json
RUN which npm
RUN npm install
RUN npm run build
RUN npm run build_dev
EXPOSE 3000
ENTRYPOINT ["npm", "run", "dev"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"type": "module",
"scripts": {
"build": "remix vite:build",
"build_dev": "NODE_ENV=development remix vite:build",
"dev": "node ./server.js",
"start": "cross-env NODE_ENV=production node ./server.js",
"typecheck": "tsc",
Expand Down
12 changes: 9 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import tsconfigPaths from "vite-tsconfig-paths";
import SiteMap from "vite-plugin-sitemap";
import { chapterMeta } from "./app/data/chapterMeta";

const CHAPTERS = Object.keys(chapterMeta).map(
(chapter) => `/chapters/${chapter}`
);
const CHAPTERS = Object.keys(chapterMeta).map((chapter) => {
return `/chapters/${chapter}`;
});

const robotOption = {
userAgent: "*",
[process.env.NODE_ENV === "production" ? "allow" : "disallow"]: "/",
};

export default defineConfig({
plugins: [
Expand All @@ -25,6 +30,7 @@ export default defineConfig({
"/prototypes/brooks_visualization/lib/empty-example",
],
dynamicRoutes: ["/about", ...CHAPTERS],
robots: [robotOption],
}),
],
ssr: {
Expand Down

0 comments on commit 2d530e2

Please sign in to comment.