@youcan/cli-kit 1.2.0-beta.8 → 2.0.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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import type { Mode, OpenMode, PathLike } from 'fs';
3
+ import type { Mode, OpenMode, PathLike, Stats } from 'fs';
4
4
  import type { Options as GlobOptions, Pattern } from 'fast-glob';
5
5
  import chokidar from 'chokidar';
6
6
  export declare function exists(path: string): Promise<boolean>;
@@ -21,8 +21,9 @@ export declare function writeFile(path: PathLike, data: string, options?: {
21
21
  export declare function readJsonFile<T = Record<string, unknown>>(path: PathLike): Promise<T>;
22
22
  export declare function writeJsonFile(path: PathLike, data: Record<string, unknown>): Promise<void>;
23
23
  export declare function glob(pattern: Pattern | Pattern[], options?: GlobOptions): Promise<string[]>;
24
- export declare function archived(path: string, name: string): Promise<string>;
24
+ export declare function archived(path: string, name: string, glob?: string): Promise<string>;
25
25
  export declare function unlink(path: string): Promise<void>;
26
26
  export declare function readdir(path: string): Promise<string[]>;
27
+ export declare function stat(path: string): Promise<Stats>;
27
28
  export declare const watch: typeof chokidar.watch;
28
29
  export {};
@@ -59,7 +59,7 @@ async function glob(pattern, options) {
59
59
  }
60
60
  return _glob(pattern, _options);
61
61
  }
62
- async function archived(path$1, name) {
62
+ async function archived(path$1, name, glob = '**/*') {
63
63
  return new Promise((resolve$1, reject) => {
64
64
  try {
65
65
  const archivePath = resolve(path$1, `${name}.zip`);
@@ -68,7 +68,10 @@ async function archived(path$1, name) {
68
68
  output.on('close', () => resolve$1(archivePath));
69
69
  _archiver.on('error', () => (err) => reject(err));
70
70
  _archiver.pipe(output);
71
- _archiver.directory(resolve(path$1, name), false);
71
+ _archiver.glob(glob, {
72
+ ignore: [`${name}.zip`],
73
+ cwd: path$1,
74
+ });
72
75
  _archiver.finalize();
73
76
  }
74
77
  catch (err) {
@@ -84,6 +87,9 @@ async function unlink(path) {
84
87
  async function readdir(path) {
85
88
  return await FilesystemPromises.readdir(path);
86
89
  }
90
+ async function stat(path) {
91
+ return await FilesystemPromises.stat(path);
92
+ }
87
93
  const watch = chokidar.watch;
88
94
 
89
- export { archived, exists, glob, mkdir, move, readFile, readJsonFile, readdir, tapIntoTmp, unlink, watch, writeFile, writeJsonFile };
95
+ export { archived, exists, glob, mkdir, move, readFile, readJsonFile, readdir, stat, tapIntoTmp, unlink, watch, writeFile, writeJsonFile };
@@ -22,7 +22,7 @@ class Logger extends Writable {
22
22
  for (let i = 0; i < lines.length; i++) {
23
23
  i === 0
24
24
  ? channel.write(this.color(`${time} | ${this.pad(this.type, 10)} | ${lines[i]}\n`))
25
- : channel.write(this.color(` | ${lines[i]}\n`));
25
+ : channel.write(this.color(` | ${lines[i]}\n`));
26
26
  }
27
27
  return true;
28
28
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/cli-kit",
3
3
  "type": "module",
4
- "version": "1.2.0-beta.8",
4
+ "version": "2.0.0",
5
5
  "description": "Utilities for the YouCan CLI",
6
6
  "author": "YouCan <contact@youcan.shop> (https://youcan.shop)",
7
7
  "license": "MIT",