diff --git a/CHANGELOG.md b/CHANGELOG.md
index d154369..1790f58 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,13 @@
-## v0.2.1
- - prevent borrow panics in VM during batch operations
- - fix Maximize batch mode
- - fix panic in parsing invalid numbers
-## v0.2.0
+
+## [v0.2.1]
+
+- prevent borrow panics in VM during batch operations
+- fix Maximize batch mode
+- fix panic in parsing invalid numbers
+
+## [v0.2.0]
### Share VM State!
@@ -12,21 +15,21 @@ New in this release is the ability to share the entire VM with you share a link.
Additionally you can now save and load any number of sessions in your browser. Access this functionality from the main menu.
-Also! the project has officially moved to https://ic10emu.dev . Old share links *should* redirect, but if not simply copy the fragment (the part of the url starting with the `#` symbol)
+Also! the project has officially moved to https://ic10emu.dev . Old share links _should_ redirect, but if not simply copy the fragment (the part of the url starting with the `#` symbol)
#### List of changes
- - Move build system from Webpack to [Rsbuild](https://rsbuild.dev/) (way faster build times).
- - VM now supports exporting and restoring a frozen state.
- - Share links updates to use frozen vm state.
- - Save and load sessions from the browser's IndexedDB storage.
- - project now includes tailwindcss to make frontend dev easier.
- - Changelog dialog to notify users of updates.
+- Move build system from Webpack to [Rsbuild](https://rsbuild.dev/) (way faster build times).
+- VM now supports exporting and restoring a frozen state.
+- Share links updates to use frozen vm state.
+- Save and load sessions from the browser's IndexedDB storage.
+- project now includes tailwindcss to make frontend dev easier.
+- Changelog dialog to notify users of updates.
-## v0.1.0
+## [v0.1.0]
### **Initial Release**:
IC10emu is released to the public! edit and share your IC10 scripts!
- - view and edit stack and registers
+- view and edit stack and registers
diff --git a/CHANGELOG.md.jinja b/CHANGELOG.md.jinja
new file mode 100644
index 0000000..39abb24
--- /dev/null
+++ b/CHANGELOG.md.jinja
@@ -0,0 +1,52 @@
+{#- macro: render_commit -#}
+{%- macro render_commit(commit) -%}
+- {{ commit.convention.subject|default(commit.subject) }} ([{{ commit.hash|truncate(7, True, '') }}]({{ commit.url }}) by {{ commit.author_name }}).
+{%- if commit.text_refs.issues_not_in_subject %} Related issues/PRs: {% for issue in commit.text_refs.issues_not_in_subject -%}
+{% if issue.url %}[{{ issue.ref }}]({{ issue.url }}){% else %}{{ issue.ref }}{% endif %}{% if not loop.last %}, {% endif -%}
+{%- endfor -%}{%- endif -%}
+{%- for trailer_name, trailer_value in commit.trailers.items() -%}
+{%- if trailer_value|is_url %} [{{ trailer_name }}]({{ trailer_value }})
+{%- else %} {{ trailer_name }}: {{ trailer_value }}{% endif %}
+{%- if not loop.last %},{% endif %}
+{%- endfor -%}
+{%- endmacro -%}
+
+{#- macro: render_section -#}
+{%- macro render_section(section) -%}
+### {{ section.type or "Misc" }}
+
+{% for commit in section.commits|sort(attribute='author_date',reverse=true)|unique(attribute='subject') -%}
+{{ render_commit(commit) }}
+{% endfor %}
+{%- endmacro -%}
+
+{#- macro: render_version -#}
+{%- macro render_version(version) -%}
+{%- if version.tag or version.planned_tag -%}
+## [{{ version.tag or version.planned_tag }}]{% if version.date %} - {{ version.date }}{% endif %}
+
+[Compare with {{ version.previous_version.tag|default("first commit") }}]({{ version.compare_url }})
+{%- else -%}
+## Unreleased
+
+[Compare with latest]({{ version.compare_url }})
+{%- endif %}
+{% for type in changelog.sections %}
+{%- if type in version.sections_dict %}
+{%- with section = version.sections_dict[type] %}
+{{ render_section(section) }}
+{%- endwith %}
+{%- endif %}
+{%- endfor %}
+{%- if not (version.tag or version.planned_tag) %}
+{% endif %}
+{% endmacro -%}
+
+{#- template -#}
+{%- if not in_place -%}
+# Changelog
+
+{% endif %}
+{% for version in changelog.versions_list -%}
+{{ render_version(version) }}
+{%- endfor -%}
diff --git a/Cargo.lock b/Cargo.lock
index 6bda096..e2b7f12 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -560,7 +560,7 @@ dependencies = [
[[package]]
name = "ic10emu"
-version = "0.2.1"
+version = "0.2.2"
dependencies = [
"const-crc32",
"convert_case",
@@ -580,7 +580,7 @@ dependencies = [
[[package]]
name = "ic10emu_wasm"
-version = "0.2.1"
+version = "0.2.2"
dependencies = [
"console_error_panic_hook",
"ic10emu",
@@ -617,7 +617,7 @@ dependencies = [
[[package]]
name = "ic10lsp_wasm"
-version = "0.2.1"
+version = "0.2.2"
dependencies = [
"console_error_panic_hook",
"futures",
@@ -1844,7 +1844,7 @@ checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8"
[[package]]
name = "xtask"
-version = "0.2.1"
+version = "0.2.2"
dependencies = [
"clap",
"thiserror",
diff --git a/Cargo.toml b/Cargo.toml
index d1e3ba9..ae76808 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,7 @@ members = ["ic10lsp_wasm", "ic10emu_wasm", "ic10emu", "xtask"]
resolver = "2"
[workspace.package]
-version = "0.2.1"
+version = "0.2.2"
edition = "2021"
[profile.release]
diff --git a/www/package.json b/www/package.json
index d019d1e..de13091 100644
--- a/www/package.json
+++ b/www/package.json
@@ -1,6 +1,6 @@
{
"name": "ic10emu",
- "version": "0.2.1",
+ "version": "0.2.2",
"description": "an IC10 emulator for IC10 mips from Stationeers",
"main": "index.js",
"scripts": {
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index c070801..6a94408 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -19,6 +19,7 @@ struct Args {
}
const PACKAGES: &[&str] = &["ic10lsp_wasm", "ic10emu_wasm"];
+const VALID_VERSION_TYPE: &[&str] = &["patch", "minor", "major"];
#[derive(Debug, Subcommand)]
enum Task {
@@ -41,6 +42,13 @@ enum Task {
Start {},
/// Runs production page under 'www/dist', Run `build` first.
Deploy {},
+ /// bump the cargo.toml and package,json versions
+ Version {
+ #[arg(last = true, default_value = "patch", value_parser = clap::builder::PossibleValuesParser::new(VALID_VERSION_TYPE))]
+ version: String,
+ },
+ /// update changelog
+ Changelog {},
}
#[derive(thiserror::Error)]
@@ -66,6 +74,7 @@ impl std::fmt::Debug for Error {
}
}
+const VERSION: Option<&str> = option_env!("CARGO_PKG_VERSION");
fn main() -> Result<(), Error> {
let args = Args::parse();
let workspace = {
@@ -100,7 +109,7 @@ fn main() -> Result<(), Error> {
cmd.args(["run", "start"]).status().map_err(|e| {
Error::Command(format!("{}", cmd.get_program().to_string_lossy()), e)
})?;
- },
+ }
Task::Deploy {} => {
pnpm_install(&args, &workspace)?;
eprintln!("Production Build");
@@ -109,6 +118,33 @@ fn main() -> Result<(), Error> {
cmd.args(["run", "build"]).status().map_err(|e| {
Error::Command(format!("{}", cmd.get_program().to_string_lossy()), e)
})?;
+ }
+ Task::Version { version } => {
+ let mut cmd = Command::new("cargo");
+ cmd.current_dir(&workspace);
+ cmd.args(["set-version", "--bump", &version])
+ .status()
+ .map_err(|e| {
+ Error::Command(format!("{}", cmd.get_program().to_string_lossy()), e)
+ })?;
+ let mut cmd = Command::new(&args.manager);
+ cmd.current_dir(&workspace.join("www"));
+ cmd.args(["version", &version]).status().map_err(|e| {
+ Error::Command(format!("{}", cmd.get_program().to_string_lossy()), e)
+ })?;
+ },
+ Task::Changelog { } => {
+ let mut cmd = Command::new("git-changelog");
+ cmd.current_dir(&workspace);
+ cmd.args([
+ "-io", "CHANGELOG.md",
+ "-t", "path:CHANGELOG.md.jinja",
+ "--bump", VERSION.unwrap_or("auto"),
+ "--parse-refs",
+ "--trailers"
+ ]).status().map_err(|e| {
+ Error::Command(format!("{}", cmd.get_program().to_string_lossy()), e)
+ })?;
},
}
Ok(())
@@ -160,10 +196,7 @@ fn build + std::fmt::Debug + std::fmt::Display>(
Ok(())
}
-fn pnpm_install(
- args: &Args,
- workspace: &std::path::Path,
-) -> Result {
+fn pnpm_install(args: &Args, workspace: &std::path::Path) -> Result {
eprintln!("Running `pnpm install`");
let mut cmd = Command::new(&args.manager);
cmd.current_dir(&workspace.join("www"));