palabra 1.7.1 → 1.8.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,8 @@
1
+ 2026.04.08, v1.8.0
2
+
3
+ feature:
4
+ - b6bc009 palabra: i: add
5
+
1
6
  2026.04.07, v1.7.1
2
7
 
3
8
  fix:
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
 
@@ -38,6 +41,14 @@ Then run:
38
41
  palabra
39
42
  ```
40
43
 
44
+ ### `i`nstall
45
+
46
+ You can also use interactive mode:
47
+
48
+ ```
49
+ palabra i bun node deno rust go nvim fasm
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/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
+
@@ -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
+ }
@@ -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,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/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
+
@@ -0,0 +1,14 @@
1
+ import yargsParse from 'yargs-parser';
2
+
3
+ export const parseArgs = (args) => {
4
+ return yargsParse(args, {
5
+ alias: {
6
+ 'install': 'i',
7
+ 'instalar': 'install',
8
+ 'quiet': 'q',
9
+ 'help': 'h',
10
+ 'dry-run': 'd',
11
+ },
12
+ boolean: ['install', 'quiet', 'help', 'dry-run'],
13
+ });
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palabra",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
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",