tsoft-cli 2.6.15 → 3.4.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.
@@ -0,0 +1,183 @@
1
+ import boxen from 'boxen';
2
+ import gradient from 'gradient-string';
3
+ import chalk from 'chalk';
4
+ import {input as inquirerInput, confirm as inquirerConfirm, select as inquirerSelect} from '@inquirer/prompts';
5
+ import { t } from '../i18n.js';
6
+
7
+ /**
8
+ * T-Soft branding renkleri
9
+ */
10
+ export const TSOFT_ORANGE = '#FF6B35';
11
+ export const TSOFT_COLORS = {
12
+ primary: TSOFT_ORANGE,
13
+ light: '#FFA500',
14
+ dark: '#FF4500'
15
+ };
16
+
17
+ /**
18
+ * T-Soft gradient oluşturur
19
+ */
20
+ export function createTSoftGradient(text) {
21
+ return gradient([TSOFT_COLORS.light, TSOFT_COLORS.primary, TSOFT_COLORS.dark])(text);
22
+ }
23
+
24
+ /**
25
+ * Box içinde branding ile mesaj gösterir
26
+ * @param {string} message - Gösterilecek mesaj
27
+ * @param {string} title - Sol üst başlık
28
+ * @param {object} options - Boxen seçenekleri
29
+ */
30
+ export function showBrandedBox(message, title = '', options = {}) {
31
+ // T-Soft branding'ini mesajın sonuna sağa hizalanmış olarak ekle
32
+ const tsoftBranding = createTSoftGradient('T-Soft');
33
+ const brandingPadding = ' '.repeat(50); // Sağa hizalama için boşluk
34
+ const messageWithBranding = `${message}\n\n${brandingPadding}${tsoftBranding}`;
35
+
36
+ const defaultOptions = {
37
+ padding: 1,
38
+ margin: {top: 0, bottom: 0, left: 0, right: 0},
39
+ borderStyle: 'round',
40
+ borderColor: TSOFT_ORANGE,
41
+ title: title,
42
+ titleAlignment: 'left',
43
+ ...options
44
+ };
45
+
46
+ const box = boxen(messageWithBranding, defaultOptions);
47
+ console.log('\n' + box + '\n');
48
+ }
49
+
50
+ /**
51
+ * Özelleştirilmiş confirm prompt
52
+ * @param {object} options - Prompt seçenekleri
53
+ * @param {string} boxTitle - Box başlığı
54
+ */
55
+ export async function brandedConfirm(options, boxTitle = t('ui.label.confirm')) {
56
+ const {message, ...restOptions} = options;
57
+
58
+ // Box içinde mesajı göster
59
+ showBrandedBox(message, boxTitle);
60
+
61
+ // Prompt'u çalıştır
62
+ return await inquirerConfirm({
63
+ message: t('ui.prompt.continue'),
64
+ ...restOptions
65
+ });
66
+ }
67
+
68
+ /**
69
+ * Özelleştirilmiş select prompt
70
+ * @param {object} options - Prompt seçenekleri
71
+ * @param {string} boxTitle - Box başlığı
72
+ */
73
+ export async function brandedSelect(options, boxTitle = t('ui.label.select')) {
74
+ const {message, choices, ...restOptions} = options;
75
+
76
+ // Box içinde mesajı göster (sadece başlık)
77
+ if (message) {
78
+ showBrandedBox(message, boxTitle);
79
+ }
80
+
81
+ // Choices'ı işle - disabled olanları görsel olarak farklılaştır
82
+ const processedChoices = choices.map(choice => {
83
+ if (choice.disabled) {
84
+ return {
85
+ ...choice,
86
+ name: chalk.gray(choice.name + ` ${t('ui.label.disabled')}`),
87
+ disabled: true
88
+ };
89
+ }
90
+ return choice;
91
+ });
92
+
93
+ // Prompt'u çalıştır
94
+ return await inquirerSelect({
95
+ message: '',
96
+ choices: processedChoices,
97
+ ...restOptions
98
+ });
99
+ }
100
+
101
+ /**
102
+ * Özelleştirilmiş input prompt
103
+ * @param {object} options - Prompt seçenekleri
104
+ * @param {string} boxTitle - Box başlığı
105
+ */
106
+ export async function brandedInput(options, boxTitle = t('ui.label.input')) {
107
+ const {message, ...restOptions} = options;
108
+
109
+ // Box içinde açıklama varsa göster
110
+ if (restOptions.description) {
111
+ showBrandedBox(restOptions.description, boxTitle);
112
+ delete restOptions.description;
113
+ }
114
+
115
+ // Prompt'u çalıştır
116
+ return await inquirerInput({
117
+ message,
118
+ ...restOptions
119
+ });
120
+ }
121
+
122
+ /**
123
+ * Uyarı mesajı gösterir
124
+ * @param {string} message - Uyarı mesajı
125
+ */
126
+ export function showWarning(message) {
127
+ showBrandedBox(message, t('ui.label.warning'), {
128
+ borderColor: 'yellow'
129
+ });
130
+ }
131
+
132
+ /**
133
+ * Hata mesajı gösterir
134
+ * @param {string} message - Hata mesajı
135
+ */
136
+ export function showError(message) {
137
+ showBrandedBox(message, t('ui.label.error'), {
138
+ borderColor: 'red'
139
+ });
140
+ }
141
+
142
+ /**
143
+ * Başarı mesajı gösterir
144
+ * @param {string} message - Başarı mesajı
145
+ */
146
+ export function showSuccess(message) {
147
+ showBrandedBox(message, t('ui.label.success'), {
148
+ borderColor: 'green'
149
+ });
150
+ }
151
+
152
+ /**
153
+ * Bilgi mesajı gösterir
154
+ * @param {string} message - Bilgi mesajı
155
+ */
156
+ export function showInfo(message) {
157
+ showBrandedBox(message, t('ui.label.info'), {
158
+ borderColor: 'blue'
159
+ });
160
+ }
161
+
162
+ /**
163
+ * Tema seçimi için özel prompt
164
+ * @param {string} message - Mesaj
165
+ * @param {array} themes - Tema listesi
166
+ */
167
+ export async function showThemeSelection(message, themes) {
168
+ return await brandedSelect({
169
+ message,
170
+ choices: themes
171
+ }, t('ui.label.theme_selection'));
172
+ }
173
+
174
+ /**
175
+ * Loading göstergesi (gelecekte animasyon için)
176
+ * @param {string} message - Loading mesajı
177
+ */
178
+ export function showLoading(message) {
179
+ showBrandedBox(message, t('ui.label.loading'), {
180
+ borderColor: TSOFT_ORANGE
181
+ });
182
+ }
183
+
package/bin/run.js DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { execute } from '@oclif/core'
4
-
5
- await execute({ dir: import.meta.url })
package/build/enums.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const packageJson: any;
package/build/enums.js DELETED
@@ -1,7 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- const __filename = fileURLToPath(import.meta.url);
5
- const __dirname = path.dirname(__filename);
6
- export const packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf-8'));
7
- //# sourceMappingURL=enums.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../enums.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AAE1C,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA"}
package/build/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { CLIAllCommands, VersionCommand } from '@tsoft-cli/shared';
2
- export declare const COMMANDS: {
3
- commands: typeof CLIAllCommands;
4
- version: typeof VersionCommand;
5
- };
package/build/index.js DELETED
@@ -1,10 +0,0 @@
1
- import theme from '@tsoft-cli/theme';
2
- import { CLIAllCommands, VersionCommand } from '@tsoft-cli/shared';
3
- import { packageJson } from './enums.js';
4
- VersionCommand.version = packageJson.version;
5
- export const COMMANDS = {
6
- ...theme,
7
- [CLIAllCommands.cliTopic]: CLIAllCommands,
8
- [VersionCommand.cliTopic]: VersionCommand,
9
- };
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAA;AAE5C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,KAAK;IACR,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,cAAc;IACzC,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,cAAc;CAC1C,CAAA"}