mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 07:00:11 +01:00
Move buildAMD to common build script
This commit is contained in:
parent
8944900f86
commit
6bfac402fb
4 changed files with 79 additions and 114 deletions
|
|
@ -199,6 +199,56 @@ function buildESM(options) {
|
|||
}
|
||||
exports.buildESM = buildESM;
|
||||
|
||||
/**
|
||||
* @param {'dev'|'min'} type
|
||||
* @param {{
|
||||
* entryPoint: string;
|
||||
* banner: string;
|
||||
* }} options
|
||||
*/
|
||||
function buildOneAMD(type, options) {
|
||||
/** @type {import('esbuild').BuildOptions} */
|
||||
const opts = {
|
||||
entryPoints: [options.entryPoint],
|
||||
bundle: true,
|
||||
target: 'esnext',
|
||||
format: 'iife',
|
||||
define: {
|
||||
AMD: 'true'
|
||||
},
|
||||
globalName: 'moduleExports',
|
||||
banner: {
|
||||
js: options.banner
|
||||
},
|
||||
footer: {
|
||||
js: 'return moduleExports;\n});'
|
||||
},
|
||||
outdir: `release/${type}/`,
|
||||
plugins: [
|
||||
alias({
|
||||
'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'),
|
||||
'monaco-editor-core': path.join(__dirname, '../build/fillers/monaco-editor-core-amd.ts')
|
||||
})
|
||||
]
|
||||
};
|
||||
if (type === 'min') {
|
||||
opts.minify = true;
|
||||
}
|
||||
build(opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {{
|
||||
* entryPoint: string;
|
||||
* banner: string;
|
||||
* }} options
|
||||
*/
|
||||
function buildAMD(options) {
|
||||
buildOneAMD('dev', options);
|
||||
buildOneAMD('min', options);
|
||||
}
|
||||
exports.buildAMD = buildAMD;
|
||||
|
||||
function getGitVersion() {
|
||||
const git = path.join(REPO_ROOT, '.git');
|
||||
const headPath = path.join(git, 'HEAD');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue