Files
qwen-code/packages/browser-use/scripts/verify-package.mjs
T
顾盼 a791e47a54 feat(cua): streamline computer use and port native reliability fixes (#14846)
* feat(cua): preload the JavaScript computer use runtime

* refactor(cua): remove the native Wayland backend

* feat(cua): move app computer use into the driver

* feat(cua): preserve background delivery and port platform fixes

* feat(cua): add explicit desktop input and browser runtime facade

* feat(cua): package the unified 0.26.0 computer use runtime

* fix(cua): finalize cross-platform native reliability

* fix(cua): isolate runtime releases from CLI versioning

* fix(cua): keep Electron out of root workspace installs

* fix(cua): synchronize consumers and async cleanup tests

* fix(browser): migrate smoke to preloaded cua runtime

* docs(cua): document MCP setup for Qwen Code Claude Code and Codex
2026-10-21 14:03:31 +08:00

62 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
import { spawnSync } from 'node:child_process';
import { mkdirSync, readFileSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const index = process.argv.indexOf('--output-dir');
if (index < 0 || !process.argv[index + 1])
throw new Error('missing --output-dir');
const output = resolve(process.argv[index + 1]);
mkdirSync(output, { recursive: true });
function run(args, capture = false) {
const result = spawnSync('npm', args, {
cwd: root,
encoding: 'utf8',
stdio: capture ? 'pipe' : 'inherit',
});
if (result.error) throw result.error;
if (result.status !== 0)
throw new Error(result.stderr || `npm exited ${result.status}`);
return result.stdout;
}
const manifest = JSON.parse(readFileSync(join(root, 'package.json'), 'utf8'));
const [packed] = JSON.parse(
run(['pack', '.', '--pack-destination', output, '--json'], true),
);
if (
packed.name !== '@qwen-code/browser-use' ||
packed.version !== manifest.version
)
throw new Error('browser package identity mismatch');
const files = new Set(packed.files.map((file) => file.path));
for (const name of [
'LICENSE',
'NOTICE',
'dist/index.js',
'dist/index.d.ts',
'dist/core/primitives.d.ts',
'dist/sdk/types.d.ts',
'dist/native-host.js',
'dist/scripts/native-host-setup.js',
]) {
if (!files.has(name)) throw new Error(`browser package missing ${name}`);
}
run([
'publish',
join(output, packed.filename),
'--dry-run',
'--access',
'public',
'--registry=https://registry.npmjs.org',
]);
process.stdout.write(
JSON.stringify({
name: packed.name,
version: packed.version,
tarball: join(output, packed.filename),
integrity: packed.integrity,
}) + '\n',
);