Add minify option

Signed-off-by: Vincenzo Scamporlino <me@vinzscam.dev>
This commit is contained in:
Vincenzo Scamporlino
2021-12-01 17:15:47 +01:00
parent 682eaa22e3
commit 4adbda5162
4 changed files with 9 additions and 11 deletions
+1
View File
@@ -123,6 +123,7 @@ export function registerCommands(program: CommanderStatic) {
program
.command('plugin:build')
.description('Build a plugin')
.option('--minify', 'Minify the generated code')
.action(lazy(() => import('./plugin/build').then(m => m.default)));
program
+3 -1
View File
@@ -14,10 +14,12 @@
* limitations under the License.
*/
import { Command } from 'commander';
import { buildPackage, Output } from '../../lib/builder';
export default async () => {
export default async (cmd: Command) => {
await buildPackage({
outputs: new Set([Output.esm, Output.types]),
minify: cmd.minify,
});
};
+4 -7
View File
@@ -98,13 +98,10 @@ export const makeConfigs = async (
include: /\.icon\.svg$/,
template: svgrTemplate,
}),
esbuild(
options.esBuild || {
target: 'es2019',
// TODO: remove this
minify: true,
},
),
esbuild({
target: 'es2019',
minify: options.minify,
}),
],
});
}
+1 -3
View File
@@ -14,8 +14,6 @@
* limitations under the License.
*/
import type { Options } from 'rollup-plugin-esbuild';
export enum Output {
esm,
cjs,
@@ -24,5 +22,5 @@ export enum Output {
export type BuildOptions = {
outputs: Set<Output>;
esBuild: Options;
minify?: boolean;
};