Skip to content

Commit 05e7e74

Browse files
committed
Merge branch 'master' into remove-unnecessary-configs-kp
2 parents 3ee558e + 341c1ac commit 05e7e74

File tree

165 files changed

+3714
-2611
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+3714
-2611
lines changed

docs/api/saved-objects/create.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ experimental[] Create {kib} saved objects.
1313

1414
`POST <kibana host>:<port>/api/saved_objects/<type>/<id>`
1515

16-
`POST <kibana host>:<port>/s/<space_id>/api/saved_objects/<type>`
16+
`POST <kibana host>:<port>/s/<space_id>/saved_objects/<type>`
1717

1818
[[saved-objects-api-create-path-params]]
1919
==== Path parameters

docs/developer/getting-started/development-plugin-resources.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To enable TypeScript support, create a `tsconfig.json` file at the root of your
3333
["source","js"]
3434
-----------
3535
{
36-
// extend {kib}'s tsconfig, or use your own settings
36+
// extend Kibana's tsconfig, or use your own settings
3737
"extends": "../../kibana/tsconfig.json",
3838
3939
// tell the TypeScript compiler where to find your source files

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@
227227
"devDependencies": {
228228
"@babel/parser": "^7.11.2",
229229
"@babel/types": "^7.11.0",
230-
"@elastic/apm-rum": "^5.5.0",
230+
"@elastic/apm-rum": "^5.6.0",
231231
"@elastic/charts": "21.1.2",
232-
"@elastic/ems-client": "7.9.3",
232+
"@elastic/ems-client": "7.10.0",
233233
"@elastic/eslint-config-kibana": "0.15.0",
234234
"@elastic/eslint-plugin-eui": "0.0.2",
235235
"@elastic/filesaver": "1.1.2",

packages/kbn-pm/dist/index.js

Lines changed: 1342 additions & 1165 deletions
Large diffs are not rendered by default.

packages/kbn-pm/src/commands/bootstrap.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
jest.mock('../utils/scripts');
2121
jest.mock('../utils/link_project_executables');
22+
jest.mock('../utils/validate_yarn_lock');
2223

2324
import { resolve } from 'path';
2425

packages/kbn-pm/src/commands/bootstrap.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import { Project } from '../utils/project';
2525
import { ICommand } from './';
2626
import { getAllChecksums } from '../utils/project_checksums';
2727
import { BootstrapCacheFile } from '../utils/bootstrap_cache_file';
28+
import { readYarnLock } from '../utils/yarn_lock';
29+
import { validateYarnLock } from '../utils/validate_yarn_lock';
2830

2931
export const BootstrapCommand: ICommand = {
3032
description: 'Install dependencies and crosslink projects',
@@ -54,6 +56,10 @@ export const BootstrapCommand: ICommand = {
5456
}
5557
}
5658

59+
const yarnLock = await readYarnLock(kbn);
60+
61+
await validateYarnLock(kbn, yarnLock);
62+
5763
await linkProjectExecutables(projects, projectGraph);
5864

5965
/**
@@ -63,7 +69,7 @@ export const BootstrapCommand: ICommand = {
6369
* have to, as it will slow down the bootstrapping process.
6470
*/
6571

66-
const checksums = await getAllChecksums(kbn, log);
72+
const checksums = await getAllChecksums(kbn, log, yarnLock);
6773
const caches = new Map<Project, { file: BootstrapCacheFile; valid: boolean }>();
6874
let cachedProjectCount = 0;
6975

packages/kbn-pm/src/utils/__snapshots__/link_project_executables.test.ts.snap

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kbn-pm/src/utils/fs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { promisify } from 'util';
2525

2626
const lstat = promisify(fs.lstat);
2727
export const readFile = promisify(fs.readFile);
28+
export const writeFile = promisify(fs.writeFile);
2829
const symlink = promisify(fs.symlink);
2930
export const chmod = promisify(fs.chmod);
3031
const cmdShim = promisify<string, string>(cmdShimCb);

packages/kbn-pm/src/utils/kibana.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import Path from 'path';
2222
import multimatch from 'multimatch';
2323
import isPathInside from 'is-path-inside';
2424

25+
import { resolveDepsForProject, YarnLock } from './yarn_lock';
26+
import { Log } from './log';
2527
import { ProjectMap, getProjects, includeTransitiveProjects } from './projects';
2628
import { Project } from './project';
2729
import { getProjectPaths } from '../config';
@@ -133,4 +135,26 @@ export class Kibana {
133135
isOutsideRepo(project: Project) {
134136
return !this.isPartOfRepo(project);
135137
}
138+
139+
resolveAllProductionDependencies(yarnLock: YarnLock, log: Log) {
140+
const kibanaDeps = resolveDepsForProject({
141+
project: this.kibanaProject,
142+
yarnLock,
143+
kbn: this,
144+
includeDependentProject: true,
145+
productionDepsOnly: true,
146+
log,
147+
})!;
148+
149+
const xpackDeps = resolveDepsForProject({
150+
project: this.getProject('x-pack')!,
151+
yarnLock,
152+
kbn: this,
153+
includeDependentProject: true,
154+
productionDepsOnly: true,
155+
log,
156+
})!;
157+
158+
return new Map([...kibanaDeps.entries(), ...xpackDeps.entries()]);
159+
}
136160
}

packages/kbn-pm/src/utils/project_checksums.ts

Lines changed: 15 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { promisify } from 'util';
2424

2525
import execa from 'execa';
2626

27-
import { readYarnLock, YarnLock } from './yarn_lock';
27+
import { YarnLock, resolveDepsForProject } from './yarn_lock';
2828
import { ProjectMap } from '../utils/projects';
2929
import { Project } from '../utils/project';
3030
import { Kibana } from '../utils/kibana';
@@ -145,51 +145,6 @@ async function getLatestSha(project: Project, kbn: Kibana) {
145145
return stdout.trim() || undefined;
146146
}
147147

148-
/**
149-
* Get a list of the absolute dependencies of this project, as resolved
150-
* in the yarn.lock file, does not include other projects in the workspace
151-
* or their dependencies
152-
*/
153-
function resolveDepsForProject(project: Project, yarnLock: YarnLock, kbn: Kibana, log: Log) {
154-
/** map of [name@range, name@resolved] */
155-
const resolved = new Map<string, string>();
156-
157-
const queue: Array<[string, string]> = Object.entries(project.allDependencies);
158-
159-
while (queue.length) {
160-
const [name, versionRange] = queue.shift()!;
161-
const req = `${name}@${versionRange}`;
162-
163-
if (resolved.has(req)) {
164-
continue;
165-
}
166-
167-
if (!kbn.hasProject(name)) {
168-
const pkg = yarnLock[req];
169-
if (!pkg) {
170-
log.warning(
171-
'yarn.lock file is out of date, please run `yarn kbn bootstrap` to re-enable caching'
172-
);
173-
return;
174-
}
175-
176-
const res = `${name}@${pkg.version}`;
177-
resolved.set(req, res);
178-
179-
const allDepsEntries = [
180-
...Object.entries(pkg.dependencies || {}),
181-
...Object.entries(pkg.optionalDependencies || {}),
182-
];
183-
184-
for (const [childName, childVersionRange] of allDepsEntries) {
185-
queue.push([childName, childVersionRange]);
186-
}
187-
}
188-
}
189-
190-
return Array.from(resolved.values()).sort((a, b) => a.localeCompare(b));
191-
}
192-
193148
/**
194149
* Get the checksum for a specific project in the workspace
195150
*/
@@ -224,11 +179,22 @@ async function getChecksum(
224179
})
225180
);
226181

227-
const deps = await resolveDepsForProject(project, yarnLock, kbn, log);
228-
if (!deps) {
182+
const depMap = resolveDepsForProject({
183+
project,
184+
yarnLock,
185+
kbn,
186+
log,
187+
includeDependentProject: false,
188+
productionDepsOnly: false,
189+
});
190+
if (!depMap) {
229191
return;
230192
}
231193

194+
const deps = Array.from(depMap.values())
195+
.map(({ name, version }) => `${name}@${version}`)
196+
.sort((a, b) => a.localeCompare(b));
197+
232198
log.verbose(`[${project.name}] resolved %d deps`, deps.length);
233199

234200
const checksum = JSON.stringify(
@@ -256,10 +222,9 @@ async function getChecksum(
256222
* - un-committed changes
257223
* - resolved dependencies from yarn.lock referenced by project package.json
258224
*/
259-
export async function getAllChecksums(kbn: Kibana, log: Log) {
225+
export async function getAllChecksums(kbn: Kibana, log: Log, yarnLock: YarnLock) {
260226
const projects = kbn.getAllProjects();
261227
const changesByProject = await getChangesForProjects(projects, kbn, log);
262-
const yarnLock = await readYarnLock(kbn);
263228

264229
/** map of [project.name, cacheKey] */
265230
const cacheKeys: ChecksumMap = new Map();

0 commit comments

Comments
 (0)