Avoid going through separate package.json files

This commit is contained in:
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

@ -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