This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: init cli * chore: add os * feat: add wget * feat: add all * refactor: os install * feat: add curl * fix: curl * fix: lint * feat: global install * chore: update readme
- Loading branch information
1 parent
91670d2
commit 01ed4f0
Showing
16 changed files
with
1,845 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
import '../dist/index.mjs' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { defineBuildConfig } from 'unbuild' | ||
|
||
export default defineBuildConfig({ | ||
entries: [ | ||
'src/index.ts', | ||
], | ||
clean: true, | ||
declaration: true, | ||
rollup: { | ||
emitCJS: true, | ||
inlineDependencies: true, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#!/bin/bash | ||
|
||
#!/bin/bash | ||
|
||
# Function to compare two version numbers | ||
version_compare() { | ||
local version1=$1 | ||
local version2=$2 | ||
if dpkg --compare-versions "$version1" gt "$version2"; then | ||
echo "1" | ||
else | ||
echo "0" | ||
fi | ||
} | ||
|
||
# Check if Wget is already installed | ||
if command -v wget &>/dev/null; then | ||
installed_version=$(wget --version | awk 'NR==1{print $3}') | ||
echo "Wget is already installed (Version $installed_version)." | ||
else | ||
echo "Wget is not installed, starting the installation..." | ||
|
||
# Use the appropriate package manager to install Wget | ||
if command -v apt-get &>/dev/null; then | ||
sudo apt-get update | ||
sudo apt-get install wget -y | ||
elif command -v yum &>/dev/null; then | ||
sudo yum install wget -y | ||
elif command -v dnf &>/dev/null; then | ||
sudo dnf install wget -y | ||
else | ||
echo "Unsupported package manager, please install Wget manually." | ||
exit 1 | ||
fi | ||
|
||
# Display a message if the installation was successful | ||
if [ $? -eq 0 ]; then | ||
installed_version=$(wget --version | awk 'NR==1{print $3}') | ||
echo "Wget has been installed successfully (Version $installed_version)." | ||
else | ||
echo "An error occurred while installing Wget." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Get the latest version of Wget | ||
latest_version=$(wget -qO- https://ftp.gnu.org/gnu/wget/ | grep -oE 'wget-[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') | ||
|
||
# Check if Wget is outdated | ||
if [ "$(version_compare "$installed_version" "$latest_version")" -eq "1" ]; then | ||
echo "Wget is outdated (Installed Version: $installed_version, Latest Version: $latest_version)." | ||
|
||
# Ask the user if they want to update Wget | ||
read -p "Do you want to update Wget? (yes/no): " update_choice | ||
if [ "$update_choice" == "yes" ]; then | ||
# Use the appropriate package manager to update Wget | ||
if command -v apt-get &>/dev/null; then | ||
sudo apt-get update | ||
sudo apt-get install wget -y | ||
elif command -v yum &>/dev/null; then | ||
sudo yum install wget -y | ||
elif command -v dnf &>/dev/null; then | ||
sudo dnf install wget -y | ||
else | ||
echo "Unsupported package manager, please update Wget manually." | ||
fi | ||
|
||
# Display a message if the update was successful | ||
if [ $? -eq 0 ]; then | ||
updated_version=$(wget --version | awk 'NR==1{print $3}') | ||
echo "Wget has been updated to Version $updated_version." | ||
else | ||
echo "An error occurred while updating Wget." | ||
fi | ||
else | ||
echo "Wget will not be updated." | ||
fi | ||
else | ||
echo "Wget is up to date (Version $installed_version)." | ||
fi | ||
|
||
|
||
# Check if nvm is not installed | ||
if command -v nvm &>/dev/null; then | ||
echo "nvm is already installed." | ||
npm install -g pergel | ||
npm list -g pergel | ||
else | ||
echo "nvm is not installed, starting the installation..." | ||
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash | ||
# Display a message if the installation was successful | ||
if [ $? -eq 0 ]; then | ||
|
||
# Install the latest LTS version of Node.js using nvm | ||
echo "Installing the latest LTS version of Node.js..." | ||
nvm install --lts | ||
|
||
# Set the LTS version as the default | ||
nvm alias default $(nvm ls --lts | tail -n 1) | ||
|
||
# Verify the installation and default version | ||
echo "Default Node.js version: $(node --version)" | ||
echo "Default npm version: $(npm --version)" | ||
|
||
|
||
echo "nvm has been installed successfully." | ||
|
||
# Install the latest version of Pergel | ||
echo "Installing the latest version of Pergel..." | ||
npm install -g pergel | ||
npm list -g pergel | ||
else | ||
echo "An error occurred while installing nvm." | ||
exit 1 | ||
fi | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,22 +5,57 @@ | |
"packageManager": "[email protected]", | ||
"description": "", | ||
"author": "", | ||
"license": "ISC", | ||
"license": "MIT", | ||
"keywords": [], | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"bin": { | ||
"pergel": "bin/pergel.mjs" | ||
}, | ||
"files": [ | ||
"bin", | ||
"dist" | ||
], | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"scripts": { | ||
"dev": "esno src/index.ts", | ||
"build": "unbuild", | ||
"stub": "unbuild --stub", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix", | ||
"test": "vitest", | ||
"test:watch": "vitest --watch", | ||
"test:coverage": "vitest --coverage" | ||
}, | ||
"dependencies": { | ||
"@clack/prompts": "^0.7.0", | ||
"citty": "^0.1.4", | ||
"globby": "^13.2.2", | ||
"picocolors": "^1.0.0", | ||
"shelljs": "^0.8.5" | ||
}, | ||
"devDependencies": { | ||
"@antfu/eslint-config": "1.0.0-beta.18", | ||
"@types/node": "^20.8.2", | ||
"@types/shelljs": "^0.8.13", | ||
"@vitest/coverage-v8": "^0.34.6", | ||
"eslint": "^8.50.0", | ||
"esno": "^0.17.0", | ||
"lint-staged": "^14.0.1", | ||
"simple-git-hooks": "^2.9.0", | ||
"tsup": "^7.2.0", | ||
"typescript": "^5.2.2", | ||
"unbuild": "^2.0.0", | ||
"vitest": "^0.34.6" | ||
}, | ||
"simple-git-hooks": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "playground", | ||
"version": "1.0.0", | ||
"description": "", | ||
"author": "", | ||
"license": "ISC", | ||
"keywords": [], | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"pergel": "workspace:^" | ||
} | ||
} |
Oops, something went wrong.