mirror of
https://github.com/stablyai/orca.git
synced 2026-09-28 00:02:41 +00:00
Adapt the packaging guard to the vendored Windows registry addon
main vendored windows-native-registry as the workspace package @orca/windows-registry (#20438). A workspace link resolves on every host, so including it in the installed-Windows-addons checks proved nothing. @vscode/windows-process-tree is the only os: win32 npm addon left, so it alone decides whether the win32 resource plan resolves.
This commit is contained in:
@@ -150,8 +150,10 @@ const MARKDOWN_FILE_EXTENSIONS = ['md', 'markdown', 'mdx']
|
||||
|
||||
// Why: the config must load on a host-only install without resolving unused Windows addons.
|
||||
// This is load-time tolerance only; beforePack enforces that the target's natives are installed.
|
||||
const windowsRuntimeResources = ['@vscode/windows-process-tree', 'windows-native-registry'].every(
|
||||
(name) => existsSync(join(__dirname, '..', 'node_modules', name, 'package.json'))
|
||||
// Why one package: @vscode/windows-process-tree is the only os: win32 npm addon;
|
||||
// @orca/windows-registry is a workspace link present on every host, so its presence proves nothing.
|
||||
const windowsRuntimeResources = existsSync(
|
||||
join(__dirname, '..', 'node_modules', '@vscode', 'windows-process-tree', 'package.json')
|
||||
)
|
||||
? createPackagedRuntimeNodeModuleResources('win32')
|
||||
: []
|
||||
|
||||
@@ -552,20 +552,18 @@ function assertPackagedNativeVariantsInstalled(electronPlatformName, electronArc
|
||||
}
|
||||
}
|
||||
|
||||
// Why one package: @vscode/windows-process-tree is the only os: win32 npm addon;
|
||||
// @orca/windows-registry is a workspace link present on every host, so its presence proves nothing.
|
||||
const missingWindowsAddons = []
|
||||
if (electronPlatformName === 'win32') {
|
||||
for (const name of ['@vscode/windows-process-tree', 'windows-native-registry']) {
|
||||
if (!isInstalled(name)) {
|
||||
missingWindowsAddons.push(name)
|
||||
}
|
||||
}
|
||||
if (electronPlatformName === 'win32' && !isInstalled('@vscode/windows-process-tree')) {
|
||||
missingWindowsAddons.push('@vscode/windows-process-tree')
|
||||
}
|
||||
|
||||
if (missing.length === 0 && missingWindowsAddons.length === 0) {
|
||||
return
|
||||
}
|
||||
// Why separate remedies: install:release widens only the CPU set, so the os: win32 addons
|
||||
// never arrive on a non-Windows host and are compiled only by the Windows-only rebuild.
|
||||
// Why separate remedies: install:release widens only the CPU set, so the os: win32 addon
|
||||
// never arrives on a non-Windows host and is compiled only by the Windows-only rebuild.
|
||||
const remedies = []
|
||||
if (missing.length > 0) {
|
||||
remedies.push('Run pnpm install:release to install another architecture.')
|
||||
|
||||
@@ -22,10 +22,11 @@ const {
|
||||
verifyPackagedMainRuntimeDeps
|
||||
} = require('../packaged-runtime-node-modules.cjs')
|
||||
|
||||
// Why not process.platform: the win32 plan resolves wherever its node-gyp addons are
|
||||
// installed, which a cross-architecture release install can also produce off Windows.
|
||||
const windowsAddonsInstalled = ['@vscode/windows-process-tree', 'windows-native-registry'].every(
|
||||
(name) => existsSync(join(projectRoot, 'node_modules', name, 'package.json'))
|
||||
// Why this and not process.platform: @vscode/windows-process-tree is the only os: win32 npm
|
||||
// addon left, so its presence is what decides whether the win32 plan resolves.
|
||||
// @orca/windows-registry is a workspace link present on every host, so it proves nothing.
|
||||
const windowsAddonsInstalled = existsSync(
|
||||
join(projectRoot, 'node_modules', '@vscode', 'windows-process-tree', 'package.json')
|
||||
)
|
||||
|
||||
describe('packaged runtime resources', () => {
|
||||
|
||||
@@ -30,18 +30,20 @@ broken. `beforePack` in
|
||||
therefore calls `assertPackagedNativeVariantsInstalled` in
|
||||
[`config/packaged-runtime-node-modules.cjs`](../../config/packaged-runtime-node-modules.cjs),
|
||||
which fails the build when the target platform/architecture's native variants
|
||||
are not installed: `sherpa-onnx-*`, `@parcel/watcher-*`, and on Windows the two
|
||||
node-gyp addons (`@vscode/windows-process-tree`, `windows-native-registry`). The
|
||||
error names every missing package and gives the remedy that fits: another
|
||||
architecture's variants come from `pnpm install:release`, the Windows addons do
|
||||
not (see below).
|
||||
are not installed: `sherpa-onnx-*`, `@parcel/watcher-*`, and on Windows the
|
||||
node-gyp addon `@vscode/windows-process-tree`. The error names every missing
|
||||
package and gives the remedy that fits: another architecture's variants come
|
||||
from `pnpm install:release`, the Windows addon does not (see below).
|
||||
|
||||
Windows packaging requires a Windows host. The two addons are `os: win32`
|
||||
packages, so they are installed only where that matches, and they are compiled
|
||||
only by the Windows-only rebuild in `config/scripts/rebuild-native-deps.mjs`
|
||||
Windows packaging requires a Windows host. `@vscode/windows-process-tree` is an
|
||||
`os: win32` npm addon, so it is installed only where that matches;
|
||||
`@orca/windows-registry` is a workspace package that links on every host, but
|
||||
its native binary is still compiled only on Windows. Both are compiled only by
|
||||
the Windows-only rebuild in `config/scripts/rebuild-native-deps.mjs`
|
||||
(`allowBuilds` in `pnpm-workspace.yaml` keeps pnpm itself from running node-gyp
|
||||
for them). `pnpm install:release` does not help on macOS or Linux because it
|
||||
does not widen the OS set.
|
||||
for them). The guard checks `@vscode/windows-process-tree` alone because the
|
||||
workspace link is present everywhere and proves nothing. `pnpm install:release`
|
||||
does not help on macOS or Linux because it does not widen the OS set.
|
||||
|
||||
Tests that inspect installed Windows addons and their packaging closure run on
|
||||
Windows, where those dependencies are required. The PR Windows lane explicitly
|
||||
|
||||
Reference in New Issue
Block a user