Skip to content

Commit

Permalink
prefer deps.cirru ; tag 0.8.54
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed May 23, 2024
1 parent 09a9228 commit 9ec0acb
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "calcit"
version = "0.8.53"
version = "0.8.54"
authors = ["jiyinyiyong <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cargo install calcit
3 binaries are installed:

- `calcit`, the runtime and js compiler
- `caps`, for downloading dependencies declared in `package.cirru`
- `caps`, for downloading dependencies declared in `deps.cirru`
- `bundle_calcit`, bundle code if you don't want to use Calcit Editor

For Ubuntu latest, try binaries from [Releases](https://github.com/calcit-lang/calcit/releases), which are provided for [CI usages](https://github.com/calcit-lang/respo-calcit-workflow/blob/main/.github/workflows/upload.yaml#L28-L37).
Expand Down Expand Up @@ -107,7 +107,7 @@ Read more in [Respo Calcit Workflow](https://github.com/calcit-lang/respo-calcit

### Modules

`package.cirru` declares dependencies that need to download, which correspond to repositories on GitHub. Specify a branch or a tag:
`deps.cirru` declares dependencies that need to download, which correspond to repositories on GitHub. Specify a branch or a tag:

```cirru
{}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@calcit/procs",
"version": "0.8.53",
"version": "0.8.54",
"main": "./lib/calcit.procs.mjs",
"devDependencies": {
"@types/node": "^20.11.28",
Expand Down
24 changes: 14 additions & 10 deletions src/bin/calcit_deps.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! CLI tool to download packages from github,
//! packages are defined in `package.cirru` file
//! packages are defined in `deps.cirru` file
//!
//! files are stored in `~/.config/calcit/modules/`.
Expand Down Expand Up @@ -53,14 +53,14 @@ struct CliArgs {
}

pub fn main() -> Result<(), String> {
// parse package.cirru
// parse deps.cirru

let cli_matches = parse_cli();

let options: CliArgs = CliArgs {
input: cli_matches
.get_one::<String>("input")
.unwrap_or(&"package.cirru".to_string())
.unwrap_or(&"deps.cirru".to_string())
.to_string(),
ci: cli_matches.get_flag("ci"),
verbose: cli_matches.get_flag("verbose"),
Expand All @@ -77,9 +77,18 @@ pub fn main() -> Result<(), String> {

download_deps(deps.dependencies, &options)?;

Ok(())
} else if Path::new("package.cirru").exists() {
// be compatible with old name
let content = fs::read_to_string("package.cirru").map_err(|e| e.to_string())?;
let parsed = cirru_edn::parse(&content)?;
let deps: PackageDeps = parsed.try_into()?;

download_deps(deps.dependencies, &options)?;

Ok(())
} else {
eprintln!("Error: no package.cirru found!");
eprintln!("Error: no deps.cirru found!");
std::process::exit(1);
}
}
Expand Down Expand Up @@ -206,12 +215,7 @@ fn parse_cli() -> clap::ArgMatches {
.version(CALCIT_VERSION)
.author("Jon. <[email protected]>")
.about("Calcit Deps")
.arg(
clap::Arg::new("input")
.help("entry file path")
.default_value("package.cirru")
.index(1),
)
.arg(clap::Arg::new("input").help("entry file path").default_value("deps.cirru").index(1))
.arg(
clap::Arg::new("verbose")
.help("verbose mode")
Expand Down

0 comments on commit 9ec0acb

Please sign in to comment.