Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,31 +96,6 @@ jobs:
- name: "Build project"
run: cargo build --verbose --all-features

package:
name: "[RUST] Package"
needs: build
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v6

- name: "Install Rust toolchain"
uses: dtolnay/rust-toolchain@stable

- name: "Cache cargo registry"
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: "Build project"
run: cargo package --allow-dirty --verbose --all-features

report:
name: "[RUST] Report"
needs: [build]
Expand Down
18 changes: 0 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,6 @@ jobs:
- run: npm run build
- run: npm publish

publish-rs-reader:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/pkg-')
defaults:
run:
working-directory: "./crates/package"
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set version
run: |
VERSION=$(echo "${{ github.ref_name }}" | sed 's/^pkg-//')
sed -i "s/version = \"0.0.0\"/version = \"$VERSION\"/" Cargo.toml
- name: Cargo Login
run: cargo login ${{secrets.CRATES_IO_PUBLISH}}
- name: Publish crate
run: cargo publish --allow-dirty

publish-defintions:
permissions:
contents: write
Expand Down
11 changes: 0 additions & 11 deletions 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,5 +1,5 @@
[workspace]
members = ["crates/cli", "crates/package"]
members = ["crates/cli"]
resolver = "3"

[workspace.package]
Expand Down
83 changes: 1 addition & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Definitions
This repository contains all definitions for Code0. These definitions will be used to create a Flow. It also contains a CLI tool for managing definitions and a reader for reading all definitions.
This repository contains all definitions for Code0. These definitions will be used to create a Flow. It also contains a CLI tool for managing definitions.

## Definition CLI

Expand Down Expand Up @@ -88,84 +88,3 @@ for (const feature in features) {
const functions = fearture.runtimeFunctions; //runtimeFunctions of this feature
}
```

## Rust Definition Package
This package is a Rust crate designed to read and parse CodeZero definition files (JSON) from a directory structure. It loads all features, including data-types, flow-types, and runtime-functions, providing them as idiomatic Rust structs.
### Package Resources
Crate: [code0-definition-reader](https://crates.io/crates/code0-definition-reader) on crates.io
### Install Package
```bash
cargo add code0-definition-reader
```

### Basic Usage

```rs
use code0_definition_reader::Reader;

fn main() {
// Create a reader with default configuration
let reader = Reader::configure(
"./path/to/definitions".to_string(), // Path to definitions directory
false, // should_break: continue on errors
Vec::new(), // accepted_features: empty = all features
None // accepted_version: None = all versions
);

// Read all features
match reader.read_features() {
Ok(features) => {
for feature in features {
println!("Loaded feature: {}", feature.name);
println!(" - Data Types: {}", feature.data_types.len());
println!(" - Flow Types: {}", feature.flow_types.len());
println!(" - Functions: {}", feature.functions.len());
}
}
Err(err) => {
eprintln!("Failed to read features: {:?}", err);
}
}
}
```

### Advanced Usage - Filter Specific Features

```rs
use code0_definition_reader::Reader;

fn main() {
let reader = Reader::configure(
"./definitions".to_string(),
false,
vec!["http".to_string(), "database".to_string()], // Only load http and database features
None
);

match reader.read_features() {
Ok(features) => {
for feature in features {
println!("Feature: {}", feature.name);

// Access data types
for data_type in &feature.data_types {
println!(" DataType: {}", data_type.identifier);
}

// Access flow types
for flow_type in &feature.flow_types {
println!(" FlowType: {}", flow_type.identifier);
}

// Access runtime functions
for function in &feature.functions {
println!(" Function: {}", function.runtime_name);
}
}
}
Err(err) => {
eprintln!("Failed to read features: {:?}", err);
}
}
}
```
16 changes: 0 additions & 16 deletions crates/package/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion crates/package/src/enum/mod.rs

This file was deleted.

24 changes: 0 additions & 24 deletions crates/package/src/enum/reader_error.rs

This file was deleted.

174 changes: 0 additions & 174 deletions crates/package/src/lib.rs

This file was deleted.

Loading