Skip to content

Commit

Permalink
[6.x] Upgrade to NodeJS 10 (#25157) (#26909)
Browse files Browse the repository at this point in the history
* chore(NA): merge and solve conflicts backporting to 6.x

* chore(NA): merge and solve conflicts backporting to 6.x
  • Loading branch information
mistic authored Dec 10, 2018
1 parent cb8ad05 commit 1d3fcaa
Show file tree
Hide file tree
Showing 77 changed files with 40,467 additions and 14,925 deletions.
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.14.0
10.14.1
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.14.0
10.14.1
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"url": "https://github.com/elastic/kibana.git"
},
"resolutions": {
"**/@types/node": "8.10.38",
"**/@types/node": "10.12.12",
"@types/react": "16.3.14"
},
"workspaces": {
Expand All @@ -111,7 +111,7 @@
"@elastic/datemath": "5.0.0",
"@elastic/eui": "5.3.0",
"@elastic/filesaver": "1.1.2",
"@elastic/good": "8.1.1-kibana1",
"@elastic/good": "8.1.1-kibana2",
"@elastic/numeral": "2.3.2",
"@elastic/ui-ace": "0.2.3",
"@kbn/babel-code-parser": "1.0.0",
Expand Down Expand Up @@ -153,7 +153,7 @@
"elasticsearch": "^15.2.0",
"elasticsearch-browser": "^15.2.0",
"encode-uri-query": "1.0.0",
"execa": "^0.10.0",
"execa": "^1.0.0",
"expiry-js": "0.1.7",
"file-loader": "2.0.0",
"font-awesome": "4.4.0",
Expand Down Expand Up @@ -302,7 +302,7 @@
"@types/minimatch": "^2.0.29",
"@types/moment-timezone": "^0.5.8",
"@types/mustache": "^0.8.31",
"@types/node": "^8.10.38",
"@types/node": "^10.12.12",
"@types/opn": "^5.1.0",
"@types/podium": "^1.0.0",
"@types/prop-types": "^15.5.3",
Expand All @@ -325,8 +325,8 @@
"angular-mocks": "1.4.7",
"archiver": "^3.0.0",
"babel-eslint": "^9.0.0",
"babel-jest": "^23.4.2",
"backport": "4.2.0",
"babel-jest": "^23.6.0",
"backport": "4.4.1",
"chai": "3.5.0",
"chance": "1.0.10",
"cheerio": "0.22.0",
Expand All @@ -342,7 +342,7 @@
"eslint-config-prettier": "^3.1.0",
"eslint-plugin-babel": "^5.2.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^21.22.1",
"eslint-plugin-jest": "^21.26.2",
"eslint-plugin-jsx-a11y": "^6.1.2",
"eslint-plugin-mocha": "^5.2.0",
"eslint-plugin-no-unsanitized": "^3.0.2",
Expand All @@ -362,13 +362,13 @@
"grunt-peg": "^2.0.1",
"grunt-run": "0.7.0",
"gulp-babel": "^7.0.1",
"gulp-sourcemaps": "1.7.3",
"gulp-sourcemaps": "2.6.4",
"has-ansi": "^3.0.0",
"image-diff": "1.6.0",
"intl-messageformat-parser": "^1.4.0",
"istanbul-instrumenter-loader": "3.0.1",
"jest": "^23.5.0",
"jest-cli": "^23.5.0",
"jest": "^23.6.0",
"jest-cli": "^23.6.0",
"jest-raw-loader": "^1.0.1",
"jimp": "0.2.28",
"json5": "^1.0.1",
Expand All @@ -386,7 +386,6 @@
"load-grunt-config": "0.19.2",
"makelogs": "^4.3.0",
"mocha": "3.3.0",
"mock-fs": "^4.4.2",
"murmurhash3js": "3.0.1",
"mutation-observer": "^1.0.3",
"nock": "8.0.0",
Expand Down Expand Up @@ -417,7 +416,7 @@
"zlib": "^1.0.5"
},
"engines": {
"node": "8.14.0",
"node": "10.14.1",
"yarn": "^1.10.1"
}
}
4 changes: 2 additions & 2 deletions packages/kbn-babel-code-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"url": "https://github.com/elastic/kibana/tree/master/packages/kbn-babel-code-parser"
},
"scripts": {
"build": "babel src --out-dir target --quiet",
"kbn:bootstrap": "yarn build",
"build": "babel src --out-dir target",
"kbn:bootstrap": "yarn build --quiet",
"kbn:watch": "yarn build --watch"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-config-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"typescript": "^3.0.3"
},
"peerDependencies": {
"joi": "10.4.1",
"joi": "^13.5.2",
"moment": "^2.20.1",
"type-detect": "^4.0.8"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"chalk": "^2.4.1",
"execa": "^0.10.0",
"execa": "^1.0.0",
"moment": "^2.20.1",
"rxjs": "^6.2.1",
"tree-kill": "^1.2.0",
Expand Down
8 changes: 3 additions & 5 deletions packages/kbn-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
"chalk": "^2.4.1",
"dedent": "^0.7.0",
"del": "^3.0.0",
"execa": "^0.10.0",
"execa": "^1.0.0",
"getopts": "^2.0.6",
"glob": "^7.1.2",
"mkdirp": "^0.5.1",
"mock-fs": "^4.5.0",
"node-fetch": "^2.0.0",
"simple-git": "^1.91.0",
"tar-fs": "^1.16.0",
"tar-fs": "^1.16.3",
"tree-kill": "^1.1.0",
"yauzl": "^2.10.0",
"zlib": "^1.0.5"
"yauzl": "^2.10.0"
}
}
36 changes: 23 additions & 13 deletions packages/kbn-es/src/utils/decompress.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,40 @@
*/

const { decompress } = require('./decompress');
const mockFs = require('mock-fs');
const fs = require('fs');
const path = require('path');
const mkdirp = require('mkdirp');
const del = require('del');
const os = require('os');

const fixturesFolder = path.resolve(__dirname, '__fixtures__');
const randomDir = Math.random().toString(36);
const tmpFolder = path.resolve(os.tmpdir(), randomDir);
const dataFolder = path.resolve(tmpFolder, 'data');
const esFolder = path.resolve(tmpFolder, '.es');

const zipSnapshot = path.resolve(dataFolder, 'snapshot.zip');
const tarGzSnapshot = path.resolve(dataFolder, 'snapshot.tar.gz');

beforeEach(() => {
mockFs({
'/data': {
'snapshot.zip': fs.readFileSync(path.resolve(__dirname, '__fixtures__/snapshot.zip')),
'snapshot.tar.gz': fs.readFileSync(path.resolve(__dirname, '__fixtures__/snapshot.tar.gz')),
},
'/.es': {},
});
mkdirp.sync(tmpFolder);
mkdirp.sync(dataFolder);
mkdirp.sync(esFolder);

fs.copyFileSync(path.resolve(fixturesFolder, 'snapshot.zip'), zipSnapshot);
fs.copyFileSync(path.resolve(fixturesFolder, 'snapshot.tar.gz'), tarGzSnapshot);
});

afterEach(() => {
mockFs.restore();
del.sync(tmpFolder, { force: true });
});

test('zip strips root directory', async () => {
await decompress('/data/snapshot.zip', '/.es/foo');
expect(fs.readdirSync('/.es/foo/bin')).toContain('elasticsearch.bat');
await decompress(zipSnapshot, path.resolve(esFolder, 'foo'));
expect(fs.readdirSync(path.resolve(esFolder, 'foo/bin'))).toContain('elasticsearch.bat');
});

test('tar strips root directory', async () => {
await decompress('/data/snapshot.tar.gz', '/.es/foo');
expect(fs.readdirSync('/.es/foo/bin')).toContain('elasticsearch');
await decompress(tarGzSnapshot, path.resolve(esFolder, 'foo'));
expect(fs.readdirSync(path.resolve(esFolder, 'foo/bin'))).toContain('elasticsearch');
});
24 changes: 12 additions & 12 deletions packages/kbn-es/src/utils/extract_config_files.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
* under the License.
*/

jest.mock('fs', () => ({
readFileSync: jest.fn(),
existsSync: jest.fn().mockImplementation(() => true),
writeFileSync: jest.fn(),
}));

const { extractConfigFiles } = require('./extract_config_files');
const mockFs = require('mock-fs');
const fs = require('fs');

beforeEach(() => {
mockFs({
'/data': {
'foo.yml': '',
},
'/es': {},
});
afterEach(() => {
jest.clearAllMocks();
});

afterEach(() => {
mockFs.restore();
afterAll(() => {
jest.restoreAllMocks();
});

test('returns config with local paths', () => {
Expand All @@ -43,8 +43,8 @@ test('returns config with local paths', () => {
test('copies file', () => {
extractConfigFiles(['path=/data/foo.yml'], '/es');

expect(fs.existsSync('/es/config/foo.yml')).toBe(true);
expect(fs.existsSync('/data/foo.yml')).toBe(true);
expect(fs.readFileSync.mock.calls[0][0]).toEqual('/data/foo.yml');
expect(fs.writeFileSync.mock.calls[0][0]).toEqual('/es/config/foo.yml');
});

test('ignores non-paths', () => {
Expand Down
47 changes: 26 additions & 21 deletions packages/kbn-es/src/utils/find_most_recently_changed.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,38 @@
* under the License.
*/

const mockFs = require('mock-fs');
const { findMostRecentlyChanged } = require('./find_most_recently_changed');

beforeEach(() => {
mockFs({
'/data': {
'oldest.yml': mockFs.file({
content: 'foo',
jest.mock('fs', () => ({
statSync: jest.fn().mockImplementation(path => {
if (path.includes('oldest')) {
return {
ctime: new Date(2018, 2, 1),
}),
'newest.yml': mockFs.file({
content: 'bar',
};
}

if (path.includes('newest')) {
return {
ctime: new Date(2018, 2, 3),
}),
'middle.yml': mockFs.file({
content: 'baz',
};
}

if (path.includes('middle')) {
return {
ctime: new Date(2018, 2, 2),
}),
},
});
});
};
}
}),
readdirSync: jest.fn().mockImplementation(() => {
return ['oldest.yml', 'newest.yml', 'middle.yml'];
}),
}));

afterEach(() => {
mockFs.restore();
});
const { findMostRecentlyChanged } = require('./find_most_recently_changed');

test('returns newest file', () => {
const file = findMostRecentlyChanged('/data/*.yml');
expect(file).toEqual('/data/newest.yml');
});

afterAll(() => {
jest.restoreAllMocks();
});
2 changes: 1 addition & 1 deletion packages/kbn-i18n/src/__snapshots__/loader.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

exports[`I18n loader registerTranslationFile should throw error if path to translation file is not an absolute 1`] = `"Paths to translation files must be absolute. Got relative path: \\"./en.json\\""`;

exports[`I18n loader registerTranslationFile should throw error if path to translation file is not specified 1`] = `"Path must be a string. Received undefined"`;
exports[`I18n loader registerTranslationFile should throw error if path to translation file is not specified 1`] = `"The \\"path\\" argument must be of type string. Received type undefined"`;
2 changes: 1 addition & 1 deletion packages/kbn-plugin-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"chalk": "^2.4.1",
"dedent": "^0.7.0",
"execa": "^0.9.0",
"execa": "^1.0.0",
"getopts": "^2.0.0",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"commander": "^2.9.0",
"del": "^2.2.2",
"execa": "^0.10.0",
"execa": "^1.0.0",
"gulp-rename": "1.2.2",
"gulp-zip": "^4.1.0",
"inquirer": "^1.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

const { resolve } = require('path');
const { readdirSync, existsSync, unlink } = require('fs');
const { readdirSync, existsSync, unlinkSync } = require('fs');
const del = require('del');
const createBuild = require('../create_build');

Expand Down Expand Up @@ -96,7 +96,7 @@ describe('creating the build', () => {
afterEach(() => {
PLUGIN.skipInstallDependencies = false;
PLUGIN.styleSheetToCompile = undefined;
unlink(cssPath);
unlinkSync(cssPath);
});

it('produces CSS', async () => {
Expand Down
Loading

0 comments on commit 1d3fcaa

Please sign in to comment.