From 0c44d73d16ffc5281ffa963a96a85e33b9f5fdda Mon Sep 17 00:00:00 2001 From: spacedragon Date: Wed, 6 Mar 2019 16:24:56 +0800 Subject: [PATCH] [Code] change nodegit to @elastic/nodegit --- x-pack/package.json | 3 +- .../code/server/__tests__/clone_worker.ts | 2 +- .../code/server/__tests__/git_operations.ts | 2 +- .../code/server/__tests__/lsp_indexer_test.ts | 2 +- .../code/server/__tests__/lsp_service.ts | 2 +- x-pack/plugins/code/server/git_operations.ts | 12 ++++- .../code/server/lsp/test_repo_manager.ts | 2 +- .../code/server/lsp/workspace_handler.ts | 2 +- .../plugins/code/server/repository_service.ts | 2 +- x-pack/plugins/code/server/routes/file.ts | 4 +- x-pack/plugins/code/tasks/nodegit_info.js | 3 +- yarn.lock | 46 ++++++++----------- 12 files changed, 43 insertions(+), 39 deletions(-) diff --git a/x-pack/package.json b/x-pack/package.json index 07e0c17660d99..0ae35efa3ee72 100644 --- a/x-pack/package.json +++ b/x-pack/package.json @@ -63,7 +63,6 @@ "@types/nock": "^9.3.0", "@types/node": "^10.12.27", "@types/node-fetch": "^2.1.4", - "@types/nodegit": "^0.22.1", "@types/papaparse": "^4.5.5", "@types/pngjs": "^3.3.1", "@types/prop-types": "^15.5.3", @@ -160,6 +159,7 @@ "@elastic/lsp-extension": "^0.1.1", "@elastic/node-crypto": "0.1.2", "@elastic/numeral": "2.3.2", + "@elastic/nodegit": "0.24.0-alpha.10", "@kbn/babel-preset": "1.0.0", "@kbn/es-query": "1.0.0", "@kbn/i18n": "1.0.0", @@ -256,7 +256,6 @@ "monaco-editor": "^0.14.3", "ngreact": "^0.5.1", "node-fetch": "^2.1.2", - "nodegit": "git+https://github.com/elastic/nodegit.git#54173ad757bc09f155183bb27bce921b02fb8198", "nodemailer": "^4.6.4", "object-path-immutable": "^0.5.3", "oppsy": "^2.0.0", diff --git a/x-pack/plugins/code/server/__tests__/clone_worker.ts b/x-pack/plugins/code/server/__tests__/clone_worker.ts index b33f8ad05be2e..ef593c97cc33b 100644 --- a/x-pack/plugins/code/server/__tests__/clone_worker.ts +++ b/x-pack/plugins/code/server/__tests__/clone_worker.ts @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ +import Git from '@elastic/nodegit'; import assert from 'assert'; import fs from 'fs'; -import Git from 'nodegit'; import path from 'path'; import rimraf from 'rimraf'; import sinon from 'sinon'; diff --git a/x-pack/plugins/code/server/__tests__/git_operations.ts b/x-pack/plugins/code/server/__tests__/git_operations.ts index ef2ec0442d374..62ba1d8c68853 100644 --- a/x-pack/plugins/code/server/__tests__/git_operations.ts +++ b/x-pack/plugins/code/server/__tests__/git_operations.ts @@ -13,7 +13,7 @@ import rimraf from 'rimraf'; import {getDefaultBranch, GitOperations} from '../git_operations'; import {ServerOptions} from "../server_options"; import * as mkdirp from "mkdirp"; -import Git from 'nodegit'; +import Git from '@elastic/nodegit'; describe('git_operations', () => { it('get default branch from a non master repo', async () => { diff --git a/x-pack/plugins/code/server/__tests__/lsp_indexer_test.ts b/x-pack/plugins/code/server/__tests__/lsp_indexer_test.ts index 4ce1cc5ccdb8f..846d9f08284a2 100644 --- a/x-pack/plugins/code/server/__tests__/lsp_indexer_test.ts +++ b/x-pack/plugins/code/server/__tests__/lsp_indexer_test.ts @@ -4,9 +4,9 @@ * you may not use this file except in compliance with the Elastic License. */ +import Git, { CloneOptions } from '@elastic/nodegit'; import assert from 'assert'; import fs from 'fs'; -import Git, { CloneOptions } from 'nodegit'; import path from 'path'; import rimraf from 'rimraf'; import sinon from 'sinon'; diff --git a/x-pack/plugins/code/server/__tests__/lsp_service.ts b/x-pack/plugins/code/server/__tests__/lsp_service.ts index 455691645dfe6..bc858a9976cfa 100644 --- a/x-pack/plugins/code/server/__tests__/lsp_service.ts +++ b/x-pack/plugins/code/server/__tests__/lsp_service.ts @@ -6,7 +6,7 @@ /* tslint:disable */ import fs from 'fs'; -import Git from 'nodegit'; +import Git from '@elastic/nodegit'; // import rimraf from 'rimraf'; import sinon from 'sinon'; import path from 'path'; diff --git a/x-pack/plugins/code/server/git_operations.ts b/x-pack/plugins/code/server/git_operations.ts index b83ce75726043..683a0ca6d4743 100644 --- a/x-pack/plugins/code/server/git_operations.ts +++ b/x-pack/plugins/code/server/git_operations.ts @@ -4,8 +4,18 @@ * you may not use this file except in compliance with the Elastic License. */ +import { + Blame, + Commit, + Error, + Object, + Oid, + Reference, + Repository, + Tree, + TreeEntry, +} from '@elastic/nodegit'; import Boom from 'boom'; -import { Blame, Commit, Error, Object, Oid, Reference, Repository, Tree, TreeEntry } from 'nodegit'; import * as Path from 'path'; import { GitBlame } from '../common/git_blame'; import { CommitDiff, DiffKind } from '../common/git_diff'; diff --git a/x-pack/plugins/code/server/lsp/test_repo_manager.ts b/x-pack/plugins/code/server/lsp/test_repo_manager.ts index 45cf6acba1d39..15f823defd449 100644 --- a/x-pack/plugins/code/server/lsp/test_repo_manager.ts +++ b/x-pack/plugins/code/server/lsp/test_repo_manager.ts @@ -6,7 +6,7 @@ /* tslint:disable */ import fs from 'fs'; -import Git from 'nodegit'; +import Git from '@elastic/nodegit'; import rimraf from 'rimraf'; import { TestConfig, Repo } from '../../model/test_config'; diff --git a/x-pack/plugins/code/server/lsp/workspace_handler.ts b/x-pack/plugins/code/server/lsp/workspace_handler.ts index de51c3332a2e7..22f3673c5d347 100644 --- a/x-pack/plugins/code/server/lsp/workspace_handler.ts +++ b/x-pack/plugins/code/server/lsp/workspace_handler.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ +import { Clone, Commit, Error as GitError, Repository, Reset } from '@elastic/nodegit'; import Boom from 'boom'; import del from 'del'; import fs from 'fs'; import { delay } from 'lodash'; import mkdirp from 'mkdirp'; -import { Clone, Commit, Error as GitError, Repository, Reset } from 'nodegit'; import path from 'path'; import { ResponseMessage } from 'vscode-jsonrpc/lib/messages'; import { Hover, Location, TextDocumentPositionParams } from 'vscode-languageserver'; diff --git a/x-pack/plugins/code/server/repository_service.ts b/x-pack/plugins/code/server/repository_service.ts index 6e39cf38cec8b..96bea36330b76 100644 --- a/x-pack/plugins/code/server/repository_service.ts +++ b/x-pack/plugins/code/server/repository_service.ts @@ -4,10 +4,10 @@ * you may not use this file except in compliance with the Elastic License. */ +import Git from '@elastic/nodegit'; import del from 'del'; import fs from 'fs'; import mkdirp from 'mkdirp'; -import Git from 'nodegit'; import path from 'path'; import { RepositoryUtils } from '../common/repository_utils'; import { diff --git a/x-pack/plugins/code/server/routes/file.ts b/x-pack/plugins/code/server/routes/file.ts index b394d99408038..249a8b40ad2f4 100644 --- a/x-pack/plugins/code/server/routes/file.ts +++ b/x-pack/plugins/code/server/routes/file.ts @@ -4,11 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ +import { Reference } from '@elastic/nodegit'; +import { Commit, Revwalk } from '@elastic/nodegit'; import Boom from 'boom'; import fileType from 'file-type'; import hapi, { RequestQuery } from 'hapi'; -import { Reference } from 'nodegit'; -import { Commit, Revwalk } from 'nodegit'; import { ReferenceInfo } from '../../model/commit'; import { commitInfo, diff --git a/x-pack/plugins/code/tasks/nodegit_info.js b/x-pack/plugins/code/tasks/nodegit_info.js index 7c86e1ac642f7..8af3872d4613e 100644 --- a/x-pack/plugins/code/tasks/nodegit_info.js +++ b/x-pack/plugins/code/tasks/nodegit_info.js @@ -3,5 +3,6 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +/* eslint-disable */ +export { default } from '@elastic/nodegit/dist/utils/binary_info'; -export { default } from 'nodegit/lib/utils/binary_info'; diff --git a/yarn.lock b/yarn.lock index b296db4f125dc..32c11e1c70145 100644 --- a/yarn.lock +++ b/yarn.lock @@ -900,6 +900,26 @@ resolved "https://registry.yarnpkg.com/@elastic/node-crypto/-/node-crypto-0.1.2.tgz#c18ac282f635e88f041cc1555d806e492ca8f3b1" integrity sha1-wYrCgvY16I8EHMFVXYBuSSyo87E= +"@elastic/nodegit@0.24.0-alpha.10": + version "0.24.0-alpha.10" + resolved "https://registry.yarnpkg.com/@elastic/nodegit/-/nodegit-0.24.0-alpha.10.tgz#aff30d245a9155620b08af494643efcd12c39313" + integrity sha512-9vQRbl/jOqRb20AceYdcwzYBNFxsh7pWAeKMfHJmLTRqTxCjvvFeOpIFW1FLAe56zj6Qd04xrE8OWE9Htxvn2Q== + dependencies: + babel-cli "^6.7.7" + babel-preset-es2015 "^6.6.0" + combyne "~0.8.1" + fs-extra "^7.0.0" + js-beautify "~1.5.10" + lodash "^4.17.11" + nan "^2.11.1" + node-gyp "^3.8.0" + node-pre-gyp "^0.11.0" + promisify-node "~0.3.0" + ramda "^0.25.0" + request-promise-native "^1.0.5" + tar-fs "^1.16.3" + walk "^2.3.9" + "@elastic/numeral@2.3.2": version "2.3.2" resolved "https://registry.yarnpkg.com/@elastic/numeral/-/numeral-2.3.2.tgz#06c9ef22f18dd8c2b39ffe353868d4d0c13ea4f9" @@ -2150,13 +2170,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.12.27.tgz#eb3843f15d0ba0986cc7e4d734d2ee8b50709ef8" integrity sha512-e9wgeY6gaY21on3ve0xAjgBVjGDWq/xUteK0ujsE53bUoxycMkqfnkUgMt6ffZtykZ5X12Mg3T7Pw4TRCObDKg== -"@types/nodegit@^0.22.1": - version "0.22.7" - resolved "https://registry.yarnpkg.com/@types/nodegit/-/nodegit-0.22.7.tgz#e4e3f9f2a0e8a6f13234748e6e12c06c864879ba" - integrity sha512-ZMsQfod9Lsxn5V5yS2Pyf46S31CGD26gP1uKmth041NhNyd3qcJvkhe/2072TgwwdXx4f+W6wdh1Vvu1e34l/A== - dependencies: - "@types/node" "*" - "@types/normalize-package-data@*": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -17245,25 +17258,6 @@ nodegit-promise@~4.0.0: dependencies: asap "~2.0.3" -"nodegit@git+https://github.com/elastic/nodegit.git#54173ad757bc09f155183bb27bce921b02fb8198": - version "0.24.0-alpha.6" - resolved "git+https://github.com/elastic/nodegit.git#54173ad757bc09f155183bb27bce921b02fb8198" - dependencies: - babel-cli "^6.7.7" - babel-preset-es2015 "^6.6.0" - combyne "~0.8.1" - fs-extra "^7.0.0" - js-beautify "~1.5.10" - lodash "^4.17.11" - nan "^2.11.1" - node-gyp "^3.8.0" - node-pre-gyp "^0.11.0" - promisify-node "~0.3.0" - ramda "^0.25.0" - request-promise-native "^1.0.5" - tar-fs "^1.16.3" - walk "^2.3.9" - nodemailer@^4.6.4: version "4.6.4" resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-4.6.4.tgz#f0d72d0c6a6ec5f4369fa8f4bf5127a31baa2014"