mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
repairs esm and amd build (#4950)
This commit is contained in:
parent
f420968fc9
commit
e56ad4b588
43 changed files with 2302 additions and 856 deletions
|
|
@ -1,13 +1,13 @@
|
|||
import { mkdir, rm } from 'fs/promises';
|
||||
import { join, resolve } from 'path';
|
||||
import { rm } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import { PackageJson, group, gitShallowClone, run, writeJsonFile, getNightlyVersion } from '../lib';
|
||||
import { getNightlyEnv } from './env';
|
||||
|
||||
const selfPath = __dirname;
|
||||
const rootPath = join(selfPath, '..', '..');
|
||||
const dependenciesPath = join(rootPath, 'dependencies');
|
||||
const vscodePath = resolve(dependenciesPath, 'vscode');
|
||||
const monacoEditorPackageJsonPath = resolve(rootPath, 'package.json');
|
||||
const vscodePath = join(dependenciesPath, 'vscode');
|
||||
const monacoEditorPackageJsonPath = join(rootPath, 'package.json');
|
||||
|
||||
async function prepareMonacoEditorCoreReleaseStableOrNightly() {
|
||||
const monacoEditorPackageJson = require(monacoEditorPackageJsonPath) as {
|
||||
|
|
@ -37,8 +37,6 @@ async function prepareMonacoEditorCoreReleaseStableOrNightly() {
|
|||
}
|
||||
|
||||
async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string) {
|
||||
await mkdir(vscodePath, { recursive: true });
|
||||
|
||||
await rm(dependenciesPath, { force: true, recursive: true });
|
||||
|
||||
let vscodeCommitId: string;
|
||||
|
|
@ -62,10 +60,7 @@ async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string
|
|||
});
|
||||
|
||||
await group('Set Version', async () => {
|
||||
const monacoEditorCorePackageJsonSourcePath = resolve(
|
||||
vscodePath,
|
||||
'./build/monaco/package.json'
|
||||
);
|
||||
const monacoEditorCorePackageJsonSourcePath = join(vscodePath, './build/monaco/package.json');
|
||||
const packageJson = require(monacoEditorCorePackageJsonSourcePath) as PackageJson;
|
||||
packageJson.version = version;
|
||||
// This ensures we can always figure out which commit monaco-editor-core was built from
|
||||
|
|
@ -74,8 +69,47 @@ async function prepareMonacoEditorCoreRelease(version: string, vscodeRef: string
|
|||
});
|
||||
|
||||
await group('Building & Testing', async () => {
|
||||
await run(resolve(selfPath, './monaco-editor-core.sh'), { cwd: vscodePath });
|
||||
// Install dependencies
|
||||
await buildAndTest();
|
||||
});
|
||||
}
|
||||
|
||||
async function buildAndTest() {
|
||||
await run('npm install', { cwd: vscodePath });
|
||||
await run('npm run playwright-install', { cwd: vscodePath });
|
||||
|
||||
// Run checks and compilation
|
||||
await run('npm run gulp hygiene', { cwd: vscodePath });
|
||||
await run('npm run valid-layers-check', { cwd: vscodePath });
|
||||
await run('npm run compile', { cwd: join(vscodePath, 'build') });
|
||||
await run('npm run eslint', { cwd: vscodePath });
|
||||
await run('npm run monaco-compile-check', { cwd: vscodePath });
|
||||
await run('npm run --max_old_space_size=4095 compile', { cwd: vscodePath });
|
||||
|
||||
// Build editor distribution
|
||||
await run('npm run gulp editor-distro', { cwd: vscodePath });
|
||||
|
||||
return; // To save CI time.
|
||||
|
||||
// Run browser tests
|
||||
await run('npm run test-browser --browser chromium', { cwd: vscodePath });
|
||||
|
||||
// TypeScript typings test
|
||||
await run('mkdir typings-test', { cwd: vscodePath });
|
||||
const typingsTestDir = join(vscodePath, 'typings-test');
|
||||
await run('npm init -yp', { cwd: typingsTestDir });
|
||||
await run('../node_modules/.bin/tsc --init', { cwd: typingsTestDir });
|
||||
await run('echo "import \'../out-monaco-editor-core\';" > a.ts', { cwd: typingsTestDir });
|
||||
await run('../node_modules/.bin/tsc --noEmit', { cwd: typingsTestDir });
|
||||
|
||||
// Monaco tests
|
||||
const testMonacoDir = join(vscodePath, 'test/monaco');
|
||||
await run('npm run esm-check', { cwd: testMonacoDir });
|
||||
await run('npm run bundle-webpack', { cwd: testMonacoDir });
|
||||
await run('npm run compile', { cwd: testMonacoDir });
|
||||
await run('npm test', { cwd: testMonacoDir });
|
||||
}
|
||||
|
||||
//buildAndTest();
|
||||
//prepareMonacoEditorCoreRelease('0.99.0', 'main');
|
||||
prepareMonacoEditorCoreReleaseStableOrNightly();
|
||||
|
|
@ -68,7 +68,16 @@ async function prepareMonacoEditorRelease(monacoEditorCoreVersion: string) {
|
|||
});
|
||||
|
||||
await group('Building & Testing', async () => {
|
||||
await run(resolve(selfPath, './monaco-editor.sh'), { cwd: rootPath });
|
||||
// TODO@hediet: await run('npm run prettier-check', { cwd: rootPath });
|
||||
|
||||
await run('npm run build', { cwd: rootPath });
|
||||
await run('npm test', { cwd: rootPath });
|
||||
await run('npm run compile', { cwd: resolve(rootPath, 'webpack-plugin') });
|
||||
await run('npm run package-for-smoketest-webpack', { cwd: rootPath });
|
||||
await run('npm run package-for-smoketest-esbuild', { cwd: rootPath });
|
||||
await run('npm run package-for-smoketest-vite', { cwd: rootPath });
|
||||
await run('npm run smoketest', { cwd: rootPath });
|
||||
// npm package is now ready to be published in ./out/monaco-editor
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# cwd must be the vscode repository.
|
||||
|
||||
yarn --frozen-lockfile --network-timeout 180000
|
||||
yarn playwright-install
|
||||
yarn gulp hygiene
|
||||
yarn valid-layers-check
|
||||
yarn --cwd build compile
|
||||
yarn eslint
|
||||
yarn monaco-compile-check
|
||||
yarn --max_old_space_size=4095 compile
|
||||
|
||||
yarn test-browser --browser chromium
|
||||
|
||||
yarn gulp editor-distro
|
||||
mkdir typings-test
|
||||
|
||||
cd typings-test
|
||||
yarn init -yp
|
||||
../node_modules/.bin/tsc --init
|
||||
echo "import '../out-monaco-editor-core';" > a.ts
|
||||
../node_modules/.bin/tsc --noEmit
|
||||
cd ..
|
||||
|
||||
cd test/monaco
|
||||
yarn run esm-check
|
||||
yarn run bundle-webpack
|
||||
yarn run compile
|
||||
yarn test
|
||||
cd ../..
|
||||
|
||||
# npm package is now in dependencies/vscode/out-monaco-editor-core, ready to be published
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Install OS Dependencies for Playwright
|
||||
sudo npm run playwright-install-deps
|
||||
# Check prettier
|
||||
npm run prettier-check
|
||||
# Build
|
||||
npm run build-monaco-editor
|
||||
|
||||
# Run unit tests
|
||||
npm test
|
||||
|
||||
# Compile webpack plugin
|
||||
npm run compile --prefix webpack-plugin
|
||||
# Package using webpack plugin
|
||||
npm run package-for-smoketest-webpack
|
||||
# Package using esbuild
|
||||
npm run package-for-smoketest-esbuild
|
||||
# Package using vite
|
||||
npm run package-for-smoketest-vite
|
||||
# Package using parcel
|
||||
# npm run package-for-smoketest-parcel --prefix test/smoke/parcel
|
||||
# Disabled for now, as the parcel bundler cannot deal with VS Code process variable
|
||||
|
||||
# Run smoke test
|
||||
npm run smoketest
|
||||
|
||||
# npm package is now ready to be published in ./out/monaco-editor
|
||||
Loading…
Add table
Add a link
Reference in a new issue