-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Code] Merge elastic code plugin to main Kibana Repo #27012
Changes from 250 commits
0dfdf37
59b7194
fe88314
deb8734
a2d7cd1
d13c15b
25042bd
7fc2014
f11e080
517a1b3
22e5878
18f11e2
0753b43
fb703b1
fbdc718
59fd57d
02b8e9e
88908d4
840a8a8
6876da8
04200dc
72feb76
3635a78
0a622f2
42e64a1
97b4c1c
b4d714a
8a59f36
a9b3fe1
c391ec7
b40bfde
28c3ac2
9eec96f
9d6fbb3
cefa8f1
bfe7bca
b902506
a1dfdbc
5b1ab0f
6459061
602d396
f25c9b9
51cda46
572f738
97752ca
bb562de
25e6742
7172f61
8b1b228
94b4144
ba8deb1
10d2aba
8d5ef9c
c98e74d
c06366f
cfa0dd7
35af595
f9c93be
dbb0730
990615e
1745988
39f1ac0
7189ee3
0e1d197
96a30ac
143c4ca
8e50a57
aa10cb4
57181c4
ccd86d9
e5f198d
b5bb4e9
ac45eca
35c6125
03af19f
1e25ad8
02ac170
c544348
3de4a68
9feea7b
360fa7d
6ce1b5f
0523fb3
4dce0ea
9f566da
1c73761
a611445
7c6e21e
892f40b
5dc2a58
d3ceee5
e7e4491
ddc23ee
db60492
c6419d1
90d9485
3ee3deb
82a5ff4
4b06222
e23d98e
9031913
c0d987c
f2956ad
572a2b5
c47b4ea
4a6738f
a950c01
4812cfb
4a263e4
9b8d1c5
bcba5cb
669b36a
aa22954
75e3497
a088554
f239983
7018e64
63cfa46
be376d1
7a7aff8
7db0996
300783c
0dd40c8
9d36039
71257ce
d537525
4d699b5
4acf2a9
240eac6
fda5073
a4cc1d1
6de9fa0
ff70ee0
9519432
821e47b
57fad3d
f493e54
fbff7de
46b9627
22d64d9
126eac4
dcd9282
f48d420
0b7c437
630dfb6
d81f066
a136341
bf29eef
ef185b1
e7c5c2a
c5cbfe3
49505a0
5afbe6f
9715202
b857bcd
4511305
d57dfe3
57caedb
f0c9973
16b34ce
c4f4f2e
1ff20b3
9a79732
cd1104e
4bcbca9
57acf26
8551139
23f6572
6c6e79e
c57b16c
e8ec86d
bb94f4a
b2af3dc
c21706f
58585ee
881bcc2
9d11d91
cfbc0fa
3f74652
781fa21
c0f2fd7
84a564b
d7e4ee3
6e66615
bd94531
431cd66
6a1fc64
57764f3
71f14ec
77b0105
c8ea4f2
5512779
b7eb82a
08d0766
bea3503
4367231
acef7a9
5b1f5d5
3f36edd
302e996
7d225f1
ca3e255
7c3fe2c
262e37c
e5a9c60
8661752
51f7310
951c53c
4245a7b
d3061e9
5d174f2
b9fb0d4
291445a
cce157a
0088511
2da9cd3
1e703f0
fa0ed43
8482f8a
2d61c7c
11ff56c
4963be3
a3014d4
465b9ad
27d2763
5b8e0e2
45bf396
dea9934
95be954
eeae014
df2d425
b28e091
87d3373
2bba2bb
0b2f5e1
1d89791
27d8a45
4e62a3d
feedd92
1c79c1b
bda74aa
7df558d
66b8047
0033bec
5774b55
4690305
7aa961d
8d5e844
e206b71
7004945
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,7 +197,7 @@ | |
"react-dom": "^16.6.0", | ||
"react-grid-layout": "^0.16.2", | ||
"react-input-range": "^1.3.0", | ||
"react-markdown": "^3.1.4", | ||
"react-markdown": "^3.4.1", | ||
"react-redux": "^5.0.7", | ||
"react-router-dom": "^4.3.1", | ||
"react-sizeme": "^2.3.6", | ||
|
@@ -263,6 +263,7 @@ | |
"@types/bluebird": "^3.1.1", | ||
"@types/boom": "^7.2.0", | ||
"@types/chance": "^1.0.0", | ||
"@types/cheerio": "^0.22.10", | ||
"@types/classnames": "^2.2.3", | ||
"@types/d3": "^3.5.41", | ||
"@types/dedent": "^0.7.0", | ||
|
@@ -304,7 +305,7 @@ | |
"@types/redux-actions": "^2.2.1", | ||
"@types/rimraf": "^2.0.2", | ||
"@types/semver": "^5.5.0", | ||
"@types/sinon": "^5.0.1", | ||
"@types/sinon": "^7.0.0", | ||
"@types/strip-ansi": "^3.0.0", | ||
"@types/styled-components": "^3.0.1", | ||
"@types/supertest": "^2.0.5", | ||
|
@@ -377,7 +378,7 @@ | |
"mocha": "3.3.0", | ||
"murmurhash3js": "3.0.1", | ||
"mutation-observer": "^1.0.3", | ||
"nock": "8.0.0", | ||
"nock": "10.0.4", | ||
"node-sass": "^4.9.4", | ||
"normalize-path": "^3.0.0", | ||
"pixelmatch": "4.0.2", | ||
|
@@ -388,7 +389,7 @@ | |
"regenerate": "^1.4.0", | ||
"sass-lint": "^1.12.1", | ||
"simple-git": "1.37.0", | ||
"sinon": "^5.0.7", | ||
"sinon": "^7.2.2", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: Sinon 6 shouldn't have any breaking changes, and upgrades the internal lolex dep which prevents negative tick values, which isn't a problem for us. |
||
"strip-ansi": "^3.0.1", | ||
"supertest": "^3.1.0", | ||
"supertest-as-promised": "^4.0.2", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { scanCopy, untar, deleteAll } from '../lib'; | ||
import { createWriteStream } from 'fs'; | ||
import binaryInfo from '../../../../x-pack/plugins/code/tasks/nodegit_info'; | ||
import wreck from 'wreck'; | ||
import mkdirp from 'mkdirp'; | ||
import { dirname, join, basename } from 'path'; | ||
import { createPromiseFromStreams } from '../../../utils/streams'; | ||
|
||
async function download(url, destination, log) { | ||
const response = await wreck.request('GET', url); | ||
|
||
if (response.statusCode !== 200) { | ||
throw new Error( | ||
`Unexpected status code ${response.statusCode} when downloading ${url}` | ||
); | ||
} | ||
mkdirp.sync(dirname(destination)); | ||
await createPromiseFromStreams([ | ||
response, | ||
createWriteStream(destination) | ||
]); | ||
log.debug('Downloaded ', url); | ||
} | ||
|
||
async function downloadAndExtractTarball(url, dest, log, retry) { | ||
try { | ||
await download(url, dest, log); | ||
const extractDir = join(dirname(dest), basename(dest, '.tar.gz')); | ||
await untar(dest, extractDir, { | ||
strip: 1 | ||
}); | ||
return extractDir; | ||
} catch (e) { | ||
if (retry > 0) { | ||
await downloadAndExtractTarball(url, dest, log, retry - 1); | ||
} else { | ||
throw e; | ||
} | ||
} | ||
} | ||
|
||
async function patchNodeGit(config, log, build, platform) { | ||
const plat = platform.isWindows() ? 'win32' : platform.getName(); | ||
const arch = platform.getNodeArch().split('-')[1]; | ||
const info = binaryInfo(plat, arch); | ||
const downloadUrl = info.hosted_tarball; | ||
const packageName = info.package_name; | ||
const downloadPath = build.resolvePathForPlatform(platform, '.nodegit_binaries', packageName); | ||
const extractDir = await downloadAndExtractTarball(downloadUrl, downloadPath, log, 3); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to delete the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
|
||
const destination = build.resolvePathForPlatform(platform, 'node_modules/nodegit/build/Release'); | ||
log.debug('Replacing nodegit binaries from ', extractDir); | ||
await deleteAll([destination], log); | ||
await scanCopy({ | ||
source: extractDir, | ||
destination: destination, | ||
time: new Date(), | ||
}); | ||
await deleteAll([extractDir, downloadPath], log); | ||
} | ||
|
||
|
||
|
||
export const PatchNativeModulesTask = { | ||
description: 'Patching platform-specific native modules directories', | ||
async run(config, log, build) { | ||
await Promise.all(config.getTargetPlatforms().map(async platform => { | ||
await patchNodeGit(config, log, build, platform); | ||
})); | ||
} | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export interface GitBlame { | ||
committer: { | ||
name: string; | ||
email: string; | ||
}; | ||
startLine: number; | ||
lines: number; | ||
commit: { | ||
id: string; | ||
message: string; | ||
date: string; | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Looks like nock just dropped support for older versions node versions in v8 and v10