[globby] normalize paths for windows support (#96476)

Co-authored-by: spalger <spalger@users.noreply.github.com>
This commit is contained in:
Spencer 2021-04-07 14:08:28 -07:00 committed by GitHub
parent 71c326c8bf
commit d8ef85e85b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 11 deletions

View file

@ -9,6 +9,7 @@
import Path from 'path';
import globby from 'globby';
import normalize from 'normalize-path';
import { parseKibanaPlatformPlugin } from './parse_kibana_platform_plugin';
@ -32,7 +33,7 @@ export function simpleKibanaPlatformPluginDiscovery(scanDirs: string[], pluginPa
),
...pluginPaths.map((path) => Path.resolve(path, `kibana.json`)),
])
);
).map((path) => normalize(path));
const manifestPaths = globby.sync(patterns, { absolute: true }).map((path) =>
// absolute paths returned from globby are using normalize or

View file

@ -11,6 +11,7 @@ import Path from 'path';
import { REPO_ROOT } from '@kbn/utils';
import { run, createFailError, createFlagError } from '@kbn/dev-utils';
import globby from 'globby';
import normalize from 'normalize-path';
import { getFailures, TestFailure } from './get_failures';
import { GithubApi, GithubIssueMini } from './github_api';
@ -61,7 +62,9 @@ export function runFailedTestsReporterCli() {
throw createFlagError('Missing --build-url or process.env.BUILD_URL');
}
const patterns = flags._.length ? flags._ : DEFAULT_PATTERNS;
const patterns = (flags._.length ? flags._ : DEFAULT_PATTERNS).map((p) =>
normalize(Path.resolve(p))
);
log.info('Searching for reports at', patterns);
const reportPaths = await globby(patterns, {
absolute: true,

View file

@ -6,7 +6,9 @@
* Side Public License, v 1.
*/
import Path from 'path';
import globby from 'globby';
import normalize from 'normalize-path';
// @ts-ignore
import { parseEntries, dependenciesParseStrategy } from '@kbn/babel-code-parser';
@ -21,16 +23,16 @@ export async function findUsedDependencies(listedPkgDependencies: any, baseDir:
// Define the entry points for the server code in order to
// start here later looking for the server side dependencies
const mainCodeEntries = [
`${baseDir}/src/cli/dist.js`,
`${baseDir}/src/cli_keystore/dist.js`,
`${baseDir}/src/cli_plugin/dist.js`,
Path.resolve(baseDir, `src/cli/dist.js`),
Path.resolve(baseDir, `src/cli_keystore/dist.js`),
Path.resolve(baseDir, `src/cli_plugin/dist.js`),
];
const discoveredPluginEntries = await globby([
`${baseDir}/src/plugins/*/server/index.js`,
`!${baseDir}/src/plugins/**/public`,
`${baseDir}/x-pack/plugins/*/server/index.js`,
`!${baseDir}/x-pack/plugins/**/public`,
normalize(Path.resolve(baseDir, `src/plugins/*/server/index.js`)),
`!${normalize(Path.resolve(baseDir, `/src/plugins/**/public`))}`,
normalize(Path.resolve(baseDir, `x-pack/plugins/*/server/index.js`)),
`!${normalize(Path.resolve(baseDir, `/x-pack/plugins/**/public`))}`,
]);
// It will include entries that cannot be discovered
@ -40,7 +42,7 @@ export async function findUsedDependencies(listedPkgDependencies: any, baseDir:
// Another way would be to include an index file and import all the functions
// using named imports
const dynamicRequiredEntries = await globby([
`${baseDir}/src/plugins/vis_type_timelion/server/**/*.js`,
normalize(Path.resolve(baseDir, 'src/plugins/vis_type_timelion/server/**/*.js')),
]);
// Compose all the needed entries

View file

@ -12,6 +12,7 @@ import Fs from 'fs';
import del from 'del';
import cpy from 'cpy';
import globby from 'globby';
import normalize from 'normalize-path';
import {
ToolingLog,
createAbsolutePathSerializer,
@ -98,7 +99,10 @@ it('creates and extracts caches, ingoring dirs with matching merge-base file and
const files = Object.fromEntries(
globby
.sync(outDirs, { dot: true })
.sync(
outDirs.map((p) => normalize(p)),
{ dot: true }
)
.map((path) => [Path.relative(TMP, path), Fs.readFileSync(path, 'utf-8')])
);