Skip to content

Commit

Permalink
Merge branch 'main' into enhancement-discover-unified-histogram-layout
Browse files Browse the repository at this point in the history
  • Loading branch information
davismcphee authored Sep 12, 2022
2 parents 03cf671 + 18111b3 commit f81bb09
Show file tree
Hide file tree
Showing 37 changed files with 228 additions and 1,456 deletions.
2 changes: 0 additions & 2 deletions .buildkite/ftr_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ disabled:
- x-pack/plugins/observability/e2e/synthetics_run.ts

# Configs that exist but weren't running in CI when this file was introduced
- test/visual_regression/config.ts
- x-pack/test/visual_regression/config.ts
- x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/config.ts
- x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/config.ts
- x-pack/test/alerting_api_integration/spaces_only_legacy/config.ts
Expand Down
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ module.exports = {
'test/*/config_open.ts',
'test/*/*.config.ts',
'test/*/{tests,test_suites,apis,apps}/**/*',
'test/visual_regression/tests/**/*',
'x-pack/test/*/{tests,test_suites,apis,apps}/**/*',
'x-pack/test/*/*config.*ts',
'x-pack/test/saved_object_api_integration/*/apis/**/*',
Expand Down
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ x-pack/examples/files_example @elastic/kibana-app-services
/x-pack/test/api_integration/apis/maps/ @elastic/kibana-gis
/x-pack/test/functional/apps/maps/ @elastic/kibana-gis
/x-pack/test/functional/es_archives/maps/ @elastic/kibana-gis
/x-pack/test/visual_regression/tests/maps/index.js @elastic/kibana-gis
/x-pack/plugins/stack_alerts/server/alert_types/geo_containment @elastic/kibana-gis
/x-pack/plugins/stack_alerts/public/alert_types/geo_containment @elastic/kibana-gis
#CC# /x-pack/plugins/file_upload @elastic/kibana-gis
Expand Down
4 changes: 2 additions & 2 deletions kbn_pm/src/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { Args } from './lib/args.mjs';
import { getHelp } from './lib/help.mjs';
import { createFlagError, isCliError } from './lib/cli_error.mjs';
import { COMMANDS } from './commands/index.mjs';
import { getCmd } from './commands/index.mjs';
import { Log } from './lib/log.mjs';

const start = Date.now();
Expand All @@ -39,7 +39,7 @@ async function tryToGetCiStatsReporter(log) {
}

try {
const cmd = cmdName ? COMMANDS.find((c) => c.name === cmdName) : undefined;
const cmd = getCmd(cmdName);

if (cmdName && !cmd) {
throw createFlagError(`Invalid command name [${cmdName}]`);
Expand Down
8 changes: 3 additions & 5 deletions kbn_pm/src/commands/bootstrap/bootstrap_command.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const command = {
// That is only intended during the migration process while non Bazel projects are not removed at all.
if (forceInstall) {
await time('force install dependencies', async () => {
removeYarnIntegrityFileIfExists();
await removeYarnIntegrityFileIfExists();
await Bazel.expungeCache(log, { quiet });
await Bazel.installYarnDeps(log, { offline, quiet });
});
Expand All @@ -89,19 +89,17 @@ export const command = {
// generate the synthetic package map which powers several other features, needed
// as an input to the package build
await time('regenerate synthetic package map', async () => {
regenerateSyntheticPackageMap(plugins);
await regenerateSyntheticPackageMap(plugins);
});

// build packages
await time('build packages', async () => {
await Bazel.buildPackages(log, { offline, quiet });
});

await time('sort package json', async () => {
await sortPackageJson();
});
await time('regenerate tsconfig.base.json', async () => {
regenerateBaseTsconfig(plugins);
await regenerateBaseTsconfig(plugins);
});

if (validate) {
Expand Down
8 changes: 4 additions & 4 deletions kbn_pm/src/commands/bootstrap/regenerate_base_tsconfig.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import Path from 'path';
import Fs from 'fs';
import Fsp from 'fs/promises';

import { REPO_ROOT } from '../../lib/paths.mjs';
import { convertPluginIdToPackageId } from './plugins.mjs';
Expand All @@ -16,9 +16,9 @@ import { normalizePath } from './normalize_path.mjs';
/**
* @param {import('@kbn/plugin-discovery').KibanaPlatformPlugin[]} plugins
*/
export function regenerateBaseTsconfig(plugins) {
export async function regenerateBaseTsconfig(plugins) {
const tsconfigPath = Path.resolve(REPO_ROOT, 'tsconfig.base.json');
const lines = Fs.readFileSync(tsconfigPath, 'utf-8').split('\n');
const lines = (await Fsp.readFile(tsconfigPath, 'utf-8')).split('\n');

const packageMap = plugins
.slice()
Expand All @@ -32,7 +32,7 @@ export function regenerateBaseTsconfig(plugins) {
const start = lines.findIndex((l) => l.trim() === '// START AUTOMATED PACKAGE LISTING');
const end = lines.findIndex((l) => l.trim() === '// END AUTOMATED PACKAGE LISTING');

Fs.writeFileSync(
await Fsp.writeFile(
tsconfigPath,
[...lines.slice(0, start + 1), ...packageMap, ...lines.slice(end)].join('\n')
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import Path from 'path';
import Fs from 'fs';
import Fsp from 'fs/promises';

import { normalizePath } from './normalize_path.mjs';
import { REPO_ROOT } from '../../lib/paths.mjs';
Expand All @@ -16,7 +16,7 @@ import { convertPluginIdToPackageId } from './plugins.mjs';
/**
* @param {import('@kbn/plugin-discovery').KibanaPlatformPlugin[]} plugins
*/
export function regenerateSyntheticPackageMap(plugins) {
export async function regenerateSyntheticPackageMap(plugins) {
/** @type {Array<[string, string]>} */
const entries = [['@kbn/core', 'src/core']];

Expand All @@ -27,7 +27,7 @@ export function regenerateSyntheticPackageMap(plugins) {
]);
}

Fs.writeFileSync(
await Fsp.writeFile(
Path.resolve(REPO_ROOT, 'packages/kbn-synthetic-package-map/synthetic-packages.json'),
JSON.stringify(entries, null, 2)
);
Expand Down
6 changes: 3 additions & 3 deletions kbn_pm/src/commands/bootstrap/yarn.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
*/

import Path from 'path';
import Fs from 'fs';
import Fsp from 'fs/promises';

import { REPO_ROOT } from '../../lib/paths.mjs';
import { maybeRealpath, isFile, isDirectory } from '../../lib/fs.mjs';

// yarn integrity file checker
export function removeYarnIntegrityFileIfExists() {
export async function removeYarnIntegrityFileIfExists() {
try {
const nodeModulesRealPath = maybeRealpath(Path.resolve(REPO_ROOT, 'node_modules'));
const yarnIntegrityFilePath = Path.resolve(nodeModulesRealPath, '.yarn-integrity');

// check if the file exists and delete it in that case
if (isFile(yarnIntegrityFilePath)) {
Fs.unlinkSync(yarnIntegrityFilePath);
await Fsp.unlink(yarnIntegrityFilePath);
}
} catch {
// no-op
Expand Down
8 changes: 8 additions & 0 deletions kbn_pm/src/commands/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ export const COMMANDS = [
(await import('./run_in_packages_command.mjs')).command,
(await import('./clean_command.mjs')).command,
(await import('./reset_command.mjs')).command,
(await import('./test_command.mjs')).command,
];

/**
* @param {string | undefined} name
*/
export function getCmd(name) {
return COMMANDS.find((c) => (c.name.startsWith('_') ? c.name.slice(1) : c.name) === name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@
* Side Public License, v 1.
*/

export * from './visual_testing';
/** @type {import('../lib/command').Command} */
export const command = {
name: '_test',
async run({ log }) {
log.success('empty');
},
};
2 changes: 1 addition & 1 deletion kbn_pm/src/lib/find_clean_paths.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function tryToGetSyntheticPackageMap(log) {
}

/**
* @param {*} packageDir
* @param {string} packageDir
* @returns {string[]}
*/
export function readCleanPatterns(packageDir) {
Expand Down
6 changes: 3 additions & 3 deletions kbn_pm/src/lib/help.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import { COMMANDS } from '../commands/index.mjs';
import { COMMANDS, getCmd } from '../commands/index.mjs';
import { dedent, indent } from './indent.mjs';
import { title } from './colors.mjs';

Expand All @@ -15,7 +15,7 @@ import { title } from './colors.mjs';
* @returns {Promise<string>}
*/
export async function getHelp(cmdName = undefined) {
const cmd = cmdName && COMMANDS.find((c) => c.name === cmdName);
const cmd = getCmd(cmdName);

/**
* @param {number} depth
Expand Down Expand Up @@ -49,6 +49,6 @@ export async function getHelp(cmdName = undefined) {
' yarn kbn <command> [...flags]',
'',
'Commands:',
...COMMANDS.map((cmd) => cmdLines(2, cmd)).flat(),
...COMMANDS.flatMap((cmd) => (cmd.name.startsWith('_') ? [] : cmdLines(2, cmd))),
].join('\n');
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,6 @@
"@mapbox/vector-tile": "1.3.1",
"@octokit/rest": "^16.35.0",
"@openpgp/web-stream-tools": "^0.0.10",
"@percy/agent": "^0.28.6",
"@storybook/addon-a11y": "^6.4.22",
"@storybook/addon-actions": "^6.4.22",
"@storybook/addon-controls": "^6.4.22",
Expand Down
30 changes: 0 additions & 30 deletions test/visual_regression/config.ts

This file was deleted.

15 changes: 0 additions & 15 deletions test/visual_regression/ftr_provider_context.ts

This file was deleted.

15 changes: 0 additions & 15 deletions test/visual_regression/services/index.ts

This file was deleted.

102 changes: 0 additions & 102 deletions test/visual_regression/services/visual_testing/take_percy_snapshot.js

This file was deleted.

Loading

0 comments on commit f81bb09

Please sign in to comment.