Skip to content

Commit

Permalink
configure git-cliff, release-plz, dependabot, and mergify
Browse files Browse the repository at this point in the history
  • Loading branch information
tlowerison committed Oct 31, 2023
1 parent 37f304b commit 260188d
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 94 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
# Maintain dependencies for Cargo
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

# Maintain dependencies for GitHub Actions
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
15 changes: 15 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pull_request_rules:
- name: Automatic merge for Dependabot pull requests
conditions:
- author=dependabot[bot]
actions:
merge:
method: squash

- name: Automatic update to the main branch for pull requests
conditions:
- -conflict # skip PRs with conflicts
- -draft # skip GH draft PRs
- -author=dependabot[bot] # skip dependabot PRs
actions:
update:
26 changes: 26 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Continuous Deployment

on:
push:
branches:
- main

jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLZ_TOKEN }}

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

- name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
25 changes: 25 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ resolver = "2"
version = "0.1.0"
edition = "2021"
authors = ["Trey Lowerison <19714082+tlowerison@users.noreply.github.com>"]
repository = "https://github.com/tlowerison/leptos_form"

[workspace.dependencies]
# internal to this workspace
# update these versions along with the workspace version
leptos_form_core = { version = "0.1.0", path = "core" }
leptos_form_proc_macros = { version = "0.1.0", path = "proc_macros" }
leptos_form_proc_macros_core = { version = "0.1.0", path = "proc_macros/core" }

bigdecimal = "~0.4"
chrono = { version = "0", features = ["std"] }
convert_case = "~0.6"
Expand All @@ -32,3 +39,21 @@ typed-builder = "~0.16"
uuid = { version = "1", features = ["serde"] }
wasm-bindgen = "~0.2"
web-sys = "~0.3"

# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.4.2"
# CI backends to support
ci = ["github"]
# The installers to generate for each app
installers = []
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
# Publish jobs to run in CI
pr-run-mode = "plan"

# The profile that 'cargo dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"
91 changes: 90 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,90 @@
# leptos_form
# leptos_form: Derive leptos forms from rust structs

<div align="center">
<!-- CI -->
<img src="https://github.com/tlowerison/leptos_form/CI/badge.svg" />
<!-- codecov -->
<img src="https://codecov.io/gh/tlowerison/leptos_form/branch/main/graph/badge.svg" />
<!-- Crates version -->
<a href="https://crates.io/crates/leptos_form">
<img src="https://img.shields.io/crates/v/leptos_form.svg?style=flat-square"
alt="Crates.io version" />
</a>
<!-- Downloads -->
<a href="https://crates.io/crates/leptos_form">
<img src="https://img.shields.io/crates/d/leptos_form.svg?style=flat-square"
alt="Download" />
</a>
<!-- docs.rs docs -->
<a href="https://docs.rs/leptos_form">
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square"
alt="docs.rs docs" />
</a>
<a href="https://github.com/rust-secure-code/safety-dance/">
<img src="https://img.shields.io/badge/unsafe-forbidden-success.svg?style=flat-square"
alt="Unsafe Rust forbidden" />
</a>
</div>

## Documentation

* [Docs](https://docs.rs/leptos_form)
* [GitHub repository](https://github.com/tlowerison/leptos_form)
* [Cargo package](https://crates.io/crates/leptos_form)

## Features

* Automatic form parsing -- focus on how your data is represented and not on how to get it in and out of html
* Easy specification of label and input classes, great for Tailwind integration
* Labels are derived from struct fields and can be given form-wide casing
* DOM layout customization through attributes
* Integration with popular crates

## Crate features

This crate offers the following features, all of which are not activated by default:

- `bigdecimal`: Provides impls for [`BigDecimal`](https://docs.rs/bigdecimal/latest/bigdecimal/struct.BigDecimal.html)
- `chrono`: Provides impls for [`DateTime`](https://docs.rs/chrono/latest/chrono/struct.DateTime.html), [`NaiveDate`](https://docs.rs/chrono/latest/chrono/naive/struct.NaiveDate.html), [`NaiveDateTime`](https://docs.rs/chrono/latest/chrono/naive/struct.NaiveDateTime.html)
- `num-bigint`: Provides impls for [`BigInt`](https://docs.rs/num-bigint/latest/num_bigint/struct.BigInt.html) and [`BigUint`](https://docs.rs/num-bigint/latest/num_bigint/struct.BigUint.html)
- `uuid`: Provides impls for [`Uuid`](https://docs.rs/uuid/latest/uuid/struct.Uuid.html)

## Example

```rust
mod my_crate {
use leptos::*;
use leptos_form::prelude::*;
use serde::*;

#[derive(Clone, Debug, Default, Deserialize, Form, Serialize)]
#[form(
component(
action = create_my_data(my_data),
submit = view!(<input type="button" value="Submit" />),
on_success = |DbMyData { id, .. }, _| view!(<div>{format!("Created {id}")}</div>),
reset_on_success,
),
label(wrap(class = "my-class", rename_all = "Title Case")),
)]
pub struct MyData {
pub my_name: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DbMyData {
pub id: i32,
pub name: String,
}

#[component]
pub fn MyComponent() -> impl IntoView {
view!(<MyData initial={MyData::default()} />)
}

#[server]
async fn create_my_data(my_data: MyData) -> Result<DbMyData, ServerFnError> {
todo!()
}
}
```
83 changes: 83 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# postprocessors
postprocessors = [
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]
[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = true
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, # replace issue numbers
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^doc", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore\\(deps\\)", skip = true },
{ message = "^chore\\(pr\\)", skip = true },
{ message = "^chore\\(pull\\)", skip = true },
{ message = "^chore|ci", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security" },
{ message = "^revert", group = "Revert" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
tag_pattern = "v[0-9].*"

# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "leptos_form_core"
version.workspace = true
edition.workspace = true
authors.workspace = true
rust-version = "1.75.0"
repository.workspace = true

[dependencies]
derivative.workspace = true
Expand Down
5 changes: 3 additions & 2 deletions leptos_form/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ name = "leptos_form"
version.workspace = true
edition.workspace = true
authors.workspace = true
repository.workspace = true

[dependencies]
leptos.workspace = true
leptos_form_core.path = "../core"
leptos_form_proc_macros.path = "../proc_macros"
leptos_form_core.workspace = true
leptos_form_proc_macros.workspace = true
leptos_router.workspace = true
wasm-bindgen.workspace = true

Expand Down
89 changes: 0 additions & 89 deletions leptos_form/Crate.md

This file was deleted.

1 change: 1 addition & 0 deletions leptos_form/Crate.md
Loading

0 comments on commit 260188d

Please sign in to comment.