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 CHANGED
@@ -1,3 +1,14 @@
1
+ 2026.04.12, v1.21.1
2
+
3
+ feature:
4
+ - 24b1f75 palabra: escuchar: duplicates
5
+ - 85c601a letras: node: add
6
+
7
+ 2026.04.12, v1.21.0
8
+
9
+ feature:
10
+ - a0ae29e palabra: PALABRA_DIR
11
+
1
12
  2026.04.11, v1.20.2
2
13
 
3
14
  fix:
package/README.md CHANGED
@@ -70,6 +70,10 @@ palabra l
70
70
  ]
71
71
  ```
72
72
 
73
+ ## Env variables
74
+
75
+ Use `PALABRA_DIR` to override default installation path `~/.local/src`.
76
+
73
77
  That's it!
74
78
 
75
79
  ## License
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "node",
3
+ "dependencies": ["nvm"],
4
+ "bin": "/${NVM_DIR}/versions/node/$(node -v)/bin/node",
5
+ "beforeInstall": [
6
+ ". {{ directorio }}/nvm.sh",
7
+ "nvm i node"
8
+ ]
9
+ }
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
  },
@@ -6,6 +6,7 @@ export const instalar = async (nombres, {directorio}) => {
6
6
  const palabra = createPalabra(nombres, {
7
7
  directorio,
8
8
  });
9
+
9
10
  return create(palabra);
10
11
  }
11
12
 
@@ -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
- silabas.push(buscar(name, {
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
@@ -22,4 +22,3 @@ export const hablar = (silabas, {directorio} = {}) => {
22
22
 
23
23
  return commands;
24
24
  };
25
-
@@ -18,4 +18,3 @@ export const download = (letra) => {
18
18
 
19
19
  return commands;
20
20
  };
21
-
@@ -6,6 +6,10 @@ const isBool = (a) => typeof a === 'boolean';
6
6
 
7
7
  export const isExecute = (letra) => {
8
8
  const {url} = letra;
9
+
10
+ if (!url)
11
+ return false;
12
+
9
13
  const ext = extname(new URL(url).pathname);
10
14
 
11
15
  if (isBool(letra.execute) && !letra.execute)
@@ -11,7 +11,11 @@ const CONTINUE = '-c';
11
11
  const NOT_OVERWRITE = '-nc';
12
12
 
13
13
  export const isArchive = ({url}) => {
14
+ if (!url)
15
+ return false;
16
+
14
17
  const ext = extname(new URL(url).pathname);
18
+
15
19
  return exts.includes(ext);
16
20
  };
17
21
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palabra",
3
- "version": "1.20.2",
3
+ "version": "1.21.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Palabra software installer",
@@ -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(' && '));