mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Merge tag 'v0.1.18' of https://github.com/google-gemini/gemini-cli into chore/sync-gemini-cli-v0.1.18
This commit is contained in:
@@ -19,11 +19,12 @@
|
||||
|
||||
import { execSync } from 'child_process';
|
||||
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
||||
import { dirname, join } from 'path';
|
||||
import { dirname, join, relative } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const root = join(__dirname, '..');
|
||||
const scriptPath = relative(root, fileURLToPath(import.meta.url));
|
||||
const generatedDir = join(root, 'packages/cli/src/generated');
|
||||
const gitCommitFile = join(generatedDir, 'git-commit.ts');
|
||||
let gitCommitInfo = 'N/A';
|
||||
@@ -38,12 +39,6 @@ try {
|
||||
}).trim();
|
||||
if (gitHash) {
|
||||
gitCommitInfo = gitHash;
|
||||
const gitStatus = execSync('git status --porcelain', {
|
||||
encoding: 'utf-8',
|
||||
}).trim();
|
||||
if (gitStatus) {
|
||||
gitCommitInfo = `${gitHash} (local modifications)`;
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
@@ -55,7 +50,7 @@ const fileContent = `/**
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
// This file is auto-generated by the build script (scripts/build.js)
|
||||
// This file is auto-generated by the build script (${scriptPath})
|
||||
// Do not edit this file manually.
|
||||
export const GIT_COMMIT_INFO = '${gitCommitInfo}';
|
||||
`;
|
||||
|
||||
@@ -55,7 +55,7 @@ if (process.env.DEBUG && !sandboxCommand) {
|
||||
}
|
||||
}
|
||||
|
||||
nodeArgs.push('./packages/cli');
|
||||
nodeArgs.push(join(root, 'packages', 'cli'));
|
||||
nodeArgs.push(...process.argv.slice(2));
|
||||
|
||||
const env = {
|
||||
|
||||
@@ -24,8 +24,8 @@ function writeJson(filePath, data) {
|
||||
}
|
||||
|
||||
// 1. Get the version from the command line arguments.
|
||||
const versionArg = process.argv[2];
|
||||
if (!versionArg) {
|
||||
const versionType = process.argv[2];
|
||||
if (!versionType) {
|
||||
console.error('Error: No version specified.');
|
||||
console.error(
|
||||
'Usage: npm run version <version> (e.g., 1.2.3 or patch|minor|major|prerelease)',
|
||||
@@ -33,15 +33,11 @@ if (!versionArg) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 2. Determine if we have a specific version or a version type
|
||||
const isSpecificVersion = /^\d+\.\d+\.\d+/.test(versionArg);
|
||||
const npmVersionArg = isSpecificVersion ? versionArg : versionArg;
|
||||
// 2. Bump the version in the root and all workspace package.json files.
|
||||
run(`npm version ${versionType} --no-git-tag-version --allow-same-version`);
|
||||
|
||||
// 3. Bump the version in the root and all workspace package.json files.
|
||||
run(`npm version ${npmVersionArg} --no-git-tag-version --allow-same-version`);
|
||||
|
||||
// 4. Get all workspaces and filter out the one we don't want to version.
|
||||
const workspacesToExclude = ['qwen-code-vscode-ide-companion'];
|
||||
// 3. Get all workspaces and filter out the one we don't want to version.
|
||||
const workspacesToExclude = ['gemini-cli-vscode-ide-companion'];
|
||||
const lsOutput = JSON.parse(
|
||||
execSync('npm ls --workspaces --json --depth=0').toString(),
|
||||
);
|
||||
@@ -52,11 +48,11 @@ const workspacesToVersion = allWorkspaces.filter(
|
||||
|
||||
for (const workspaceName of workspacesToVersion) {
|
||||
run(
|
||||
`npm version ${npmVersionArg} --workspace ${workspaceName} --no-git-tag-version --allow-same-version`,
|
||||
`npm version ${versionType} --workspace ${workspaceName} --no-git-tag-version --allow-same-version`,
|
||||
);
|
||||
}
|
||||
|
||||
// 5. Get the new version number from the root package.json
|
||||
// 4. Get the new version number from the root package.json
|
||||
const rootPackageJsonPath = resolve(process.cwd(), 'package.json');
|
||||
const newVersion = readJson(rootPackageJsonPath).version;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user