palabra 1.1.0 → 1.3.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.06, v1.3.0
2
+
3
+ feature:
4
+ - f0b2ce6 palabra: env: add
5
+
6
+ 2026.04.06, v1.2.0
7
+
8
+ feature:
9
+ - b14dbe6 palabra: camino: add
10
+
1
11
  2026.04.06, v1.1.0
2
12
 
3
13
  feature:
package/README.md CHANGED
@@ -25,6 +25,7 @@ First thing you should do is:
25
25
 
26
26
  ```json
27
27
  {
28
+ "camino": "~/.local/src",
28
29
  "letras": {
29
30
  "fasm": "*"
30
31
  }
package/bin/palabra.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  import {join} from 'node:path';
3
4
  import process from 'node:process';
4
5
  import {execa} from 'execa';
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "deno",
3
+ "link": "https://deno.land/install.sh",
4
+ "bin": "bin/deno",
5
+ "env": {
6
+ "DENO_DIR": "{{ camino }}"
7
+ }
8
+ }
package/lib/buscar.js CHANGED
@@ -10,11 +10,13 @@ export const buscar = async (name, values = {}) => {
10
10
  };
11
11
 
12
12
  const version = values.version || data.version;
13
+ const {camino} = values;
13
14
 
14
15
  return {
15
16
  encontro: true,
16
17
  ...data,
17
18
  version,
19
+ camino,
18
20
  };
19
21
  };
20
22
 
package/lib/escuchar.js CHANGED
@@ -4,12 +4,17 @@ const {entries} = Object;
4
4
 
5
5
  export const escuchar = async (palabras) => {
6
6
  const silabas = [];
7
- const {letras = []} = palabras;
7
+ const {
8
+ camino = '~/.local/src',
9
+ letras = [],
10
+ } = palabras;
8
11
 
9
12
  for (const [name, version] of entries(letras)) {
10
- silabas.push(buscar(name, version));
13
+ silabas.push(buscar(name, {
14
+ version,
15
+ camino,
16
+ }));
11
17
  }
12
18
 
13
19
  return await Promise.all(silabas);
14
20
  };
15
-
package/lib/hablar.js CHANGED
@@ -18,4 +18,3 @@ export const hablar = (silabas) => {
18
18
 
19
19
  return commands;
20
20
  };
21
-
package/lib/palabra.js CHANGED
@@ -7,4 +7,3 @@ export const create = async (palabras) => {
7
7
 
8
8
  return commands.join(' && ');
9
9
  };
10
-
@@ -0,0 +1,27 @@
1
+ import {rendy} from 'rendy';
2
+
3
+ const {entries} = Object;
4
+
5
+ export const execute = (letra) => {
6
+ const commands = [];
7
+ const {
8
+ link,
9
+ env = {},
10
+ } = letra;
11
+
12
+ const envLine = [];
13
+
14
+ for (const [name, value] of entries(env)) {
15
+ const envValue = rendy(value, letra);
16
+ envLine.push(`${name}=${envValue}`);
17
+ }
18
+
19
+ if (!envLine.length) {
20
+ commands.push(`curl -fsSL ${link} | sh`);
21
+ return commands;
22
+ }
23
+
24
+ commands.push(`${envLine.join(' ')} curl -fsSL ${link} | sh`);
25
+
26
+ return commands;
27
+ };
@@ -1,20 +1,25 @@
1
- import {basename, extname} from 'node:path';
2
- import {rendy} from 'rendy';
1
+ import {normalize} from 'node:path';
2
+ import {unpack} from './unpack.js';
3
+ import {execute} from './execute.js';
3
4
 
4
5
  export const parse = (letra) => {
5
6
  const commands = [];
6
- const {link, name, bin} = letra;
7
- const renderedLink = rendy(link, letra);
8
- const filename = basename(renderedLink);
7
+ const {
8
+ link,
9
+ name,
10
+ bin,
11
+ camino,
12
+ } = letra;
9
13
 
10
- commands.push(`wget ${renderedLink}`);
11
- commands.push(`tar zxf ${filename}`);
12
- commands.push(`rm ${filename}`);
13
- commands.push(`mkdir -p ~/.local/src`);
14
- commands.push(`rm -rf ~/.local/src/${name}`);
15
- commands.push(`mv -f ${name} ~/.local/src/${name}`);
16
- commands.push(`ln -fs ~/.local/src/${name}/${bin} ~/.local/bin/${name}`);
14
+ const dirBin = normalize(`${camino}/../bin/${name}`);
15
+
16
+ if (link.endsWith('tgz'))
17
+ commands.push(...unpack(letra));
18
+
19
+ if (link.endsWith('sh'))
20
+ commands.push(...execute(letra));
21
+
22
+ commands.push(`ln -fs ${camino}/${name}/${bin} ${dirBin}`);
17
23
 
18
24
  return commands;
19
25
  };
20
-
@@ -0,0 +1,23 @@
1
+ import {basename} from 'node:path';
2
+ import {rendy} from 'rendy';
3
+
4
+ export const unpack = (letra) => {
5
+ const commands = [];
6
+ const {
7
+ name,
8
+ link,
9
+ camino,
10
+ } = letra;
11
+
12
+ const renderedLink = rendy(link, letra);
13
+ const filename = basename(renderedLink);
14
+
15
+ commands.push(`wget ${renderedLink}`);
16
+ commands.push(`tar zxf ${filename}`);
17
+ commands.push(`rm ${filename}`);
18
+ commands.push(`mkdir -p ${camino}`);
19
+ commands.push(`rm -rf ${camino}/${name}`);
20
+ commands.push(`mv -f ${name} ${camino}/${name}`);
21
+
22
+ return commands;
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palabra",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Palabra software installer",