From 6421629cc077f79668edc895e5b04ff2b0deeb1f Mon Sep 17 00:00:00 2001 From: bdbch Date: Tue, 2 Jun 2026 15:16:01 +0200 Subject: [PATCH] Prefix changelog versions with v and add solo mode Change generate_changelog_section to emit a 'v' before version numbers. Treat solo workspaces specially in apply_release_plan: for single-package repos generate a per-package changelog section (version H2, no package prefix) instead of aggregating into a dated global section. Add create_solo_workspace helper and tests for solo changelog formatting; update megatest expectations accordingly. --- .oxrls/770e-faint-lane.md | 5 ++ packages/oxrls/index.d.ts | 1 - packages/oxrls/index.js | 130 ++++++++++++++++++------------- packages/oxrls/src/bump/apply.rs | 54 +++++++++---- packages/oxrls/src/bump/mod.rs | 76 ++++++++++++++++++ packages/oxrls/src/changelog.rs | 5 +- packages/oxrls/tests/megatest.rs | 13 +++- 7 files changed, 206 insertions(+), 78 deletions(-) create mode 100644 .oxrls/770e-faint-lane.md diff --git a/.oxrls/770e-faint-lane.md b/.oxrls/770e-faint-lane.md new file mode 100644 index 0000000..94fc170 --- /dev/null +++ b/.oxrls/770e-faint-lane.md @@ -0,0 +1,5 @@ +--- +'@bdbchgg/oxrls': 'patch' +--- + +Fix a bug where the changelog format for solorepo workspaces would not use the normal mono-repo format diff --git a/packages/oxrls/index.d.ts b/packages/oxrls/index.d.ts index fa067e2..c6e428d 100644 --- a/packages/oxrls/index.d.ts +++ b/packages/oxrls/index.d.ts @@ -1,4 +1,3 @@ /* auto-generated by NAPI-RS */ /* eslint-disable */ export declare function runCli(args: Array): void -export declare function plus100(input: number): number diff --git a/packages/oxrls/index.js b/packages/oxrls/index.js index 8babf48..5e9250e 100644 --- a/packages/oxrls/index.js +++ b/packages/oxrls/index.js @@ -3,9 +3,6 @@ // @ts-nocheck /* auto-generated by NAPI-RS */ -const { createRequire } = require('node:module') -require = createRequire(__filename) - const { readFileSync } = require('node:fs') let nativeBinding = null const loadErrors = [] @@ -80,8 +77,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-android-arm64') const bindingPackageVersion = require('@bdbchgg/oxrls-android-arm64/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -96,8 +93,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-android-arm-eabi') const bindingPackageVersion = require('@bdbchgg/oxrls-android-arm-eabi/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -108,7 +105,24 @@ function requireNative() { } } else if (process.platform === 'win32') { if (process.arch === 'x64') { + if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') { + try { + return require('./oxrls-native.win32-x64-gnu.node') + } catch (e) { + loadErrors.push(e) + } try { + const binding = require('@bdbchgg/oxrls-win32-x64-gnu') + const bindingPackageVersion = require('@bdbchgg/oxrls-win32-x64-gnu/package.json').version + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + } + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + try { return require('./oxrls-native.win32-x64-msvc.node') } catch (e) { loadErrors.push(e) @@ -116,13 +130,14 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-win32-x64-msvc') const bindingPackageVersion = require('@bdbchgg/oxrls-win32-x64-msvc/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { loadErrors.push(e) } + } } else if (process.arch === 'ia32') { try { return require('./oxrls-native.win32-ia32-msvc.node') @@ -132,8 +147,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-win32-ia32-msvc') const bindingPackageVersion = require('@bdbchgg/oxrls-win32-ia32-msvc/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -148,8 +163,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-win32-arm64-msvc') const bindingPackageVersion = require('@bdbchgg/oxrls-win32-arm64-msvc/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -167,8 +182,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-darwin-universal') const bindingPackageVersion = require('@bdbchgg/oxrls-darwin-universal/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -183,8 +198,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-darwin-x64') const bindingPackageVersion = require('@bdbchgg/oxrls-darwin-x64/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -199,8 +214,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-darwin-arm64') const bindingPackageVersion = require('@bdbchgg/oxrls-darwin-arm64/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -219,8 +234,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-freebsd-x64') const bindingPackageVersion = require('@bdbchgg/oxrls-freebsd-x64/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -235,8 +250,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-freebsd-arm64') const bindingPackageVersion = require('@bdbchgg/oxrls-freebsd-arm64/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -256,8 +271,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-x64-musl') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-x64-musl/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -272,8 +287,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-x64-gnu') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-x64-gnu/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -290,8 +305,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-arm64-musl') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-arm64-musl/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -306,8 +321,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-arm64-gnu') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-arm64-gnu/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -324,8 +339,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-arm-musleabihf') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-arm-musleabihf/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -340,8 +355,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-arm-gnueabihf') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-arm-gnueabihf/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -358,8 +373,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-loong64-musl') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-loong64-musl/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -374,8 +389,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-loong64-gnu') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-loong64-gnu/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -392,8 +407,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-riscv64-musl') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-riscv64-musl/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -408,8 +423,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-riscv64-gnu') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-riscv64-gnu/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -425,8 +440,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-ppc64-gnu') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-ppc64-gnu/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -441,8 +456,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-linux-s390x-gnu') const bindingPackageVersion = require('@bdbchgg/oxrls-linux-s390x-gnu/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -461,8 +476,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-openharmony-arm64') const bindingPackageVersion = require('@bdbchgg/oxrls-openharmony-arm64/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -477,8 +492,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-openharmony-x64') const bindingPackageVersion = require('@bdbchgg/oxrls-openharmony-x64/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -493,8 +508,8 @@ function requireNative() { try { const binding = require('@bdbchgg/oxrls-openharmony-arm') const bindingPackageVersion = require('@bdbchgg/oxrls-openharmony-arm/package.json').version - if (bindingPackageVersion !== '1.0.0-alpha.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '1.0.0-alpha.5' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 1.0.0-alpha.5 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -521,13 +536,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { wasiBindingError = err } } - if (!nativeBinding) { + if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { try { wasiBinding = require('@bdbchgg/oxrls-wasm32-wasi') nativeBinding = wasiBinding } catch (err) { if (process.env.NAPI_RS_FORCE_WASI) { - wasiBindingError.cause = err + if (!wasiBindingError) { + wasiBindingError = err + } else { + wasiBindingError.cause = err + } loadErrors.push(err) } } @@ -557,5 +576,4 @@ if (!nativeBinding) { } module.exports = nativeBinding -module.exports.plus100 = nativeBinding.plus100 module.exports.runCli = nativeBinding.runCli diff --git a/packages/oxrls/src/bump/apply.rs b/packages/oxrls/src/bump/apply.rs index dc43ac2..1c11a8f 100644 --- a/packages/oxrls/src/bump/apply.rs +++ b/packages/oxrls/src/bump/apply.rs @@ -141,24 +141,44 @@ pub fn apply_release_plan( } if changelog_mode.global { - // Collect all bumped packages with their summaries for the global changelog - let global_packages: Vec<(String, semver::Version, BumpType, Vec)> = plan - .bumps - .values() - .map(|bump| { - ( - bump.package_name.clone(), - bump.new_version.clone(), - bump.bump_type, - bump.summaries.clone(), - ) - }) - .collect(); + if is_solo_repo { + // Solo repo: use per-package format (version h2, no package prefix). + // Since there's only one package, the per-package formatter gives the + // desired output — version as heading, plain bullet entries. + if let Some((_name, bump)) = plan.bumps.iter().next() { + let mut changes: IndexMap> = IndexMap::new(); + changes.insert(bump.bump_type, bump.summaries.clone()); + let entry = ChangelogEntry { + package_name: bump.package_name.clone(), + version: bump.new_version.to_string(), + changes, + }; + let section = generate_changelog_section(&entry); + if !section.is_empty() { + let changelog_path = workspace.root.join("CHANGELOG.md"); + update_changelog(&changelog_path, §ion)?; + } + } + } else { + // Monorepo: aggregate changes from all bumped packages with a date heading + let global_packages: Vec<(String, semver::Version, BumpType, Vec)> = plan + .bumps + .values() + .map(|bump| { + ( + bump.package_name.clone(), + bump.new_version.clone(), + bump.bump_type, + bump.summaries.clone(), + ) + }) + .collect(); - let global_section = generate_global_changelog_section(&global_packages); - if !global_section.is_empty() { - let global_changelog_path = workspace.root.join("CHANGELOG.md"); - update_global_changelog(&global_changelog_path, &global_section)?; + let global_section = generate_global_changelog_section(&global_packages); + if !global_section.is_empty() { + let global_changelog_path = workspace.root.join("CHANGELOG.md"); + update_global_changelog(&global_changelog_path, &global_section)?; + } } } diff --git a/packages/oxrls/src/bump/mod.rs b/packages/oxrls/src/bump/mod.rs index d2f2a36..d0f7f3b 100644 --- a/packages/oxrls/src/bump/mod.rs +++ b/packages/oxrls/src/bump/mod.rs @@ -656,6 +656,82 @@ Mixed changes for pre-release and stable."#; ); } + /// Helper: create a solo repo workspace (single package at root, no workspaces field). + fn create_solo_workspace(tmp: &TempDir) -> Workspace { + let root_pkg = serde_json::json!({ + "name": "@bdbchgg/wingetjs", + "version": "1.0.0" + }); + std::fs::write( + tmp.path().join("package.json"), + serde_json::to_string_pretty(&root_pkg).unwrap(), + ) + .unwrap(); + + load_workspace(tmp.path()).unwrap() + } + + #[test] + fn test_solo_repo_changelog_format() { + let tmp = TempDir::new().unwrap(); + let workspace = create_solo_workspace(&tmp); + + let release_dir = tmp.path().join(".oxrls"); + std::fs::create_dir_all(&release_dir).unwrap(); + + let content = r#"--- +"@bdbchgg/wingetjs": minor +--- + +Initial release of @bdbchgg/wingetjs"#; + std::fs::write(release_dir.join("release.md"), content).unwrap(); + + let config = OxrlsConfig::default(); + let plan = build_release_plan(&workspace, &config, &release_dir).unwrap(); + + // Apply the plan (not dry run) + apply_release_plan(&workspace, &plan, &config, &release_dir, false, false).unwrap(); + + // Read the generated changelog + let changelog_path = tmp.path().join("CHANGELOG.md"); + assert!(changelog_path.exists(), "CHANGELOG.md should exist"); + + let changelog = std::fs::read_to_string(&changelog_path).unwrap(); + + // Should use version as h2, NOT a date + assert!( + changelog.contains("## v1.1.0"), + "Changelog should use version heading, got:\n{}", + changelog + ); + assert!( + !changelog.contains("2026-"), + "Changelog should NOT use date heading, got:\n{}", + changelog + ); + + // Should NOT contain package prefix + assert!( + !changelog.contains("**@bdbchgg/wingetjs**"), + "Changelog should NOT contain package prefix in solo mode, got:\n{}", + changelog + ); + + // Should use plain bullet format + assert!( + changelog.contains("- Initial release of @bdbchgg/wingetjs"), + "Changelog should use plain bullet format, got:\n{}", + changelog + ); + + // Verify structure + assert!( + changelog.contains("### Minor Changes"), + "Changelog should have Minor Changes section, got:\n{}", + changelog + ); + } + #[test] fn test_pre_state_not_saved_by_build_plan_alone() { // When build_release_plan is called without a subsequent apply, diff --git a/packages/oxrls/src/changelog.rs b/packages/oxrls/src/changelog.rs index 9de9216..9c633e6 100644 --- a/packages/oxrls/src/changelog.rs +++ b/packages/oxrls/src/changelog.rs @@ -38,7 +38,7 @@ fn indent_continuations(text: &str, first_line_prefix: &str) -> String { pub fn generate_changelog_section(entry: &ChangelogEntry) -> String { let mut lines = Vec::new(); - lines.push(format!("## {}", entry.version)); + lines.push(format!("## v{}", entry.version)); lines.push(String::new()); let type_names = [ @@ -237,7 +237,7 @@ mod tests { }; let section = generate_changelog_section(&entry); - assert!(section.contains("1.2.4")); + assert!(section.contains("v1.2.4")); assert!(section.contains("### Patch Changes")); assert!(section.contains("Fixed editor selection behavior.")); assert!(!section.contains("Minor Changes")); @@ -263,6 +263,7 @@ mod tests { }; let section = generate_changelog_section(&entry); + assert!(section.contains("v2.0.0")); assert!(section.contains("### Major Changes")); assert!(section.contains("### Minor Changes")); assert!(section.contains("### Patch Changes")); diff --git a/packages/oxrls/tests/megatest.rs b/packages/oxrls/tests/megatest.rs index 3d76c38..51cdce6 100644 --- a/packages/oxrls/tests/megatest.rs +++ b/packages/oxrls/tests/megatest.rs @@ -418,8 +418,17 @@ fn test_solo_repo_always_creates_changelog() { let changelog_content = std::fs::read_to_string(&changelog_path).unwrap(); assert!(changelog_content.contains("# Changelog"), "Should have changelog header"); - assert!(changelog_content.contains("my-app"), "Should reference the package name"); - assert!(changelog_content.contains("1.0.1"), "Should reference the new version"); + // Solo repo uses version heading (not date), no package prefix + assert!( + changelog_content.contains("## v1.0.1"), + "Should use version heading, got:\n{}", + changelog_content + ); + assert!( + !changelog_content.contains("**my-app**"), + "Solo repo should NOT have package prefix, got:\n{}", + changelog_content + ); assert!(changelog_content.contains("Fix login bug"), "Should contain the release summary"); assert!(changelog_content.contains("### Patch Changes"), "Should group changes by type"); -- 2.51.2