palabra 2.14.0 → 2.15.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 +10 -0
- package/letras/gh/gh.json +12 -8
- package/lib/parser/extract.js +7 -1
- package/lib/parser/rename.js +14 -4
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/letras/gh/gh.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
"name": "gh",
|
|
3
|
+
"version": "2.93.0",
|
|
4
|
+
"url": {
|
|
5
|
+
"darwin": "https://github.com/cli/cli/releases/download/v{{ version }}/gh_{{ version }}_macOS_arm64.zip",
|
|
6
|
+
"linux": "https://github.com/cli/cli/releases/download/v{{ version }}/gh_{{ version }}_linux_amd64.tar.gz"
|
|
7
|
+
},
|
|
8
|
+
"test": "{{ name }} version",
|
|
9
|
+
"rename": [
|
|
10
|
+
"gh_{{ version }}_macOS_arm64",
|
|
11
|
+
"gh_{{ version }}_linux_amd64"
|
|
12
|
+
]
|
|
13
|
+
}
|
package/lib/parser/extract.js
CHANGED
|
@@ -9,6 +9,7 @@ const exts = [
|
|
|
9
9
|
'.tgz',
|
|
10
10
|
'.gz',
|
|
11
11
|
'.xz',
|
|
12
|
+
'.zip',
|
|
12
13
|
];
|
|
13
14
|
|
|
14
15
|
const CONTINUE = '-c';
|
|
@@ -40,7 +41,12 @@ export const extract = (letra) => {
|
|
|
40
41
|
commands.push(`wget ${CONTINUE} ${renderedURL} -O ${tmpFile}`);
|
|
41
42
|
commands.push(`rm -rf ${directorio}/${name}`);
|
|
42
43
|
commands.push(`mkdir -p ${directorio}/${name}`);
|
|
43
|
-
|
|
44
|
+
|
|
45
|
+
if (tmpFile.endsWith('.zip'))
|
|
46
|
+
commands.push(`unzip -q ${tmpFile} -d ${renderedextractDirectory}`);
|
|
47
|
+
else
|
|
48
|
+
commands.push(`tar xf ${tmpFile} -C ${renderedextractDirectory}`);
|
|
49
|
+
|
|
44
50
|
commands.push(`rm ${tmpFile}`);
|
|
45
51
|
|
|
46
52
|
return commands;
|
package/lib/parser/rename.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import {join} from 'node:path';
|
|
2
2
|
import {rendy} from 'rendy';
|
|
3
3
|
|
|
4
|
+
const {isArray} = Array;
|
|
5
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
6
|
+
|
|
4
7
|
export const rename = (letra) => {
|
|
5
8
|
const {name, directorio} = letra;
|
|
6
9
|
const commands = [];
|
|
7
|
-
const renderedRename = rendy(letra.rename, letra);
|
|
8
|
-
const from = join(directorio, renderedRename);
|
|
9
|
-
const to = join(directorio, name);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
for (const rawFrom of maybeArray(letra.rename)) {
|
|
12
|
+
const renderedRename = rendy(rawFrom, letra);
|
|
13
|
+
const from = join(directorio, renderedRename);
|
|
14
|
+
const to = join(directorio, name);
|
|
15
|
+
|
|
16
|
+
const rm = `rm -rf ${to}`;
|
|
17
|
+
const mv = `mv -f ${from} ${to}`;
|
|
18
|
+
|
|
19
|
+
commands.push(`[ -e ${from} ] && ${rm}`);
|
|
20
|
+
commands.push(`[ -e ${from} ] && ${mv}`);
|
|
21
|
+
}
|
|
12
22
|
|
|
13
23
|
return commands;
|
|
14
24
|
};
|