Skip to content

Commit

Permalink
feat: add download dockerfile step
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuhanW committed Jan 18, 2024
1 parent 7922a66 commit 0c5c2c8
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/saofile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { formatFiles } from "@Helper/prettier";
import chalk from "chalk";
import { exec } from "child_process";
import { prompt } from "enquirer";
import fs from "fs";
import fetch from "node-fetch";
import path from "path";
import { promisify } from "util";
Expand Down Expand Up @@ -382,7 +383,27 @@ const saoConfig: GeneratorConfig = {
tips.preInstall();
},
async completed(saoInstance) {
const { debug, apiMode } = saoInstance.opts.extras;
const { debug, apiMode, projectType } = saoInstance.opts.extras;

/**
* Download Dockerfile
*/
if (projectType.startsWith("refine")) {
const folder = projectType.split("-")[1];

fetch(
`https://raw.githubusercontent.com/refinedev/dockerfiles/main/dockerfiles/${folder}/Dockerfile`,
).then((r) => {
r.blob().then((b) =>
b.text().then((t) => {
fs.writeFileSync(
path.join(saoInstance.outDir, "Dockerfile"),
t,
);
}),
);
});
}

/**
* Format generated project
Expand Down

0 comments on commit 0c5c2c8

Please sign in to comment.