Avoid going through separate `package.json` files

pull/2766/head
Alexandru Dima 2021-11-12 14:14:05 +01:00
parent d2e1d5104f
commit aa5bb2cfa7
No known key found for this signature in database
GPG Key ID: 39563C1504FDD0C9
13 changed files with 38 additions and 30 deletions

View File

@ -55,11 +55,7 @@ You need to have all the build setup of VS Code to be able to build the Monaco E
/src/monaco-editor> npm install .
# compile all plugins
/src/monaco-editor> npm run prepublishOnly --prefix monaco-css
/src/monaco-editor> npm run prepublishOnly --prefix monaco-languages
/src/monaco-editor> npm run prepublishOnly --prefix monaco-typescript
/src/monaco-editor> npm run prepublishOnly --prefix monaco-json
/src/monaco-editor> npm run prepublishOnly --prefix monaco-html
/src/monaco-editor> npm run release
# start a local http server in the background
/src/monaco-editor> npm run simpleserver

View File

@ -178,13 +178,14 @@ exports.build = build;
/**
* @param {{
* base: string;
* entryPoints: string[];
* external: string[];
* }} options
*/
function buildESM(options) {
build({
entryPoints: options.entryPoints,
entryPoints: options.entryPoints.map(e => (`${options.base}/${e}`)),
bundle: true,
target: 'esnext',
format: 'esm',
@ -192,8 +193,8 @@ function buildESM(options) {
AMD: 'false'
},
external: options.external,
outbase: 'src',
outdir: 'release/esm/',
outbase: `${options.base}/src`,
outdir: `${options.base}/release/esm/`,
plugins: [
alias({
'vscode-nls': path.join(__dirname, 'fillers/vscode-nls.ts')
@ -206,6 +207,7 @@ exports.buildESM = buildESM;
/**
* @param {'dev'|'min'} type
* @param {{
* base: string;
* entryPoint: string;
* banner: string;
* }} options
@ -213,7 +215,7 @@ exports.buildESM = buildESM;
function buildOneAMD(type, options) {
/** @type {import('esbuild').BuildOptions} */
const opts = {
entryPoints: [options.entryPoint],
entryPoints: [`${options.base}/${options.entryPoint}`],
bundle: true,
target: 'esnext',
format: 'iife',
@ -227,8 +229,8 @@ function buildOneAMD(type, options) {
footer: {
js: 'return moduleExports;\n});'
},
outbase: 'src',
outdir: `release/${type}/`,
outbase: `${options.base}/src`,
outdir: `${options.base}/release/${type}/`,
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
@ -244,6 +246,7 @@ function buildOneAMD(type, options) {
/**
* @param {{
* base: string;
* entryPoint: string;
* banner: string;
* }} options

View File

@ -19,18 +19,22 @@ dts(
);
buildESM({
base: 'monaco-css',
entryPoints: ['src/monaco.contribution.ts', 'src/cssMode.ts', 'src/css.worker.ts'],
external: ['monaco-editor-core', '*/cssMode']
});
buildAMD({
base: 'monaco-css',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/css/monaco.contribution",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-css',
entryPoint: 'src/cssMode.ts',
banner: 'define("vs/language/css/cssMode",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-css',
entryPoint: 'src/cssWorker.ts',
banner: 'define("vs/language/css/cssWorker",[],()=>{'
});

View File

@ -1,6 +1,5 @@
{
"scripts": {
"watch": "../node_modules/.bin/tsc -p ./src --watch",
"prepublishOnly": "node ./build"
"watch": "../node_modules/.bin/tsc -p ./src --watch"
}
}

View File

@ -19,18 +19,22 @@ dts(
);
buildESM({
base: 'monaco-html',
entryPoints: ['src/monaco.contribution.ts', 'src/htmlMode.ts', 'src/html.worker.ts'],
external: ['monaco-editor-core', '*/htmlMode']
});
buildAMD({
base: 'monaco-html',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/html/monaco.contribution",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-html',
entryPoint: 'src/htmlMode.ts',
banner: 'define("vs/language/html/htmlMode",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-html',
entryPoint: 'src/htmlWorker.ts',
banner: 'define("vs/language/html/htmlWorker",[],()=>{'
});

View File

@ -1,6 +1,5 @@
{
"scripts": {
"watch": "../node_modules/.bin/tsc -p ./src --watch",
"prepublishOnly": "node ./build"
"watch": "../node_modules/.bin/tsc -p ./src --watch"
}
}

View File

@ -19,18 +19,22 @@ dts(
);
buildESM({
base: 'monaco-json',
entryPoints: ['src/monaco.contribution.ts', 'src/jsonMode.ts', 'src/json.worker.ts'],
external: ['monaco-editor-core', '*/jsonMode']
});
buildAMD({
base: 'monaco-json',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/json/monaco.contribution",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-json',
entryPoint: 'src/jsonMode.ts',
banner: 'define("vs/language/json/jsonMode",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-json',
entryPoint: 'src/jsonWorker.ts',
banner: 'define("vs/language/json/jsonWorker",[],()=>{'
});

View File

@ -1,6 +1,5 @@
{
"scripts": {
"watch": "../node_modules/.bin/tsc -p ./src --watch",
"prepublishOnly": "node ./build"
"watch": "../node_modules/.bin/tsc -p ./src --watch"
}
}

View File

@ -33,6 +33,7 @@ glob('src/*/*.contribution.ts', { cwd: __dirname }, function (err, files) {
external.push(`*/${language}`);
}
buildESM({
base: 'monaco-languages',
entryPoints,
external
});
@ -41,11 +42,13 @@ glob('src/*/*.contribution.ts', { cwd: __dirname }, function (err, files) {
// AMD
{
buildAMD({
base: 'monaco-languages',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/basic-languages/monaco.contribution",["vs/editor/editor.api"],()=>{'
});
for (const language of languages) {
buildAMD({
base: 'monaco-languages',
entryPoint: `src/${language}/${language}.ts`,
banner: `define("vs/basic-languages/${language}/${language}",[],()=>{`
});

View File

@ -1,7 +1,6 @@
{
"scripts": {
"watch": "../node_modules/.bin/tsc -p ./src --watch",
"test": "node ./test/all.js",
"prepublishOnly": "node ./build"
"test": "node ./test/all.js"
}
}

View File

@ -15,11 +15,6 @@ copyFile(
`monaco-typescript/out/amd/lib/typescriptServices.js`
);
copyFile(
`monaco-typescript/src/lib/typescriptServices.js`,
`monaco-typescript/out/esm/lib/typescriptServices.js`
);
tsc(`monaco-typescript/src/tsconfig.json`);
dts(
@ -29,18 +24,22 @@ dts(
);
buildESM({
base: 'monaco-typescript',
entryPoints: ['src/monaco.contribution.ts', 'src/tsMode.ts', 'src/ts.worker.ts'],
external: ['monaco-editor-core', '*/tsMode']
});
buildAMD({
base: 'monaco-typescript',
entryPoint: 'src/monaco.contribution.ts',
banner: 'define("vs/language/typescript/monaco.contribution",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-typescript',
entryPoint: 'src/tsMode.ts',
banner: 'define("vs/language/typescript/tsMode",["vs/editor/editor.api"],()=>{'
});
buildAMD({
base: 'monaco-typescript',
entryPoint: 'src/tsWorker.ts',
banner: 'define("vs/language/typescript/tsWorker",[],()=>{'
});

View File

@ -1,7 +1,6 @@
{
"scripts": {
"watch": "../node_modules/.bin/tsc -p ./src --watch",
"prepublishOnly": "node ./build",
"import-typescript": "node ./scripts/importTypescript"
}
}

View File

@ -7,11 +7,11 @@
"license": "MIT",
"scripts": {
"simpleserver": "gulp simpleserver",
"release-css": "npm run prepublishOnly --prefix monaco-css",
"release-html": "npm run prepublishOnly --prefix monaco-html",
"release-json": "npm run prepublishOnly --prefix monaco-json",
"release-languages": "npm run prepublishOnly --prefix monaco-languages",
"release-typescript": "npm run prepublishOnly --prefix monaco-typescript",
"release-css": "node ./monaco-css/build",
"release-html": "node ./monaco-html/build",
"release-json": "node ./monaco-json/build",
"release-languages": "node ./monaco-languages/build",
"release-typescript": "node ./monaco-typescript/build",
"release": "npm run release-css && npm run release-html && npm run release-json && npm run release-languages && npm run release-typescript && gulp release",
"website": "gulp build-website && npm run typedoc && gulp prepare-website-branch",
"build-website": "gulp build-website && npm run typedoc",