diff --git a/next.config.js b/next.config.js index a79adb6d..d7a8ff46 100644 --- a/next.config.js +++ b/next.config.js @@ -1,7 +1,6 @@ const withCss = require('@zeit/next-css') const withSass = require('@zeit/next-sass') const { range } = require('lodash') -const fs = require('fs').promises function createPath(page, map, query, items) { return items.reduce((acc, path) => { @@ -24,8 +23,6 @@ module.exports = withCss(withSass({ // secondSecret: process.env.SECOND_SECRET // Pass through env variables }, exportPathMap: async (defaultPathMap, { dev }) => { - await fs.copyFile('./public/robots.txt', './dist/robots.txt') - if (dev) { return null } diff --git a/package.json b/package.json index 23b371c1..f9338c92 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,8 @@ "scripts": { "start": "NODE_ENV=production node src/server.js", "dev": "node src/server.js", - "next": "next", - "build": "next build", - "export": "npm run build && next export -o dist && npm run sitemap && npm run feed", + "build": "next build && next export -o dist && npm run sitemap && npm run feed && npm run robots-txt", + "robots-txt": "node scripts/robots-txt.js", "sitemap": "node scripts/sitemap.js", "feed": "node scripts/feed.js", "test": "mocha --compilers js:babel-register" diff --git a/scripts/robots-txt.js b/scripts/robots-txt.js new file mode 100644 index 00000000..046d9580 --- /dev/null +++ b/scripts/robots-txt.js @@ -0,0 +1,5 @@ +const fs = require('fs').promises; + +(async () => { + await fs.copyFile('public/robots.txt', 'dist/robots.txt') +})()