@sapphire/cli 1.2.1-next.3a0b7d4.0 → 1.2.1-next.42b9dca.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,7 +1,7 @@
1
1
  import { componentsFolder } from '#constants';
2
2
  import { CreateFileFromTemplate } from '#functions/CreateFileFromTemplate';
3
3
  import { fileExists } from '#functions/FileExists';
4
- import { Spinner } from '#functions/Spinner';
4
+ import { Spinner } from '@favware/colorette-spinner';
5
5
  import { fromAsync, isErr } from '@sapphire/result';
6
6
  import { blueBright, red } from 'colorette';
7
7
  import findUp from 'find-up';
@@ -2,8 +2,8 @@ import { repoUrl } from '#constants';
2
2
  import { CommandExists } from '#functions/CommandExists';
3
3
  import { CreateFileFromTemplate } from '#functions/CreateFileFromTemplate';
4
4
  import { fileExists } from '#functions/FileExists';
5
- import { Spinner } from '#functions/Spinner';
6
5
  import { PromptNew } from '#prompts/PromptNew';
6
+ import { Spinner } from '@favware/colorette-spinner';
7
7
  import { fromAsync, isErr, isOk } from '@sapphire/result';
8
8
  import { blueBright, red } from 'colorette';
9
9
  import { execa } from 'execa';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/cli",
3
- "version": "1.2.1-next.3a0b7d4.0",
3
+ "version": "1.2.1-next.42b9dca.0",
4
4
  "description": "CLI for Sapphire Framework",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -38,8 +38,9 @@
38
38
  "postpack": "pinst --enable"
39
39
  },
40
40
  "dependencies": {
41
+ "@favware/colorette-spinner": "^1.0.0",
41
42
  "@sapphire/result": "^1.1.1",
42
- "colorette": "^2.0.17",
43
+ "colorette": "^2.0.19",
43
44
  "commander": "^9.3.0",
44
45
  "execa": "^6.1.0",
45
46
  "find-up": "^5.0.0",
@@ -48,30 +49,30 @@
48
49
  "tslib": "^2.4.0"
49
50
  },
50
51
  "devDependencies": {
51
- "@commitlint/cli": "^17.0.2",
52
- "@commitlint/config-conventional": "^17.0.2",
53
- "@favware/cliff-jumper": "^1.8.2",
52
+ "@commitlint/cli": "^17.0.3",
53
+ "@commitlint/config-conventional": "^17.0.3",
54
+ "@favware/cliff-jumper": "^1.8.5",
54
55
  "@favware/npm-deprecate": "^1.0.4",
55
- "@sapphire/eslint-config": "^4.3.6",
56
+ "@sapphire/eslint-config": "^4.3.7",
56
57
  "@sapphire/prettier-config": "^1.4.3",
57
58
  "@sapphire/ts-config": "^3.3.4",
58
59
  "@types/js-yaml": "^4.0.5",
59
60
  "@types/node": "^17.0.33",
60
61
  "@types/prompts": "^2.0.14",
61
- "@typescript-eslint/eslint-plugin": "^5.27.0",
62
- "@typescript-eslint/parser": "^5.27.0",
62
+ "@typescript-eslint/eslint-plugin": "^5.30.3",
63
+ "@typescript-eslint/parser": "^5.30.3",
63
64
  "cz-conventional-changelog": "^3.3.0",
64
- "eslint": "^8.17.0",
65
+ "eslint": "^8.19.0",
65
66
  "eslint-config-prettier": "^8.5.0",
66
- "eslint-plugin-prettier": "^4.0.0",
67
- "globby": "^13.1.1",
67
+ "eslint-plugin-prettier": "^4.2.1",
68
+ "globby": "^13.1.2",
68
69
  "husky": "^8.0.1",
69
- "lint-staged": "^13.0.0",
70
+ "lint-staged": "^13.0.3",
70
71
  "pinst": "^3.0.0",
71
- "prettier": "^2.6.2",
72
+ "prettier": "^2.7.1",
72
73
  "pretty-quick": "^3.1.3",
73
- "ts-node": "^10.8.1",
74
- "typescript": "^4.7.3"
74
+ "ts-node": "^10.8.2",
75
+ "typescript": "^4.7.4"
75
76
  },
76
77
  "resolutions": {
77
78
  "ansi-regex": "^5.0.1",
@@ -1,122 +0,0 @@
1
- import * as colorette from 'colorette';
2
- import tty from 'node:tty';
3
- /**
4
- * A very minimal terminal spinner
5
- *
6
- * @license ISC
7
- * @copyright 2021 Usman Yunusov <usman.iunusov@gmail.com>
8
- * @see https://github.com/usmanyunusov/nanospinner/blob/master/index.js
9
- */
10
- export class Spinner {
11
- #isCI = process.env.CI ||
12
- process.env.WT_SESSION ||
13
- process.env.ConEmuTask === '{cmd::Cmder}' ||
14
- process.env.TERM_PROGRAM === 'vscode' ||
15
- process.env.TERM === 'xterm-256color' ||
16
- process.env.TERM === 'alacritty';
17
- #isTTY = tty.isatty(1) && process.env.TERM !== 'dumb' && !('CI' in process.env);
18
- #supportUnicode = process.platform === 'win32' ? this.#isCI : process.env.TERM !== 'linux';
19
- #symbols = {
20
- frames: this.#isTTY ? (this.#supportUnicode ? ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'] : ['-', '\\', '|', '/']) : ['-'],
21
- tick: this.#supportUnicode ? '✔' : '√',
22
- cross: this.#supportUnicode ? '✖' : '×'
23
- };
24
- #text = '';
25
- #current = 0;
26
- #interval = 50;
27
- #stream = process.stderr;
28
- #frames = this.#symbols.frames;
29
- #color = 'greenBright';
30
- #lines = 0;
31
- #timer;
32
- constructor(text, options) {
33
- this.#text = text ?? this.#text;
34
- this.#interval = options?.interval ?? this.#interval;
35
- this.#stream = options?.stream ?? this.#stream;
36
- if (options?.frames && options?.frames.length) {
37
- this.#frames = options.frames;
38
- }
39
- this.#color = options?.color ?? this.#color;
40
- }
41
- clear() {
42
- this.write('\x1b[1G');
43
- for (let i = 0; i < this.#lines; i++) {
44
- i > 0 && this.write('\x1b[1A');
45
- this.write('\x1b[2K\x1b[1G');
46
- }
47
- this.#lines = 0;
48
- return this;
49
- }
50
- error(options) {
51
- const mark = colorette.red(this.#symbols.cross);
52
- return this.stop({ mark, ...options });
53
- }
54
- reset() {
55
- this.#current = 0;
56
- this.#lines = 0;
57
- if (this.#timer) {
58
- clearTimeout(this.#timer);
59
- }
60
- return this;
61
- }
62
- spin() {
63
- this.render();
64
- this.#current = ++this.#current % this.#frames.length;
65
- return this;
66
- }
67
- start(opts = {}) {
68
- this.#timer && this.reset();
69
- return this.update({ text: opts.text, color: opts.color }).loop();
70
- }
71
- stop(opts = {}) {
72
- if (this.#timer) {
73
- clearTimeout(this.#timer);
74
- }
75
- const mark = colorette[opts.color || this.#color](this.#frames[this.#current]);
76
- const optsMark = opts.mark && opts.color ? colorette[opts.color](opts.mark) : opts.mark;
77
- this.write(`${optsMark || mark} ${opts.text || this.#text}\n`, true);
78
- return this.#isTTY ? this.write(`\x1b[?25h`) : this;
79
- }
80
- success(opts = {}) {
81
- const mark = colorette.green(this.#symbols.tick);
82
- return this.stop({ mark, ...opts });
83
- }
84
- update(opts = {}) {
85
- this.#text = opts.text || this.#text;
86
- this.#interval = opts?.interval ?? this.#interval;
87
- this.#stream = opts?.stream ?? this.#stream;
88
- if (opts?.frames && opts?.frames.length) {
89
- this.#frames = opts.frames;
90
- }
91
- this.#color = opts?.color ?? this.#color;
92
- if (this.#frames.length - 1 < this.#current) {
93
- this.#current = 0;
94
- }
95
- return this;
96
- }
97
- loop() {
98
- this.#isTTY && (this.#timer = setTimeout(() => this.loop(), this.#interval));
99
- return this.spin();
100
- }
101
- write(str, clear = false) {
102
- if (clear && this.#isTTY) {
103
- this.clear();
104
- }
105
- this.#stream.write(str);
106
- return this;
107
- }
108
- render() {
109
- const mark = colorette[this.#color](this.#frames[this.#current]);
110
- let str = `${mark} ${this.#text}`;
111
- this.#isTTY ? this.write(`\x1b[?25l`) : (str += '\n');
112
- this.write(str, true);
113
- this.#isTTY && (this.#lines = this.getLines(str, this.#stream.columns));
114
- }
115
- getLines(str = '', width = 80) {
116
- return str
117
- .replace(/\u001b[^m]*?m/g, '')
118
- .split('\n')
119
- .reduce((col, line) => (col += Math.max(1, Math.ceil(line.length / width))), 0);
120
- }
121
- }
122
- //# sourceMappingURL=Spinner.js.map