Skip to content
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

Remove rimraf #48985

Merged
merged 15 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"custom-event-polyfill": "^0.3.0",
"d3": "3.5.17",
"d3-cloud": "1.2.5",
"del": "^4.1.1",
"del": "^5.1.0",
"elasticsearch": "^16.4.0",
"elasticsearch-browser": "^16.4.0",
"encode-uri-query": "1.0.1",
Expand Down Expand Up @@ -232,7 +232,6 @@
"request": "^2.88.0",
"reselect": "^3.0.1",
"resize-observer-polyfill": "^1.5.0",
"rimraf": "2.7.1",
"rison-node": "1.0.2",
"rxjs": "^6.2.1",
"script-loader": "0.7.2",
Expand Down Expand Up @@ -341,7 +340,6 @@
"@types/redux": "^3.6.31",
"@types/redux-actions": "^2.2.1",
"@types/request": "^2.48.2",
"@types/rimraf": "^2.0.2",
"@types/selenium-webdriver": "^4.0.3",
"@types/semver": "^5.5.0",
"@types/sinon": "^7.0.13",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@kbn/babel-preset": "1.0.0",
"@kbn/dev-utils": "1.0.0",
"@kbn/expect": "1.0.0",
"del": "^4.1.1",
"del": "^5.1.0",
"getopts": "^2.2.4",
"supports-color": "^7.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"abort-controller": "^2.0.3",
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"del": "^4.1.1",
"del": "^5.1.0",
"execa": "^1.0.0",
"getopts": "^2.2.4",
"glob": "^7.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@kbn/dev-utils": "1.0.0",
"@types/intl-relativeformat": "^2.1.0",
"@types/react-intl": "^2.3.15",
"del": "^4.1.1",
"del": "^5.1.0",
"getopts": "^2.2.4",
"supports-color": "^7.0.0",
"typescript": "3.5.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-interpreter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"babel-loader": "^8.0.6",
"copy-webpack-plugin": "^5.0.4",
"css-loader": "2.1.1",
"del": "^4.1.1",
"del": "^5.1.0",
"getopts": "^2.2.4",
"pegjs": "0.10.0",
"sass-loader": "^7.3.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 @@ -16,7 +16,7 @@
"@babel/core": "^7.5.5",
"argv-split": "^2.0.1",
"commander": "^3.0.0",
"del": "^4.1.1",
"del": "^5.1.0",
"execa": "^1.0.0",
"globby": "^8.0.1",
"gulp-babel": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"cmd-shim": "^2.1.0",
"cpy": "^7.3.0",
"dedent": "^0.7.0",
"del": "^4.1.1",
"del": "^5.1.0",
"execa": "^1.0.0",
"getopts": "^2.2.4",
"glob": "^7.1.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-pm/src/utils/projects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { mkdir, symlink } from 'fs';
import { join, resolve } from 'path';
import rmdir from 'rimraf';
import del from 'del';
import { promisify } from 'util';

import { getProjectPaths } from '../config';
Expand All @@ -33,20 +33,20 @@ import {
topologicallyBatchProjects,
} from './projects';

const rootPath = resolve(`${__dirname}/__fixtures__/kibana`);
const rootPath = resolve(__dirname, '__fixtures__/kibana');
const rootPlugins = join(rootPath, 'plugins');

describe('#getProjects', () => {
beforeAll(async () => {
await promisify(mkdir)(rootPlugins);

return promisify(symlink)(
await promisify(symlink)(
join(__dirname, '__fixtures__/symlinked-plugins/corge'),
join(rootPlugins, 'corge')
);
});

afterAll(() => promisify(rmdir)(rootPlugins));
afterAll(async () => await del(rootPlugins));

test('find all packages in the packages directory', async () => {
const projects = await getProjects(rootPath, ['packages/*']);
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"chalk": "^2.4.2",
"dedent": "^0.7.0",
"del": "^4.1.1",
"del": "^5.1.0",
"getopts": "^2.2.4",
"glob": "^7.1.2",
"parse-link-header": "^1.0.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/kbn-utility-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
"kbn:bootstrap": "tsc",
"kbn:watch": "tsc --watch",
"test": "tsd",
"clean": "rimraf target"
"clean": "del target"
},
"dependencies": {
"utility-types": "^3.7.0"
},
"devDependencies": {
"del-cli": "^3.0.0",
"tsd": "^0.7.4"
}
}
8 changes: 0 additions & 8 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,6 @@
'@types/request',
],
},
{
groupSlug: 'rimraf',
groupName: 'rimraf related packages',
packageNames: [
'rimraf',
'@types/rimraf',
],
},
{
groupSlug: 'selenium-webdriver',
groupName: 'selenium-webdriver related packages',
Expand Down
4 changes: 2 additions & 2 deletions src/cli/serve/integration_tests/reload_logging_config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { spawn } from 'child_process';
import fs from 'fs';
import path from 'path';
import os from 'os';
import rimraf from 'rimraf';
import del from 'del';

import { safeDump } from 'js-yaml';
import { createMapStream, createSplitStream, createPromiseFromStreams } from '../../../legacy/utils/streams';
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('Server logging configuration', function () {
child = undefined;
}

rimraf.sync(tempDir);
del.sync(tempDir);
});

const isWindows = /^win/.test(process.platform);
Expand Down
8 changes: 4 additions & 4 deletions src/cli_plugin/install/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import rimraf from 'rimraf';
import del from 'del';
import fs from 'fs';

export function cleanPrevious(settings, logger) {
Expand All @@ -27,7 +27,7 @@ export function cleanPrevious(settings, logger) {

logger.log('Found previous install attempt. Deleting...');
try {
rimraf.sync(settings.workingPath);
del.sync(settings.workingPath);
} catch (e) {
reject(e);
}
Expand All @@ -44,8 +44,8 @@ export function cleanArtifacts(settings) {
// delete the working directory.
// At this point we're bailing, so swallow any errors on delete.
try {
rimraf.sync(settings.workingPath);
rimraf.sync(settings.plugins[0].path);
del.sync(settings.workingPath);
del.sync(settings.plugins[0].path);
}
catch (e) {} // eslint-disable-line no-empty
}
26 changes: 13 additions & 13 deletions src/cli_plugin/install/cleanup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import sinon from 'sinon';
import fs from 'fs';
import rimraf from 'rimraf';
import del from 'del';

import { cleanPrevious, cleanArtifacts } from './cleanup';
import Logger from '../lib/logger';
Expand Down Expand Up @@ -48,11 +48,11 @@ describe('kibana cli', function () {
logger.log.restore();
logger.error.restore();
fs.statSync.restore();
rimraf.sync.restore();
del.sync.restore();
});

it('should resolve if the working path does not exist', function () {
sinon.stub(rimraf, 'sync');
sinon.stub(del, 'sync');
sinon.stub(fs, 'statSync').callsFake(() => {
const error = new Error('ENOENT');
error.code = 'ENOENT';
Expand All @@ -67,7 +67,7 @@ describe('kibana cli', function () {
});

it('should rethrow any exception except ENOENT from fs.statSync', function () {
sinon.stub(rimraf, 'sync');
sinon.stub(del, 'sync');
sinon.stub(fs, 'statSync').throws(new Error('An Unhandled Error'));

errorStub = sinon.stub();
Expand All @@ -79,7 +79,7 @@ describe('kibana cli', function () {
});

it('should log a message if there was a working directory', function () {
sinon.stub(rimraf, 'sync');
sinon.stub(del, 'sync');
sinon.stub(fs, 'statSync');

return cleanPrevious(settings, logger)
Expand All @@ -89,9 +89,9 @@ describe('kibana cli', function () {
});
});

it('should rethrow any exception from rimraf.sync', function () {
it('should rethrow any exception from del.sync', function () {
sinon.stub(fs, 'statSync');
sinon.stub(rimraf, 'sync').throws(new Error('I am an error thrown by rimraf'));
sinon.stub(del, 'sync').throws(new Error('I am an error thrown by del'));

errorStub = sinon.stub();
return cleanPrevious(settings, logger)
Expand All @@ -102,7 +102,7 @@ describe('kibana cli', function () {
});

it('should resolve if the working path is deleted', function () {
sinon.stub(rimraf, 'sync');
sinon.stub(del, 'sync');
sinon.stub(fs, 'statSync');

return cleanPrevious(settings, logger)
Expand All @@ -117,18 +117,18 @@ describe('kibana cli', function () {
beforeEach(function () {});

afterEach(function () {
rimraf.sync.restore();
del.sync.restore();
});

it('should attempt to delete the working directory', function () {
sinon.stub(rimraf, 'sync');
sinon.stub(del, 'sync');

cleanArtifacts(settings);
expect(rimraf.sync.calledWith(settings.workingPath)).toBe(true);
expect(del.sync.calledWith(settings.workingPath)).toBe(true);
});

it('should swallow any errors thrown by rimraf.sync', function () {
sinon.stub(rimraf, 'sync').throws(new Error('Something bad happened.'));
it('should swallow any errors thrown by del.sync', function () {
sinon.stub(del, 'sync').throws(new Error('Something bad happened.'));

expect(() => cleanArtifacts(settings)).not.toThrow();
});
Expand Down
6 changes: 3 additions & 3 deletions src/cli_plugin/install/download.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import sinon from 'sinon';
import nock from 'nock';
import glob from 'glob-all';
import rimraf from 'rimraf';
import del from 'del';
import Fs from 'fs';
import Logger from '../lib/logger';
import { UnsupportedProtocolError } from '../lib/errors';
Expand Down Expand Up @@ -63,14 +63,14 @@ describe('kibana cli', function () {
beforeEach(function () {
sinon.stub(logger, 'log');
sinon.stub(logger, 'error');
rimraf.sync(testWorkingPath);
del.sync(testWorkingPath);
Fs.mkdirSync(testWorkingPath, { recursive: true });
});

afterEach(function () {
logger.log.restore();
logger.error.restore();
rimraf.sync(testWorkingPath);
del.sync(testWorkingPath);
});

describe('_downloadSingle', function () {
Expand Down
4 changes: 2 additions & 2 deletions src/cli_plugin/install/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import path from 'path';
import { cleanPrevious, cleanArtifacts } from './cleanup';
import { extract, getPackData } from './pack';
import { renamePlugin } from './rename';
import { sync as rimrafSync } from 'rimraf';
import del from 'del';
import { errorIfXPackInstall } from '../lib/error_if_x_pack';
import { existingInstall, assertVersion } from './kibana';
import { prepareExternalProjectDependencies } from '@kbn/pm';
Expand All @@ -46,7 +46,7 @@ export default async function install(settings, logger) {

await extract(settings, logger);

rimrafSync(settings.tempArchiveFile);
del.sync(settings.tempArchiveFile);

existingInstall(settings, logger);

Expand Down
6 changes: 3 additions & 3 deletions src/cli_plugin/install/kibana.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jest.mock('fs', () => ({
import sinon from 'sinon';
import Logger from '../lib/logger';
import { join } from 'path';
import rimraf from 'rimraf';
import del from 'del';
import fs from 'fs';
import { existingInstall, assertVersion } from './kibana';

Expand All @@ -53,7 +53,7 @@ describe('kibana cli', function () {
describe('assertVersion', function () {

beforeEach(function () {
rimraf.sync(testWorkingPath);
del.sync(testWorkingPath);
fs.mkdirSync(testWorkingPath, { recursive: true });
sinon.stub(logger, 'log');
sinon.stub(logger, 'error');
Expand All @@ -62,7 +62,7 @@ describe('kibana cli', function () {
afterEach(function () {
logger.log.restore();
logger.error.restore();
rimraf.sync(testWorkingPath);
del.sync(testWorkingPath);
});

it('should succeed with exact match', function () {
Expand Down
6 changes: 3 additions & 3 deletions src/cli_plugin/install/pack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Fs from 'fs';

import sinon from 'sinon';
import glob from 'glob-all';
import rimraf from 'rimraf';
import del from 'del';
import Logger from '../lib/logger';
import { extract, getPackData } from './pack';
import { _downloadSingle } from './download';
Expand All @@ -41,7 +41,7 @@ describe('kibana cli', function () {

beforeEach(function () {
//These tests are dependent on the file system, and I had some inconsistent
//behavior with rimraf.sync show up. Until these tests are re-written to not
//behavior with del.sync show up. Until these tests are re-written to not
//depend on the file system, I make sure that each test uses a different
//working directory.
testNum += 1;
Expand All @@ -65,7 +65,7 @@ describe('kibana cli', function () {
afterEach(function () {
logger.log.restore();
logger.error.restore();
rimraf.sync(workingPathRoot);
del.sync(workingPathRoot);
});

function copyReplyFile(filename) {
Expand Down
4 changes: 2 additions & 2 deletions src/cli_plugin/install/zip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import rimraf from 'rimraf';
import del from 'del';
import path from 'path';
import os from 'os';
import glob from 'glob';
Expand All @@ -38,7 +38,7 @@ describe('kibana cli', function () {
});

afterEach(() => {
rimraf.sync(tempPath);
del.sync(tempPath);
});

describe('analyzeArchive', function () {
Expand Down
Loading