qwen-code/scripts/tests/workspaces.test.js
易良 ce72ddbe6c
feat(desktop): remove packages/desktop after OpenWork fork; keep the Tauri upgrade bridge (#9085)
OpenWork (modelstudioai/openwork) has forked the Electron desktop code and is
self-contained now, so retire the Electron package and its release/sync
machinery from this repo:

- Delete packages/desktop (Electron app, live-host app, bun workspace).
- Retire scripts/desktop-openwork-sync.ts and the desktop-openwork-sync root
  script; the OpenWork sync is no longer needed.
- Retire .github/workflows/live-host.yml, live-host-release.yml and
  sync-live-host-to-oss.yml; live-host releases now live in OpenWork. The
  CLI-side packages/cli/src/serve/live code stays for now (separate cleanup).
- Retire scripts/check-voice-guard-sync.js (cli<->desktop parity only) and
  its CI step.
- Clean up remaining references: root package.json workspaces negation and
  package-lock.json, eslint/prettier/yamllint ignores, architecture docs,
  web-shell skill descriptions, and review-lib workspace fixtures/comments
  (renamed to point at packages/desktop-shell, the remaining negation).

Deliberately kept: the Electron->Tauri upgrade bridge — desktop-release.yml
(incl. the electron_bridge input), create-electron-bridge-manifest.mjs,
sync-desktop-to-oss.yml (mirrors Tauri desktop-shell artifacts only) and
everything under packages/desktop-shell.
2026-08-25 05:26:11 +00:00

79 lines
2.1 KiB
JavaScript

/**
* @license
* Copyright 2026 Qwen Team
* SPDX-License-Identifier: Apache-2.0
*/
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import path from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
import { getWorkspacePackageJsonPaths } from '../workspaces.js';
describe('workspace helpers', () => {
const tempDirs = [];
afterEach(() => {
for (const tempDir of tempDirs.splice(0)) {
rmSync(tempDir, { force: true, recursive: true });
}
});
it('honors negated workspace patterns', () => {
const root = mkdtempSync(path.join(tmpdir(), 'qwen-workspaces-'));
tempDirs.push(root);
for (const packagePath of [
'packages/cli/package.json',
'packages/core/package.json',
'packages/desktop-shell/package.json',
'packages/channels/base/package.json',
]) {
writeFile(root, packagePath, '{}\n');
}
expect(
getWorkspacePackageJsonPaths(root, [
'packages/*',
'packages/channels/base',
'!packages/desktop-shell',
]),
).toEqual([
'packages/channels/base/package.json',
'packages/cli/package.json',
'packages/core/package.json',
]);
});
it('normalizes Windows-style workspace patterns', () => {
const root = mkdtempSync(path.join(tmpdir(), 'qwen-workspaces-'));
tempDirs.push(root);
for (const packagePath of [
'packages/cli/package.json',
'packages/core/package.json',
'packages/desktop-shell/package.json',
'packages/channels/base/package.json',
]) {
writeFile(root, packagePath, '{}\n');
}
expect(
getWorkspacePackageJsonPaths(root, [
'packages\\*',
'packages\\channels\\base',
'!packages\\desktop-shell',
]),
).toEqual([
'packages/channels/base/package.json',
'packages/cli/package.json',
'packages/core/package.json',
]);
});
function writeFile(root, relativePath, content) {
const filePath = path.join(root, relativePath);
mkdirSync(path.dirname(filePath), { recursive: true });
writeFileSync(filePath, content);
}
});