Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/melfore/clibelt
CLI belt: the Melfore tool belt
https://github.com/melfore/clibelt
Last synced: about 5 hours ago
JSON representation
CLI belt: the Melfore tool belt
- Host: GitHub
- URL: https://github.com/melfore/clibelt
- Owner: melfore
- License: mit
- Created: 2020-05-28T09:21:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-01T14:30:40.000Z (10 months ago)
- Last Synced: 2024-11-07T10:19:20.110Z (11 days ago)
- Language: JavaScript
- Size: 645 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# clibelt
CLI belt: the Melfore tool belt
## Usage
### Install
```shell
npm install @melfore/clibelt
```### Add scripts to `package.json`
Add required CLIs to your `package.json`, for example:
```json
"scripts": {
"i18n": "i18n-msg",
"i18n:copy": "i18n-copy --from it --to fr",
"pwd2hash": "pwd2hash"
}
```### Configure
There are three ways to configure a CLI.
#### Clibelt configuration
Create a file `.clibelt.json` in project root.
Configuration example:
```json
{
"i18nMsg": {
"input": "./resources/messages-all-langs.js",
"outMsg": "./src/messages",
"outTs": "./src/messages/i18nMessages.ts"
}
}
```#### Command line arguments
Add arguments to script in `package.json`, for example:
```json
"scripts": {
"i18n": "i18n-msg --input new/path --outTs new/constants.ts"
}
```#### Environment variables
Run script with CLI's specific env variables set.
## CLIs
### i18n-msg
`i18n-msg`:
- splits an input file containing all the translations into one file for each language
- creates a TypeScript source containing a constant for each message.#### Configuration
Add `i18nMsg` to `.clibelt.json`.
##### Options
| .clibelt param | command line arg | env variable | Description | Example |
| -------------- | ---------------- | ------------ | ------------------------------------------ | ------------------------------ |
| input | i18n-input | I18N_INPUT | the input file containing all translations | ./resources/messages-all-langs |
| outMsg | i18n-out-msg | I18N_OUT_MSG | splitted messages output directory | ./src/messages |
| outTs | i18n-out-ts | I18N_OUT_TS | TypeScript constants output file | ./src/messages/i18nMessages.ts |Example:
```json
{
"i18nMsg": {
"input": "./resources/messages-all-langs.js",
"outMsg": "./src/messages",
"outTs": "./src/messages/i18nMessages.ts"
}
}
```### pwd2hash
`pwd2hash` generates an hash for input string
#### Configuration
No configuration is required, just add to `package.json` script and run:
```shell
npm run pwd2hash string_to_hash
```test