@intlpullhq/cli 0.1.6 → 0.1.8

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.
Files changed (3) hide show
  1. package/README.md +103 -11
  2. package/dist/index.js +3208 -2621
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,6 +19,31 @@
19
19
 
20
20
  ---
21
21
 
22
+ ## Table of Contents
23
+
24
+ | Section | Description |
25
+ |---------|-------------|
26
+ | [Features](#features) | Key capabilities of the CLI |
27
+ | [Installation](#installation) | How to install the CLI |
28
+ | [Quick Start](#quick-start) | Get started in 4 commands |
29
+ | [Authentication](#authentication) | Login, API keys, and auth methods |
30
+ | [Commands Reference](#commands-reference) | All available commands |
31
+ | ↳ [Initialize](#initialize-project) | Set up IntlPull in your project |
32
+ | ↳ [Upload / Push](#upload--push) | Upload translation keys |
33
+ | ↳ [Download / Pull](#download--pull) | Download translations |
34
+ | ↳ [Sync](#sync) | One-time sync for CI/CD |
35
+ | ↳ [Listen / Watch](#listen--watch) | Real-time sync during dev |
36
+ | ↳ [Import / Export](#import) | Bulk import/export translations |
37
+ | ↳ [OTA Releases](#ota-releases) | Over-the-air updates |
38
+ | ↳ [Migration](#migration) | Migrate from other platforms |
39
+ | [CI/CD Integration](#cicd-integration) | GitHub Actions, GitLab CI, Docker |
40
+ | [Configuration](#configuration) | Project config and output patterns |
41
+ | ↳ [Output Patterns](#output-patterns-namespace-support) | Namespace file structures |
42
+ | [Tips & Best Practices](#tips--best-practices) | Recommended usage patterns |
43
+ | [Support](#support) | Get help |
44
+
45
+ ---
46
+
22
47
  ## Features
23
48
 
24
49
  - **Parallel Downloads** - Fetch translations by namespace concurrently for blazing fast syncs
@@ -744,35 +769,102 @@ Created by `intlpull init`, this file configures your project:
744
769
  "framework": "next",
745
770
  "library": "next-intl",
746
771
  "outputDir": "./messages",
772
+ "output": "messages/[locale]/[namespace].json",
747
773
  "sourceLanguage": "en",
748
774
  "namespaces": ["common", "admin"]
749
775
  }
750
776
  ```
751
777
 
778
+ ### Output Patterns (Namespace Support)
779
+
780
+ The CLI supports flexible output patterns with placeholders to match any i18n library structure.
781
+
782
+ **Placeholders:**
783
+ - `[locale]` or `{locale}` - Language code (e.g., `en`, `es`, `zh-CN`)
784
+ - `[namespace]` or `{namespace}` - Namespace name (e.g., `common`, `auth`)
785
+
786
+ **Common Patterns by Framework:**
787
+
788
+ | Framework/Library | Pattern | Example Output |
789
+ |------------------|---------|----------------|
790
+ | **next-intl** | `messages/[locale].json` | `messages/en.json` |
791
+ | **next-i18next** | `public/locales/[locale]/[namespace].json` | `public/locales/en/common.json` |
792
+ | **react-i18next** | `public/locales/[locale]/[namespace].json` | `public/locales/en/auth.json` |
793
+ | **i18next** | `locales/[locale]/[namespace].json` | `locales/en/common.json` |
794
+ | **vue-i18n** | `src/locales/[locale].json` | `src/locales/en.json` |
795
+ | **Chrome Extension** | `_locales/[locale]/messages.json` | `_locales/en/messages.json` |
796
+ | **React Native** | `assets/locales/[locale]/[namespace].json` | `assets/locales/en/common.json` |
797
+
798
+ **Configure via CLI flag:**
799
+ ```bash
800
+ # Namespaced output (creates separate files per namespace)
801
+ npx @intlpullhq/cli pull --output "public/locales/[locale]/[namespace].json"
802
+
803
+ # Flat output (merges all namespaces into one file)
804
+ npx @intlpullhq/cli pull --output "messages/[locale].json"
805
+
806
+ # Namespace-first structure
807
+ npx @intlpullhq/cli pull --output "locales/[namespace]/[locale].json"
808
+ ```
809
+
810
+ **Configure in `.intlpull.json`:**
811
+ ```json
812
+ {
813
+ "projectId": "proj_xxxx",
814
+ "output": "public/locales/[locale]/[namespace].json"
815
+ }
816
+ ```
817
+
818
+ **Important:** Ensure your i18n library's configuration matches the output path:
819
+
820
+ | Library | Config Update Required |
821
+ |---------|----------------------|
822
+ | **next-intl** | Update `src/i18n/request.ts` to load from the correct path |
823
+ | **i18next / react-i18next** | Update `backend.loadPath` in your i18n config |
824
+ | **Chrome Extension** | Must use `_locales/[locale]/messages.json` (Chrome requirement) |
825
+
752
826
  ### Environment Variables
753
827
 
754
828
  | Variable | Description |
755
829
  |----------|-------------|
756
- | `INTLPULL_API_KEY` | API key for authentication |
757
- | `INTLPULL_DEBUG` | Enable debug logging |
830
+ | `INTLPULL_API_KEY` | API key for authentication (required) |
831
+ | `INTLPULL_PROJECT_ID` | Default project ID |
832
+ | `INTLPULL_DEBUG` | Enable debug logging (`true`/`false`) |
758
833
 
759
834
  ---
760
835
 
761
836
  ## Tips & Best Practices
762
837
 
763
- 1. **Use project-scoped API keys** - Auto-detects project ID, no need to specify `--project`
764
- 2. **Enable parallel mode** (default) - Downloads namespaces concurrently for faster syncs
765
- 3. **Use `--quiet` in CI** - Minimal output, machine-friendly
766
- 4. **Use `--dry-run`** - Preview changes before applying
767
- 5. **Set up Git branch detection** - CLI auto-detects git branch for branch workflows
838
+ | Practice | Recommendation |
839
+ |----------|----------------|
840
+ | 🔑 **API Keys** | Use project-scoped keys for auto-detection (no `--project` flag needed) |
841
+ | **Parallel Mode** | Enabled by default — downloads namespaces concurrently |
842
+ | 🤫 **CI/CD Output** | Use `--quiet` for minimal, machine-friendly logs |
843
+ | 🔍 **Preview Changes** | Use `--dry-run` before applying destructive operations |
844
+ | 🌿 **Branch Workflows** | CLI auto-detects git branch for branch-based translations |
845
+ | 📦 **Namespace Files** | Use output patterns like `[locale]/[namespace].json` for organized files |
768
846
 
769
847
  ---
770
848
 
771
849
  ## Support
772
850
 
773
- - Documentation: [docs.intlpull.com](https://docs.intlpull.com)
774
- - Email: support@intlpull.com
851
+ | Resource | Link |
852
+ |:---------|:-----|
853
+ | 📚 Documentation | [docs.intlpull.com](https://docs.intlpull.com) |
854
+ | 📧 Email Support | [support@intlpull.com](mailto:support@intlpull.com) |
855
+ | 🐛 GitHub Issues | [github.com/intlpullhq/cli/issues](https://github.com/intlpullhq/cli/issues) |
856
+ | 💬 Discord | [discord.gg/intlpull](https://discord.gg/intlpull) |
775
857
 
776
- ## License
858
+ ---
859
+
860
+ <p align="center">
861
+ <a href="#features">Features</a> •
862
+ <a href="#installation">Installation</a> •
863
+ <a href="#commands-reference">Commands</a> •
864
+ <a href="#cicd-integration">CI/CD</a> •
865
+ <a href="#configuration">Config</a>
866
+ </p>
777
867
 
778
- MIT © [IntlPull](https://intlpull.com)
868
+ <p align="center">
869
+ MIT © <a href="https://intlpull.com">IntlPull</a>
870
+ </p>