palabra 1.3.0 → 1.4.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 +6 -0
- package/letras/bun.json +7 -0
- package/letras/deno.json +1 -2
- package/letras/fasm.json +1 -1
- package/lib/parser/execute.js +5 -3
- package/lib/parser/parser.js +10 -7
- package/lib/parser/unpack.js +4 -4
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/letras/bun.json
ADDED
package/letras/deno.json
CHANGED
package/letras/fasm.json
CHANGED
package/lib/parser/execute.js
CHANGED
|
@@ -5,7 +5,7 @@ const {entries} = Object;
|
|
|
5
5
|
export const execute = (letra) => {
|
|
6
6
|
const commands = [];
|
|
7
7
|
const {
|
|
8
|
-
|
|
8
|
+
url,
|
|
9
9
|
env = {},
|
|
10
10
|
} = letra;
|
|
11
11
|
|
|
@@ -16,12 +16,14 @@ export const execute = (letra) => {
|
|
|
16
16
|
envLine.push(`${name}=${envValue}`);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
const curl = `bash -c "$(curl -fsSL ${url})"`;
|
|
20
|
+
|
|
19
21
|
if (!envLine.length) {
|
|
20
|
-
commands.push(
|
|
22
|
+
commands.push(curl);
|
|
21
23
|
return commands;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
commands.push(`${envLine.join(' ')}
|
|
26
|
+
commands.push(`${envLine.join(' ')} ${curl}`);
|
|
25
27
|
|
|
26
28
|
return commands;
|
|
27
29
|
};
|
package/lib/parser/parser.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {extname, join} from 'node:path';
|
|
2
2
|
import {unpack} from './unpack.js';
|
|
3
3
|
import {execute} from './execute.js';
|
|
4
4
|
|
|
5
5
|
export const parse = (letra) => {
|
|
6
6
|
const commands = [];
|
|
7
7
|
const {
|
|
8
|
-
|
|
8
|
+
url,
|
|
9
9
|
name,
|
|
10
|
-
bin
|
|
10
|
+
bin = `/bin/${name}`,
|
|
11
11
|
camino,
|
|
12
12
|
} = letra;
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const binTo = join(camino, '..', `bin/${name}`);
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const ext = extname(url);
|
|
17
|
+
|
|
18
|
+
if (ext === '.tgz')
|
|
17
19
|
commands.push(...unpack(letra));
|
|
18
20
|
|
|
19
|
-
if (
|
|
21
|
+
if (!ext || ext === '.sh')
|
|
20
22
|
commands.push(...execute(letra));
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
const binFrom = join(camino, name, bin);
|
|
25
|
+
commands.push(`ln -fs ${binFrom} ${binTo}`);
|
|
23
26
|
|
|
24
27
|
return commands;
|
|
25
28
|
};
|
package/lib/parser/unpack.js
CHANGED
|
@@ -5,14 +5,14 @@ export const unpack = (letra) => {
|
|
|
5
5
|
const commands = [];
|
|
6
6
|
const {
|
|
7
7
|
name,
|
|
8
|
-
|
|
8
|
+
url,
|
|
9
9
|
camino,
|
|
10
10
|
} = letra;
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
const filename = basename(
|
|
12
|
+
const renderedurl = rendy(url, letra);
|
|
13
|
+
const filename = basename(renderedurl);
|
|
14
14
|
|
|
15
|
-
commands.push(`wget ${
|
|
15
|
+
commands.push(`wget ${renderedurl}`);
|
|
16
16
|
commands.push(`tar zxf ${filename}`);
|
|
17
17
|
commands.push(`rm ${filename}`);
|
|
18
18
|
commands.push(`mkdir -p ${camino}`);
|