1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
import fs from 'fs' import dotenv from 'dotenv' dotenv.config() let robotsTxt = '' if (process.env.IS_MIRROR) { robotsTxt += `User-agent: *\nDisallow: /\n` } await fs.promises.writeFile( 'static/robots.txt', robotsTxt, { encoding: 'utf8' } )