palabra 1.0.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/LICENSE +21 -0
- package/README.md +46 -0
- package/bin/palabras.js +24 -0
- package/letras/fasm.json +6 -0
- package/lib/buscar.js +29 -0
- package/lib/escuchar.js +15 -0
- package/lib/hablar.js +21 -0
- package/lib/palabras.js +10 -0
- package/lib/parser/parser.js +14 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) coderaiser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 民 Palabra [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
[NPMURL]: https://npmjs.org/package/palabra "npm"
|
|
6
|
+
[NPMIMGURL]: https://img.shields.io/npm/v/palabra.svg?style=flat
|
|
7
|
+
[BuildStatusURL]: https://github.com/coderaiser/palabra/actions?query=workflow%3A%22Node+CI%22 "Build Status"
|
|
8
|
+
[BuildStatusIMGURL]: https://github.com/coderaiser/palabra/workflows/Node%20CI/badge.svg
|
|
9
|
+
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
|
|
10
|
+
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
|
|
11
|
+
[CoverageURL]: https://coveralls.io/github/coderaiser/palabra?branch=master
|
|
12
|
+
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/palabra/badge.svg?branch=master&service=github
|
|
13
|
+
|
|
14
|
+
Install software easer then ever before.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npm i palabra -g
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
# Usage
|
|
23
|
+
|
|
24
|
+
First thing you should do is:
|
|
25
|
+
|
|
26
|
+
- ✅ create `.palabra.json` with soft you want to install, like this:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"letras": {
|
|
31
|
+
"fasm": "*"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then run:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
palabra
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
That's it!
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
MIT
|
package/bin/palabras.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {join} from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import {execa} from 'execa';
|
|
4
|
+
import {tryToCatch} from 'try-to-catch';
|
|
5
|
+
import {create} from '../lib/palabras.js';
|
|
6
|
+
|
|
7
|
+
const [arg] = process.argv.slice(2);
|
|
8
|
+
const name = join(process.cwd(), '.palabras.json');
|
|
9
|
+
|
|
10
|
+
const {default: palabras} = await import(name, {
|
|
11
|
+
with: {
|
|
12
|
+
type: 'json',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const cmd = await create(palabras);
|
|
17
|
+
|
|
18
|
+
if (arg !== '-q')
|
|
19
|
+
console.log(`> ${cmd}`);
|
|
20
|
+
|
|
21
|
+
const [error] = await tryToCatch(execa, cmd, {shell: '/bin/bash', stdio: 'inherit'});
|
|
22
|
+
|
|
23
|
+
if (error)
|
|
24
|
+
process.exitCode = error.exitCode;
|
package/letras/fasm.json
ADDED
package/lib/buscar.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {tryToCatch} from 'try-to-catch';
|
|
2
|
+
|
|
3
|
+
export const buscar = async (name, values = {}) => {
|
|
4
|
+
const [, data] = await tryToCatch(importPalabra, name);
|
|
5
|
+
|
|
6
|
+
if (!data)
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
encontro: false,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const version = values.version || data.version;
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
encontro: true,
|
|
16
|
+
...data,
|
|
17
|
+
version,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
async function importPalabra(name) {
|
|
22
|
+
const {default: letra} = await import(`../letras/${name}.json`, {
|
|
23
|
+
with: {
|
|
24
|
+
type: 'json',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return letra;
|
|
29
|
+
}
|
package/lib/escuchar.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {buscar} from './buscar.js';
|
|
2
|
+
|
|
3
|
+
const {entries} = Object;
|
|
4
|
+
|
|
5
|
+
export const escuchar = async (palabras) => {
|
|
6
|
+
const silabas = [];
|
|
7
|
+
const {letras = []} = palabras;
|
|
8
|
+
|
|
9
|
+
for (const [name, version] of entries(letras)) {
|
|
10
|
+
silabas.push(buscar(name, version));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return await Promise.all(silabas);
|
|
14
|
+
};
|
|
15
|
+
|
package/lib/hablar.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {parse} from './parser/parser.js';
|
|
2
|
+
|
|
3
|
+
export const hablar = (silabas) => {
|
|
4
|
+
const commands = [];
|
|
5
|
+
|
|
6
|
+
for (const {encontro, ...letra} of silabas) {
|
|
7
|
+
const {name} = letra;
|
|
8
|
+
|
|
9
|
+
if (!encontro) {
|
|
10
|
+
commands.push(`echo "🧨letra '${name}' not found"`);
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
commands.push(...parse(letra));
|
|
15
|
+
|
|
16
|
+
return commands;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return commands;
|
|
20
|
+
};
|
|
21
|
+
|
package/lib/palabras.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {basename} from 'node:path';
|
|
2
|
+
import {rendy} from 'rendy';
|
|
3
|
+
|
|
4
|
+
export const parse = (letra) => {
|
|
5
|
+
const commands = [];
|
|
6
|
+
const {link} = letra;
|
|
7
|
+
const renderedLink = rendy(link, letra);
|
|
8
|
+
|
|
9
|
+
commands.push(`wget ${renderedLink}`);
|
|
10
|
+
commands.push(`tar zxf ${basename(renderedLink)}`);
|
|
11
|
+
|
|
12
|
+
return commands;
|
|
13
|
+
};
|
|
14
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "palabra",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
|
+
"description": "Palabra software installer",
|
|
7
|
+
"homepage": "https://github.com/coderaiser/palabra#readme",
|
|
8
|
+
"main": "",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/coderaiser/palabra.git"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "madrun test",
|
|
15
|
+
"watch:test": "madrun watch:test",
|
|
16
|
+
"lint": "madrun lint",
|
|
17
|
+
"fresh:lint": "madrun fresh:lint",
|
|
18
|
+
"lint:fresh": "madrun lint:fresh",
|
|
19
|
+
"fix:lint": "madrun fix:lint",
|
|
20
|
+
"coverage": "madrun coverage",
|
|
21
|
+
"report": "madrun report"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"execa": "^9.6.1",
|
|
25
|
+
"rendy": "^5.0.2",
|
|
26
|
+
"try-to-catch": "^4.0.5"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"putout",
|
|
30
|
+
"putout-plugin",
|
|
31
|
+
"putout-plugin-remove",
|
|
32
|
+
"plugin",
|
|
33
|
+
"debugger"
|
|
34
|
+
],
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@putout/test": "^15.0.0",
|
|
37
|
+
"eslint": "^10.0.0",
|
|
38
|
+
"eslint-plugin-putout": "^31.0.0",
|
|
39
|
+
"madrun": "^13.0.0",
|
|
40
|
+
"nodemon": "^3.0.1",
|
|
41
|
+
"redlint": "^6.0.0",
|
|
42
|
+
"superc8": "^12.0.0",
|
|
43
|
+
"supertape": "^12.10.5"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"putout": ">=42"
|
|
47
|
+
},
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=22"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
}
|
|
55
|
+
}
|