Skip to content

Commit e27b07a

Browse files
committed
refactor(*): Some refactoring
1 parent 18886b0 commit e27b07a

File tree

3 files changed

+12
-43
lines changed

3 files changed

+12
-43
lines changed

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,19 @@
6464
}
6565
},
6666
"devDependencies": {
67-
"@types/fs-extra": "4.0.0",
67+
"@types/fs-extra": "5.0.1",
6868
"@types/lodash.escaperegexp": "^4.1.3",
69-
"@types/mocha": "^2.2.41",
70-
"@types/node": "^8.0.20",
71-
"mocha": "^3.5.0",
72-
"tslint": "^5.6.0",
69+
"@types/mocha": "^5.0.0",
70+
"@types/node": "^9.6.2",
71+
"mocha": "^5.0.5",
72+
"tslint": "^5.9.1",
7373
"tslint-config-mrmlnc": "^1.0.0",
74-
"tslint-config-xo": "^1.3.0",
7574
"typescript": "^2.8.1",
76-
"vscode": "^1.1.4"
75+
"vscode": "^1.1.14"
7776
},
7877
"dependencies": {
79-
"fs-extra": "^4.0.1",
80-
"lodash.escaperegexp": "^4.1.2",
81-
"tslib": "^1.7.1"
78+
"fs-extra": "^5.0.0",
79+
"lodash.escaperegexp": "^4.1.2"
8280
},
8381
"scripts": {
8482
"postinstall": "node ./node_modules/vscode/bin/install",

src/extension.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import * as fs from 'fs-extra';
12
import * as path from 'path';
23

34
import escapeRegExp = require('lodash.escaperegexp');
45
import * as vscode from 'vscode';
56

67
import * as filepaths from './managers/filepaths';
7-
import * as fsUtils from './utils/fs';
88
import * as promptUtils from './utils/prompt';
99

1010
import { IPluginSettings } from './types';
@@ -24,7 +24,7 @@ async function openFile(filepath: string): Promise<vscode.TextEditor> {
2424
async function duplicator(uri: vscode.Uri, settings: IPluginSettings): Promise<vscode.TextEditor | undefined> {
2525
const oldPath = uri.fsPath;
2626
const oldPathParsed = path.parse(oldPath);
27-
const oldPathStats = await fsUtils.pathStat(oldPath);
27+
const oldPathStats = await fs.stat(oldPath);
2828

2929
// Get a new name for the resource
3030
const newName = await promptUtils.name(oldPathParsed.name);
@@ -43,7 +43,7 @@ async function duplicator(uri: vscode.Uri, settings: IPluginSettings): Promise<v
4343
}
4444

4545
// Check if the current path exists
46-
const newPathExists = await fsUtils.pathExists(newPath);
46+
const newPathExists = await fs.pathExists(newPath);
4747
if (newPathExists) {
4848
const userAnswer = await promptUtils.overwrite(newPath);
4949
if (!userAnswer) {
@@ -52,7 +52,7 @@ async function duplicator(uri: vscode.Uri, settings: IPluginSettings): Promise<v
5252
}
5353

5454
try {
55-
await fsUtils.copy(uri.fsPath, newPath);
55+
await fs.copy(uri.fsPath, newPath);
5656

5757
if (settings.openFileAfterCopy && oldPathStats.isFile()) {
5858
return openFile(newPath);

src/utils/fs.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)