mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Merge tag 'v0.1.15' into feature/yiheng/sync-gemini-cli-0.1.15
This commit is contained in:
@@ -40,6 +40,11 @@ const argv = yargs(hideBin(process.argv))
|
||||
alias: 'image',
|
||||
type: 'string',
|
||||
description: 'use <image> name for custom image',
|
||||
})
|
||||
.option('output-file', {
|
||||
type: 'string',
|
||||
description:
|
||||
'Path to write the final image URI. Used for CI/CD pipeline integration.',
|
||||
}).argv;
|
||||
|
||||
let sandboxCommand;
|
||||
|
||||
30
scripts/build_vscode_companion.js
Normal file
30
scripts/build_vscode_companion.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2025 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
import { execSync } from 'child_process';
|
||||
import { dirname, join } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const root = join(__dirname, '..');
|
||||
|
||||
execSync('npx --yes @vscode/vsce package --no-dependencies', {
|
||||
stdio: 'inherit',
|
||||
cwd: join(root, 'packages', 'vscode-ide-companion'),
|
||||
});
|
||||
@@ -45,3 +45,11 @@ for (const workspace of rootPackageJson.workspaces) {
|
||||
rmSync(join(pkgDir, 'dist'), RMRF_OPTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
// Clean up vsix files in vscode-ide-companion
|
||||
const vsixFiles = globSync('packages/vscode-ide-companion/*.vsix', {
|
||||
cwd: root,
|
||||
});
|
||||
for (const vsixFile of vsixFiles) {
|
||||
rmSync(join(root, vsixFile), RMRF_OPTIONS);
|
||||
}
|
||||
|
||||
@@ -37,4 +37,12 @@ for (const file of sbFiles) {
|
||||
copyFileSync(join(root, file), join(bundleDir, basename(file)));
|
||||
}
|
||||
|
||||
// Find and copy all .vsix files from packages to the root of the bundle directory
|
||||
const vsixFiles = glob.sync('packages/vscode-ide-companion/*.vsix', {
|
||||
cwd: root,
|
||||
});
|
||||
for (const file of vsixFiles) {
|
||||
copyFileSync(join(root, file), join(bundleDir, basename(file)));
|
||||
}
|
||||
|
||||
console.log('Assets copied to bundle/');
|
||||
|
||||
@@ -111,6 +111,32 @@ export function writeJsonFile(filePath, data) {
|
||||
fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
|
||||
}
|
||||
|
||||
export function moveBinary(source, destination) {
|
||||
try {
|
||||
fs.renameSync(source, destination);
|
||||
} catch (error) {
|
||||
if (error.code !== 'EXDEV') {
|
||||
throw error;
|
||||
}
|
||||
// Handle a cross-device error: copy-to-temp-then-rename.
|
||||
const destDir = path.dirname(destination);
|
||||
const destFile = path.basename(destination);
|
||||
const tempDest = path.join(destDir, `${destFile}.tmp`);
|
||||
|
||||
try {
|
||||
fs.copyFileSync(source, tempDest);
|
||||
fs.renameSync(tempDest, destination);
|
||||
} catch (moveError) {
|
||||
// If copy or rename fails, clean up the intermediate temp file.
|
||||
if (fs.existsSync(tempDest)) {
|
||||
fs.unlinkSync(tempDest);
|
||||
}
|
||||
throw moveError;
|
||||
}
|
||||
fs.unlinkSync(source);
|
||||
}
|
||||
}
|
||||
|
||||
export function waitForPort(port, timeout = 10000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const startTime = Date.now();
|
||||
@@ -248,7 +274,7 @@ export async function ensureBinary(
|
||||
);
|
||||
}
|
||||
|
||||
fs.renameSync(foundBinaryPath, executablePath);
|
||||
moveBinary(foundBinaryPath, executablePath);
|
||||
|
||||
if (platform !== 'windows') {
|
||||
fs.chmodSync(executablePath, '755');
|
||||
|
||||
Reference in New Issue
Block a user