Co-authored-by: spalger <spalger@users.noreply.github.com> Co-authored-by: Spencer <email@spalger.com> Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
parent
0d8b13054b
commit
7c53bc8de2
|
@ -135,6 +135,7 @@ it('passes correct args to sub-classes', () => {
|
||||||
"repoRoot": <absolute path>,
|
"repoRoot": <absolute path>,
|
||||||
"runExamples": false,
|
"runExamples": false,
|
||||||
"silent": false,
|
"silent": false,
|
||||||
|
"verbose": false,
|
||||||
"watch": true,
|
"watch": true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
|
@ -37,6 +37,7 @@ export type SomeCliArgs = Pick<
|
||||||
CliArgs,
|
CliArgs,
|
||||||
| 'quiet'
|
| 'quiet'
|
||||||
| 'silent'
|
| 'silent'
|
||||||
|
| 'verbose'
|
||||||
| 'disableOptimizer'
|
| 'disableOptimizer'
|
||||||
| 'watch'
|
| 'watch'
|
||||||
| 'oss'
|
| 'oss'
|
||||||
|
@ -148,6 +149,7 @@ export class CliDevMode {
|
||||||
dist: cliArgs.dist,
|
dist: cliArgs.dist,
|
||||||
quiet: !!cliArgs.quiet,
|
quiet: !!cliArgs.quiet,
|
||||||
silent: !!cliArgs.silent,
|
silent: !!cliArgs.silent,
|
||||||
|
verbose: !!cliArgs.verbose,
|
||||||
watch: cliArgs.watch,
|
watch: cliArgs.watch,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ const defaultOptions: Options = {
|
||||||
pluginScanDirs: ['/some-scan-path'],
|
pluginScanDirs: ['/some-scan-path'],
|
||||||
quiet: true,
|
quiet: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
|
verbose: false,
|
||||||
repoRoot: '/app',
|
repoRoot: '/app',
|
||||||
runExamples: true,
|
runExamples: true,
|
||||||
watch: true,
|
watch: true,
|
||||||
|
|
|
@ -25,6 +25,7 @@ export interface Options {
|
||||||
repoRoot: string;
|
repoRoot: string;
|
||||||
quiet: boolean;
|
quiet: boolean;
|
||||||
silent: boolean;
|
silent: boolean;
|
||||||
|
verbose: boolean;
|
||||||
watch: boolean;
|
watch: boolean;
|
||||||
cache: boolean;
|
cache: boolean;
|
||||||
dist: boolean;
|
dist: boolean;
|
||||||
|
@ -80,6 +81,7 @@ export class Optimizer {
|
||||||
|
|
||||||
const { flags: levelFlags } = parseLogLevel(
|
const { flags: levelFlags } = parseLogLevel(
|
||||||
pickLevelFromFlags({
|
pickLevelFromFlags({
|
||||||
|
verbose: options.verbose,
|
||||||
quiet: options.quiet,
|
quiet: options.quiet,
|
||||||
silent: options.silent,
|
silent: options.silent,
|
||||||
})
|
})
|
||||||
|
|
|
@ -24,6 +24,7 @@ export interface CliArgs {
|
||||||
/** @deprecated */
|
/** @deprecated */
|
||||||
quiet?: boolean;
|
quiet?: boolean;
|
||||||
silent?: boolean;
|
silent?: boolean;
|
||||||
|
verbose?: boolean;
|
||||||
watch: boolean;
|
watch: boolean;
|
||||||
basePath: boolean;
|
basePath: boolean;
|
||||||
oss: boolean;
|
oss: boolean;
|
||||||
|
|
|
@ -42,7 +42,6 @@ it('creates cache keys', () => {
|
||||||
"id": "bar",
|
"id": "bar",
|
||||||
"manifestPath": undefined,
|
"manifestPath": undefined,
|
||||||
"outputDir": "/foo/bar/target",
|
"outputDir": "/foo/bar/target",
|
||||||
"pageLoadAssetSizeLimit": undefined,
|
|
||||||
"publicDirNames": Array [
|
"publicDirNames": Array [
|
||||||
"public",
|
"public",
|
||||||
],
|
],
|
||||||
|
|
|
@ -11,6 +11,7 @@ import Fs from 'fs';
|
||||||
|
|
||||||
import { BundleCache } from './bundle_cache';
|
import { BundleCache } from './bundle_cache';
|
||||||
import { UnknownVals } from './ts_helpers';
|
import { UnknownVals } from './ts_helpers';
|
||||||
|
import { omit } from './obj_helpers';
|
||||||
import { includes, ascending, entriesToObject } from './array_helpers';
|
import { includes, ascending, entriesToObject } from './array_helpers';
|
||||||
|
|
||||||
const VALID_BUNDLE_TYPES = ['plugin' as const, 'entry' as const];
|
const VALID_BUNDLE_TYPES = ['plugin' as const, 'entry' as const];
|
||||||
|
@ -90,7 +91,7 @@ export class Bundle {
|
||||||
*/
|
*/
|
||||||
createCacheKey(files: string[], mtimes: Map<string, number | undefined>): unknown {
|
createCacheKey(files: string[], mtimes: Map<string, number | undefined>): unknown {
|
||||||
return {
|
return {
|
||||||
spec: this.toSpec(),
|
spec: omit(this.toSpec(), ['pageLoadAssetSizeLimit']),
|
||||||
mtimes: entriesToObject(
|
mtimes: entriesToObject(
|
||||||
files.map((p) => [p, mtimes.get(p)] as const).sort(ascending((e) => e[0]))
|
files.map((p) => [p, mtimes.get(p)] as const).sort(ascending((e) => e[0]))
|
||||||
),
|
),
|
||||||
|
|
|
@ -18,3 +18,4 @@ export * from './array_helpers';
|
||||||
export * from './event_stream_helpers';
|
export * from './event_stream_helpers';
|
||||||
export * from './parse_path';
|
export * from './parse_path';
|
||||||
export * from './theme_tags';
|
export * from './theme_tags';
|
||||||
|
export * from './obj_helpers';
|
||||||
|
|
17
packages/kbn-optimizer/src/common/obj_helpers.ts
Normal file
17
packages/kbn-optimizer/src/common/obj_helpers.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||||
|
* or more contributor license agreements. Licensed under the Elastic License
|
||||||
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||||
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||||
|
* Side Public License, v 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {
|
||||||
|
const result: any = {};
|
||||||
|
for (const [key, value] of Object.entries(obj) as any) {
|
||||||
|
if (!keys.includes(key)) {
|
||||||
|
result[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result as Omit<T, K>;
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import {
|
||||||
ThemeTag,
|
ThemeTag,
|
||||||
ThemeTags,
|
ThemeTags,
|
||||||
parseThemeTags,
|
parseThemeTags,
|
||||||
|
omit,
|
||||||
} from '../common';
|
} from '../common';
|
||||||
|
|
||||||
import { findKibanaPlatformPlugins, KibanaPlatformPlugin } from './kibana_platform_plugins';
|
import { findKibanaPlatformPlugins, KibanaPlatformPlugin } from './kibana_platform_plugins';
|
||||||
|
@ -40,16 +41,6 @@ function pickMaxWorkerCount(dist: boolean) {
|
||||||
return Math.max(maxWorkers, 2);
|
return Math.max(maxWorkers, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {
|
|
||||||
const result: any = {};
|
|
||||||
for (const [key, value] of Object.entries(obj) as any) {
|
|
||||||
if (!keys.includes(key)) {
|
|
||||||
result[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result as Omit<T, K>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
/** absolute path to root of the repo/build */
|
/** absolute path to root of the repo/build */
|
||||||
repoRoot: string;
|
repoRoot: string;
|
||||||
|
|
|
@ -228,6 +228,7 @@ export default function (program) {
|
||||||
// no longer supported
|
// no longer supported
|
||||||
quiet: !!opts.quiet,
|
quiet: !!opts.quiet,
|
||||||
silent: !!opts.silent,
|
silent: !!opts.silent,
|
||||||
|
verbose: !!opts.verbose,
|
||||||
watch: !!opts.watch,
|
watch: !!opts.watch,
|
||||||
runExamples: !!opts.runExamples,
|
runExamples: !!opts.runExamples,
|
||||||
// We want to run without base path when the `--run-examples` flag is given so that we can use local
|
// We want to run without base path when the `--run-examples` flag is given so that we can use local
|
||||||
|
|
Loading…
Reference in a new issue