From 03ffe9ad10137b2a5e68070d83a6a00bda6dcc7a Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 14:26:19 +0200 Subject: [PATCH 1/6] docs: add docs for installation and first usage --- README.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c49dba..6705ab3 100644 --- a/README.md +++ b/README.md @@ -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 as a `devDependency` 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"` + ## 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 { @@ -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. From 37a044ec42d82ae64e7ad497defc8356697f04b3 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 14:28:59 +0200 Subject: [PATCH 2/6] docs: fix typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6705ab3..d6cdc13 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,11 @@ If you want the `keeli` command to be globally available on your system, you can 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) +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 as a `devDependency` using the package manager of your choice: +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** From c618d2dfd1e1a9a240f8df86764df72ded92d700 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 14:30:00 +0200 Subject: [PATCH 3/6] docs: fix typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6cdc13..3efa823 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ npm install --save-dev keeli **yarn** ``` -yarn add keeli --D +yarn add keeli -D ``` **pnpm** From f26c0e5f67aa2607b81b6f8c1e6d7591b112306b Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 14:39:52 +0200 Subject: [PATCH 4/6] fix: allow keeli to be run via npm scripts --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 57892cf..b40b33e 100755 --- a/src/index.ts +++ b/src/index.ts @@ -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)) { From eab02f047469d584e8eb64c5dcb72da383ef8864 Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 14:40:02 +0200 Subject: [PATCH 5/6] fix: allow keeli to be run via npm scripts --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a83d909..13daa28 100644 --- a/package.json +++ b/package.json @@ -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" From 51896db0dec7582d41811eebe6dc3d6d8cdab35d Mon Sep 17 00:00:00 2001 From: Michael Wuergler Date: Sun, 20 Oct 2024 14:40:22 +0200 Subject: [PATCH 6/6] docs: add notes about running keeli --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3efa823..25b486b 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ yarn add keeli -D pnpm add keeli --save-dev ``` -Then you can use the `keeli` command in your package,json scripts, for example: `"validate-i18n": "keeli"` +Then you can use the `keeli` command in your package.json scripts, for example: `"validate-i18n": "keeli"` or `"validate-i18n": "npx keeli"` ## Configuration