palabra 1.19.4 → 1.20.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.
package/ChangeLog CHANGED
@@ -1,3 +1,13 @@
1
+ 2026.04.11, v1.20.0
2
+
3
+ feature:
4
+ - 66506d8 palabra: letras: create bin directory only once at the beginning
5
+
6
+ 2026.04.11, v1.19.5
7
+
8
+ feature:
9
+ - cfffde2 palabra: letras: bin
10
+
1
11
  2026.04.11, v1.19.4
2
12
 
3
13
  fix:
@@ -5,10 +5,5 @@
5
5
  "bin": {
6
6
  "bin": "bin"
7
7
  },
8
- "execute": false,
9
- "commands": [
10
- "mkdir -p {{ directorio }}/bin",
11
- "mv -f {{ directorio }}/bin_{{ version }}_linux_amd64 {{ directorio }}/bin/bin",
12
- "chmod +x {{ directorio }}/bin/bin"
13
- ]
8
+ "preparado": true
14
9
  }
package/lib/escuchar.js CHANGED
@@ -16,5 +16,5 @@ export const escuchar = async (palabras) => {
16
16
  }));
17
17
  }
18
18
 
19
- return await Promise.all(silabas);
19
+ return [directorio, await Promise.all(silabas)];
20
20
  };
package/lib/hablar.js CHANGED
@@ -1,8 +1,14 @@
1
+ import {join} from 'node:path';
1
2
  import {parse} from './parser/parser.js';
2
3
 
3
- export const hablar = (silabas) => {
4
+ export const hablar = (silabas, {directorio} = {}) => {
4
5
  const commands = [];
5
6
 
7
+ if (directorio) {
8
+ const binDir = join(directorio, '..', `bin`);
9
+ commands.push(`mkdir -p ${binDir}`);
10
+ }
11
+
6
12
  for (const {encontro, ...letra} of silabas) {
7
13
  const {name} = letra;
8
14
 
@@ -16,3 +22,4 @@ export const hablar = (silabas) => {
16
22
 
17
23
  return commands;
18
24
  };
25
+
package/lib/palabra.js CHANGED
@@ -4,8 +4,10 @@ import {hablar} from './hablar.js';
4
4
  const isString = (a) => typeof a === 'string';
5
5
 
6
6
  export const create = async (palabras) => {
7
- const silabas = await escuchar(palabras);
8
- const commands = hablar(silabas);
7
+ const [directorio, silabas] = await escuchar(palabras);
8
+ const commands = hablar(silabas, {
9
+ directorio,
10
+ });
9
11
 
10
12
  return commands.join(' && ');
11
13
  };
@@ -0,0 +1,21 @@
1
+ import {join} from 'node:path';
2
+ import {rendy} from 'rendy';
3
+
4
+ export const download = (letra) => {
5
+ const {
6
+ name,
7
+ url,
8
+ directorio,
9
+ } = letra;
10
+
11
+ const commands = [];
12
+ const urlRendered = rendy(url, letra);
13
+ const fullName = join(directorio, name, name);
14
+
15
+ commands.push(`mkdir -p ${directorio}/${name}`);
16
+ commands.push(`wget ${urlRendered} -O ${fullName}`);
17
+ commands.push(`chmod +x ${fullName}`);
18
+
19
+ return commands;
20
+ };
21
+
@@ -4,6 +4,7 @@ import {extract, isArchive} from './extract.js';
4
4
  import {execute, isExecute} from './execute.js';
5
5
  import {parseEnv} from './parse-env.js';
6
6
  import {run} from './run.js';
7
+ import {download} from './download.js';
7
8
 
8
9
  const isBool = (a) => typeof a === 'boolean';
9
10
 
@@ -39,10 +40,11 @@ export const parse = (letra) => {
39
40
  envLine,
40
41
  }));
41
42
 
42
- if (isArchive(letra))
43
+ if (letra.preparado)
44
+ commands.push(...download(letra));
45
+ else if (isArchive(letra))
43
46
  commands.push(...extract(letra));
44
-
45
- if (isExecute(letra))
47
+ else if (isExecute(letra))
46
48
  commands.push(...execute(letra));
47
49
 
48
50
  if (isBool(letra.execute) && !letra.execute) {
@@ -84,7 +86,6 @@ function createSymlinks({name, directorio, hogar, bin}) {
84
86
 
85
87
  const binDir = join(directorio, '..', `bin`);
86
88
 
87
- commands.push(`mkdir -p ${binDir}`);
88
89
  for (const [name, from] of entries(parsedBin)) {
89
90
  const binFrom = join(directorio, from);
90
91
  const binTo = join(binDir, name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palabra",
3
- "version": "1.19.4",
3
+ "version": "1.20.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Palabra software installer",