mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
Include monaco-editor git commit id in release
This commit is contained in:
parent
30f0acb38b
commit
c59c649c28
2 changed files with 9 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import { readFile } from 'fs/promises';
|
import { readFile } from 'fs/promises';
|
||||||
import { join, resolve } from 'path';
|
import { join, resolve } from 'path';
|
||||||
import { PackageJson, getNightlyVersion, group, run, writeJsonFile } from '../lib';
|
import { PackageJson, getNightlyVersion, group, run, writeJsonFile, gitCommitId } from '../lib';
|
||||||
|
|
||||||
const selfPath = __dirname;
|
const selfPath = __dirname;
|
||||||
const rootPath = join(selfPath, '..', '..');
|
const rootPath = join(selfPath, '..', '..');
|
||||||
|
|
@ -59,6 +59,7 @@ async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) {
|
||||||
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
||||||
) as PackageJson;
|
) as PackageJson;
|
||||||
packageJson.vscodeCommitId = monacoEditorCorePackageJson.vscodeCommitId;
|
packageJson.vscodeCommitId = monacoEditorCorePackageJson.vscodeCommitId;
|
||||||
|
packageJson.monacoCommitId = await gitCommitId(rootPath);
|
||||||
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ export async function runGetOutput(command: string, options: RunOptions): Promis
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function gitCommitId(repositoryPath: string): Promise<string> {
|
||||||
|
const commitId = (await runGetOutput('git rev-parse HEAD', { cwd: repositoryPath })).trim();
|
||||||
|
return commitId;
|
||||||
|
}
|
||||||
|
|
||||||
export async function gitShallowClone(
|
export async function gitShallowClone(
|
||||||
targetPath: string,
|
targetPath: string,
|
||||||
repositoryUrl: string,
|
repositoryUrl: string,
|
||||||
|
|
@ -48,7 +53,7 @@ export async function gitShallowClone(
|
||||||
await run(`git remote add origin ${repositoryUrl}`, options);
|
await run(`git remote add origin ${repositoryUrl}`, options);
|
||||||
await run(`git fetch --depth 1 origin ${ref}`, options);
|
await run(`git fetch --depth 1 origin ${ref}`, options);
|
||||||
await run(`git checkout ${ref}`, options);
|
await run(`git checkout ${ref}`, options);
|
||||||
const commitId = (await runGetOutput('git rev-parse HEAD', options)).trim();
|
const commitId = await gitCommitId(targetPath);
|
||||||
return { commitId };
|
return { commitId };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,5 +87,6 @@ export interface PackageJson {
|
||||||
version: string;
|
version: string;
|
||||||
vscodeRef?: string;
|
vscodeRef?: string;
|
||||||
vscodeCommitId?: string;
|
vscodeCommitId?: string;
|
||||||
|
monacoCommitId?: string;
|
||||||
devDependencies: Record<string, string>;
|
devDependencies: Record<string, string>;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue