npm.io
1.0.1 • Published 3d agoCLI

s3build-cli

Licence
MIT
Version
1.0.1
Deps
4
Size
39 kB
Vulns
0
Weekly
0

s3build-cli

CLI tool giúp build và publish các project .NET (ASP.NET, WebForms, MVC) bằng MSBuild — thay thế các file .bat thủ công.

Tính năng

  • Multi-profile — quản lý nhiều project (WebPOS, WebAdmin, API...) qua file JSON
  • Auto-zip — tự động nén output thành file .zip có gắn ngày
  • Dọn dẹp thông minh — xóa file/folder không cần thiết trước khi zip (config, images, resources...)
  • Cross-platform — chạy trên Windows (nơi có MSBuild)

Cài đặt

npm install -g s3build-cli

Yêu cầu: Node.js >= 16 và MSBuild (Visual Studio hoặc Build Tools).

Sử dụng

Khởi tạo profile mẫu
s3build init

Tạo thư mục s3build-profiles/ trong folder hiện tại với file example.json mẫu.

Chỉnh sửa profile
{
  "name": "WebPOS",
  "project": "C:\\path\\to\\WebPOS.csproj",
  "publishDir": "C:\\localpublish\\WebPOS",
  "zipDir": "C:\\localpublish",
  "zipPattern": "WebPOS_{date}.zip",
  "msbuild": {
    "configuration": "Release",
    "deployOnBuild": true,
    "webPublishMethod": "FileSystem"
  },
  "clean": {
    "folders": ["Images", "PaymentSetting"],
    "files": ["web.config", "ConnectionStrings.config"]
  }
}
Build
# Build theo profile
s3build build webpos

# Build với ngày tùy chỉnh
s3build build webpos --date 01-07-2026
Xem danh sách profiles
s3build list

Profile lookup

CLI tìm profile theo thứ tự ưu tiên:

  1. ./s3build-profiles/<name>.json (thư mục hiện tại)
  2. Bundled profiles (cài kèm package)

Điều này cho phép mỗi team/project có bộ profile riêng mà không cần sửa package.

Luồng hoạt động

s3build build <profile>
  │
  ├── 1. Load profile config
  ├── 2. Xóa thư mục publish cũ
  ├── 3. Chạy MSBuild → publish ra folder
  ├── 4. Xóa folders/files theo clean config
  ├── 5. Nén thành ZIP (archiver, level 9)
  └── 6. Done → hiển thị đường dẫn + size

License

MIT