Add minify option
Signed-off-by: Vincenzo Scamporlino <me@vinzscam.dev>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user