Skip to content

Commit 89da839

Browse files
committed
docs: update README with force flag and Yarn information
1 parent bae6845 commit 89da839

2 files changed

Lines changed: 82 additions & 7 deletions

File tree

‎README-GLOBAL-DEV.md‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# Global Development Environment Setup
22

3-
Scripts để cài đặt và cấu hình môi trường development (NVM, Node.js, NPM, ZSH) cho tất cả user trên server, bao gồm cả user mới tạo trong tương lai.
3+
Scripts để cài đặt và cấu hình môi trường development (NVM, Node.js, NPM, Yarn, ZSH) cho tất cả user trên server, bao gồm cả user mới tạo trong tương lai.
44

55
## 🚀 Tính năng
66

77
- ✅ **NVM** (Node Version Manager) cài đặt global tại `/usr/local/nvm`
88
- ✅ **Node.js LTS** - Phiên bản mới nhất
99
- ✅ **NPM** - Đi kèm với Node.js
10+
- ✅ **Yarn** - Package Manager được cài global
1011
- ✅ **ZSH** với Oh-My-Zsh cài đặt global tại `/usr/share/oh-my-zsh`
1112
- ✅ **Plugins ZSH**:
1213
- fast-syntax-highlighting
1314
- zsh-autosuggestions
1415
- ✅ **Powerlevel10k theme** - Theme đẹp và mạnh mẽ cho ZSH
1516
- ✅ Tự động cấu hình cho **tất cả user mới** qua `/etc/skel/`
1617
- ✅ Helper script để setup cho **existing users**
18+
- ✅ **Force update mode** - Cập nhật dotfiles cho tất cả users hiện tại
1719

1820
## 📦 Cài đặt
1921

@@ -25,8 +27,19 @@ sudo bash install.sh global_dev
2527

2628
# Hoặc dùng alias
2729
sudo bash install.sh gd
30+
31+
# Force update dotfiles cho tất cả users hiện tại
32+
sudo bash install.sh global_dev -f
33+
# hoặc
34+
sudo bash install.sh gd --force
2835
```
2936

37+
**Force Mode (`-f` hoặc `--force`):**
38+
- Tự động copy/update các dotfiles từ folder `home/` cho **tất cả users** hiện tại (UID >= 1000)
39+
- Backup các file config cũ trước khi update
40+
- Áp dụng cấu hình mới cho tất cả users
41+
- Files được update: `.zshrc`, `.zsh_aliases`, `.p10k.zsh`
42+
3043
### Cách 2: Chạy từng script riêng lẻ
3144

3245
```bash
@@ -38,8 +51,14 @@ sudo bash zsh-global.sh
3851
# Setup NVM globally
3952
sudo bash nvm-global.sh
4053

54+
# Setup Yarn globally
55+
sudo bash yarn-global.sh
56+
4157
# Hoặc chạy script tổng hợp
4258
sudo bash global-dev-setup.sh
59+
60+
# Với force mode
61+
sudo bash global-dev-setup.sh --force
4362
```
4463

4564
## 🔧 Cấu hình sau khi cài đặt
@@ -117,6 +136,9 @@ node --version
117136
# Kiểm tra NPM
118137
npm --version
119138

139+
# Kiểm tra Yarn
140+
yarn --version
141+
120142
# Kiểm tra ZSH
121143
zsh --version
122144

@@ -170,6 +192,25 @@ nvm use 18.20.0
170192
nvm alias default 18.20.0
171193
```
172194

195+
### Sử dụng Yarn
196+
197+
```bash
198+
# Kiểm tra version
199+
yarn --version
200+
201+
# Khởi tạo project mới
202+
yarn init
203+
204+
# Thêm package
205+
yarn add express
206+
207+
# Cài dependencies
208+
yarn install
209+
210+
# Upgrade dependencies
211+
yarn upgrade
212+
```
213+
173214
## 🐛 Troubleshooting
174215

175216
### NVM command not found
@@ -216,6 +257,7 @@ sudo chmod -R 755 /usr/share/oh-my-zsh
216257
## 🔗 Links
217258

218259
- [NVM GitHub](https://github.com/nvm-sh/nvm)
260+
- [Yarn](https://yarnpkg.com/)
219261
- [Oh-My-Zsh](https://ohmyz.sh/)
220262
- [Powerlevel10k](https://github.com/romkatv/powerlevel10k)
221263
- [Fast Syntax Highlighting](https://github.com/zdharma-continuum/fast-syntax-highlighting)

‎README.md‎

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,45 @@ cd dotfiles_server
3434
3535
The runner has the following commands:
3636
37-
| Command | Description |
38-
|-----------------------|------------------------------|
39-
| `setup`, `s`, `a` | Setup the server |
40-
| `ssh_port`, `sp` | Change the SSH port |
41-
| `php`, `php-install` | Install PHP version you want |
42-
| `php_extension`, `pe` | Install PHP extensions |
37+
| Command | Description |
38+
|-----------------------|--------------------------------------------------------------------|
39+
| `setup`, `s`, `a` | Setup the server |
40+
| `ssh_port`, `sp` | Change the SSH port |
41+
| `ssh_timeout`, `st` | Configure SSH timeout (auto disconnect after 5min idle) |
42+
| `php`, `php-install` | Install PHP version you want |
43+
| `php_extension`, `pe` | Install PHP extensions |
44+
| `lazydocker`, `ld` | Install lazydocker |
45+
| `global_dev`, `gd` | Setup NVM, NPM, Yarn, ZSH globally for all users |
46+
47+
### Global Dev Setup
48+
49+
Setup development environment globally for all users (including new users):
50+
51+
```bash
52+
sudo bash install.sh global_dev
53+
# or
54+
sudo bash install.sh gd
55+
```
56+
57+
This will install and configure:
58+
- ✓ ZSH with Oh-My-Zsh (Powerlevel10k theme)
59+
- ✓ NVM (Node Version Manager)
60+
- ✓ Node.js (LTS version)
61+
- ✓ NPM (Node Package Manager)
62+
- ✓ Yarn (Package Manager)
63+
64+
**Force update dotfiles for all existing users:**
65+
66+
```bash
67+
sudo bash install.sh global_dev -f
68+
# or
69+
sudo bash install.sh gd --force
70+
```
71+
72+
The `-f` or `--force` flag will:
73+
- Force copy/update all dotfiles (.zshrc, .zsh_aliases, .p10k.zsh) from `home/` folder to all existing users
74+
- Backup existing dotfiles before updating
75+
- Apply new configuration to all users with UID >= 1000
4376

4477
## License
4578

0 commit comments

Comments
 (0)