@struggler/cli
v1.0.5
Published
CLI to Upload vite packaged files to Qiniu Cloud OSS.
Downloads
105
Readme
struggler-cli
struggler-cli is a small deployment CLI for front-end build assets on Qiniu Cloud. It can generate versioned paths, upload build output, refresh CDN URLs, and now supports dry-run, concurrent uploads, ignore rules, manifest export, JSON output, and a one-shot deploy command.
Install
pnpm installFor local command usage:
pnpm link --globalConfig Files
The CLI expects two files in the same directory:
qiniu.json: Qiniu credentials and bucket metadataconfig.json: generated deploy prefix metadata used by upload/refresh
Example qiniu.json:
{
"path": "your-project",
"accessKey": "",
"secretKey": "",
"Bucket": "",
"zone": "Zone_z1",
"domain": "https://cdn.example.com/"
}Optional ignore file:
.strugglerignoreExample:
.DS_Store
*.map
legacy/**Commands
Initialize versioned config:
node ./index.js --config ./command/qiniu.json --dir ./dist initPreview upload work without changing files or calling Qiniu:
node ./index.js --config ./command/qiniu.json --dir ./dist --dry-run uploadUpload with concurrency:
node ./index.js --config ./command/qiniu.json --dir ./dist --concurrency 8 uploadUpload with ignore patterns and a manifest:
node ./index.js --config ./command/qiniu.json --dir ./dist --exclude ".DS_Store,*.map" --manifest ./artifacts/upload-manifest.json uploadRefresh CDN for generated URLs:
node ./index.js --config ./command/qiniu.json --dir ./dist refreshRun the full flow:
node ./index.js --config ./command/qiniu.json --dir ./dist --concurrency 8 deploySkip parts of deploy:
node ./index.js --config ./command/qiniu.json --dir ./dist --skip-refresh deployMachine-readable output:
node ./index.js --config ./command/qiniu.json --dir ./dist --json --dry-run deployVersion bump script:
pnpm add-versionMakefile Shortcuts
make init
make upload
make refresh
make deploy
make upload DIR=./test/dist3 CONFIG=./test/command/qiniu.json DRY_RUN=--dry-run
make deploy MANIFEST=./artifacts/deploy.json JSON=--json SKIP_REFRESH=--skip-refreshTest
pnpm testThe automated tests cover config path resolution, init dry-run behavior, upload ignore handling, manifest generation, and deploy JSON summaries.
