markdown-to-document-cli 1.1.4 β 1.2.8
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/README.md +248 -18
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +523 -134
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/services/CoverService.d.ts +25 -3
- package/dist/services/CoverService.d.ts.map +1 -1
- package/dist/services/CoverService.js +226 -97
- package/dist/services/CoverService.js.map +1 -1
- package/dist/services/MarkdownPreprocessor.d.ts +5 -0
- package/dist/services/MarkdownPreprocessor.d.ts.map +1 -1
- package/dist/services/MarkdownPreprocessor.js +18 -7
- package/dist/services/MarkdownPreprocessor.js.map +1 -1
- package/dist/services/PandocService.d.ts +7 -1
- package/dist/services/PandocService.d.ts.map +1 -1
- package/dist/services/PandocService.js +61 -15
- package/dist/services/PandocService.js.map +1 -1
- package/dist/services/TypographyService.d.ts +8 -1
- package/dist/services/TypographyService.d.ts.map +1 -1
- package/dist/services/TypographyService.js +417 -57
- package/dist/services/TypographyService.js.map +1 -1
- package/dist/types/index.d.ts +37 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +28 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +224 -0
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/cssBuilder.d.ts +93 -0
- package/dist/utils/cssBuilder.d.ts.map +1 -0
- package/dist/utils/cssBuilder.js +231 -0
- package/dist/utils/cssBuilder.js.map +1 -0
- package/dist/utils/dependencyChecker.d.ts +63 -0
- package/dist/utils/dependencyChecker.d.ts.map +1 -0
- package/dist/utils/dependencyChecker.js +268 -0
- package/dist/utils/dependencyChecker.js.map +1 -0
- package/dist/utils/pathValidator.d.ts +48 -0
- package/dist/utils/pathValidator.d.ts.map +1 -0
- package/dist/utils/pathValidator.js +188 -0
- package/dist/utils/pathValidator.js.map +1 -0
- package/dist/utils/themeUtils.d.ts +70 -0
- package/dist/utils/themeUtils.d.ts.map +1 -0
- package/dist/utils/themeUtils.js +141 -0
- package/dist/utils/themeUtils.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Checker - Proactive installation guidance
|
|
3
|
+
*
|
|
4
|
+
* Checks for required dependencies and provides user-friendly installation instructions
|
|
5
|
+
*/
|
|
6
|
+
export interface DependencyStatus {
|
|
7
|
+
name: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
installed: boolean;
|
|
10
|
+
version?: string;
|
|
11
|
+
installInstructions: InstallInstructions;
|
|
12
|
+
}
|
|
13
|
+
export interface InstallInstructions {
|
|
14
|
+
description: string;
|
|
15
|
+
macOS: string[];
|
|
16
|
+
linux: string[];
|
|
17
|
+
windows: string[];
|
|
18
|
+
notes?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class DependencyChecker {
|
|
21
|
+
/**
|
|
22
|
+
* Check if a command is available
|
|
23
|
+
*/
|
|
24
|
+
private isCommandAvailable;
|
|
25
|
+
/**
|
|
26
|
+
* Check Node.js
|
|
27
|
+
*/
|
|
28
|
+
private checkNode;
|
|
29
|
+
/**
|
|
30
|
+
* Check Pandoc
|
|
31
|
+
*/
|
|
32
|
+
private checkPandoc;
|
|
33
|
+
/**
|
|
34
|
+
* Check PDF engines (at least one should be available)
|
|
35
|
+
*/
|
|
36
|
+
private checkPdfEngines;
|
|
37
|
+
/**
|
|
38
|
+
* Check Python (optional, for WeasyPrint)
|
|
39
|
+
*/
|
|
40
|
+
private checkPython;
|
|
41
|
+
/**
|
|
42
|
+
* Check all dependencies
|
|
43
|
+
*/
|
|
44
|
+
checkAll(): Promise<{
|
|
45
|
+
allRequired: boolean;
|
|
46
|
+
hasPdfEngine: boolean;
|
|
47
|
+
dependencies: DependencyStatus[];
|
|
48
|
+
pdfEngines: DependencyStatus[];
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Display installation instructions for a dependency
|
|
52
|
+
*/
|
|
53
|
+
displayInstallInstructions(dep: DependencyStatus): void;
|
|
54
|
+
/**
|
|
55
|
+
* Display comprehensive dependency report
|
|
56
|
+
*/
|
|
57
|
+
displayDependencyReport(): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Quick check - returns true if ready to convert
|
|
60
|
+
*/
|
|
61
|
+
quickCheck(format: 'epub' | 'pdf' | 'both'): Promise<boolean>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=dependencyChecker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencyChecker.d.ts","sourceRoot":"","sources":["../../src/utils/dependencyChecker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;CAC5C;AAED,MAAM,WAAW,mBAAmB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,iBAAiB;IAC1B;;OAEG;YACW,kBAAkB;IAahC;;OAEG;YACW,SAAS;IAiBvB;;OAEG;YACW,WAAW;IAiBzB;;OAEG;YACW,eAAe;IAoD7B;;OAEG;YACW,WAAW;IAmBzB;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC;QACtB,WAAW,EAAE,OAAO,CAAC;QACrB,YAAY,EAAE,OAAO,CAAC;QACtB,YAAY,EAAE,gBAAgB,EAAE,CAAC;QACjC,UAAU,EAAE,gBAAgB,EAAE,CAAC;KAClC,CAAC;IAkBF;;OAEG;IACH,0BAA0B,CAAC,GAAG,EAAE,gBAAgB,GAAG,IAAI;IA6BvD;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IA0EjD;;OAEG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CActE"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Checker - Proactive installation guidance
|
|
3
|
+
*
|
|
4
|
+
* Checks for required dependencies and provides user-friendly installation instructions
|
|
5
|
+
*/
|
|
6
|
+
import { execFile } from 'child_process';
|
|
7
|
+
import { promisify } from 'util';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
export class DependencyChecker {
|
|
11
|
+
/**
|
|
12
|
+
* Check if a command is available
|
|
13
|
+
*/
|
|
14
|
+
async isCommandAvailable(command, args = ['--version']) {
|
|
15
|
+
try {
|
|
16
|
+
const { stdout } = await execFileAsync(command, args, { timeout: 3000 });
|
|
17
|
+
const versionMatch = stdout.match(/(\d+\.\d+(?:\.\d+)?)/);
|
|
18
|
+
return {
|
|
19
|
+
available: true,
|
|
20
|
+
version: versionMatch ? versionMatch[1] : 'installed'
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return { available: false };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check Node.js
|
|
29
|
+
*/
|
|
30
|
+
async checkNode() {
|
|
31
|
+
const result = await this.isCommandAvailable('node');
|
|
32
|
+
return {
|
|
33
|
+
name: 'Node.js',
|
|
34
|
+
required: true,
|
|
35
|
+
installed: result.available,
|
|
36
|
+
version: result.version,
|
|
37
|
+
installInstructions: {
|
|
38
|
+
description: 'JavaScript λ°νμ - CLIκ° μ€νλλ κΈ°λ°',
|
|
39
|
+
macOS: ['brew install node', 'λλ https://nodejs.org μμ λ€μ΄λ‘λ'],
|
|
40
|
+
linux: ['sudo apt-get install nodejs npm', 'λλ https://nodejs.org μμ λ€μ΄λ‘λ'],
|
|
41
|
+
windows: ['winget install OpenJS.NodeJS', 'λλ https://nodejs.org μμ λ€μ΄λ‘λ'],
|
|
42
|
+
notes: 'Node.js 18 μ΄μ κΆμ₯'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Check Pandoc
|
|
48
|
+
*/
|
|
49
|
+
async checkPandoc() {
|
|
50
|
+
const result = await this.isCommandAvailable('pandoc');
|
|
51
|
+
return {
|
|
52
|
+
name: 'Pandoc',
|
|
53
|
+
required: true,
|
|
54
|
+
installed: result.available,
|
|
55
|
+
version: result.version,
|
|
56
|
+
installInstructions: {
|
|
57
|
+
description: 'λ¬Έμ λ³ν μμ§ - EPUB/PDF μμ±μ ν΅μ¬',
|
|
58
|
+
macOS: ['brew install pandoc'],
|
|
59
|
+
linux: ['sudo apt-get install pandoc'],
|
|
60
|
+
windows: ['winget install --id JohnMacFarlane.Pandoc'],
|
|
61
|
+
notes: 'Pandoc 2.19 μ΄μ νμ'
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check PDF engines (at least one should be available)
|
|
67
|
+
*/
|
|
68
|
+
async checkPdfEngines() {
|
|
69
|
+
const engines = [
|
|
70
|
+
{
|
|
71
|
+
name: 'WeasyPrint',
|
|
72
|
+
command: 'weasyprint',
|
|
73
|
+
description: 'PDF μμ± μμ§ (μΆμ²) - κ°μ₯ μ½κ³ νκΈ μ§μ μ°μ',
|
|
74
|
+
macOS: ['pip3 install weasyprint', 'λλ pip install weasyprint'],
|
|
75
|
+
linux: ['pip3 install weasyprint', 'λλ pip install weasyprint'],
|
|
76
|
+
windows: ['pip install weasyprint'],
|
|
77
|
+
notes: 'Pythonμ΄ νμν©λλ€: https://python.org'
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'XeLaTeX',
|
|
81
|
+
command: 'xelatex',
|
|
82
|
+
description: 'PDF μμ± μμ§ (νκΈ μ΅μ ν) - μ λ¬Έ μΆν νμ§',
|
|
83
|
+
macOS: ['brew install --cask basictex', 'eval "$(/usr/libexec/path_helper)"'],
|
|
84
|
+
linux: ['sudo apt-get install texlive-xetex texlive-fonts-recommended'],
|
|
85
|
+
windows: ['https://www.tug.org/texlive/ μμ μ€μΉ'],
|
|
86
|
+
notes: 'μ€μΉ ν ν°λ―Έλ μ¬μμ νμ'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'PDFLaTeX',
|
|
90
|
+
command: 'pdflatex',
|
|
91
|
+
description: 'PDF μμ± μμ§ (κΈ°λ³Έ) - νμ€ LaTeX',
|
|
92
|
+
macOS: ['brew install --cask basictex'],
|
|
93
|
+
linux: ['sudo apt-get install texlive-latex-base'],
|
|
94
|
+
windows: ['https://www.tug.org/texlive/ μμ μ€μΉ'],
|
|
95
|
+
notes: 'μ€μΉ ν ν°λ―Έλ μ¬μμ νμ'
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
const results = [];
|
|
99
|
+
for (const engine of engines) {
|
|
100
|
+
const result = await this.isCommandAvailable(engine.command);
|
|
101
|
+
results.push({
|
|
102
|
+
name: engine.name,
|
|
103
|
+
required: false,
|
|
104
|
+
installed: result.available,
|
|
105
|
+
version: result.version,
|
|
106
|
+
installInstructions: {
|
|
107
|
+
description: engine.description,
|
|
108
|
+
macOS: engine.macOS,
|
|
109
|
+
linux: engine.linux,
|
|
110
|
+
windows: engine.windows,
|
|
111
|
+
notes: engine.notes
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return results;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Check Python (optional, for WeasyPrint)
|
|
119
|
+
*/
|
|
120
|
+
async checkPython() {
|
|
121
|
+
const result = await this.isCommandAvailable('python3', ['--version']);
|
|
122
|
+
const result2 = !result.available ? await this.isCommandAvailable('python', ['--version']) : result;
|
|
123
|
+
return {
|
|
124
|
+
name: 'Python',
|
|
125
|
+
required: false,
|
|
126
|
+
installed: result.available || result2.available,
|
|
127
|
+
version: result.version || result2.version,
|
|
128
|
+
installInstructions: {
|
|
129
|
+
description: 'WeasyPrint μ€μΉμ νμ (μ νμ¬ν)',
|
|
130
|
+
macOS: ['brew install python3'],
|
|
131
|
+
linux: ['sudo apt-get install python3 python3-pip'],
|
|
132
|
+
windows: ['winget install Python.Python.3', 'λλ https://python.org μμ λ€μ΄λ‘λ'],
|
|
133
|
+
notes: 'WeasyPrintλ₯Ό μ¬μ©νλ €λ©΄ νμν©λλ€'
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check all dependencies
|
|
139
|
+
*/
|
|
140
|
+
async checkAll() {
|
|
141
|
+
const node = await this.checkNode();
|
|
142
|
+
const pandoc = await this.checkPandoc();
|
|
143
|
+
const python = await this.checkPython();
|
|
144
|
+
const pdfEngines = await this.checkPdfEngines();
|
|
145
|
+
const dependencies = [node, pandoc, python];
|
|
146
|
+
const allRequired = node.installed && pandoc.installed;
|
|
147
|
+
const hasPdfEngine = pdfEngines.some(engine => engine.installed);
|
|
148
|
+
return {
|
|
149
|
+
allRequired,
|
|
150
|
+
hasPdfEngine,
|
|
151
|
+
dependencies,
|
|
152
|
+
pdfEngines
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Display installation instructions for a dependency
|
|
157
|
+
*/
|
|
158
|
+
displayInstallInstructions(dep) {
|
|
159
|
+
const platform = process.platform;
|
|
160
|
+
const instructions = dep.installInstructions;
|
|
161
|
+
console.log(chalk.yellow(`\nπ¦ ${dep.name} μ€μΉ λ°©λ²:`));
|
|
162
|
+
console.log(chalk.gray(` ${instructions.description}\n`));
|
|
163
|
+
if (platform === 'darwin') {
|
|
164
|
+
console.log(chalk.cyan(' macOS:'));
|
|
165
|
+
instructions.macOS.forEach(cmd => {
|
|
166
|
+
console.log(chalk.white(` $ ${cmd}`));
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
else if (platform === 'win32') {
|
|
170
|
+
console.log(chalk.cyan(' Windows:'));
|
|
171
|
+
instructions.windows.forEach(cmd => {
|
|
172
|
+
console.log(chalk.white(` > ${cmd}`));
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
console.log(chalk.cyan(' Linux:'));
|
|
177
|
+
instructions.linux.forEach(cmd => {
|
|
178
|
+
console.log(chalk.white(` $ ${cmd}`));
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (instructions.notes) {
|
|
182
|
+
console.log(chalk.gray(`\n π‘ ${instructions.notes}`));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Display comprehensive dependency report
|
|
187
|
+
*/
|
|
188
|
+
async displayDependencyReport() {
|
|
189
|
+
console.log(chalk.cyan.bold('\nπ μμ‘΄μ± νμΈ μ€...\n'));
|
|
190
|
+
const { allRequired, hasPdfEngine, dependencies, pdfEngines } = await this.checkAll();
|
|
191
|
+
// Show required dependencies
|
|
192
|
+
console.log(chalk.bold('νμ μμ‘΄μ±:'));
|
|
193
|
+
dependencies.filter(d => d.required).forEach(dep => {
|
|
194
|
+
if (dep.installed) {
|
|
195
|
+
console.log(chalk.green(` β
${dep.name} ${dep.version ? `(v${dep.version})` : ''}`));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
console.log(chalk.red(` β ${dep.name} - μ€μΉ νμ`));
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
// Show PDF engines
|
|
202
|
+
console.log(chalk.bold('\nPDF μμ± μμ§ (μ΅μ 1κ° νμ):'));
|
|
203
|
+
pdfEngines.forEach(engine => {
|
|
204
|
+
if (engine.installed) {
|
|
205
|
+
console.log(chalk.green(` β
${engine.name} ${engine.version ? `(v${engine.version})` : ''}`));
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
console.log(chalk.gray(` βͺ ${engine.name} - λ―Έμ€μΉ`));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
// Show optional dependencies
|
|
212
|
+
const optional = dependencies.filter(d => !d.required);
|
|
213
|
+
if (optional.length > 0) {
|
|
214
|
+
console.log(chalk.bold('\nμ ν μμ‘΄μ±:'));
|
|
215
|
+
optional.forEach(dep => {
|
|
216
|
+
if (dep.installed) {
|
|
217
|
+
console.log(chalk.green(` β
${dep.name} ${dep.version ? `(v${dep.version})` : ''}`));
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
console.log(chalk.gray(` βͺ ${dep.name} - λ―Έμ€μΉ`));
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
// If missing required dependencies, show installation instructions
|
|
225
|
+
if (!allRequired) {
|
|
226
|
+
console.log(chalk.red.bold('\nβ οΈ νμ μμ‘΄μ±μ΄ λλ½λμμ΅λλ€!\n'));
|
|
227
|
+
dependencies.filter(d => d.required && !d.installed).forEach(dep => {
|
|
228
|
+
this.displayInstallInstructions(dep);
|
|
229
|
+
});
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
// If no PDF engine, show recommendations
|
|
233
|
+
if (!hasPdfEngine) {
|
|
234
|
+
console.log(chalk.yellow.bold('\nβ οΈ PDF μμ± μμ§μ΄ μμ΅λλ€!\n'));
|
|
235
|
+
console.log(chalk.yellow('PDF νμΌμ μμ±νλ €λ©΄ μ΅μ 1κ°μ PDF μμ§μ΄ νμν©λλ€.'));
|
|
236
|
+
console.log(chalk.yellow('EPUBλ§ μμ±νλ €λ©΄ μ΄ λ¨κ³λ₯Ό 건λλΈ μ μμ΅λλ€.\n'));
|
|
237
|
+
// Show WeasyPrint first (recommended)
|
|
238
|
+
const weasyprint = pdfEngines.find(e => e.name === 'WeasyPrint');
|
|
239
|
+
if (weasyprint) {
|
|
240
|
+
this.displayInstallInstructions(weasyprint);
|
|
241
|
+
}
|
|
242
|
+
console.log(chalk.gray('\nλλ λ€λ₯Έ PDF μμ§μ μ ννμΈμ:'));
|
|
243
|
+
pdfEngines.filter(e => e.name !== 'WeasyPrint').forEach(engine => {
|
|
244
|
+
console.log(chalk.gray(` β’ ${engine.name}: ${engine.installInstructions.description}`));
|
|
245
|
+
});
|
|
246
|
+
console.log(chalk.cyan('\nπ‘ μ 체 μ€μΉ κ°μ΄λ: https://github.com/goodlookingprokim/markdown-to-document-cli#-νμ-μꡬμ¬ν\n'));
|
|
247
|
+
}
|
|
248
|
+
if (allRequired && hasPdfEngine) {
|
|
249
|
+
console.log(chalk.green.bold('\nβ
λͺ¨λ μμ‘΄μ±μ΄ μ€λΉλμμ΅λλ€!\n'));
|
|
250
|
+
}
|
|
251
|
+
return allRequired;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Quick check - returns true if ready to convert
|
|
255
|
+
*/
|
|
256
|
+
async quickCheck(format) {
|
|
257
|
+
const { allRequired, hasPdfEngine } = await this.checkAll();
|
|
258
|
+
if (!allRequired) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
// If PDF is needed but no engine available
|
|
262
|
+
if ((format === 'pdf' || format === 'both') && !hasPdfEngine) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
//# sourceMappingURL=dependencyChecker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencyChecker.js","sourceRoot":"","sources":["../../src/utils/dependencyChecker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,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YAC3D,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path Validator - Robust file path handling and validation
|
|
3
|
+
*
|
|
4
|
+
* Handles common path issues:
|
|
5
|
+
* - Backslash escapes in paths
|
|
6
|
+
* - Quoted paths
|
|
7
|
+
* - Spaces in paths
|
|
8
|
+
* - Relative vs absolute paths
|
|
9
|
+
* - Path existence validation
|
|
10
|
+
*/
|
|
11
|
+
export interface PathValidationResult {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
normalizedPath?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
suggestions?: string[];
|
|
16
|
+
}
|
|
17
|
+
export declare class PathValidator {
|
|
18
|
+
/**
|
|
19
|
+
* Normalize and clean a file path
|
|
20
|
+
* Handles backslashes, quotes, and other common issues
|
|
21
|
+
*/
|
|
22
|
+
static normalizePath(inputPath: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Validate a file path and provide helpful feedback
|
|
25
|
+
*/
|
|
26
|
+
static validatePath(inputPath: string): PathValidationResult;
|
|
27
|
+
/**
|
|
28
|
+
* Generate helpful suggestions based on the invalid path
|
|
29
|
+
*/
|
|
30
|
+
private static generatePathSuggestions;
|
|
31
|
+
/**
|
|
32
|
+
* Display validation error with helpful suggestions
|
|
33
|
+
*/
|
|
34
|
+
static displayValidationError(result: PathValidationResult): void;
|
|
35
|
+
/**
|
|
36
|
+
* Interactive path input with validation
|
|
37
|
+
*/
|
|
38
|
+
static promptForValidPath(initialPath?: string): Promise<string | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Quick validation for CLI arguments
|
|
41
|
+
*/
|
|
42
|
+
static quickValidate(inputPath: string): {
|
|
43
|
+
valid: boolean;
|
|
44
|
+
path?: string;
|
|
45
|
+
error?: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=pathValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathValidator.d.ts","sourceRoot":"","sources":["../../src/utils/pathValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,qBAAa,aAAa;IACtB;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAuB/C;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB;IA0D5D;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAwCtC;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;IAwBjE;;OAEG;WACU,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAwB7E;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;CAQ7F"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path Validator - Robust file path handling and validation
|
|
3
|
+
*
|
|
4
|
+
* Handles common path issues:
|
|
5
|
+
* - Backslash escapes in paths
|
|
6
|
+
* - Quoted paths
|
|
7
|
+
* - Spaces in paths
|
|
8
|
+
* - Relative vs absolute paths
|
|
9
|
+
* - Path existence validation
|
|
10
|
+
*/
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as path from 'path';
|
|
13
|
+
import chalk from 'chalk';
|
|
14
|
+
export class PathValidator {
|
|
15
|
+
/**
|
|
16
|
+
* Normalize and clean a file path
|
|
17
|
+
* Handles backslashes, quotes, and other common issues
|
|
18
|
+
*/
|
|
19
|
+
static normalizePath(inputPath) {
|
|
20
|
+
let cleaned = inputPath.trim();
|
|
21
|
+
// Remove surrounding quotes (single or double)
|
|
22
|
+
cleaned = cleaned.replace(/^['"]|['"]$/g, '');
|
|
23
|
+
// Replace escaped spaces (\ ) with regular spaces
|
|
24
|
+
cleaned = cleaned.replace(/\\\s/g, ' ');
|
|
25
|
+
// Replace other escaped characters
|
|
26
|
+
cleaned = cleaned.replace(/\\(.)/g, '$1');
|
|
27
|
+
// Normalize path separators and resolve
|
|
28
|
+
cleaned = path.normalize(cleaned);
|
|
29
|
+
// Resolve to absolute path if relative
|
|
30
|
+
if (!path.isAbsolute(cleaned)) {
|
|
31
|
+
cleaned = path.resolve(process.cwd(), cleaned);
|
|
32
|
+
}
|
|
33
|
+
return cleaned;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Validate a file path and provide helpful feedback
|
|
37
|
+
*/
|
|
38
|
+
static validatePath(inputPath) {
|
|
39
|
+
if (!inputPath || inputPath.trim() === '') {
|
|
40
|
+
return {
|
|
41
|
+
valid: false,
|
|
42
|
+
error: 'νμΌ κ²½λ‘κ° λΉμ΄μμ΅λλ€.',
|
|
43
|
+
suggestions: [
|
|
44
|
+
'νμΌμ ν°λ―Έλλ‘ λλκ·Έ μ€ λλ‘νμΈμ',
|
|
45
|
+
'λλ μ λ κ²½λ‘λ₯Ό μ
λ ₯νμΈμ: /Users/username/document.md'
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const normalizedPath = this.normalizePath(inputPath);
|
|
50
|
+
// Check if file exists
|
|
51
|
+
if (!fs.existsSync(normalizedPath)) {
|
|
52
|
+
const suggestions = this.generatePathSuggestions(normalizedPath);
|
|
53
|
+
return {
|
|
54
|
+
valid: false,
|
|
55
|
+
normalizedPath,
|
|
56
|
+
error: `νμΌμ μ°Ύμ μ μμ΅λλ€: ${normalizedPath}`,
|
|
57
|
+
suggestions
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// Check if it's a file (not a directory)
|
|
61
|
+
const stats = fs.statSync(normalizedPath);
|
|
62
|
+
if (!stats.isFile()) {
|
|
63
|
+
return {
|
|
64
|
+
valid: false,
|
|
65
|
+
normalizedPath,
|
|
66
|
+
error: `λλ ν λ¦¬κ° μλ νμΌμ μ νν΄μΌ ν©λλ€: ${normalizedPath}`,
|
|
67
|
+
suggestions: [
|
|
68
|
+
'λ§ν¬λ€μ΄ νμΌ(.md)μ μ ννμΈμ',
|
|
69
|
+
'λλ ν 리 λ΄μ νΉμ νμΌμ μ§μ νμΈμ'
|
|
70
|
+
]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Check if it's a markdown file
|
|
74
|
+
if (!normalizedPath.endsWith('.md')) {
|
|
75
|
+
return {
|
|
76
|
+
valid: false,
|
|
77
|
+
normalizedPath,
|
|
78
|
+
error: `λ§ν¬λ€μ΄ νμΌ(.md)μ΄ μλλλ€: ${normalizedPath}`,
|
|
79
|
+
suggestions: [
|
|
80
|
+
'νμΌ νμ₯μκ° .mdμΈμ§ νμΈνμΈμ',
|
|
81
|
+
'μ: document.md, README.md'
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
valid: true,
|
|
87
|
+
normalizedPath
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Generate helpful suggestions based on the invalid path
|
|
92
|
+
*/
|
|
93
|
+
static generatePathSuggestions(invalidPath) {
|
|
94
|
+
const suggestions = [];
|
|
95
|
+
const dirname = path.dirname(invalidPath);
|
|
96
|
+
const basename = path.basename(invalidPath);
|
|
97
|
+
// Check if directory exists
|
|
98
|
+
if (fs.existsSync(dirname)) {
|
|
99
|
+
suggestions.push(`λλ ν 리λ μ‘΄μ¬ν©λλ€: ${dirname}`);
|
|
100
|
+
// Try to find similar files
|
|
101
|
+
try {
|
|
102
|
+
const files = fs.readdirSync(dirname);
|
|
103
|
+
const mdFiles = files.filter(f => f.endsWith('.md'));
|
|
104
|
+
if (mdFiles.length > 0) {
|
|
105
|
+
suggestions.push(`μ΄ λλ ν 리μ λ§ν¬λ€μ΄ νμΌ:`);
|
|
106
|
+
mdFiles.slice(0, 5).forEach(f => {
|
|
107
|
+
suggestions.push(` - ${path.join(dirname, f)}`);
|
|
108
|
+
});
|
|
109
|
+
if (mdFiles.length > 5) {
|
|
110
|
+
suggestions.push(` ... κ·Έ μΈ ${mdFiles.length - 5}κ° νμΌ`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// Ignore permission errors
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
suggestions.push('λλ ν λ¦¬κ° μ‘΄μ¬νμ§ μμ΅λλ€');
|
|
120
|
+
suggestions.push('κ²½λ‘λ₯Ό λ€μ νμΈνμΈμ');
|
|
121
|
+
}
|
|
122
|
+
// Common mistakes
|
|
123
|
+
if (invalidPath.includes('\\')) {
|
|
124
|
+
suggestions.push('β οΈ λ°±μ¬λμ(\\)κ° ν¬ν¨λμ΄ μμ΅λλ€');
|
|
125
|
+
suggestions.push('νμΌμ λλκ·Έ μ€ λλ‘νκ±°λ λ°μ΄ν μμ΄ κ²½λ‘λ₯Ό μ
λ ₯νμΈμ');
|
|
126
|
+
}
|
|
127
|
+
return suggestions;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Display validation error with helpful suggestions
|
|
131
|
+
*/
|
|
132
|
+
static displayValidationError(result) {
|
|
133
|
+
console.log(chalk.red(`\nβ ${result.error}\n`));
|
|
134
|
+
if (result.suggestions && result.suggestions.length > 0) {
|
|
135
|
+
console.log(chalk.yellow('π‘ λμλ§:'));
|
|
136
|
+
result.suggestions.forEach(suggestion => {
|
|
137
|
+
if (suggestion.startsWith(' -')) {
|
|
138
|
+
console.log(chalk.gray(suggestion));
|
|
139
|
+
}
|
|
140
|
+
else if (suggestion.startsWith('β οΈ')) {
|
|
141
|
+
console.log(chalk.yellow(` ${suggestion}`));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
console.log(chalk.cyan(` β’ ${suggestion}`));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
console.log();
|
|
148
|
+
}
|
|
149
|
+
console.log(chalk.cyan('π μ¬λ°λ₯Έ κ²½λ‘ μ
λ ₯ λ°©λ²:'));
|
|
150
|
+
console.log(chalk.gray(' 1. νμΌμ ν°λ―Έλ μ°½μΌλ‘ λλκ·Έ μ€ λλ‘'));
|
|
151
|
+
console.log(chalk.gray(' 2. μ λ κ²½λ‘ μ
λ ₯: /Users/username/document.md'));
|
|
152
|
+
console.log(chalk.gray(' 3. μλ κ²½λ‘ μ
λ ₯: ./docs/document.md'));
|
|
153
|
+
console.log();
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Interactive path input with validation
|
|
157
|
+
*/
|
|
158
|
+
static async promptForValidPath(initialPath) {
|
|
159
|
+
let attempts = 0;
|
|
160
|
+
const maxAttempts = 3;
|
|
161
|
+
while (attempts < maxAttempts) {
|
|
162
|
+
const inputPath = initialPath || '';
|
|
163
|
+
const result = this.validatePath(inputPath);
|
|
164
|
+
if (result.valid && result.normalizedPath) {
|
|
165
|
+
return result.normalizedPath;
|
|
166
|
+
}
|
|
167
|
+
this.displayValidationError(result);
|
|
168
|
+
attempts++;
|
|
169
|
+
if (attempts >= maxAttempts) {
|
|
170
|
+
console.log(chalk.red('β μ΅λ μλ νμλ₯Ό μ΄κ³Όνμ΅λλ€.\n'));
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Quick validation for CLI arguments
|
|
178
|
+
*/
|
|
179
|
+
static quickValidate(inputPath) {
|
|
180
|
+
const result = this.validatePath(inputPath);
|
|
181
|
+
return {
|
|
182
|
+
valid: result.valid,
|
|
183
|
+
path: result.normalizedPath,
|
|
184
|
+
error: result.error
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=pathValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathValidator.js","sourceRoot":"","sources":["../../src/utils/pathValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,OAAO,aAAa;IACtB;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,SAAiB;QAClC,IAAI,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;QAE/B,+CAA+C;QAC/C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAE9C,kDAAkD;QAClD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAExC,mCAAmC;QACnC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAE1C,wCAAwC;QACxC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAElC,uCAAuC;QACvC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,SAAiB;QACjC,IAAI,CAAC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|
|
2
|
+
* Theme and Preset Utility Functions
|
|
3
|
+
* Centralized helpers for theme/preset filtering, validation, and listing
|
|
4
|
+
*/
|
|
5
|
+
import type { CoverTheme, TypographyPreset, TypographyPresetId } from '../types/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Get all available cover theme IDs
|
|
8
|
+
*/
|
|
9
|
+
export declare function getCoverThemeIds(): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Get cover theme by ID
|
|
12
|
+
*/
|
|
13
|
+
export declare function getCoverTheme(id: string): CoverTheme | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a cover theme ID is valid
|
|
16
|
+
*/
|
|
17
|
+
export declare function isValidCoverTheme(id: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get cover themes filtered by category
|
|
20
|
+
*/
|
|
21
|
+
export declare function getCoverThemesByCategory(category: string): CoverTheme[];
|
|
22
|
+
/**
|
|
23
|
+
* Get cover themes grouped by category
|
|
24
|
+
*/
|
|
25
|
+
export declare function getCoverThemesGrouped(): Record<string, CoverTheme[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get cover theme categories with theme counts
|
|
28
|
+
*/
|
|
29
|
+
export declare function getCoverThemeCategorySummary(): {
|
|
30
|
+
category: string;
|
|
31
|
+
count: number;
|
|
32
|
+
themes: string[];
|
|
33
|
+
}[];
|
|
34
|
+
/**
|
|
35
|
+
* Get all available typography preset IDs
|
|
36
|
+
*/
|
|
37
|
+
export declare function getTypographyPresetIds(): TypographyPresetId[];
|
|
38
|
+
/**
|
|
39
|
+
* Get typography preset by ID
|
|
40
|
+
*/
|
|
41
|
+
export declare function getTypographyPreset(id: string): TypographyPreset | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check if a typography preset ID is valid
|
|
44
|
+
*/
|
|
45
|
+
export declare function isValidTypographyPreset(id: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get typography presets by category (basic, content, document)
|
|
48
|
+
*/
|
|
49
|
+
export declare function getTypographyPresetsByCategory(category: 'basic' | 'content' | 'document'): TypographyPreset[];
|
|
50
|
+
/**
|
|
51
|
+
* Get typography presets grouped by category
|
|
52
|
+
*/
|
|
53
|
+
export declare function getTypographyPresetsGrouped(): Record<string, TypographyPreset[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Generate help text for cover themes
|
|
56
|
+
*/
|
|
57
|
+
export declare function generateCoverThemeHelpText(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Generate help text for typography presets
|
|
60
|
+
*/
|
|
61
|
+
export declare function generateTypographyPresetHelpText(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Validate and return cover theme, with fallback to default
|
|
64
|
+
*/
|
|
65
|
+
export declare function validateCoverTheme(id: string | undefined, defaultId?: string): CoverTheme;
|
|
66
|
+
/**
|
|
67
|
+
* Validate and return typography preset ID, with fallback to default
|
|
68
|
+
*/
|
|
69
|
+
export declare function validateTypographyPreset(id: string | undefined, defaultId?: TypographyPresetId): TypographyPresetId;
|
|
70
|
+
//# sourceMappingURL=themeUtils.d.ts.map
|