@tobiastengler/create-relay-app
Version:
Easy configuration of Relay for existing projects
24 lines (23 loc) • 754 B
JavaScript
import { TaskBase } from "./TaskBase.js";
import { bold } from "../utils/index.js";
export class GenerateArtifactDirectoryTask extends TaskBase {
constructor(context) {
super();
this.context = context;
this.message = "Generate artifact directory";
}
isEnabled() {
return !!this.context.artifactPath;
}
async run() {
if (!this.context.artifactPath) {
return;
}
this.updateMessage(this.message + " " + bold(this.context.artifactPath.rel));
if (this.context.fs.exists(this.context.artifactPath.abs)) {
this.skip("Directory exists");
return;
}
await this.context.fs.createDirectory(this.context.artifactPath.abs);
}
}