i18n-dashboard 0.3.8 → 0.4.3

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 +31 -1
  2. package/bin/cli.mjs +62 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -713,11 +713,41 @@ Contributions are welcome. Please open an issue before submitting a pull request
713
713
  git clone https://github.com/arnaudprioul/i18n-dashboard.git
714
714
  cd i18n-dashboard
715
715
  npm install
716
- npm run dev
716
+
717
+ # Register the project git hooks (one-time, per clone)
718
+ git config core.hooksPath .githooks
717
719
  ```
718
720
 
721
+ ### Commit message convention
722
+
723
+ Every push to `main` must include at least one commit message with a version bump indicator:
724
+
725
+ | Indicator | Bump | Example |
726
+ |---|---|---|
727
+ | `[patch]` | `0.3.8 → 0.3.9` | `fix: correct typo in error message [patch]` |
728
+ | `[minor]` | `0.3.8 → 0.4.0` | `feat: add git scan mode [minor]` |
729
+ | `[major]` | `0.3.8 → 1.0.0` | `feat!: breaking API change [major]` |
730
+
731
+ The pre-push hook will block the push if:
732
+ - No `[major]`, `[minor]`, or `[patch]` indicator is found in the commits
733
+ - `README.md` has not been updated
734
+
735
+ If both checks pass, the CI automatically bumps `package.json`, creates the git tag, and triggers the npm publish workflow.
736
+
737
+ ---
738
+
739
+ ## Support
740
+
741
+ If this project saved you time, consider buying me a coffee ☕
742
+
743
+ [![Donate with PayPal](https://img.shields.io/badge/Donate-PayPal-blue?logo=paypal)](https://www.paypal.com/paypalme/arnaudprioul)
744
+
719
745
  ---
720
746
 
721
747
  ## License
722
748
 
723
749
  [MIT](./LICENSE)
750
+
751
+ ---
752
+
753
+ Made with ❤️ by [arnaudprioul](https://github.com/arnaudprioul)
package/bin/cli.mjs CHANGED
@@ -3,10 +3,70 @@ import { spawn } from 'child_process'
3
3
  import { Command } from 'commander'
4
4
  import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'fs'
5
5
  import { resolve } from 'path'
6
+ import { dirname } from 'path'
7
+ import { fileURLToPath } from 'url'
6
8
  import { tmpdir } from 'os'
7
9
 
8
- import { _dirname } from '../consts/commons.const.ts'
9
- import { buildEnv, loadUserConfig } from '../utils/config.util.ts'
10
+ // Inlined from consts/commons.const.ts
11
+ const _dirname = typeof __dirname !== 'undefined'
12
+ ? __dirname
13
+ : dirname(fileURLToPath(import.meta.url))
14
+
15
+ // Inlined from utils/config.util.ts
16
+ async function loadUserConfig() {
17
+ const configPath = resolve(process.cwd(), 'i18n-dashboard.config.js')
18
+ const configPathMjs = resolve(process.cwd(), 'i18n-dashboard.config.mjs')
19
+
20
+ if (existsSync(configPath)) {
21
+ try {
22
+ const mod = await import(configPath)
23
+ return mod.default || mod
24
+ } catch (e) {
25
+ console.warn('Warning: Could not load i18n-dashboard.config.js:', e.message)
26
+ }
27
+ } else if (existsSync(configPathMjs)) {
28
+ try {
29
+ const mod = await import(configPathMjs)
30
+ return mod.default || mod
31
+ } catch (e) {
32
+ console.warn('Warning: Could not load i18n-dashboard.config.mjs:', e.message)
33
+ }
34
+ }
35
+
36
+ return {}
37
+ }
38
+
39
+ function buildEnv(config) {
40
+ const env = { ...process.env }
41
+
42
+ if (config.port) env.I18N_PORT = String(config.port)
43
+ if (config.keySeparator) env.I18N_KEY_SEPARATOR = config.keySeparator
44
+ if (config.localesPath) env.I18N_LOCALES_PATH = config.localesPath
45
+ if (config.apiPath) env.I18N_API_PATH = config.apiPath
46
+
47
+ env.I18N_PROJECT_ROOT = config.projectRoot
48
+ ? resolve(config.projectRoot)
49
+ : process.cwd()
50
+
51
+ if (config.database) {
52
+ if (config.database.client) env.I18N_DB_CLIENT = config.database.client
53
+ if (config.database.connection) {
54
+ if (typeof config.database.connection === 'string') {
55
+ env.I18N_DB_CONNECTION = config.database.connection
56
+ } else {
57
+ if (config.database.connection.host) env.I18N_DB_HOST = config.database.connection.host
58
+ if (config.database.connection.port) env.I18N_DB_PORT = String(config.database.connection.port)
59
+ if (config.database.connection.user) env.I18N_DB_USER = config.database.connection.user
60
+ if (config.database.connection.password) env.I18N_DB_PASSWORD = config.database.connection.password
61
+ if (config.database.connection.database) env.I18N_DB_NAME = config.database.connection.database
62
+ }
63
+ }
64
+ }
65
+
66
+ if (config.googleTranslate?.apiKey) env.GOOGLE_TRANSLATE_API_KEY = config.googleTranslate.apiKey
67
+
68
+ return env
69
+ }
10
70
 
11
71
  const packageRoot = resolve(_dirname, '..')
12
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18n-dashboard",
3
- "version": "0.3.8",
3
+ "version": "0.4.3",
4
4
  "description": "A web dashboard to manage vue-i18n translation keys with database persistence",
5
5
  "type": "module",
6
6
  "bin": {