@sewing-kit/core
Advanced tools
Comparing version 0.1.5 to 0.2.0
@@ -31,2 +31,7 @@ "use strict"; | ||
async remove(file) { | ||
const resolved = this.resolvePath(file); | ||
await (0, _fsExtra.remove)(resolved); | ||
} | ||
async copy(from, to, options) { | ||
@@ -33,0 +38,0 @@ const resolvedFrom = this.resolvePath(from); |
@@ -8,2 +8,3 @@ import { CopyOptions } from 'fs-extra'; | ||
write(file: string, contents: string): Promise<void>; | ||
remove(file: string): Promise<void>; | ||
copy(from: string, to: string, options?: CopyOptions): Promise<void>; | ||
@@ -10,0 +11,0 @@ hasFile(file: string): Promise<boolean>; |
@@ -22,2 +22,6 @@ "use strict"; | ||
} | ||
async remove(file) { | ||
const resolved = this.resolvePath(file); | ||
await fs_extra_1.remove(resolved); | ||
} | ||
async copy(from, to, options) { | ||
@@ -24,0 +28,0 @@ const resolvedFrom = this.resolvePath(from); |
{ | ||
"name": "@sewing-kit/core", | ||
"license": "MIT", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"sideEffects": false, | ||
@@ -19,3 +19,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "cfd9415223b3ab3e561c52da2a9b31ec70fc7284" | ||
"gitHead": "21aa22517dc984dd2562a15cfb6547125c90ead2" | ||
} |
@@ -9,2 +9,3 @@ import {resolve, dirname} from 'path'; | ||
CopyOptions, | ||
remove, | ||
} from 'fs-extra'; | ||
@@ -26,2 +27,7 @@ import glob, {IOptions as GlobOptions} from 'glob'; | ||
async remove(file: string) { | ||
const resolved = this.resolvePath(file); | ||
await remove(resolved); | ||
} | ||
async copy(from: string, to: string, options?: CopyOptions) { | ||
@@ -28,0 +34,0 @@ const resolvedFrom = this.resolvePath(from); |
@@ -12,2 +12,3 @@ import {join} from 'path'; | ||
copy: mockCopy, | ||
remove: mockRemove, | ||
} = jest.requireMock('fs-extra'); | ||
@@ -27,2 +28,3 @@ const {sync: mockGlob} = jest.requireMock('glob'); | ||
mockGlob.mockReset(); | ||
mockRemove.mockReset(); | ||
}); | ||
@@ -102,2 +104,18 @@ | ||
describe('remove', () => { | ||
it('removes a file', async () => { | ||
const fromFile = 'file.json'; | ||
await fileSystem.remove(fromFile); | ||
expect(mockRemove).toHaveBeenCalledWith(join(root, fromFile)); | ||
}); | ||
it('removes directory', async () => { | ||
const fromDir = 'folder'; | ||
await fileSystem.remove(fromDir); | ||
expect(mockRemove).toHaveBeenCalledWith(join(root, fromDir)); | ||
}); | ||
}); | ||
describe('hasFile', () => { | ||
@@ -104,0 +122,0 @@ it('detects file', async () => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
441758
77
2429