mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 12:45:39 +01:00
Adopt esbuild for the esm release of monaco-css
This commit is contained in:
parent
8430c538b4
commit
70d1828179
8 changed files with 272 additions and 41 deletions
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"scripts": {
|
||||
"compile": "../node_modules/.bin/mrmdir ./out && ../node_modules/.bin/tsc -p ./src/tsconfig.json && ../node_modules/.bin/tsc -p ./src/tsconfig.esm.json && node ./scripts/dts && ../node_modules/.bin/prettier --write ./monaco.d.ts",
|
||||
"watch": "../node_modules/.bin/tsc -p ./src --watch",
|
||||
"prepublishOnly": "../node_modules/.bin/mrmdir ./release && npm run compile && node ./scripts/release.js && node ./scripts/bundle && ../node_modules/.bin/mcopy ./out/esm/monaco.contribution.d.ts ./release/esm/monaco.contribution.d.ts && ../node_modules/.bin/mcopy ./out/esm/fillers/monaco-editor-core.d.ts ./release/esm/fillers/monaco-editor-core.d.ts"
|
||||
"prepublishOnly": "node ./scripts/build"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
45
monaco-css/scripts/build.js
Normal file
45
monaco-css/scripts/build.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const esbuild = require('esbuild');
|
||||
const alias = require('esbuild-plugin-alias');
|
||||
const path = require('path');
|
||||
const cp = require('child_process');
|
||||
const { copyFile, removeDir } = require('../../build/utils');
|
||||
|
||||
removeDir(`monaco-css/release`);
|
||||
removeDir(`monaco-css/out`);
|
||||
|
||||
cp.spawnSync(process.execPath, [path.join(__dirname, '../../node_modules/typescript/lib/tsc.js'), '-p', path.join(__dirname, '../src/tsconfig.json')], { stdio: 'inherit', stderr: 'inherit' });
|
||||
|
||||
cp.spawnSync(process.execPath, [path.join(__dirname, './dts.js')], { stdio: 'inherit', stderr: 'inherit' });
|
||||
|
||||
cp.spawnSync(process.execPath, [path.join(__dirname, '../../node_modules/prettier/bin-prettier.js'), '--write', path.join(__dirname, '../monaco.d.ts')], { stdio: 'inherit', stderr: 'inherit' });
|
||||
|
||||
esbuild.build({
|
||||
entryPoints: ['src/cssMode.ts', 'src/css.worker.ts', 'src/monaco.contribution.ts'],
|
||||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'esm',
|
||||
external: ['monaco-editor-core', '*/cssMode'],
|
||||
outdir: 'release/esm/',
|
||||
plugins: [
|
||||
alias({
|
||||
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'),
|
||||
}),
|
||||
],
|
||||
}).then((result) => {
|
||||
if (result.errors.length > 0) {
|
||||
console.error(result.errors);
|
||||
}
|
||||
if (result.warnings.length > 0) {
|
||||
console.error(result.warnings);
|
||||
}
|
||||
});
|
||||
|
||||
copyFile('monaco-css/out/amd/monaco.contribution.d.ts', 'monaco-css/release/esm/monaco.contribution.d.ts');
|
||||
copyFile('monaco-css/out/amd/fillers/monaco-editor-core.d.ts', 'monaco-css/release/esm/fillers/monaco-editor-core.d.ts');
|
||||
|
||||
cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { stdio: 'inherit', stderr: 'inherit' });
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
const path = require('path');
|
||||
const helpers = require('monaco-plugin-helpers');
|
||||
|
||||
const REPO_ROOT = path.join(__dirname, '../../');
|
||||
|
||||
helpers.packageESM({
|
||||
repoRoot: REPO_ROOT,
|
||||
esmSource: 'monaco-css/out/esm',
|
||||
esmDestination: 'monaco-css/release/esm',
|
||||
entryPoints: ['monaco.contribution.js', 'cssMode.js', 'css.worker.js'],
|
||||
resolveAlias: {
|
||||
'vscode-nls': path.join(REPO_ROOT, 'monaco-css/out/esm/fillers/vscode-nls.js')
|
||||
},
|
||||
resolveSkip: ['monaco-editor-core'],
|
||||
destinationFolderSimplification: {
|
||||
node_modules: '_deps',
|
||||
'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
|
||||
'vscode-uri/lib/esm': 'vscode-uri',
|
||||
'vscode-css-languageservice/lib/esm': 'vscode-css-languageservice'
|
||||
}
|
||||
});
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "../out/esm",
|
||||
"declaration": true,
|
||||
"target": "es5",
|
||||
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue