From c59c649c28361c52eb09c42a4b234cfc93c2de49 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Thu, 9 Feb 2023 18:55:14 +0100 Subject: [PATCH] Include monaco-editor git commit id in release --- scripts/ci/monaco-editor-prepare.ts | 3 ++- scripts/lib/index.ts | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/ci/monaco-editor-prepare.ts b/scripts/ci/monaco-editor-prepare.ts index c8f75484..2a46a5e1 100644 --- a/scripts/ci/monaco-editor-prepare.ts +++ b/scripts/ci/monaco-editor-prepare.ts @@ -1,6 +1,6 @@ import { readFile } from 'fs/promises'; 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 rootPath = join(selfPath, '..', '..'); @@ -59,6 +59,7 @@ async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) { await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' }) ) as PackageJson; packageJson.vscodeCommitId = monacoEditorCorePackageJson.vscodeCommitId; + packageJson.monacoCommitId = await gitCommitId(rootPath); await writeJsonFile(monacoEditorPackageJsonPath, packageJson); }); diff --git a/scripts/lib/index.ts b/scripts/lib/index.ts index 507e15c3..4db4cfe2 100644 --- a/scripts/lib/index.ts +++ b/scripts/lib/index.ts @@ -37,6 +37,11 @@ export async function runGetOutput(command: string, options: RunOptions): Promis }); } +export async function gitCommitId(repositoryPath: string): Promise { + const commitId = (await runGetOutput('git rev-parse HEAD', { cwd: repositoryPath })).trim(); + return commitId; +} + export async function gitShallowClone( targetPath: string, repositoryUrl: string, @@ -48,7 +53,7 @@ export async function gitShallowClone( await run(`git remote add origin ${repositoryUrl}`, options); await run(`git fetch --depth 1 origin ${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 }; } @@ -82,5 +87,6 @@ export interface PackageJson { version: string; vscodeRef?: string; vscodeCommitId?: string; + monacoCommitId?: string; devDependencies: Record; }