palabra 1.7.1 → 1.8.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,13 @@
1
+ 2026.04.08, v1.8.1
2
+
3
+ feature:
4
+ - 2fd25ef palabra: camino -> directorio
5
+
6
+ 2026.04.08, v1.8.0
7
+
8
+ feature:
9
+ - b6bc009 palabra: i: add
10
+
1
11
  2026.04.07, v1.7.1
2
12
 
3
13
  fix:
@@ -33,7 +43,7 @@ feature:
33
43
  2026.04.06, v1.2.0
34
44
 
35
45
  feature:
36
- - b14dbe6 palabra: camino: add
46
+ - b14dbe6 palabra: directorio: add
37
47
 
38
48
  2026.04.06, v1.1.0
39
49
 
package/README.md CHANGED
@@ -9,7 +9,10 @@
9
9
  [CoverageURL]: https://coveralls.io/github/coderaiser/palabra?branch=master
10
10
  [CoverageIMGURL]: https://coveralls.io/repos/coderaiser/palabra/badge.svg?branch=master&service=github
11
11
 
12
- Install software easer then ever before.
12
+ Install software easier then ever before.
13
+
14
+ <img width="546" height="405" alt="image" src="https://github.com/user-attachments/assets/272fb625-a51e-488f-9d58-89268f810efb" />
15
+
13
16
 
14
17
  ## Install
15
18
 
@@ -17,7 +20,7 @@ Install software easer then ever before.
17
20
  npm i palabra -g
18
21
  ```
19
22
 
20
- # Usage
23
+ ## Usage
21
24
 
22
25
  First thing you should do is:
23
26
 
@@ -25,7 +28,7 @@ First thing you should do is:
25
28
 
26
29
  ```json
27
30
  {
28
- "camino": "~/.local/src",
31
+ "directorio": "~/.local/src",
29
32
  "letras": {
30
33
  "fasm": "*"
31
34
  }
@@ -38,6 +41,14 @@ Then run:
38
41
  palabra
39
42
  ```
40
43
 
44
+ ### `i`
45
+
46
+ You can also use interactive mode:
47
+
48
+ ```
49
+ palabra i bun node deno rust go nvim fasm -d /usr/local/src
50
+ ```
51
+
41
52
  That's it!
42
53
 
43
54
  ## License
package/bin/palabra.js CHANGED
@@ -1,25 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import {join} from 'node:path';
4
3
  import process from 'node:process';
5
4
  import {execa} from 'execa';
6
5
  import {tryToCatch} from 'try-to-catch';
7
- import {create} from '../lib/palabra.js';
6
+ import {parseArgs} from '../lib/cli/parse-args.js';
7
+ import {instalar} from '../lib/cli/instalar.js';
8
8
 
9
- const [arg] = process.argv.slice(2);
10
- const name = join(process.cwd(), '.palabra.json');
9
+ const argv = process.argv.slice(2);
10
+ const args = parseArgs(argv);
11
11
 
12
- const {default: palabras} = await import(name, {
13
- with: {
14
- type: 'json',
15
- },
16
- });
12
+ const instrucciones = args._.shift();
13
+
14
+ let cmd = '';
17
15
 
18
- const cmd = await create(palabras);
16
+ if (!instrucciones || instrucciones === 'i')
17
+ cmd = await instalar(args._);
19
18
 
20
- if (arg !== '-q')
19
+ if (!args.quiet)
21
20
  console.log(`> ${cmd}`);
22
21
 
22
+ if (args['dry-run'])
23
+ process.exit(0);
24
+
23
25
  const [error] = await tryToCatch(execa, cmd, {
24
26
  shell: '/bin/bash',
25
27
  stdio: 'inherit',
@@ -27,3 +29,4 @@ const [error] = await tryToCatch(execa, cmd, {
27
29
 
28
30
  if (error)
29
31
  process.exitCode = error.exitCode;
32
+
@@ -2,6 +2,6 @@
2
2
  "name": "bun",
3
3
  "url": "https://bun.sh/install",
4
4
  "env": {
5
- "BUN_INSTALL": "{{ camino }}/bun"
5
+ "BUN_INSTALL": "{{ directorio }}/bun"
6
6
  }
7
7
  }
@@ -2,6 +2,6 @@
2
2
  "name": "deno",
3
3
  "url": "https://deno.land/install.sh",
4
4
  "env": {
5
- "DENO_DIR": "{{ camino }}/deno"
5
+ "DENO_DIR": "{{ directorio }}/deno"
6
6
  }
7
7
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "nvim",
3
- "version": "0.12.0",
4
- "url": "https://github.com/neovim/neovim/releases/download/v{{ version }}/nvim-linux-x86_64.tar.gz"
5
- }
2
+ "name": "nvim",
3
+ "version": "0.12.0",
4
+ "url": "https://github.com/neovim/neovim/releases/download/v{{ version }}/nvim-linux-x86_64.tar.gz"
5
+ }
@@ -3,7 +3,7 @@
3
3
  "url": "https://sh.rustup.rs",
4
4
  "confirmar": false,
5
5
  "env": {
6
- "RUSTUP_HOME": "{{ camino }}/rustup",
7
- "CARGO_HOME": "{{ camino }}/cargo"
6
+ "RUSTUP_HOME": "{{ directorio }}/rustup",
7
+ "CARGO_HOME": "{{ directorio }}/cargo"
8
8
  }
9
9
  }
package/lib/buscar.js CHANGED
@@ -10,14 +10,14 @@ export const buscar = async (name, values = {}) => {
10
10
  };
11
11
 
12
12
  const version = values.version || data.version;
13
- const {camino} = values;
13
+ const {directorio} = values;
14
14
 
15
15
  return {
16
16
  encontro: true,
17
17
  confirmar: true,
18
18
  ...data,
19
19
  version,
20
- camino,
20
+ directorio,
21
21
  };
22
22
  };
23
23
 
@@ -0,0 +1,11 @@
1
+ import {create, createPalabra} from '../palabra.js';
2
+ import {readPalabra} from './read-palabra.js';
3
+
4
+ export const instalar = async (nombres) => {
5
+ if (nombres) {
6
+ const palabra = createPalabra(nombres);
7
+ return create(palabra);
8
+ }
9
+
10
+ return await readPalabra();
11
+ };
@@ -0,0 +1,12 @@
1
+ import yargsParse from 'yargs-parser';
2
+
3
+ export const parseArgs = (args) => {
4
+ return yargsParse(args, {
5
+ alias: {
6
+ q: 'quiet',
7
+ h: 'help',
8
+ d: 'directorio',
9
+ },
10
+ boolean: ['quiet', 'help', 'dry-run', 'directorio'],
11
+ });
12
+ };
@@ -0,0 +1,17 @@
1
+ import process from 'node:process';
2
+ import {join} from 'node:path';
3
+
4
+ const {cwd: _cwd} = process;
5
+
6
+ export const readPalabra = async (nombres, overrides = {}) => {
7
+ const {cwd = _cwd} = overrides;
8
+ const name = join(cwd(), '.palabra.json');
9
+
10
+ const {default: palabra} = await import(name, {
11
+ with: {
12
+ type: 'json',
13
+ },
14
+ });
15
+
16
+ return palabra;
17
+ };
package/lib/escuchar.js CHANGED
@@ -5,14 +5,14 @@ const {entries} = Object;
5
5
  export const escuchar = async (palabras) => {
6
6
  const silabas = [];
7
7
  const {
8
- camino = '~/.local/src',
8
+ directorio = '~/.local/src',
9
9
  letras = [],
10
10
  } = palabras;
11
11
 
12
12
  for (const [name, version] of entries(letras)) {
13
13
  silabas.push(buscar(name, {
14
14
  version,
15
- camino,
15
+ directorio,
16
16
  }));
17
17
  }
18
18
 
package/lib/palabra.js CHANGED
@@ -1,9 +1,36 @@
1
1
  import {escuchar} from './escuchar.js';
2
2
  import {hablar} from './hablar.js';
3
3
 
4
+ const isString = (a) => typeof a === 'string';
5
+
4
6
  export const create = async (palabras) => {
5
7
  const silabas = await escuchar(palabras);
6
8
  const commands = hablar(silabas);
7
9
 
8
10
  return commands.join(' && ');
9
11
  };
12
+
13
+ export const createPalabra = (nombres, letras) => {
14
+ if (letras)
15
+ return {
16
+ letras,
17
+ };
18
+
19
+ if (isString(nombres))
20
+ return {
21
+ letras: {
22
+ [nombres]: '*',
23
+ },
24
+ };
25
+
26
+ const newLetras = {};
27
+
28
+ for (const nombre of nombres) {
29
+ newLetras[nombre] = '*';
30
+ }
31
+
32
+ return {
33
+ letras: newLetras,
34
+ };
35
+ };
36
+
@@ -8,7 +8,7 @@ const isString = (a) => typeof a === 'string';
8
8
 
9
9
  const addDefaults = (letra) => ({
10
10
  confirmar: true,
11
- camino: '~/.local/src',
11
+ directorio: '~/.local/src',
12
12
  ...letra,
13
13
  });
14
14
 
@@ -20,7 +20,7 @@ export const parse = (letra) => {
20
20
  url,
21
21
  name,
22
22
  bin = `/bin/${name}`,
23
- camino,
23
+ directorio,
24
24
  } = letra;
25
25
 
26
26
  const ext = extname(new URL(url).pathname);
@@ -32,7 +32,7 @@ export const parse = (letra) => {
32
32
  commands.push(...execute(letra));
33
33
 
34
34
  commands.push(...createSymlinks({
35
- camino,
35
+ directorio,
36
36
  name,
37
37
  bin,
38
38
  }));
@@ -40,13 +40,13 @@ export const parse = (letra) => {
40
40
  return commands;
41
41
  };
42
42
 
43
- function createSymlinks({camino, name, bin}) {
43
+ function createSymlinks({directorio, name, bin}) {
44
44
  const commands = [];
45
45
  const parsedBin = parseBin(name, bin);
46
46
 
47
47
  for (const [name, from] of entries(parsedBin)) {
48
- const binFrom = join(camino, from);
49
- const binTo = join(camino, '..', `bin/${name}`);
48
+ const binFrom = join(directorio, from);
49
+ const binTo = join(directorio, '..', `bin/${name}`);
50
50
 
51
51
  commands.push(`ln -fs ${binFrom} ${binTo}`);
52
52
  }
@@ -6,16 +6,16 @@ export const unpack = (letra) => {
6
6
  const {
7
7
  name,
8
8
  url,
9
- camino,
9
+ directorio,
10
10
  } = letra;
11
11
 
12
12
  const renderedurl = rendy(url, letra);
13
13
  const filename = basename(renderedurl);
14
14
 
15
15
  commands.push(`wget ${renderedurl}`);
16
- commands.push(`rm -rf ${camino}/${name}`);
17
- commands.push(`mkdir -p ${camino}/${name}`);
18
- commands.push(`tar zxf ${filename} -C ${camino}/${name}`);
16
+ commands.push(`rm -rf ${directorio}/${name}`);
17
+ commands.push(`mkdir -p ${directorio}/${name}`);
18
+ commands.push(`tar zxf ${filename} -C ${directorio}/${name}`);
19
19
  commands.push(`rm ${filename}`);
20
20
 
21
21
  return commands;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palabra",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Palabra software installer",
@@ -29,7 +29,8 @@
29
29
  "dependencies": {
30
30
  "execa": "^9.6.1",
31
31
  "rendy": "^5.0.2",
32
- "try-to-catch": "^4.0.5"
32
+ "try-to-catch": "^4.0.5",
33
+ "yargs-parser": "^22.0.0"
33
34
  },
34
35
  "keywords": [
35
36
  "putout",