22 lines
497 B
TypeScript
22 lines
497 B
TypeScript
import { join } from "path";
|
|
import { type Plugin } from "rollup";
|
|
|
|
export default function robotsPlugin(): Plugin {
|
|
return {
|
|
name: "rollup-plugin-robots",
|
|
writeBundle(options, _) {
|
|
this.debug(options.dir || "dir undefined");
|
|
if (options.dir) {
|
|
this.fs
|
|
.writeFile(
|
|
join(options.dir, "robots.txt"),
|
|
"User-agent: *\nDisallow: /",
|
|
)
|
|
.catch((err) => {
|
|
this.error(err);
|
|
});
|
|
}
|
|
},
|
|
};
|
|
}
|