@chneau/x 0.0.150 → 0.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/x +1 -1
package/package.json
CHANGED
package/x
CHANGED
|
@@ -64,4 +64,4 @@ Expecting one of '${G.join("', '")}'`);let H=`${$}Help`;return this.on(H,(Z)=>{l
|
|
|
64
64
|
`);console.log("\u2705 Git config is set")},k0=async()=>{let w=await Promise.all([".bashrc",".zshrc",".aliases",".profile"].map(async(G)=>({name:G,content:await fetch(`https://raw.githubusercontent.com/chneau/dotfiles/HEAD/${G}`).then((H)=>H.text()),isPresent:await Bun.file(`${Bun.env.HOME}/${G}`).exists()})));if(w.every((G)=>G.isPresent))console.log("\u2705 Dotfiles are installed");else console.log("\u274C Dotfiles are not installed"),console.log("\uD83D\uDD52 Installing dotfiles"),await Promise.all(w.map(async(G)=>{console.log(`\uD83D\uDD52 Installing ${G.name}`),await Bun.write(`${Bun.env.HOME}/${G.name}`,G.content),console.log(`\u2705 Installed ${G.name}`)})),console.log("\u2705 Dotfiles are installed")},S0=async()=>{if(!(await y`which docker`.nothrow().text()).includes("not found"))console.log("\u2705 Docker is installed");else console.log("\u274C Docker is not installed"),console.log("\uD83D\uDD52 Installing Docker"),await y`curl -sSL get.docker.com | sh`,console.log("\u2705 Docker is installed")},O0=async()=>{if((await y`groups`.text()).includes("docker"))console.log("\u2705 User is in docker groups");else console.log("\u274C User is not in docker groups"),console.log("\uD83D\uDD52 Adding user to docker groups"),await y`sudo usermod -aG docker $USER`.catch(()=>{}),console.log("\u2705 User is in docker groups")},E0=async()=>{let $=`${Bun.env.HOME}/.ssh/id_rsa`;if(await Bun.file($).exists())console.log("\u2705 SSH key is set");else throw console.log("\u274C SSH key is not set"),console.log(`\u26A1 Please execute this command:
|
|
65
65
|
|
|
66
66
|
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -P ""`),new Error("\u274C SSH key is not set")},f0=async()=>{if(await y`ssh -o "StrictHostKeyChecking no" git@github.com 2>&1`.nothrow().text().then(($)=>$.includes("successfully authenticated")))console.log("\u2705 SSH key is set on GitHub");else console.log("\u274C SSH key is not set on GitHub"),console.log("\uD83D\uDD52 Adding SSH key to GitHub"),await y`cat ~/.ssh/id_rsa.pub`,console.log("\u26A1 Go to https://github.com/settings/ssh/new and past the text above")},x0=async()=>{let $=await Bun.file("/etc/shells").text().then((H)=>H.split(`
|
|
67
|
-
`)),w=await y`which zsh`.nothrow().text();if($.includes(w))console.log("\u2705 Zsh is set as a valid shell");else console.log("\u274C Zsh is not set as a valid shell"),console.log("\uD83D\uDD52 Adding Zsh to /etc/shells"),await y`echo ${w} | sudo tee -a /etc/shells`,console.log("\u2705 Zsh is set as a valid shell");if((await y`cat /etc/passwd | grep "^$USER:"`.text()).includes(w))console.log("\u2705 Zsh is set as your shell");else console.log("\u274C Zsh is not set as your shell"),console.log("\uD83D\uDD52 Setting Zsh as your shell"),await y`sudo chsh -s ${w} $USER`,console.log("\u2705 Zsh is set as your shell")},$w=async()=>{await Promise.all([b0(),A0()]),await Promise.all([k0(),y0().then(()=>Promise.all([P0().then(E0).then(f0),x0(),S0().then(O0)]))])};var{$:_$}=globalThis.Bun;var ww=async()=>void await Promise.all([_$`deno fmt --use-tabs --quiet; oxlint --fix-dangerously --quiet; biome check --write --unsafe .`.nothrow(),_$`go fmt ./...`.nothrow(),_$`dotnet csharpier .`.nothrow()]);var{$:K}=globalThis.Bun;var g0=async()=>{let $=await fetch("https://raw.githubusercontent.com/chneau/dotfiles/master/bootstrap.sh").then((w)=>w.text());await K`echo ${$} | sh`.nothrow()},v0=async()=>{let $=["@biomejs/biome","http-server","live-server","fkill-cli","ungit","npm-check","tsx","npm-check-updates","nodemon","prettier","typesync","depcheck","concurrently","ts-unused-exports"];await K`bun upgrade`.nothrow(),await K`bun install --force --global ${{raw:$.join(" ")}}`.nothrow(),await K`bun update --latest --force --global`.nothrow()},u0=async()=>{await K`sudo apt install -y ${{raw:["git","curl","wget","unzip","zsh","bash"].join(" ")}}`.nothrow(),await K`sudo apt update -y`.nothrow(),await K`sudo apt upgrade -y`.nothrow(),await K`sudo apt autoremove -y`.nothrow(),await K`sudo apt autoclean -y`.nothrow()},h0=async()=>{if(!await O("brew"))await K`CI=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`.nothrow();let $=["bpytop","dive","dldash/core/docker-color-output","docker-compose","go","helm","hyperfine","kubecolor","kubectx","kubernetes-cli","lazygit","node","pipx","zsh"],w=(await K`which brew`.text().catch(()=>"")).trim()||"/home/linuxbrew/.linuxbrew/bin/brew";await K`${w} install ${{raw:$.join(" ")}}`.nothrow(),await K`${w} update`.nothrow(),await K`${w} upgrade`.nothrow(),await K`${w} cleanup`.nothrow()},Hw=async()=>{if(await o())throw new Error("You cannot run this command as root");if(!await t())throw new Error("You cannot sudo");await g0(),await u0(),await v0(),await h0(),console.log("System updated")};var{$:m0}=globalThis.Bun;var Gw=async()=>await fetch("https://registry.npmjs.org/@chneau/x/latest").then(($)=>$.json().then((w)=>w.version)).catch(()=>"UNKNOWN");var Zw=async()=>{let $=await Gw(),w=await r();if($===w){console.log(`\u2705 You are already using the latest version ${w}`);return}console.log(`\uD83D\uDD52 You are using version ${w}`);while(!0){if(console.log(`\uD83D\uDD52 Updating to version ${$}`),await m0`bun i -fg @chneau/x@${$}`.quiet().then(()=>!0).catch(()=>!1))break;await Bun.sleep(1000)}console.log(`\u2705 Updated to version ${$}`)};var l0=await r();A.name("x").description("chneau's utility CLI").version(l0);A.option("-r, --recursive [number]","Recursion level",Number.parseFloat).argument("[dir]","Directory to manage",".").action(r$);A.command("fmt").description("Format all files").action(ww);A.command("upgrade").description("Uprade x to the latest version").action(Zw);A.command("system").description("Update/install the system packages").action(Hw);A.command("doctor").description("Check the system for issues").action($w);A.parse();
|
|
67
|
+
`)),w=await y`which zsh`.nothrow().text();if($.includes(w))console.log("\u2705 Zsh is set as a valid shell");else console.log("\u274C Zsh is not set as a valid shell"),console.log("\uD83D\uDD52 Adding Zsh to /etc/shells"),await y`echo ${w} | sudo tee -a /etc/shells`,console.log("\u2705 Zsh is set as a valid shell");if((await y`cat /etc/passwd | grep "^$USER:"`.text()).includes(w))console.log("\u2705 Zsh is set as your shell");else console.log("\u274C Zsh is not set as your shell"),console.log("\uD83D\uDD52 Setting Zsh as your shell"),await y`sudo chsh -s ${w} $USER`,console.log("\u2705 Zsh is set as your shell")},$w=async()=>{await Promise.all([b0(),A0()]),await Promise.all([k0(),y0().then(()=>Promise.all([P0().then(E0).then(f0),x0(),S0().then(O0)]))])};var{$:_$}=globalThis.Bun;var ww=async()=>void await Promise.all([_$`deno fmt --use-tabs --quiet; oxlint --fix-dangerously --quiet; biome check --write --unsafe .`.nothrow(),_$`go fmt ./...`.nothrow(),_$`dotnet csharpier .`.nothrow()]);var{$:K}=globalThis.Bun;var g0=async()=>{let $=await fetch("https://raw.githubusercontent.com/chneau/dotfiles/master/bootstrap.sh").then((w)=>w.text());await K`echo ${$} | sh`.nothrow()},v0=async()=>{let $=["@biomejs/biome","http-server","live-server","fkill-cli","ungit","npm-check","tsx","npm-check-updates","nodemon","prettier","typesync","depcheck","concurrently","ts-unused-exports"];await K`bun upgrade`.nothrow(),await K`bun install --force --global ${{raw:$.join(" ")}}`.nothrow(),await K`bun update --latest --force --global`.nothrow()},u0=async()=>{await K`sudo apt install -y ${{raw:["git","curl","wget","unzip","zsh","bash"].join(" ")}}`.nothrow(),await K`sudo apt update -y`.nothrow(),await K`sudo apt upgrade -y`.nothrow(),await K`sudo apt autoremove -y`.nothrow(),await K`sudo apt autoclean -y`.nothrow()},h0=async()=>{if(!await O("brew"))await K`CI=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`.nothrow();let $=["bpytop","dive","dldash/core/docker-color-output","docker-compose","go","helm","hyperfine","kubecolor","kubectx","kubernetes-cli","lazygit","node","pipx","zsh"],w=(await K`which brew`.text().catch(()=>"")).trim()||"/home/linuxbrew/.linuxbrew/bin/brew";await K`${w} install ${{raw:$.join(" ")}}`.nothrow(),await K`${w} update`.nothrow(),await K`${w} upgrade`.nothrow(),await K`${w} cleanup`.nothrow()},Hw=async()=>{if(await o())throw new Error("You cannot run this command as root");if(!await t())throw new Error("You cannot sudo");await g0(),await u0(),await v0(),await h0(),console.log("System updated")};var{$:m0}=globalThis.Bun;var Gw=async()=>await fetch("https://registry.npmjs.org/@chneau/x/latest").then(($)=>$.json().then((w)=>w.version)).catch(()=>"UNKNOWN");var Zw=async()=>{let $=await Gw(),w=await r();if($===w){console.log(`\u2705 You are already using the latest version ${w}`);return}console.log(`\uD83D\uDD52 You are using version ${w}`);while(!0){if(console.log(`\uD83D\uDD52 Updating to version ${$}`),await m0`bun i -fg @chneau/x@${$}`.quiet().then(()=>!0).catch(()=>!1))break;await Bun.sleep(1000)}console.log(`\u2705 Updated to version ${$}`)};console.log(Bun.argv);var l0=await r();A.name("x").description("chneau's utility CLI").version(l0);A.option("-r, --recursive [number]","Recursion level",Number.parseFloat).argument("[dir]","Directory to manage",".").action(r$);A.command("fmt").description("Format all files").action(ww);A.command("upgrade").description("Uprade x to the latest version").action(Zw);A.command("system").description("Update/install the system packages").action(Hw);A.command("doctor").description("Check the system for issues").action($w);A.parse();
|