palabra 1.2.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,8 @@
1
+ 2026.04.06, v1.3.0
2
+
3
+ feature:
4
+ - f0b2ce6 palabra: env: add
5
+
1
6
  2026.04.06, v1.2.0
2
7
 
3
8
  feature:
@@ -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
+ }
@@ -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,5 +1,6 @@
1
- import {basename, normalize} 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 = [];
@@ -10,16 +11,14 @@ export const parse = (letra) => {
10
11
  camino,
11
12
  } = letra;
12
13
 
13
- const renderedLink = rendy(link, letra);
14
- const filename = basename(renderedLink);
15
14
  const dirBin = normalize(`${camino}/../bin/${name}`);
16
15
 
17
- commands.push(`wget ${renderedLink}`);
18
- commands.push(`tar zxf ${filename}`);
19
- commands.push(`rm ${filename}`);
20
- commands.push(`mkdir -p ${camino}`);
21
- commands.push(`rm -rf ${camino}/${name}`);
22
- commands.push(`mv -f ${name} ${camino}/${name}`);
16
+ if (link.endsWith('tgz'))
17
+ commands.push(...unpack(letra));
18
+
19
+ if (link.endsWith('sh'))
20
+ commands.push(...execute(letra));
21
+
23
22
  commands.push(`ln -fs ${camino}/${name}/${bin} ${dirBin}`);
24
23
 
25
24
  return commands;
@@ -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.2.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",