mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Set vscodeCommitId in package.json to track which vscode commit the package has been built from.
This commit is contained in:
parent
71ac097e61
commit
ccb646cca9
7 changed files with 75 additions and 15 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { mkdir, rm } from 'fs/promises';
|
||||
import { join, resolve } from 'path';
|
||||
import { group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
|
||||
import { PackageJson } from './types';
|
||||
|
||||
const selfPath = __dirname;
|
||||
const rootPath = join(selfPath, '..', '..');
|
||||
|
|
@ -37,9 +38,17 @@ async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string
|
|||
|
||||
await rm(dependenciesPath, { force: true, recursive: true });
|
||||
|
||||
let vscodeCommitId: string;
|
||||
|
||||
await group('Checkout vscode', async () => {
|
||||
await gitShallowClone(vscodePath, 'https://github.com/microsoft/vscode.git', vscodeRef);
|
||||
const result = await gitShallowClone(
|
||||
vscodePath,
|
||||
'https://github.com/microsoft/vscode.git',
|
||||
vscodeRef
|
||||
);
|
||||
vscodeCommitId = result.commitId;
|
||||
});
|
||||
|
||||
await group('Checkout vscode-loc', async () => {
|
||||
await gitShallowClone(
|
||||
// Must be a sibling to the vscode repository
|
||||
|
|
@ -54,8 +63,10 @@ async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string
|
|||
vscodePath,
|
||||
'./build/monaco/package.json'
|
||||
);
|
||||
const packageJson = require(monacoEditorCorePackageJsonSourcePath) as { version: string };
|
||||
const packageJson = require(monacoEditorCorePackageJsonSourcePath) as PackageJson;
|
||||
packageJson.version = version;
|
||||
// This ensures we can always figure out which commit monaco-editor-core was built from
|
||||
packageJson.vscodeCommitId = vscodeCommitId;
|
||||
await writeJsonFile(monacoEditorCorePackageJsonSourcePath, packageJson);
|
||||
});
|
||||
|
||||
|
|
@ -1,15 +1,22 @@
|
|||
import { readFile } from 'fs/promises';
|
||||
import { join, resolve } from 'path';
|
||||
import { getNightlyVersion, group, run, writeJsonFile } from '../lib';
|
||||
import { PackageJson } from './types';
|
||||
|
||||
const selfPath = __dirname;
|
||||
const rootPath = join(selfPath, '..', '..');
|
||||
const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
|
||||
const monacoEditorCorePackageJsonPath = resolve(
|
||||
rootPath,
|
||||
'node_modules',
|
||||
'monaco-editor-core',
|
||||
'package.json'
|
||||
);
|
||||
|
||||
async function prepareMonacoEditorReleaseStableOrNightly() {
|
||||
const monacoEditorPackageJson = JSON.parse(
|
||||
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
||||
) as { version: string };
|
||||
) as PackageJson;
|
||||
|
||||
let version: string;
|
||||
|
||||
|
|
@ -27,18 +34,32 @@ async function prepareMonacoEditorReleaseStableOrNightly() {
|
|||
// npm package is now in ./release, ready to be published
|
||||
}
|
||||
|
||||
async function prepareMonacoEditorRelease(version: string) {
|
||||
async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) {
|
||||
await group('npm ci', async () => {
|
||||
await run('npm ci', { cwd: resolve(rootPath, 'webpack-plugin') });
|
||||
});
|
||||
|
||||
await group('Set Version', async () => {
|
||||
await group('Set Version & Update monaco-editor-core Version', async () => {
|
||||
const packageJson = JSON.parse(
|
||||
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
||||
) as { version: string; devDependencies: Record<string, string> };
|
||||
packageJson.version = version;
|
||||
packageJson.devDependencies['monaco-editor-core'] = version;
|
||||
) as PackageJson;
|
||||
packageJson.version = monacoEditorCoreVersion;
|
||||
packageJson.devDependencies['monaco-editor-core'] = monacoEditorCoreVersion;
|
||||
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
||||
});
|
||||
|
||||
await group('npm install to pick up monaco-editor-core', async () => {
|
||||
await run('npm install', { cwd: rootPath });
|
||||
});
|
||||
|
||||
await group('Setting vscode commitId from monaco-editor-core', async () => {
|
||||
const monacoEditorCorePackageJson = JSON.parse(
|
||||
await readFile(monacoEditorCorePackageJsonPath, { encoding: 'utf-8' })
|
||||
) as PackageJson;
|
||||
const packageJson = JSON.parse(
|
||||
await readFile(monacoEditorPackageJsonPath, { encoding: 'utf-8' })
|
||||
) as PackageJson;
|
||||
packageJson.vscodeCommitId = monacoEditorCorePackageJson.vscodeCommitId;
|
||||
await writeJsonFile(monacoEditorPackageJsonPath, packageJson);
|
||||
});
|
||||
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# execute `npm install` to pick up local monaco-editor-core
|
||||
npm install
|
||||
# Install OS Dependencies for Playwright
|
||||
sudo npm run playwright-install-deps
|
||||
# Check prettier
|
||||
|
|
|
|||
6
scripts/ci/types.ts
Normal file
6
scripts/ci/types.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
export interface PackageJson {
|
||||
version: string;
|
||||
vscodeRef?: string;
|
||||
vscodeCommitId?: string;
|
||||
devDependencies: Record<string, string>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue