@dsh-workbench/adapter-probe 1.1.14-beta.0 → 1.1.14-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/install.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { isolatedInstallCommand, isolatedPnpmInstallCommand } from '@dsh-workbench/adapter-runtime';
3
- import { desktopPnpmPath } from './toolchain.js';
3
+ import { desktopPnpmPath, desktopPnpmVersion } from './toolchain.js';
4
4
  export function opencliInstallCommand(proc = process, exists = existsSync) {
5
5
  const override = process.env.DSH_WB_PNPM?.trim();
6
6
  if (override !== undefined && override !== '')
7
7
  return isolatedInstallCommand();
8
8
  const pnpm = desktopPnpmPath(proc, exists);
9
- return pnpm === undefined ? isolatedInstallCommand() : isolatedPnpmInstallCommand(pnpm);
9
+ const major = Number(desktopPnpmVersion(proc, exists)?.split('.')[0] ?? '0');
10
+ return pnpm === undefined || (major !== 0 && major < 10)
11
+ ? isolatedInstallCommand()
12
+ : isolatedPnpmInstallCommand(pnpm);
10
13
  }
@@ -5,7 +5,7 @@ import writeFileAtomic from 'write-file-atomic';
5
5
  import { chmodSync, closeSync, mkdirSync, openSync, readFileSync, rmSync, } from 'node:fs';
6
6
  import { delimiter, dirname, join, sep } from 'node:path';
7
7
  import { quoteShellArg, quoteShellArgFor } from '@dsh-workbench/shared/host';
8
- import { desktopPnpmPath, desktopPnpmVersion, ensureToolchain, localNpmCache, provisionLocalPnpmSync } from './toolchain.js';
8
+ import { desktopPnpmPath, desktopPnpmVersion, ensureToolchain, localNpmCache, localPnpmCommand, provisionLocalPnpmSync, } from './toolchain.js';
9
9
  export function opencliBinName(platform = process.platform) {
10
10
  return platform === 'win32' ? 'opencli.cmd' : 'opencli';
11
11
  }
@@ -126,13 +126,14 @@ export function prependPath(entryDir, env = process.env) {
126
126
  }
127
127
  export function seedWorkbenchToolchain(root, log) {
128
128
  const bundledPnpm = desktopPnpmPath();
129
- const bundledVersion = desktopPnpmVersion()?.split('.')[0];
130
- if (bundledPnpm !== undefined && bundledVersion === '10') {
129
+ const bundledMajor = Number(desktopPnpmVersion()?.split('.')[0] ?? '0');
130
+ const bundledUsable = bundledPnpm !== undefined && bundledMajor >= 10;
131
+ if (bundledPnpm !== undefined && bundledUsable) {
131
132
  process.env.DSH_WB_PNPM = `node ${quoteShellArgFor(bundledPnpm, process.platform)}`;
132
133
  log(`pnpm 用 Desktop 自带的:${bundledPnpm}`);
133
134
  }
134
135
  else if (bundledPnpm !== undefined) {
135
- log(`Desktop 自带 pnpm 版本不是 10,优先用 PATH 上的 pnpm`);
136
+ log(`Desktop 自带 pnpm 版本低于 10,优先用 PATH 上的 pnpm`);
136
137
  }
137
138
  const toolchain = ensureToolchain({ root, log });
138
139
  for (const file of toolchain.files)
@@ -150,12 +151,15 @@ export function seedWorkbenchToolchain(root, log) {
150
151
  if (toolchain.pnpmDir !== undefined) {
151
152
  if (prependPath(toolchain.pnpmDir))
152
153
  log(`PATH 前插 ${toolchain.pnpmDir}`);
154
+ if (!bundledUsable)
155
+ process.env.DSH_WB_PNPM = localPnpmCommand(root);
153
156
  }
154
- else if (toolchain.pathDir !== undefined) {
157
+ else if (!bundledUsable && toolchain.pathDir !== undefined) {
155
158
  const installed = provisionLocalPnpmSync({ root });
156
159
  if (installed.ok && installed.binDir !== undefined) {
157
160
  if (prependPath(installed.binDir))
158
161
  log(`PATH 前插 ${installed.binDir}`);
162
+ process.env.DSH_WB_PNPM = localPnpmCommand(root);
159
163
  log(`工具链 provision ${installed.detail}`);
160
164
  }
161
165
  else {
@@ -15,7 +15,7 @@ async function toolVersion(shell, line) {
15
15
  export async function probeDesktopToolchain(shell) {
16
16
  const bundledPnpm = desktopPnpmPath();
17
17
  const bundledMajor = desktopPnpmVersion()?.split('.')[0];
18
- const preferBundled = bundledPnpm !== undefined && bundledMajor === '10';
18
+ const preferBundled = bundledPnpm !== undefined && Number(bundledMajor ?? '0') >= 10;
19
19
  const pnpmLine = preferBundled
20
20
  ? `node ${quoteShellArg(bundledPnpm ?? '')} --version`
21
21
  : 'pnpm --version';
@@ -36,8 +36,8 @@ export async function probeDesktopToolchain(shell) {
36
36
  }
37
37
  const nodeMissing = !node.ok;
38
38
  const npmMissing = !npm.ok;
39
- const pnpmMajor = /^v?(\d+)/.exec(pnpm.text)?.[1];
40
- const pnpmProblem = !pnpm.ok || pnpmMajor !== '10';
39
+ const pnpmMajor = Number(/^v?(\d+)/.exec(pnpm.text)?.[1] ?? '0');
40
+ const pnpmProblem = !pnpm.ok || pnpmMajor < 10;
41
41
  const desktop = hostSurface({ proc: process }).deployment === 'desktop';
42
42
  const parts = [
43
43
  nodeMissing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/adapter-probe",
3
- "version": "1.1.14-beta.0",
3
+ "version": "1.1.14-beta.1",
4
4
  "description": "Workbench adapter-probe adapter.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -16,10 +16,10 @@
16
16
  "execa": "^10.2.0",
17
17
  "proper-lockfile": "^4.1.2",
18
18
  "write-file-atomic": "^8.0.0",
19
- "@dsh-workbench/adapter-profile": "1.1.14-beta.0",
20
- "@dsh-workbench/adapter-runtime": "1.1.14-beta.0",
21
- "@dsh-workbench/adapter-supply": "1.1.14-beta.0",
22
- "@dsh-workbench/shared": "1.1.14-beta.0"
19
+ "@dsh-workbench/adapter-supply": "1.1.14-beta.1",
20
+ "@dsh-workbench/adapter-runtime": "1.1.14-beta.1",
21
+ "@dsh-workbench/shared": "1.1.14-beta.1",
22
+ "@dsh-workbench/adapter-profile": "1.1.14-beta.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^24.19.0",