@brianbuie/node-kit 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Cache.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { temp } from './Dir.js';
2
- const cacheDir = temp.subDir('cache');
2
+ const cacheDir = temp.dir('cache');
3
3
  export class Cache {
4
4
  file;
5
5
  ttl;
package/dist/Dir.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare class Dir {
19
19
  * const child = folder.subDir('path/to/dir');
20
20
  * // child.path = './example/path/to/dir'
21
21
  */
22
- subDir(subPath: string): Dir;
22
+ dir(subPath: string): Dir;
23
23
  sanitize(name: string): string;
24
24
  /**
25
25
  * @param base - The file name with extension
@@ -35,7 +35,7 @@ export declare class Dir {
35
35
  * Extends Dir class with method to `clear()` contents
36
36
  */
37
37
  export declare class TempDir extends Dir {
38
- subDir(subPath: string): TempDir;
38
+ dir(subPath: string): TempDir;
39
39
  clear(): void;
40
40
  }
41
41
  /**
package/dist/Dir.js CHANGED
@@ -26,7 +26,7 @@ export class Dir {
26
26
  * const child = folder.subDir('path/to/dir');
27
27
  * // child.path = './example/path/to/dir'
28
28
  */
29
- subDir(subPath) {
29
+ dir(subPath) {
30
30
  return new Dir(path.resolve(this.path, subPath));
31
31
  }
32
32
  sanitize(name) {
@@ -50,7 +50,7 @@ export class Dir {
50
50
  * Extends Dir class with method to `clear()` contents
51
51
  */
52
52
  export class TempDir extends Dir {
53
- subDir(subPath) {
53
+ dir(subPath) {
54
54
  return new TempDir(path.resolve(this.path, subPath));
55
55
  }
56
56
  clear() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brianbuie/node-kit",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "license": "ISC",
5
5
  "repository": {
6
6
  "type": "git",
package/src/Cache.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { temp } from './Dir.js';
2
2
 
3
- const cacheDir = temp.subDir('cache');
3
+ const cacheDir = temp.dir('cache');
4
4
 
5
5
  export class Cache<T> {
6
6
  file;
package/src/Dir.test.ts CHANGED
@@ -3,7 +3,7 @@ import assert from 'node:assert';
3
3
  import { Dir, TempDir, temp } from './Dir.js';
4
4
 
5
5
  describe('Dir', () => {
6
- const testDir = temp.subDir('dir-test');
6
+ const testDir = temp.dir('dir-test');
7
7
 
8
8
  it('Sanitizes filenames', () => {
9
9
  const name = testDir.sanitize(':/something/else.json');
@@ -13,13 +13,13 @@ describe('Dir', () => {
13
13
 
14
14
  it('Creates sub directories', () => {
15
15
  const subPath = 'sub/dir';
16
- const sub = testDir.subDir(subPath);
16
+ const sub = testDir.dir(subPath);
17
17
  assert(sub.path.includes(testDir.path));
18
18
  assert(sub.path.includes(subPath));
19
19
  });
20
20
 
21
- it('TempDir.subDir returns instance of TempDir', () => {
22
- const sub = temp.subDir('example');
21
+ it('TempDir.dir returns instance of TempDir', () => {
22
+ const sub = temp.dir('example');
23
23
  assert(sub instanceof TempDir);
24
24
  });
25
25
 
package/src/Dir.ts CHANGED
@@ -2,7 +2,6 @@ import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
3
  import sanitizeFilename from 'sanitize-filename';
4
4
  import { File } from './File.js';
5
- import { snapshot } from './snapshot.js';
6
5
 
7
6
  /**
8
7
  * Reference to a specific directory with helpful methods for resolving filepaths,
@@ -31,7 +30,7 @@ export class Dir {
31
30
  * const child = folder.subDir('path/to/dir');
32
31
  * // child.path = './example/path/to/dir'
33
32
  */
34
- subDir(subPath: string) {
33
+ dir(subPath: string) {
35
34
  return new Dir(path.resolve(this.path, subPath));
36
35
  }
37
36
 
@@ -59,7 +58,7 @@ export class Dir {
59
58
  * Extends Dir class with method to `clear()` contents
60
59
  */
61
60
  export class TempDir extends Dir {
62
- subDir(subPath: string) {
61
+ dir(subPath: string) {
63
62
  return new TempDir(path.resolve(this.path, subPath));
64
63
  }
65
64
 
package/src/File.test.ts CHANGED
@@ -3,7 +3,7 @@ import assert from 'node:assert';
3
3
  import { temp } from './Dir.js';
4
4
  import { File } from './File.js';
5
5
 
6
- const testDir = temp.subDir('file-test');
6
+ const testDir = temp.dir('file-test');
7
7
  testDir.clear();
8
8
 
9
9
  const thing = {