Skip to content

Instantly share code, notes, and snippets.

@Comamoca
Last active February 3, 2023 21:31
Show Gist options
  • Save Comamoca/895f6dace1065ad02621e3cb420f685d to your computer and use it in GitHub Desktop.
Save Comamoca/895f6dace1065ad02621e3cb420f685d to your computer and use it in GitHub Desktop.
import {
yellow,
} from "https://deno.land/x/boost_cli@0.0.1/utils.ts?source";
import $ from "https://deno.land/x/dax@0.23.0/mod.ts";
import {
text,
toggle,
} from "https://raw.githubusercontent.com/Comamoca/boost/main/clikit.ts";
const name = "Lation Stack";
console.log(`
_/ _/ _/ _/_/_/ _/ _/
_/ _/_/_/ _/_/_/_/ _/_/ _/_/_/ _/ _/_/_/_/ _/_/_/ _/_/_/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/_/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/_/_/ _/_/_/ _/_/ _/ _/_/ _/ _/ _/_/_/ _/_/ _/_/_/ _/_/_/ _/ _/
Version 0.1.0
by Comamoca
`);
alert(`Welcome to ${name}✨.\nPlease start to pless Enter🚀`);
export const dry_run = true;
if (dry_run) {
console.warn(`${name} s now dry running...🏜`);
}
const install = async (pkg: string) => {
console.log(yellow(`Install ${pkg}`));
await $("pipx install " + pkg);
};
const install_queue = [];
console.log(yellow("Install pipx"));
await $`pip install pipx`;
install_queue.push(install("black"));
if (Deno.build.os == "windows") {
// windows
console.log(yellow("Sorry, pyre is can't work on windows"));
console.log(yellow("Install to mypy instead..."));
install_queue.push(await install("mypy"));
} else {
install_queue.push(install("pyre-check"));
}
await Promise.all(
install_queue,
);
const poetry_install_url = "https://install.python-poetry.org";
const pwsh_script_url =
"https://gist.githubusercontent.com/Comamoca/8dbecc2d2c84c94b2f8939256750d7e3/raw/dbf06fb816fd4d06dc05e68ca3189f0d8c67702c/set_path.ps1";
async function dl(url: string) {
const data = await fetch(url);
const script = await data.text();
return script;
}
const encoder = new TextEncoder();
const install_script = "./poetry_install.py";
try {
// const script = await download(poetry_install_link)
const script = await dl(poetry_install_url);
await Deno.writeFile(install_script, encoder.encode(script));
if (Deno.build.os == "windows") {
// windows
await $`py ${install_script}`;
} else {
await $`python3 ${install_script}`;
}
} catch (e) {
console.error("Poetry install script can not download💥");
console.error(e);
Deno.exit(0);
} finally {
await Deno.remove(install_script);
}
const setup = await toggle("Install is done. Would you setup project now?");
if (setup && !(Deno.build.os == "windows")) {
const prj_name = await text("project name?");
await $`poetry new ${prj_name}`;
await $`pyre init`;
console.log(yellow("Instration & setup is done. Happy Hacking✨"));
} else {
console.log(yellow("Instration is done. Happy Hacking✨\n"));
console.log("If you use Windows, you must to set PATH. see under website.");
console.log("JP: https://zenn.dev/pejpo/articles/5080662546764c");
console.log(
"EN: https://learn.microsoft.com/en-us/powershell/scripting/samples/managing-current-location?view=powershell-7.3",
);
Deno.exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment