command-cmd 1.0.10 → 1.0.11
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/cmd.js +9 -72
- package/doc.md +1 -2
- package/docPTBR.md +1 -2
- package/package.json +1 -1
package/cmd.js
CHANGED
|
@@ -35,12 +35,6 @@ const DOC_TEMPLATE_MAP = Object.freeze({
|
|
|
35
35
|
target: 'docPTBR.md',
|
|
36
36
|
isMapDoc: false
|
|
37
37
|
}),
|
|
38
|
-
doc_html: Object.freeze({
|
|
39
|
-
key: 'doc_html',
|
|
40
|
-
source: 'doc.html',
|
|
41
|
-
target: 'doc.html',
|
|
42
|
-
isMapDoc: false
|
|
43
|
-
}),
|
|
44
38
|
map_en: Object.freeze({
|
|
45
39
|
key: 'map_en',
|
|
46
40
|
source: 'map.md',
|
|
@@ -56,7 +50,6 @@ const DOC_TEMPLATE_MAP = Object.freeze({
|
|
|
56
50
|
});
|
|
57
51
|
|
|
58
52
|
const DOC_TEMPLATES = Object.freeze(Object.values(DOC_TEMPLATE_MAP));
|
|
59
|
-
const DOC_HTML_MARKDOWN_PLACEHOLDER = '__DOC_MARKDOWN_BUNDLE__';
|
|
60
53
|
|
|
61
54
|
const ACTION_ALIASES = Object.freeze({
|
|
62
55
|
skip_ads: 'skip_ads',
|
|
@@ -432,7 +425,15 @@ export async function initDoc(options = {}) {
|
|
|
432
425
|
continue;
|
|
433
426
|
}
|
|
434
427
|
|
|
435
|
-
|
|
428
|
+
let content;
|
|
429
|
+
try {
|
|
430
|
+
content = await readFile(sourcePath, 'utf8');
|
|
431
|
+
} catch (error) {
|
|
432
|
+
if (error && error.code === 'ENOENT') {
|
|
433
|
+
throw new Error(`doc_template_not_found:${template.source}`);
|
|
434
|
+
}
|
|
435
|
+
throw error;
|
|
436
|
+
}
|
|
436
437
|
|
|
437
438
|
await writeFile(targetPath, content, 'utf8');
|
|
438
439
|
|
|
@@ -452,59 +453,6 @@ export async function initDoc(options = {}) {
|
|
|
452
453
|
};
|
|
453
454
|
}
|
|
454
455
|
|
|
455
|
-
async function loadDocTemplateContent(template, sourcePath) {
|
|
456
|
-
let content;
|
|
457
|
-
try {
|
|
458
|
-
content = await readFile(sourcePath, 'utf8');
|
|
459
|
-
} catch (error) {
|
|
460
|
-
if (error && error.code === 'ENOENT') {
|
|
461
|
-
throw new Error(`doc_template_not_found:${template.source}`);
|
|
462
|
-
}
|
|
463
|
-
throw error;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (template.key !== DOC_TEMPLATE_MAP.doc_html.key) {
|
|
467
|
-
return content;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
const markdownBundle = await loadDocMarkdownBundle();
|
|
471
|
-
const serialized = JSON.stringify(markdownBundle)
|
|
472
|
-
.replace(/</g, '\\u003c')
|
|
473
|
-
.replace(/>/g, '\\u003e')
|
|
474
|
-
.replace(/&/g, '\\u0026');
|
|
475
|
-
|
|
476
|
-
if (content.includes(DOC_HTML_MARKDOWN_PLACEHOLDER)) {
|
|
477
|
-
return content.replace(DOC_HTML_MARKDOWN_PLACEHOLDER, serialized);
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return content;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
async function loadDocMarkdownBundle() {
|
|
484
|
-
const templates = [
|
|
485
|
-
DOC_TEMPLATE_MAP.doc_en,
|
|
486
|
-
DOC_TEMPLATE_MAP.doc_ptbr,
|
|
487
|
-
DOC_TEMPLATE_MAP.map_en,
|
|
488
|
-
DOC_TEMPLATE_MAP.map_ptbr
|
|
489
|
-
];
|
|
490
|
-
|
|
491
|
-
const bundle = {};
|
|
492
|
-
|
|
493
|
-
for (const template of templates) {
|
|
494
|
-
const sourcePath = resolvePath(MODULE_DIR, template.source);
|
|
495
|
-
try {
|
|
496
|
-
bundle[template.key] = await readFile(sourcePath, 'utf8');
|
|
497
|
-
} catch (error) {
|
|
498
|
-
if (error && error.code === 'ENOENT') {
|
|
499
|
-
throw new Error(`doc_template_not_found:${template.source}`);
|
|
500
|
-
}
|
|
501
|
-
throw error;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return bundle;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
456
|
export async function cursor(input, options = {}) {
|
|
509
457
|
const commands = normalizeCursorInput(input);
|
|
510
458
|
if (commands.length === 0) {
|
|
@@ -1591,17 +1539,6 @@ function resolveDocTemplateByName(value) {
|
|
|
1591
1539
|
return DOC_TEMPLATE_MAP.doc_ptbr;
|
|
1592
1540
|
}
|
|
1593
1541
|
|
|
1594
|
-
if (
|
|
1595
|
-
token === 'doc_html' ||
|
|
1596
|
-
token === 'dochtml' ||
|
|
1597
|
-
token === 'html' ||
|
|
1598
|
-
token === 'docs_html' ||
|
|
1599
|
-
token === 'documentation_html' ||
|
|
1600
|
-
token === 'documentacao_html'
|
|
1601
|
-
) {
|
|
1602
|
-
return DOC_TEMPLATE_MAP.doc_html;
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
1542
|
if (
|
|
1606
1543
|
token === 'map' ||
|
|
1607
1544
|
token === 'map_en' ||
|
package/doc.md
CHANGED
|
@@ -166,7 +166,6 @@ By default it writes in current working directory:
|
|
|
166
166
|
|
|
167
167
|
- `doc.md`
|
|
168
168
|
- `docPTBR.md`
|
|
169
|
-
- `doc.html`
|
|
170
169
|
- `map.md`
|
|
171
170
|
- `mapPTBR.md`
|
|
172
171
|
|
|
@@ -182,7 +181,7 @@ Optional keys:
|
|
|
182
181
|
- `outputDir` (alias: `dir`, `path`)
|
|
183
182
|
- `overwrite`
|
|
184
183
|
- `includeMapDocs`
|
|
185
|
-
- `files` (e.g. `['doc', 'docPTBR', '
|
|
184
|
+
- `files` (e.g. `['doc', 'docPTBR', 'map', 'mapPTBR']`)
|
|
186
185
|
|
|
187
186
|
## 7) `maper(enabled)`
|
|
188
187
|
|
package/docPTBR.md
CHANGED
|
@@ -166,7 +166,6 @@ Por padrao, escreve no diretório atual:
|
|
|
166
166
|
|
|
167
167
|
- `doc.md`
|
|
168
168
|
- `docPTBR.md`
|
|
169
|
-
- `doc.html`
|
|
170
169
|
- `map.md`
|
|
171
170
|
- `mapPTBR.md`
|
|
172
171
|
|
|
@@ -182,7 +181,7 @@ Campos opcionais:
|
|
|
182
181
|
- `outputDir` (alias: `dir`, `path`)
|
|
183
182
|
- `overwrite`
|
|
184
183
|
- `includeMapDocs`
|
|
185
|
-
- `files` (ex.: `['doc', 'docPTBR', '
|
|
184
|
+
- `files` (ex.: `['doc', 'docPTBR', 'map', 'mapPTBR']`)
|
|
186
185
|
|
|
187
186
|
## 7) `maper(enabled)`
|
|
188
187
|
|