bananass-utils-console 0.1.0-canary.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/LICENSE.md +21 -0
- package/README.md +146 -0
- package/build/icons/icons.d.ts +24 -0
- package/build/icons/index.d.ts +1 -0
- package/build/logger/index.d.ts +2 -0
- package/build/logger/logger.d.ts +97 -0
- package/build/spinner/index.d.ts +2 -0
- package/build/spinner/spinner.d.ts +173 -0
- package/build/theme/index.d.ts +1 -0
- package/build/theme/theme.d.ts +60 -0
- package/package.json +88 -0
- package/src/icons/icons.js +68 -0
- package/src/icons/index.js +1 -0
- package/src/logger/index.js +3 -0
- package/src/logger/logger.js +209 -0
- package/src/spinner/index.js +3 -0
- package/src/spinner/spinner.js +390 -0
- package/src/theme/index.js +1 -0
- package/src/theme/theme.js +113 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present 루밀LuMir(lumirlumir)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# bananass
|
|
2
|
+
|
|
3
|
+
<kbd>한국어</kbd> | <kbd>[English](README.en.md)</kbd>
|
|
4
|
+
|
|
5
|
+
바나나<sup>Bananass, 🍌🍌🍌🍌</sup>: <kbd>명사</kbd> 자바스크립트를 위한 백준 프레임워크.
|
|
6
|
+
|
|
7
|
+
> [!IMPORTANT]
|
|
8
|
+
>
|
|
9
|
+
> ```js
|
|
10
|
+
> const whyBananass = {
|
|
11
|
+
> banana: '🍌',
|
|
12
|
+
> bananas: '🍌🍌',
|
|
13
|
+
> bananass: '🍌🍌🍌🍌',
|
|
14
|
+
> }
|
|
15
|
+
> ```
|
|
16
|
+
>
|
|
17
|
+
> ```js
|
|
18
|
+
> console.log(('b' + 'a' + +'a' + 'a').toLowerCase() + (!(1/0) + [])[3].repeat(2));
|
|
19
|
+
> ```
|
|
20
|
+
|
|
21
|
+
<!-- markdownlint-disable-next-line md026 -->
|
|
22
|
+
## 안녕, 바나나!
|
|
23
|
+
|
|
24
|
+
바나나<sup>Bananass, 🍌🍌🍌🍌</sup> 프레임워크에 오신 것을 환영합니다.🎉
|
|
25
|
+
|
|
26
|
+
바나나 프레임워크는 [루밀<sup>LuMir</sup>](https://github.com/lumirlumir)이 제작한 **자바스크립트<sup>JavaScript</sup>를 위한 백준 프레임워크**로, 백준 Node.js 환경에서의 보다 편리한 문제풀이를 위해 설계되었습니다.
|
|
27
|
+
|
|
28
|
+
이제 더 이상 `readline` 혹은 `fs` 모듈을 이용한 템플릿<sup>Template</sup> 코드를 작성한 후, 일일이 복사 붙여넣기할 필요가 없습니다! 바나나 프레임워크를 통해 [**프로그래머스**](https://programmers.co.kr/)에서 하나의 솔루션 함수<sup>`function solution() {}`</sup>를 작성하듯 더욱 간편한 문제 풀이를 경험해보세요.
|
|
29
|
+
|
|
30
|
+
그런데, 백준 문제 풀이를 하는데 굳이 프레임워크까지 알아야 할까요? 아래에서 그 이유를 찾아보죠!
|
|
31
|
+
|
|
32
|
+
## 왜 바나나일까요?
|
|
33
|
+
|
|
34
|
+
왜 자바스크립트<sup>JavaScript</sup> 생태계의 수 많은 프레임워크 중 문제 풀이에 특화된 프레임워크는 없었을까요? 함께 자바스크립트를 이용한 [백준 1000번: A+B](https://www.acmicpc.net/problem/1000) 문제 풀이 예제를 살펴보죠!
|
|
35
|
+
|
|
36
|
+
- 전<sup>Before</sup>: 기존 방법을 통한 문제 풀이.
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const readline = require('node:readline');
|
|
40
|
+
const { EOL } = require('node:os');
|
|
41
|
+
|
|
42
|
+
let inputStr = '';
|
|
43
|
+
|
|
44
|
+
const rl = readline.createInterface({
|
|
45
|
+
input: process.stdin,
|
|
46
|
+
output: process.stdout,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
rl.on('line', line => {
|
|
50
|
+
inputStr = `${inputStr}${line}${EOL}`;
|
|
51
|
+
|
|
52
|
+
}).on('close', () => {
|
|
53
|
+
console.log(solution(inputStr));
|
|
54
|
+
|
|
55
|
+
process.exit(0);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function solution(inputStr) {
|
|
59
|
+
const input = inputStr
|
|
60
|
+
.trim()
|
|
61
|
+
.split(' ')
|
|
62
|
+
.map(val => Number(val));
|
|
63
|
+
|
|
64
|
+
const [a, b] = input;
|
|
65
|
+
|
|
66
|
+
return a + b;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
- 후<sup>After</sup>: 바나나 프레임워크를 이용한 문제 풀이.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
function solution(input) {
|
|
74
|
+
const [a, b] = input
|
|
75
|
+
.trim()
|
|
76
|
+
.split(' ')
|
|
77
|
+
.map(Number);
|
|
78
|
+
|
|
79
|
+
console.log(a + b);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = solution;
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
와우!😲 놀랍지 않나요? 이제 여러분들은 단순해진 코드와 더불어 알고리즘 로직에만 집중할 수 있습니다.
|
|
86
|
+
|
|
87
|
+
근데, 이게 전부냐고요? 물론 아닙니다!
|
|
88
|
+
|
|
89
|
+
- 백준 Node.js 환경에 구애받지 않는 ES2025 등 최신 문법의 사용
|
|
90
|
+
- 사용자 정의 모듈 및 `lodash` 등 외부 라이브러리의 사용
|
|
91
|
+
- ESLint 및 Prettier 자체 지원
|
|
92
|
+
- 풍부한 문서 및 커뮤니티 지원
|
|
93
|
+
- ...
|
|
94
|
+
|
|
95
|
+
어떤가요? 바나나 프레임워크를 통해 더욱 편리한 문제 풀이를 경험해보고 싶지 않으신가요?🤔
|
|
96
|
+
|
|
97
|
+
## 바나나로 시작하기
|
|
98
|
+
|
|
99
|
+
React의 `create-react-app`, Next.js의 `create-next-app` 처럼,
|
|
100
|
+
|
|
101
|
+
**바나나 프레임워크에서 제공하는 `create-bananass-app`으로 지금 바로 새로운 문제 풀이 패러다임을 경험해보세요!**
|
|
102
|
+
|
|
103
|
+
바나나 프레임워크는 `create-bananass-app`을 통해 즉시 설치하고 사용할 수 있습니다! (사실 앱<sup>App</sup>은 아니지만, 그건 중요한게 아닙니다...🤔)
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
npx create-bananass-app my-bananass-app --no-install
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
더욱 자세한 사용법은 [바나나 프레임워크 문서](https://bananass.lumir.page)를 참고해주세요.
|
|
110
|
+
|
|
111
|
+
## 바나나 프레임워크 문서
|
|
112
|
+
|
|
113
|
+
> <https://bananass.lumir.page>
|
|
114
|
+
|
|
115
|
+
바나나 프레임워크는 문서화를 가장 큰 가치로 여깁니다. 바나나 프레임워크의 모든 사용법과 기능은 [바나나 프레임워크 문서](https://bananass.lumir.page)에서 확인하실 수 있습니다.
|
|
116
|
+
|
|
117
|
+
## 기여(이슈<sup>Issue</sup>, 끌어오기 요청<sup>Pull Request</sup>, 토론<sup>Discussion</sup>)
|
|
118
|
+
|
|
119
|
+
바나나 프레임워크에 관심을 가져주셔서 감사합니다.🙇♂️ 저희는 여러분들의 소중한 시간을 바나나 프레임워크에 투자해주신 것에 대해 고마움을 가지고 있습니다.
|
|
120
|
+
|
|
121
|
+
모든 버그<sup>Bug</sup> 및 제안<sup>Suggestion</sup> 등 여러 주제에 대한 이슈<sup>Issue</sup>, 끌어오기 요청<sup>Pull Request</sup> 및 토론<sup>Discussion</sup> 등을 환영합니다.
|
|
122
|
+
|
|
123
|
+
다만, 올바른 커뮤니티 환경을 준수하고 더 나은 오픈소스를 만들기 위해, 바나나 프레임워크에 기여하기 전 반드시 아래 내용들을 확인해주세요.
|
|
124
|
+
|
|
125
|
+
- [기여자 행동 강령 규약](CODE_OF_CONDUCT.md)
|
|
126
|
+
- [기여하기](CONTRIBUTING.md)
|
|
127
|
+
|
|
128
|
+
## 버전 정책<sup>Versioning</sup>
|
|
129
|
+
|
|
130
|
+
바나나 프레임워크는 [유의적 버전 정책<sup>Sementic Versioning</sup>](https://semver.org/lang/ko/)을 따릅니다. 모든 릴리즈 버전은 `주(MAJOR).부(MINOR).수(PATCH)` 형식을 따릅니다.
|
|
131
|
+
|
|
132
|
+
## 기여자 행동 강령 규약<sup>Code of Conduct</sup>
|
|
133
|
+
|
|
134
|
+
커뮤니티에 기여하기 전, [기여자 행동 강령 규약](CODE_OF_CONDUCT.md)을 참고해주세요.
|
|
135
|
+
|
|
136
|
+
## 변경 사항<sup>Change Log</sup>
|
|
137
|
+
|
|
138
|
+
변경 사항에 대한 상세한 내용을 확인하려면, [변경 사항](CHANGELOG.md)을 참고해주세요.
|
|
139
|
+
|
|
140
|
+
## 보안<sup>Security</sup>
|
|
141
|
+
|
|
142
|
+
보안 문제를 발견하셨나요? [보안](SECURITY.md) 문서를 참고해주세요.
|
|
143
|
+
|
|
144
|
+
## 라이센스<sup>License</sup>
|
|
145
|
+
|
|
146
|
+
바나나 프레임워크는 MIT 라이센스를 따릅니다. [라이센스](LICENSE.md) 문서를 참고해주세요.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @type {string} */
|
|
2
|
+
export const successIcon: string;
|
|
3
|
+
/** @type {string} */
|
|
4
|
+
export const errorIcon: string;
|
|
5
|
+
/** @type {string} */
|
|
6
|
+
export const warningIcon: string;
|
|
7
|
+
/** @type {string} */
|
|
8
|
+
export const infoIcon: string;
|
|
9
|
+
/** @type {string} */
|
|
10
|
+
export const bananassIcon: string;
|
|
11
|
+
/** @type {string} */
|
|
12
|
+
export const successText: string;
|
|
13
|
+
/** @type {string} */
|
|
14
|
+
export const errorText: string;
|
|
15
|
+
/** @type {string} */
|
|
16
|
+
export const warningText: string;
|
|
17
|
+
/** @type {string} */
|
|
18
|
+
export const infoText: string;
|
|
19
|
+
/** @type {SpinnerStyle} */
|
|
20
|
+
export const defaultSpinner: SpinnerStyle;
|
|
21
|
+
export type SpinnerStyle = {
|
|
22
|
+
frames: string[];
|
|
23
|
+
interval?: number;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./icons.js";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new `Logger` instance.
|
|
3
|
+
*
|
|
4
|
+
* @param {Options} options
|
|
5
|
+
* @returns {Logger} A new `Logger` instance.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import createLogger from 'bananass-utils-console/logger';
|
|
9
|
+
*
|
|
10
|
+
* const logger = createLogger({
|
|
11
|
+
* debug: false,
|
|
12
|
+
* quiet: false,
|
|
13
|
+
* textPrefix: '>',
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* logger
|
|
17
|
+
* .log('Hello, log!');
|
|
18
|
+
* .debug('Hello, debug!');
|
|
19
|
+
* .eol();
|
|
20
|
+
*/
|
|
21
|
+
export default function createLogger(options: Options): Logger;
|
|
22
|
+
/**
|
|
23
|
+
* Logger options.
|
|
24
|
+
*/
|
|
25
|
+
export type Options = {
|
|
26
|
+
/**
|
|
27
|
+
* Enable debug mode.
|
|
28
|
+
*/
|
|
29
|
+
debug?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Enable quiet mode.
|
|
32
|
+
*/
|
|
33
|
+
quiet?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Text prefix.
|
|
36
|
+
*/
|
|
37
|
+
textPrefix?: string | boolean;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {object} Options Logger options.
|
|
41
|
+
* @property {boolean} [debug] Enable debug mode.
|
|
42
|
+
* @property {boolean} [quiet] Enable quiet mode.
|
|
43
|
+
* @property {string | boolean} [textPrefix] Text prefix.
|
|
44
|
+
*/
|
|
45
|
+
declare class Logger {
|
|
46
|
+
/** @param {Options} options */
|
|
47
|
+
constructor(options?: Options);
|
|
48
|
+
/**
|
|
49
|
+
* Log a message or executes a callback.
|
|
50
|
+
*
|
|
51
|
+
* The first parameter can be a message or a callback function.
|
|
52
|
+
* - If it's a function, it's invoked with subsequent arguments.
|
|
53
|
+
* - Otherwise, the message (with a configured text prefix) and additional arguments are logged.
|
|
54
|
+
*
|
|
55
|
+
* Behavior based on `quiet` option:
|
|
56
|
+
* - `quiet === true`: output X
|
|
57
|
+
* - `quiet === false`: output O
|
|
58
|
+
*
|
|
59
|
+
* @param {...any} params
|
|
60
|
+
* @returns {Logger}
|
|
61
|
+
*/
|
|
62
|
+
log(...params: any[]): Logger;
|
|
63
|
+
/**
|
|
64
|
+
* Log a message or executes a callback in debug mode.
|
|
65
|
+
*
|
|
66
|
+
* The first parameter can be a message or a callback function.
|
|
67
|
+
* - If it's a function, it's invoked with subsequent arguments.
|
|
68
|
+
* - Otherwise, the message (with a configured text prefix) and additional arguments are logged in debug mode.
|
|
69
|
+
*
|
|
70
|
+
* Behavior based on `debug` and `quiet` options:
|
|
71
|
+
* - `quiet === true`: output X
|
|
72
|
+
* - `quiet === false && debug === true`: output O
|
|
73
|
+
* - `quiet === false && debug === false`: output X
|
|
74
|
+
*
|
|
75
|
+
* @param {...any} params
|
|
76
|
+
* @returns {Logger}
|
|
77
|
+
*/
|
|
78
|
+
debug(...params: any[]): Logger;
|
|
79
|
+
/**
|
|
80
|
+
* Ends the current line by logging an empty line using the last method called.
|
|
81
|
+
*
|
|
82
|
+
* This method temporarily sets the text prefix to an undeclared value,
|
|
83
|
+
* then invokes either `log()` or `debug()` depending on the previously method called.
|
|
84
|
+
* After logging, it restores the original text prefix.
|
|
85
|
+
*
|
|
86
|
+
* @returns {Logger}
|
|
87
|
+
*/
|
|
88
|
+
eol(): Logger;
|
|
89
|
+
/**
|
|
90
|
+
* Get the last method called.
|
|
91
|
+
*
|
|
92
|
+
* @returns {'log' | 'debug'}
|
|
93
|
+
*/
|
|
94
|
+
get lastMethodCalled(): "log" | "debug";
|
|
95
|
+
#private;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a new spinner instance.
|
|
3
|
+
*
|
|
4
|
+
* @param {Options} [options]
|
|
5
|
+
* @returns {Spinner} A new spinner instance.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import createSpinner from 'bananass-utils-console/spinner';
|
|
9
|
+
*
|
|
10
|
+
* const spinner = createSpinner({
|
|
11
|
+
* text: 'Loading…'
|
|
12
|
+
* color: 'yellow',
|
|
13
|
+
* stream: process.stderr,
|
|
14
|
+
* spinner: {
|
|
15
|
+
* frames: ['-', '\\', '|', '/'],
|
|
16
|
+
* interval: 100,
|
|
17
|
+
* },
|
|
18
|
+
* }).start();
|
|
19
|
+
*
|
|
20
|
+
* setTimeout(() => {
|
|
21
|
+
* spinner.success('Success!');
|
|
22
|
+
* }, 2000);
|
|
23
|
+
*/
|
|
24
|
+
export default function createSpinner(options?: Options): Spinner;
|
|
25
|
+
export type ForegroundColorName = import("chalk").ForegroundColorName;
|
|
26
|
+
export type SpinnerStyle = {
|
|
27
|
+
frames: string[];
|
|
28
|
+
interval?: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Spinner options.
|
|
32
|
+
*/
|
|
33
|
+
export type Options = {
|
|
34
|
+
/**
|
|
35
|
+
* Text to display next to the spinner. (default: `''`)
|
|
36
|
+
*/
|
|
37
|
+
text?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The color of the spinner. (default: `'yellow'`)
|
|
40
|
+
*/
|
|
41
|
+
color?: ForegroundColorName;
|
|
42
|
+
/**
|
|
43
|
+
* The stream to which the spinner is written. (default: `process.stderr`)
|
|
44
|
+
*/
|
|
45
|
+
stream?: NodeJS.WriteStream;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the spinner should be interactive. (default: Auto-detected)
|
|
48
|
+
*/
|
|
49
|
+
isInteractive?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Customize the spinner animation with a custom set of frames and interval.
|
|
52
|
+
*
|
|
53
|
+
* ```
|
|
54
|
+
* {
|
|
55
|
+
* frames: ['-', '\\', '|', '/'],
|
|
56
|
+
* interval: 100,
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* Pass in any spinner from [`cli-spinners`](https://github.com/sindresorhus/cli-spinners).
|
|
61
|
+
*/
|
|
62
|
+
spinner?: SpinnerStyle;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {import('chalk').ForegroundColorName} ForegroundColorName
|
|
66
|
+
*/
|
|
67
|
+
/**
|
|
68
|
+
* @typedef {object} SpinnerStyle
|
|
69
|
+
* @property {string[]} frames
|
|
70
|
+
* @property {number} [interval]
|
|
71
|
+
*/
|
|
72
|
+
/**
|
|
73
|
+
* @typedef {object} Options Spinner options.
|
|
74
|
+
* @property {string} [text] Text to display next to the spinner. (default: `''`)
|
|
75
|
+
* @property {ForegroundColorName} [color] The color of the spinner. (default: `'yellow'`)
|
|
76
|
+
* @property {NodeJS.WriteStream} [stream] The stream to which the spinner is written. (default: `process.stderr`)
|
|
77
|
+
* @property {boolean} [isInteractive] Whether the spinner should be interactive. (default: Auto-detected)
|
|
78
|
+
* @property {SpinnerStyle} [spinner]
|
|
79
|
+
* Customize the spinner animation with a custom set of frames and interval.
|
|
80
|
+
*
|
|
81
|
+
* ```
|
|
82
|
+
* {
|
|
83
|
+
* frames: ['-', '\\', '|', '/'],
|
|
84
|
+
* interval: 100,
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* Pass in any spinner from [`cli-spinners`](https://github.com/sindresorhus/cli-spinners).
|
|
89
|
+
*/
|
|
90
|
+
declare class Spinner {
|
|
91
|
+
/** @param {Options} options */
|
|
92
|
+
constructor(options?: Options);
|
|
93
|
+
/**
|
|
94
|
+
* Starts the spinner.
|
|
95
|
+
*
|
|
96
|
+
* Optionally, updates the text.
|
|
97
|
+
*
|
|
98
|
+
* @param {string} [text] The text to display next to the spinner.
|
|
99
|
+
* @returns The spinner instance.
|
|
100
|
+
*/
|
|
101
|
+
start(text?: string): this;
|
|
102
|
+
/**
|
|
103
|
+
* Stops the spinner.
|
|
104
|
+
*
|
|
105
|
+
* Optionally displays a final message.
|
|
106
|
+
*
|
|
107
|
+
* @param {string} [finalText] The final text to display after stopping the spinner.
|
|
108
|
+
* @returns The spinner instance.
|
|
109
|
+
*/
|
|
110
|
+
stop(finalText?: string): this;
|
|
111
|
+
/**
|
|
112
|
+
* Stops the spinner and displays a success symbol with the message.
|
|
113
|
+
*
|
|
114
|
+
* @param {string} [text] The success message to display.
|
|
115
|
+
* @returns The spinner instance.
|
|
116
|
+
*/
|
|
117
|
+
success(text?: string): this;
|
|
118
|
+
/**
|
|
119
|
+
* Stops the spinner and displays an error symbol with the message.
|
|
120
|
+
*
|
|
121
|
+
* @param {string} [text] The error message to display.
|
|
122
|
+
* @returns The spinner instance.
|
|
123
|
+
*/
|
|
124
|
+
error(text?: string): this;
|
|
125
|
+
/**
|
|
126
|
+
* Stops the spinner and displays a warning symbol with the message.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} [text] The warning message to display.
|
|
129
|
+
* @returns The spinner instance.
|
|
130
|
+
*/
|
|
131
|
+
warning(text?: string): this;
|
|
132
|
+
/**
|
|
133
|
+
* Stops the spinner and displays an info symbol with the message.
|
|
134
|
+
*
|
|
135
|
+
* @param {string} [text] The info message to display.
|
|
136
|
+
* @returns The spinner instance.
|
|
137
|
+
*/
|
|
138
|
+
info(text?: string): this;
|
|
139
|
+
/**
|
|
140
|
+
* Clears the spinner.
|
|
141
|
+
*
|
|
142
|
+
* @returns The spinner instance.
|
|
143
|
+
*/
|
|
144
|
+
clear(): this;
|
|
145
|
+
/**
|
|
146
|
+
* Change the text displayed next to the spinner.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* spinner.text = 'New text';
|
|
150
|
+
*/
|
|
151
|
+
set text(value: string);
|
|
152
|
+
/**
|
|
153
|
+
* Change the text displayed next to the spinner.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* spinner.text = 'New text';
|
|
157
|
+
*/
|
|
158
|
+
get text(): string;
|
|
159
|
+
/**
|
|
160
|
+
* Change the spinner color.
|
|
161
|
+
*/
|
|
162
|
+
set color(value: keyof import("chalk/source/vendor/ansi-styles/index.js").ForegroundColor);
|
|
163
|
+
/**
|
|
164
|
+
* Change the spinner color.
|
|
165
|
+
*/
|
|
166
|
+
get color(): keyof import("chalk/source/vendor/ansi-styles/index.js").ForegroundColor;
|
|
167
|
+
/**
|
|
168
|
+
* Returns whether the spinner is currently spinning.
|
|
169
|
+
*/
|
|
170
|
+
get isSpinning(): boolean;
|
|
171
|
+
#private;
|
|
172
|
+
}
|
|
173
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./theme.js";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a green-colored success message prefixed with an icon.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} str The success message to format.
|
|
5
|
+
* @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
|
|
6
|
+
* @returns {string} Returns a green-colored success message prefixed with an icon.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* console.log(complete('Operation successful.'));
|
|
10
|
+
* // Output: (icon?) Operation successful. (displayed in green text in the terminal.)
|
|
11
|
+
*/
|
|
12
|
+
export function success(str: string, showIcon?: boolean): string;
|
|
13
|
+
/**
|
|
14
|
+
* Returns a red-colored error message prefixed with an icon.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} str The error message to format.
|
|
17
|
+
* @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
|
|
18
|
+
* @returns {string} Returns a red-colored error message prefixed with an icon.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* console.log(error('Something went wrong.'));
|
|
22
|
+
* // Output: (icon?) Something went wrong. (displayed in red text in the terminal.)
|
|
23
|
+
*/
|
|
24
|
+
export function error(str: string, showIcon?: boolean): string;
|
|
25
|
+
/**
|
|
26
|
+
* Returns a yellow-colored warning message prefixed with an icon.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} str The warning message to format.
|
|
29
|
+
* @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
|
|
30
|
+
* @returns {string} Returns a yellow-colored warning message prefixed with an icon.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* console.log(warning('This is a warning.'));
|
|
34
|
+
* // Output: (icon?) This is a warning. (displayed in yellow text in the terminal.)
|
|
35
|
+
*/
|
|
36
|
+
export function warning(str: string, showIcon?: boolean): string;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a blue-colored info message prefixed with an icon.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} str The info message to format.
|
|
41
|
+
* @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
|
|
42
|
+
* @returns {string} Returns a blue-colored info message prefixed with an icon.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* console.log(info('Informational message.'));
|
|
46
|
+
* // Output: (icon?) Informational message. (displayed in blue text in the terminal.)
|
|
47
|
+
*/
|
|
48
|
+
export function info(str: string, showIcon?: boolean): string;
|
|
49
|
+
/**
|
|
50
|
+
* Returns a yellow-colored error message prefixed with an icon.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} str The bananass message to format.
|
|
53
|
+
* @param {boolean} showIcon Whether to show the icon. Defaults to `false`.
|
|
54
|
+
* @returns Returns a yellow-colored error message prefixed with an icon.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* console.log(bananass('Hello, Bananass.'));
|
|
58
|
+
* // Output: (icon?) Hello, Bananass. (displayed in yellow text in the terminal.)
|
|
59
|
+
*/
|
|
60
|
+
export function bananass(str: string, showIcon?: boolean): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bananass-utils-console",
|
|
3
|
+
"version": "0.1.0-canary.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Console Utilities for Bananass Framework.🍌",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./icons": {
|
|
8
|
+
"types": "./build/icons/index.d.ts",
|
|
9
|
+
"default": "./src/icons/index.js"
|
|
10
|
+
},
|
|
11
|
+
"./logger": {
|
|
12
|
+
"types": "./build/logger/index.d.ts",
|
|
13
|
+
"default": "./src/logger/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./spinner": {
|
|
16
|
+
"types": "./build/spinner/index.d.ts",
|
|
17
|
+
"default": "./src/spinner/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./theme": {
|
|
20
|
+
"types": "./build/theme/index.d.ts",
|
|
21
|
+
"default": "./src/theme/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"typesVersions": {
|
|
26
|
+
"*": {
|
|
27
|
+
"*": [
|
|
28
|
+
"./build/*"
|
|
29
|
+
],
|
|
30
|
+
"icons": [
|
|
31
|
+
"./build/icons/index.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"logger": [
|
|
34
|
+
"./build/logger/index.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"spinner": [
|
|
37
|
+
"./build/spinner/index.d.ts"
|
|
38
|
+
],
|
|
39
|
+
"theme": [
|
|
40
|
+
"./build/theme/index.d.ts"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"src",
|
|
46
|
+
"build",
|
|
47
|
+
"LICENSE.md",
|
|
48
|
+
"README.md",
|
|
49
|
+
"!src/**/*.test.js",
|
|
50
|
+
"!**/fixtures/**"
|
|
51
|
+
],
|
|
52
|
+
"keywords": [
|
|
53
|
+
"bananass",
|
|
54
|
+
"baekjoon",
|
|
55
|
+
"framework",
|
|
56
|
+
"javascript",
|
|
57
|
+
"utils",
|
|
58
|
+
"console",
|
|
59
|
+
"icon",
|
|
60
|
+
"logger",
|
|
61
|
+
"spinner",
|
|
62
|
+
"theme"
|
|
63
|
+
],
|
|
64
|
+
"author": "루밀LuMir <rpfos@naver.com> (https://github.com/lumirlumir)",
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"homepage": "https://bananass.lumir.page",
|
|
67
|
+
"repository": {
|
|
68
|
+
"type": "github",
|
|
69
|
+
"url": "git+https://github.com/lumirlumir/npm-bananass.git",
|
|
70
|
+
"directory": "packages/bananass-utils-console"
|
|
71
|
+
},
|
|
72
|
+
"bugs": {
|
|
73
|
+
"url": "https://github.com/lumirlumir/npm-bananass/issues"
|
|
74
|
+
},
|
|
75
|
+
"engines": {
|
|
76
|
+
"node": ">=20.18.0"
|
|
77
|
+
},
|
|
78
|
+
"scripts": {
|
|
79
|
+
"prepublishOnly": "npm run build",
|
|
80
|
+
"build": "npx tsc && shx cp ../../LICENSE.md ../../README.md .",
|
|
81
|
+
"test": "node --test"
|
|
82
|
+
},
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"chalk": "^5.4.1",
|
|
85
|
+
"is-interactive": "^2.0.0",
|
|
86
|
+
"is-unicode-supported": "^2.1.0"
|
|
87
|
+
}
|
|
88
|
+
}
|