@promakeai/cli 0.4.8 → 0.4.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promakeai/cli",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "promake": "dist/index.js"
@@ -1,37 +1,37 @@
1
- import js from '@eslint/js';
2
- import globals from 'globals';
3
- import reactHooks from 'eslint-plugin-react-hooks';
4
- import reactRefresh from 'eslint-plugin-react-refresh';
5
- import tseslint from 'typescript-eslint';
6
- import { defineConfig, globalIgnores } from 'eslint/config';
7
- import eslintConfigPrettier from 'eslint-config-prettier/flat';
8
-
9
- export default defineConfig([
10
- globalIgnores(['dist']),
11
- {
12
- files: ['**/*.{ts,tsx}'],
13
- extends: [
14
- js.configs.recommended,
15
- tseslint.configs.recommended,
16
- reactHooks.configs.flat.recommended,
17
- reactRefresh.configs.vite,
18
- eslintConfigPrettier,
19
- ],
20
- languageOptions: {
21
- ecmaVersion: 2020,
22
- globals: globals.browser,
23
- },
24
- rules: {
25
- '@typescript-eslint/no-explicit-any': 'off',
26
- '@typescript-eslint/no-unused-vars': 'off',
27
- '@typescript-eslint/no-unused-expressions': 'off',
28
- 'react-refresh/only-export-components': 'off',
29
- 'react-hooks/purity': 'off',
30
- 'react-hooks/exhaustive-deps': 'off',
31
- 'react-hooks/set-state-in-effect': 'off',
32
- 'no-unused-vars': 'off',
33
- 'prefer-const': 'warn',
34
- '@typescript-eslint/no-empty-object-type': 'off',
35
- },
36
- },
37
- ]);
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+ import reactHooks from 'eslint-plugin-react-hooks';
4
+ import reactRefresh from 'eslint-plugin-react-refresh';
5
+ import tseslint from 'typescript-eslint';
6
+ import { defineConfig, globalIgnores } from 'eslint/config';
7
+ import eslintConfigPrettier from 'eslint-config-prettier/flat';
8
+
9
+ export default defineConfig([
10
+ globalIgnores(['dist']),
11
+ {
12
+ files: ['**/*.{ts,tsx}'],
13
+ extends: [
14
+ js.configs.recommended,
15
+ tseslint.configs.recommended,
16
+ reactHooks.configs.flat.recommended,
17
+ reactRefresh.configs.vite,
18
+ eslintConfigPrettier,
19
+ ],
20
+ languageOptions: {
21
+ ecmaVersion: 2020,
22
+ globals: globals.browser,
23
+ },
24
+ rules: {
25
+ '@typescript-eslint/no-explicit-any': 'off',
26
+ '@typescript-eslint/no-unused-vars': 'off',
27
+ '@typescript-eslint/no-unused-expressions': 'off',
28
+ 'react-refresh/only-export-components': 'off',
29
+ 'react-hooks/purity': 'off',
30
+ 'react-hooks/exhaustive-deps': 'off',
31
+ 'react-hooks/set-state-in-effect': 'off',
32
+ 'no-unused-vars': 'off',
33
+ 'prefer-const': 'warn',
34
+ '@typescript-eslint/no-empty-object-type': 'off',
35
+ },
36
+ },
37
+ ]);
@@ -1,86 +1,86 @@
1
- import i18n from "i18next";
2
- import { initReactI18next } from "react-i18next";
3
- import LanguageDetector from "i18next-browser-languagedetector";
4
-
5
- import constants from "@/constants/constants.json";
6
-
7
- // Auto-import translations from two locations:
8
- // 1. Core: @/lang/{lang}/{namespace}.json (e.g., lang/en/header.json)
9
- // 2. Modules: @/modules/{namespace}/lang/{lang}.json (e.g., modules/about-page/lang/en.json)
10
- const coreLangs = import.meta.glob("@/lang/*/*.json", { eager: true });
11
- const moduleLangs = import.meta.glob("@/modules/*/lang/*.json", { eager: true });
12
-
13
- // Get available languages from config
14
- const availableLanguages =
15
- Object.keys(constants?.site?.availableLanguages || {}) || [];
16
-
17
- // Build resources object: { en: { header: {...}, about-page: {...} }, tr: {...} }
18
- const resources: Record<string, Record<string, any>> = {};
19
-
20
- // Process core translations: /lang/{lang}/{namespace}.json
21
- Object.entries(coreLangs).forEach(([path, module]) => {
22
- const match = path.match(/\/lang\/([^/]+)\/([^/]+)\.json$/);
23
- if (match) {
24
- const [, lang, namespace] = match;
25
- if (!availableLanguages.includes(lang)) return;
26
- if (!resources[lang]) resources[lang] = {};
27
- resources[lang][namespace] = (module as any).default || module;
28
- }
29
- });
30
-
31
- // Process module translations: /modules/{namespace}/lang/{lang}.json
32
- Object.entries(moduleLangs).forEach(([path, module]) => {
33
- const match = path.match(/\/modules\/([^/]+)\/lang\/([^/]+)\.json$/);
34
- if (match) {
35
- const [, namespace, lang] = match;
36
- if (!availableLanguages.includes(lang)) return;
37
- if (!resources[lang]) resources[lang] = {};
38
- resources[lang][namespace] = (module as any).default || module;
39
- }
40
- });
41
-
42
- // Custom detector for cached settings
43
- const settingsDetector = {
44
- name: "settingsDetector",
45
- lookup() {
46
- if (constants.site.overrideBrowserLanguage) {
47
- return constants?.site?.defaultLanguage;
48
- }
49
- return undefined;
50
- },
51
- cacheUserLanguage() {
52
- // Don't cache - settings detector is read-only
53
- },
54
- };
55
-
56
- // Create detector instance and add custom detector
57
- const languageDetector = new LanguageDetector();
58
- languageDetector.addDetector(settingsDetector);
59
-
60
- i18n
61
- .use(languageDetector)
62
- .use(initReactI18next)
63
- .init({
64
- resources,
65
- fallbackLng: constants?.site?.defaultLanguage || "en",
66
- supportedLngs: availableLanguages,
67
- detection: {
68
- // Priority: localStorage > settings > browser
69
- order: ["localStorage", "settingsDetector", "navigator"],
70
- lookupLocalStorage: "i18nextLng",
71
- caches: ["localStorage"],
72
- },
73
- interpolation: {
74
- escapeValue: false,
75
- },
76
- });
77
-
78
- // Helper to change language and persist to localStorage
79
- export const changeLanguage = (lang: string) => {
80
- if (availableLanguages.includes(lang)) {
81
- i18n.changeLanguage(lang);
82
- }
83
- };
84
-
85
- export { availableLanguages };
86
- export default i18n;
1
+ import i18n from "i18next";
2
+ import { initReactI18next } from "react-i18next";
3
+ import LanguageDetector from "i18next-browser-languagedetector";
4
+
5
+ import constants from "@/constants/constants.json";
6
+
7
+ // Auto-import translations from two locations:
8
+ // 1. Core: @/lang/{lang}/{namespace}.json (e.g., lang/en/header.json)
9
+ // 2. Modules: @/modules/{namespace}/lang/{lang}.json (e.g., modules/about-page/lang/en.json)
10
+ const coreLangs = import.meta.glob("@/lang/*/*.json", { eager: true });
11
+ const moduleLangs = import.meta.glob("@/modules/*/lang/*.json", { eager: true });
12
+
13
+ // Get available languages from config
14
+ const availableLanguages =
15
+ Object.keys(constants?.site?.availableLanguages || {}) || [];
16
+
17
+ // Build resources object: { en: { header: {...}, about-page: {...} }, tr: {...} }
18
+ const resources: Record<string, Record<string, any>> = {};
19
+
20
+ // Process core translations: /lang/{lang}/{namespace}.json
21
+ Object.entries(coreLangs).forEach(([path, module]) => {
22
+ const match = path.match(/\/lang\/([^/]+)\/([^/]+)\.json$/);
23
+ if (match) {
24
+ const [, lang, namespace] = match;
25
+ if (!availableLanguages.includes(lang)) return;
26
+ if (!resources[lang]) resources[lang] = {};
27
+ resources[lang][namespace] = (module as any).default || module;
28
+ }
29
+ });
30
+
31
+ // Process module translations: /modules/{namespace}/lang/{lang}.json
32
+ Object.entries(moduleLangs).forEach(([path, module]) => {
33
+ const match = path.match(/\/modules\/([^/]+)\/lang\/([^/]+)\.json$/);
34
+ if (match) {
35
+ const [, namespace, lang] = match;
36
+ if (!availableLanguages.includes(lang)) return;
37
+ if (!resources[lang]) resources[lang] = {};
38
+ resources[lang][namespace] = (module as any).default || module;
39
+ }
40
+ });
41
+
42
+ // Custom detector for cached settings
43
+ const settingsDetector = {
44
+ name: "settingsDetector",
45
+ lookup() {
46
+ if (constants.site.overrideBrowserLanguage) {
47
+ return constants?.site?.defaultLanguage;
48
+ }
49
+ return undefined;
50
+ },
51
+ cacheUserLanguage() {
52
+ // Don't cache - settings detector is read-only
53
+ },
54
+ };
55
+
56
+ // Create detector instance and add custom detector
57
+ const languageDetector = new LanguageDetector();
58
+ languageDetector.addDetector(settingsDetector);
59
+
60
+ i18n
61
+ .use(languageDetector)
62
+ .use(initReactI18next)
63
+ .init({
64
+ resources,
65
+ fallbackLng: constants?.site?.defaultLanguage || "en",
66
+ supportedLngs: availableLanguages,
67
+ detection: {
68
+ // Priority: localStorage > settings > browser
69
+ order: ["localStorage", "settingsDetector", "navigator"],
70
+ lookupLocalStorage: "i18nextLng",
71
+ caches: ["localStorage"],
72
+ },
73
+ interpolation: {
74
+ escapeValue: false,
75
+ },
76
+ });
77
+
78
+ // Helper to change language and persist to localStorage
79
+ export const changeLanguage = (lang: string) => {
80
+ if (availableLanguages.includes(lang)) {
81
+ i18n.changeLanguage(lang);
82
+ }
83
+ };
84
+
85
+ export { availableLanguages };
86
+ export default i18n;