Linux command
shards 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Install dependencies
shards install
Update all dependencies
shards update
Build project targets
shards build
Check for outdated dependencies
shards outdated
Initialize a new shard.yml
shards init
List installed shards
shards list
Install without development dependencies
shards install --production
Verify dependencies are installed and satisfied
shards check
说明
shards is the official dependency manager for the Crystal programming language, similar to Bundler for Ruby or npm for JavaScript. It reads project dependencies from a shard.yml file that defines package metadata, version constraints, and development dependencies. Dependencies are resolved from Git repositories, with GitHub being the most common source. The shard.lock file pins exact versions to ensure reproducible builds across environments. The build command compiles Crystal projects and places executables in the bin/ directory, while install and update manage the dependency lifecycle.
参数
- --production
- Skip development dependencies and only use locked versions.
- --without-development
- Skip development dependencies during install.
- --skip-postinstall
- Skip running postinstall scripts.
- --skip-executables
- Skip installing executables.
- -q, --quiet
- Decrease log verbosity, printing only warnings and errors.
- -v, --verbose
- Increase log verbosity.
- --jobs _N_
- Number of parallel download jobs.
- --frozen
- Require that shard.lock is up to date and refuse to update it.
- --ignore-crystal-version
- Do not check the Crystal version restriction in shard.yml.
FAQ
What is the shards command used for?
shards is the official dependency manager for the Crystal programming language, similar to Bundler for Ruby or npm for JavaScript. It reads project dependencies from a shard.yml file that defines package metadata, version constraints, and development dependencies. Dependencies are resolved from Git repositories, with GitHub being the most common source. The shard.lock file pins exact versions to ensure reproducible builds across environments. The build command compiles Crystal projects and places executables in the bin/ directory, while install and update manage the dependency lifecycle.
How do I run a basic shards example?
Run `shards install` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --production do in shards?
Skip development dependencies and only use locked versions.