Skip to content

Commit

Permalink
Merge pull request #35 from radiovisual/update-docs-for-installation
Browse files Browse the repository at this point in the history
docs: add docs for installation and first usage
  • Loading branch information
radiovisual authored Oct 20, 2024
2 parents 1ba4bcd + 51896db commit 561b0d7
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,48 @@ Keeli will help you automatically discover many problems with your translation f

Most of these rules are configurable so you can customize keeli to your specific needs.

## Global Installation

If you want the `keeli` command to be globally available on your system, you can install it globally:

```bash
npm install --global keeli
```

And then you have the `keeli` command in your terminal. Now you are ready to [configure Keeli for your first validation check](#configuration). 🎉

## Project Installation

If you don't need the `keeli` command to be available globally on your system, then you can install Keeli into your project directly into `devDependencies` using the package manager of your choice:

**npm**

```
npm install --save-dev keeli
```

**yarn**

```
yarn add keeli -D
```

**pnpm**

```
pnpm add keeli --save-dev
```

Then you can use the `keeli` command in your package.json scripts, for example: `"validate-i18n": "keeli"` or `"validate-i18n": "npx keeli"`

## Configuration

For each project where you want to run the keeli, you will need to have a file named `keeli.config.json` with the following format:
For each project where you want to run the keeli, you will need to have a file named `keeli.config.json` in the project root where your internationalization files are defined.

> [!TIP]
> You can also pass in a custom configuration file path location with keeli's `--config` option.
Each configuration file should be a valid JSON file and have a similar format to this (with comments removed):

```json5
{
Expand Down Expand Up @@ -114,6 +153,9 @@ For each project where you want to run the keeli, you will need to have a file n
}
```

> [!TIP]
> Your configuration file does need to be complete, if you do not specify a value for any parameter that is not required, then the default configuration value will apply. If you forget to provide a value for a required value, then keeli will throw a useful error.
# Rule Defaults

Each rule (that allows you to configure the severity) can have a default setting of `error`, `warn` or `off`, these defaults will apply if you do not provide a configuration for the rule in the configuration file.
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"build:dev": "rm -rf dist/* && npm run typecheck && tsc && node build/cli.mjs",
"start": "npm run build:dev -- --watch",
"test": "jest",
"typecheck": "tsc --noEmit"
"typecheck": "tsc --noEmit",
"validate-i18n": "keeli"
},
"bin": {
"keeli": "dist/index.js"
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const argv: ParsedArgs = minimist(process.argv.slice(2));

const configPath =
typeof argv?.config === "string"
? path.join(process.cwd(), argv.config)
: path.join(process.cwd(), "../keeli.config.json");
? path.resolve(process.cwd(), argv.config)
: path.resolve(process.cwd(), "keeli.config.json");

// Only start keeli if the keeli configuration file is found.
if (fs.existsSync(configPath)) {
Expand Down

0 comments on commit 561b0d7

Please sign in to comment.