Skip to content

Commit bc4d5cc

Browse files
committed
wip
1 parent d41585b commit bc4d5cc

19 files changed

Lines changed: 827 additions & 640 deletions

File tree

.github/cliff.toml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# git-cliff ~ default configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# template for the changelog header
6+
header = """
7+
# Changelog\n
8+
All notable changes to this project will be documented in this file.\n
9+
"""
10+
# template for the changelog body
11+
# https://keats.github.io/tera/docs/#introduction
12+
body = """
13+
{% for group, commits in commits | group_by(attribute="group") %}
14+
### {{ group | striptags | trim | upper_first }}
15+
{% for commit in commits %}
16+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
17+
{% if commit.breaking %}[**breaking**] {% endif %}\
18+
{{ commit.message | upper_first }}\
19+
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}\
20+
{% endfor %}
21+
{% endfor %}\n
22+
23+
24+
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
25+
## New Contributors ❤️
26+
{% endif %}\
27+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
28+
* @{{ contributor.username }} made their first contribution
29+
{%- if contributor.pr_number %} in \
30+
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
31+
{%- endif %}
32+
{%- endfor -%}
33+
34+
{% if version %}
35+
{% if previous.version %}
36+
**Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
37+
{% endif %}
38+
{% else -%}
39+
{% raw %}\n{% endraw %}
40+
{% endif %}
41+
42+
{%- macro remote_url() -%}
43+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
44+
{%- endmacro -%}
45+
46+
"""
47+
# template for the changelog footer
48+
footer = """
49+
<!-- generated by git-cliff -->
50+
"""
51+
# remove the leading and trailing s
52+
trim = true
53+
# postprocessors
54+
postprocessors = [
55+
# { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
56+
]
57+
58+
[git]
59+
# parse the commits based on https://www.conventionalcommits.org
60+
conventional_commits = true
61+
# filter out the commits that are not conventional
62+
filter_unconventional = false
63+
# process each line of a commit as an individual commit
64+
split_commits = false
65+
# regex for preprocessing the commit messages
66+
commit_preprocessors = [
67+
# Replace issue numbers
68+
#{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
69+
# Check spelling of the commit with https://github.com/crate-ci/typos
70+
# If the spelling is incorrect, it will be automatically fixed.
71+
#{ pattern = '.*', replace_command = 'typos --write-changes -' },
72+
]
73+
# regex for parsing and grouping commits
74+
commit_parsers = [
75+
{ message = "^feat", group = "<!-- 0 -->🚀 Features" },
76+
{ message = "^fix", group = "<!-- 1 -->🐛 Bug Fixes" },
77+
{ message = "^refactor", group = "<!-- 2 -->🚜 Refactor" },
78+
{ message = "^doc", group = "<!-- 3 -->📚 Documentation" },
79+
{ message = "^perf", group = "<!-- 4 -->⚡ Performance" },
80+
{ message = "^style\\(fmt\\)", skip = true },
81+
{ message = "^style", group = "<!-- 5 -->🎨 Styling" },
82+
{ message = "^test", group = "<!-- 6 -->🧪 Testing" },
83+
{ message = "^build", group = "<!-- 7 -->🛠️ Builds" },
84+
{ message = "^chore\\(release\\): prepare for", skip = true },
85+
{ message = "^chore\\(deps.*\\)", skip = true },
86+
{ message = "^chore\\(pr\\)", skip = true },
87+
{ message = "^chore\\(pull\\)", skip = true },
88+
{ message = "^chore|^ci", group = "<!-- 8 -->⚙️ Miscellaneous Tasks" },
89+
{ body = ".*security", group = "<!-- 9 -->🛡️ Security" },
90+
{ message = "^revert", group = "<!-- 10 -->◀️ Revert" },
91+
]
92+
# filter out the commits that are not matched by commit parsers
93+
filter_commits = false
94+
# sort the tags topologically
95+
topo_order = false
96+
# sort the commits inside sections by oldest/newest order
97+
sort_commits = "oldest"

.github/dependabot.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: monthly
7+
groups:
8+
rust-dependencies:
9+
patterns:
10+
- "*"
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: monthly
15+
groups:
16+
actions-dependencies:
17+
patterns:
18+
- "*"

Cargo.lock

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/wind-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ impl Default for AppContext {
3333
token: CancellationToken::new(),
3434
}
3535
}
36-
}
36+
}

crates/wind-core/src/log.rs

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,17 @@ macro_rules! error {
5959
}
6060

6161
/// Extract the crate name from the module path at compile time.
62-
///
63-
/// This macro parses `module_path!()` to extract the crate name (the part before the first `::`)
64-
/// using only const operations, ensuring compile-time evaluation.
65-
///
62+
///
63+
/// This macro parses `module_path!()` to extract the crate name (the part
64+
/// before the first `::`) using only const operations, ensuring compile-time
65+
/// evaluation.
66+
///
6667
/// # Implementation Notes
67-
///
68-
/// The original implementation had potential issues with the unsafe UTF-8 conversion.
69-
/// This version is safer and clearer while maintaining compile-time evaluation.
70-
///
68+
///
69+
/// The original implementation had potential issues with the unsafe UTF-8
70+
/// conversion. This version is safer and clearer while maintaining compile-time
71+
/// evaluation.
72+
///
7173
/// Reference: https://github.com/Gadiguibou/current_crate_name/blob/master/src/lib.rs
7274
#[macro_export]
7375
macro_rules! extract_crate_name {
@@ -76,37 +78,31 @@ macro_rules! extract_crate_name {
7678
const CRATE_NAME: &str = {
7779
let bytes = MODULE_PATH.as_bytes();
7880
let mut end_index = 0;
79-
81+
8082
// Find the first '::' or end of string
8183
while end_index < bytes.len() {
8284
// Check for ':' followed by another ':'
83-
if end_index + 1 < bytes.len()
84-
&& bytes[end_index] == b':'
85-
&& bytes[end_index + 1] == b':'
86-
{
85+
if end_index + 1 < bytes.len() && bytes[end_index] == b':' && bytes[end_index + 1] == b':' {
8786
break;
8887
}
8988
end_index += 1;
9089
}
91-
90+
9291
// Create a slice with the crate name
93-
// SAFETY: We're slicing at character boundaries (either at '::' which are ASCII,
94-
// or at the end of the string). Since the original string is valid UTF-8 and
95-
// we only slice at ASCII character boundaries, the result is also valid UTF-8.
92+
// SAFETY: We're slicing at character boundaries (either at '::' which are
93+
// ASCII, or at the end of the string). Since the original string is valid
94+
// UTF-8 and we only slice at ASCII character boundaries, the result is also
95+
// valid UTF-8.
9696
const fn slice_str(s: &str, end: usize) -> &str {
9797
let bytes = s.as_bytes();
9898
// This is safe because we know the input is valid UTF-8 and we slice at
9999
// ASCII boundaries (either at '::' or string end)
100-
unsafe {
101-
core::str::from_utf8_unchecked(
102-
core::slice::from_raw_parts(bytes.as_ptr(), end)
103-
)
104-
}
100+
unsafe { core::str::from_utf8_unchecked(core::slice::from_raw_parts(bytes.as_ptr(), end)) }
105101
}
106-
102+
107103
slice_str(MODULE_PATH, end_index)
108104
};
109-
105+
110106
CRATE_NAME
111107
}};
112108
}
@@ -119,15 +115,15 @@ mod tests {
119115
let crate_name = extract_crate_name!();
120116
assert_eq!(crate_name, "wind_core");
121117
}
122-
118+
123119
#[test]
124120
fn test_extract_crate_name_with_logging() {
125121
// Test that the macro works in logging context
126122
let crate_name = extract_crate_name!();
127123
assert!(!crate_name.is_empty());
128124
assert!(!crate_name.contains("::"));
129125
}
130-
126+
131127
mod nested {
132128
#[test]
133129
fn test_extract_crate_name_nested() {
@@ -136,7 +132,7 @@ mod tests {
136132
assert_eq!(crate_name, "wind_core");
137133
}
138134
}
139-
135+
140136
mod deeply {
141137
pub mod nested {
142138
pub mod module {
@@ -149,17 +145,17 @@ mod tests {
149145
}
150146
}
151147
}
152-
148+
153149
#[test]
154150
fn test_crate_name_is_valid_identifier() {
155151
let crate_name = extract_crate_name!();
156-
152+
157153
// Crate name should not be empty
158154
assert!(!crate_name.is_empty());
159-
155+
160156
// Crate name should not contain '::'
161157
assert!(!crate_name.contains("::"));
162-
158+
163159
// Crate name should only contain valid identifier characters
164160
assert!(crate_name.chars().all(|c| c.is_alphanumeric() || c == '_'));
165161
}

0 commit comments

Comments
 (0)