palabra 1.20.2 → 1.21.1
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/ChangeLog +11 -0
- package/README.md +4 -0
- package/letras/node/node.json +9 -0
- package/lib/buscar.js +1 -1
- package/lib/cli/instalar.js +1 -0
- package/lib/cli/parse-args.js +2 -1
- package/lib/escuchar.js +20 -2
- package/lib/hablar.js +0 -1
- package/lib/parser/download.js +0 -1
- package/lib/parser/execute.js +4 -0
- package/lib/parser/extract.js +4 -0
- package/package.json +1 -1
- package/scripts/run-all-bin.js +30 -0
package/ChangeLog
CHANGED
package/README.md
CHANGED
package/lib/buscar.js
CHANGED
|
@@ -33,7 +33,7 @@ export const buscar = async (name, values = {}) => {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
async function importPalabra(name) {
|
|
36
|
-
const {default: letra} = await import(`../letras/${name}/${name}.json`, {
|
|
36
|
+
const {default: letra} = await import(new URL(`../letras/${name}/${name}.json`, import.meta.url), {
|
|
37
37
|
with: {
|
|
38
38
|
type: 'json',
|
|
39
39
|
},
|
package/lib/cli/instalar.js
CHANGED
package/lib/cli/parse-args.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
1
2
|
import yargsParse from 'yargs-parser';
|
|
2
3
|
|
|
3
4
|
export const parseArgs = (args) => {
|
|
@@ -10,7 +11,7 @@ export const parseArgs = (args) => {
|
|
|
10
11
|
},
|
|
11
12
|
string: ['directorio'],
|
|
12
13
|
default: {
|
|
13
|
-
directorio: '~/.local/src',
|
|
14
|
+
directorio: process.env.PALABRA_DIR || '~/.local/src',
|
|
14
15
|
},
|
|
15
16
|
boolean: [
|
|
16
17
|
'quiet',
|
package/lib/escuchar.js
CHANGED
|
@@ -9,11 +9,29 @@ export const escuchar = async (palabras) => {
|
|
|
9
9
|
letras = [],
|
|
10
10
|
} = palabras;
|
|
11
11
|
|
|
12
|
+
const names = new Set();
|
|
13
|
+
|
|
12
14
|
for (const [name, version] of entries(letras)) {
|
|
13
|
-
|
|
15
|
+
const letra = await buscar(name, {
|
|
14
16
|
version,
|
|
15
17
|
directorio,
|
|
16
|
-
})
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
silabas.push(letra);
|
|
21
|
+
names.add(name);
|
|
22
|
+
|
|
23
|
+
for (const dep of letra.dependencies || []) {
|
|
24
|
+
if (names.has(dep))
|
|
25
|
+
continue;
|
|
26
|
+
|
|
27
|
+
const letra = await buscar(dep, {
|
|
28
|
+
version,
|
|
29
|
+
directorio,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
silabas.unshift(letra);
|
|
33
|
+
names.add(name);
|
|
34
|
+
}
|
|
17
35
|
}
|
|
18
36
|
|
|
19
37
|
return [directorio, await Promise.all(silabas)];
|
package/lib/hablar.js
CHANGED
package/lib/parser/download.js
CHANGED
package/lib/parser/execute.js
CHANGED
package/lib/parser/extract.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {readdir} from 'node:fs/promises';
|
|
2
|
+
|
|
3
|
+
const isString = (a) => typeof a === 'string';
|
|
4
|
+
const {keys} = Object;
|
|
5
|
+
const names = await readdir(new URL('../letras', import.meta.url));
|
|
6
|
+
const {log} = console;
|
|
7
|
+
|
|
8
|
+
const bins = [];
|
|
9
|
+
|
|
10
|
+
for (const name of names) {
|
|
11
|
+
const {default: letra} = await import(new URL(`../letras/${name}/${name}.json`, import.meta.url), {
|
|
12
|
+
with: {
|
|
13
|
+
type: 'json',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
if (!letra.bin)
|
|
18
|
+
continue;
|
|
19
|
+
|
|
20
|
+
if (isString(letra.bin)) {
|
|
21
|
+
bins.push(`type ${letra.name}`);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const bin of keys(letra.bin)) {
|
|
26
|
+
bins.push(`type ${bin}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
log(bins.join(' && '));
|