i18ntk 1.10.2 → 2.0.2

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 (108) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +141 -1191
  3. package/main/i18ntk-analyze.js +65 -84
  4. package/main/i18ntk-backup-class.js +420 -0
  5. package/main/i18ntk-backup.js +3 -3
  6. package/main/i18ntk-complete.js +90 -65
  7. package/main/i18ntk-doctor.js +123 -103
  8. package/main/i18ntk-fixer.js +61 -725
  9. package/main/i18ntk-go.js +14 -15
  10. package/main/i18ntk-init.js +77 -26
  11. package/main/i18ntk-java.js +27 -32
  12. package/main/i18ntk-js.js +70 -68
  13. package/main/i18ntk-manage.js +129 -30
  14. package/main/i18ntk-php.js +75 -75
  15. package/main/i18ntk-py.js +55 -56
  16. package/main/i18ntk-scanner.js +59 -57
  17. package/main/i18ntk-setup.js +9 -404
  18. package/main/i18ntk-sizing.js +6 -6
  19. package/main/i18ntk-summary.js +21 -18
  20. package/main/i18ntk-ui.js +11 -10
  21. package/main/i18ntk-usage.js +54 -18
  22. package/main/i18ntk-validate.js +13 -13
  23. package/main/manage/commands/AnalyzeCommand.js +1124 -0
  24. package/main/manage/commands/BackupCommand.js +62 -0
  25. package/main/manage/commands/CommandRouter.js +295 -0
  26. package/main/manage/commands/CompleteCommand.js +61 -0
  27. package/main/manage/commands/DoctorCommand.js +60 -0
  28. package/main/manage/commands/FixerCommand.js +624 -0
  29. package/main/manage/commands/InitCommand.js +62 -0
  30. package/main/manage/commands/ScannerCommand.js +654 -0
  31. package/main/manage/commands/SizingCommand.js +60 -0
  32. package/main/manage/commands/SummaryCommand.js +61 -0
  33. package/main/manage/commands/UsageCommand.js +60 -0
  34. package/main/manage/commands/ValidateCommand.js +978 -0
  35. package/main/manage/index-fixed.js +1447 -0
  36. package/main/manage/index.js +1462 -0
  37. package/main/manage/managers/DebugMenu.js +140 -0
  38. package/main/manage/managers/InteractiveMenu.js +177 -0
  39. package/main/manage/managers/LanguageMenu.js +62 -0
  40. package/main/manage/managers/SettingsMenu.js +53 -0
  41. package/main/manage/services/AuthenticationService.js +263 -0
  42. package/main/manage/services/ConfigurationService-fixed.js +449 -0
  43. package/main/manage/services/ConfigurationService.js +449 -0
  44. package/main/manage/services/FileManagementService.js +368 -0
  45. package/main/manage/services/FrameworkDetectionService.js +458 -0
  46. package/main/manage/services/InitService.js +1051 -0
  47. package/main/manage/services/SetupService.js +462 -0
  48. package/main/manage/services/SummaryService.js +450 -0
  49. package/main/manage/services/UsageService.js +1502 -0
  50. package/package.json +32 -29
  51. package/runtime/enhanced.d.ts +221 -221
  52. package/runtime/index.d.ts +29 -29
  53. package/runtime/index.full.d.ts +331 -331
  54. package/runtime/index.js +7 -6
  55. package/scripts/build-lite.js +17 -17
  56. package/scripts/deprecate-versions.js +23 -6
  57. package/scripts/export-translations.js +5 -5
  58. package/scripts/fix-all-i18n.js +3 -3
  59. package/scripts/fix-and-purify-i18n.js +3 -2
  60. package/scripts/fix-locale-control-chars.js +110 -0
  61. package/scripts/lint-locales.js +80 -0
  62. package/scripts/locale-optimizer.js +8 -8
  63. package/scripts/prepublish.js +21 -21
  64. package/scripts/security-check.js +117 -117
  65. package/scripts/sync-translations.js +4 -4
  66. package/scripts/sync-ui-locales.js +9 -8
  67. package/scripts/validate-all-translations.js +8 -7
  68. package/scripts/verify-deprecations.js +157 -161
  69. package/scripts/verify-translations.js +6 -5
  70. package/settings/i18ntk-config.json +282 -282
  71. package/settings/language-config.json +5 -5
  72. package/settings/settings-cli.js +9 -9
  73. package/settings/settings-manager.js +18 -18
  74. package/ui-locales/de.json +2417 -2348
  75. package/ui-locales/en.json +2415 -2352
  76. package/ui-locales/es.json +2425 -2353
  77. package/ui-locales/fr.json +2418 -2348
  78. package/ui-locales/ja.json +2463 -2361
  79. package/ui-locales/ru.json +2463 -2359
  80. package/ui-locales/zh.json +2418 -2351
  81. package/utils/admin-auth.js +2 -2
  82. package/utils/admin-cli.js +297 -297
  83. package/utils/admin-pin.js +9 -9
  84. package/utils/cli-helper.js +9 -9
  85. package/utils/config-helper.js +73 -104
  86. package/utils/config-manager.js +204 -171
  87. package/utils/config.js +5 -4
  88. package/utils/env-manager.js +249 -263
  89. package/utils/framework-detector.js +27 -24
  90. package/utils/i18n-helper.js +85 -41
  91. package/utils/init-helper.js +152 -94
  92. package/utils/json-output.js +98 -98
  93. package/utils/mini-commander.js +179 -0
  94. package/utils/missing-key-validator.js +5 -5
  95. package/utils/plugin-loader.js +40 -29
  96. package/utils/prompt.js +14 -44
  97. package/utils/safe-json.js +40 -0
  98. package/utils/secure-errors.js +3 -3
  99. package/utils/security-check-improved.js +390 -0
  100. package/utils/security-config.js +5 -5
  101. package/utils/security-fixed.js +607 -0
  102. package/utils/security.js +652 -602
  103. package/utils/setup-enforcer.js +136 -44
  104. package/utils/setup-validator.js +33 -32
  105. package/utils/ultra-performance-optimizer.js +11 -9
  106. package/utils/watch-locales.js +2 -1
  107. package/utils/prompt-fixed.js +0 -55
  108. package/utils/security-check.js +0 -454
@@ -1,161 +1,157 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * i18ntk Deprecation Verification Script
5
- *
6
- * This script verifies that versions have been properly deprecated
7
- */
8
-
9
- const https = require('https');
10
- const fs = require('fs');
11
- const path = require('path');
12
-
13
- // Read package.json to get deprecation list
14
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
15
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
16
-
17
- console.log('🔍 i18ntk Deprecation Verification');
18
- console.log('=====================================');
19
- console.log(`📦 Package: ${packageJson.name}`);
20
- console.log(`🎯 Current Version: ${packageJson.version}`);
21
- console.log('=====================================\n');
22
-
23
- // Get deprecation info for all versions
24
- async function getDeprecationInfo() {
25
- try {
26
- const output = await new Promise((resolve, reject) => {
27
- https.get('https://registry.npmjs.org/i18ntk', (res) => {
28
- let data = '';
29
- res.on('data', (chunk) => {
30
- data += chunk;
31
- });
32
- res.on('end', () => {
33
- resolve(data);
34
- });
35
- }).on('error', (err) => {
36
- reject(err);
37
- });
38
- });
39
- const packageInfo = JSON.parse(output);
40
-
41
- if (packageInfo.versions) {
42
- const deprecatedVersions = [];
43
- const activeVersions = [];
44
-
45
- // Check each version for deprecation
46
- for (const version of Object.keys(packageInfo.versions)) {
47
- const versionInfo = packageInfo.versions[version];
48
- if (versionInfo.deprecated) {
49
- deprecatedVersions.push({
50
- version,
51
- reason: versionInfo.deprecated
52
- });
53
- } else {
54
- activeVersions.push(version);
55
- }
56
- }
57
-
58
- return { deprecatedVersions, activeVersions };
59
- }
60
- } catch (error) {
61
- console.error('❌ Failed to get deprecation info:', error.message);
62
- return null;
63
- }
64
- }
65
-
66
- // Main verification process
67
- async function verifyDeprecations() {
68
- console.log('📊 Checking deprecation status...\n');
69
-
70
- const deprecationInfo = await getDeprecationInfo();
71
-
72
- if (!deprecationInfo) {
73
- console.log('❌ Could not retrieve deprecation information');
74
- return;
75
- }
76
-
77
- const { deprecatedVersions, activeVersions } = deprecationInfo;
78
- const currentVersion = packageJson.version;
79
- const deprecationList = packageJson.versionInfo.deprecations;
80
-
81
- console.log(`📈 Total Published Versions: ${deprecatedVersions.length + activeVersions.length}`);
82
- console.log(`✅ Deprecated Versions: ${deprecatedVersions.length}`);
83
- console.log(`🔄 Active Versions: ${activeVersions.length}`);
84
- console.log(`🎯 Current Version: ${currentVersion}`);
85
- console.log(`📋 Expected Deprecations: ${deprecationList.length}`);
86
- console.log('');
87
-
88
- // Check if current version is active
89
- const currentVersionActive = activeVersions.includes(currentVersion);
90
- if (currentVersionActive) {
91
- console.log(`✅ Current version ${currentVersion} is active (correct)`);
92
- } else {
93
- console.log(`❌ Current version ${currentVersion} is not active (problem)`);
94
- }
95
-
96
- // Check deprecated versions
97
- console.log('\n📋 Deprecated Versions:');
98
- if (deprecatedVersions.length > 0) {
99
- deprecatedVersions.forEach(({ version, reason }) => {
100
- console.log(` ❌ ${version}: ${reason}`);
101
- });
102
- } else {
103
- console.log(' (None)');
104
- }
105
-
106
- // Check active versions (should only be current version)
107
- console.log('\n🔄 Active Versions:');
108
- if (activeVersions.length > 0) {
109
- activeVersions.forEach(version => {
110
- if (version === currentVersion) {
111
- console.log(` ✅ ${version} (current version - correct)`);
112
- } else {
113
- console.log(` ⚠️ ${version} (should be deprecated)`);
114
- }
115
- });
116
- } else {
117
- console.log(' (None)');
118
- }
119
-
120
- // Summary
121
- console.log('\n=====================================');
122
- console.log('🎯 Verification Summary');
123
- console.log('=====================================');
124
-
125
- const expectedDeprecated = deprecationList.length;
126
- const actualDeprecated = deprecatedVersions.length;
127
- const successRate = expectedDeprecated > 0 ? (actualDeprecated / expectedDeprecated * 100).toFixed(1) : 0;
128
-
129
- console.log(`📊 Expected deprecated: ${expectedDeprecated}`);
130
- console.log(`📊 Actually deprecated: ${actualDeprecated}`);
131
- console.log(`📊 Success rate: ${successRate}%`);
132
-
133
- if (activeVersions.length === 1 && activeVersions[0] === currentVersion) {
134
- console.log('✅ Status: All previous versions deprecated, current version active');
135
- } else {
136
- console.log('⚠️ Status: Some versions may still need deprecation');
137
- }
138
-
139
- console.log('=====================================');
140
- }
141
-
142
- // Handle command line arguments
143
- const args = process.argv.slice(2);
144
- if (args.includes('--help') || args.includes('-h')) {
145
- console.log(`
146
- i18ntk Deprecation Verification Script
147
-
148
- Usage:
149
- node scripts/verify-deprecations.js [options]
150
-
151
- Description:
152
- This script verifies that i18ntk versions have been properly deprecated.
153
-
154
- Examples:
155
- node scripts/verify-deprecations.js
156
- `);
157
- process.exit(0);
158
- }
159
-
160
- // Run verification
161
- verifyDeprecations();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * i18ntk Deprecation Verification Script
5
+ *
6
+ * This script verifies that versions have been properly deprecated
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ // Read package.json to get deprecation list
13
+ const packageJsonPath = path.join(__dirname, '..', 'package.json');
14
+ const packageJson = JSON.parse(SecurityUtils.safeReadFileSync(packageJsonPath, path.dirname(packageJsonPath), 'utf8'));
15
+
16
+ console.log('🔍 i18ntk Deprecation Verification');
17
+ console.log('=====================================');
18
+ console.log(`📦 Package: ${packageJson.name}`);
19
+ console.log(`🎯 Current Version: ${packageJson.version}`);
20
+ console.log('=====================================\n');
21
+
22
+ // Get deprecation info for all versions
23
+ async function getDeprecationInfo() {
24
+ try {
25
+ // Deprecation information is no longer fetched from npmjs.org
26
+ // This script now relies on local deprecation-config.json if available.
27
+ const deprecationConfigPath = path.join(__dirname, '..', 'deprecation-config.json');
28
+ let packageInfo = { versions: {} };
29
+
30
+ if (SecurityUtils.safeExistsSync(deprecationConfigPath)) {
31
+ packageInfo = JSON.parse(SecurityUtils.safeReadFileSync(deprecationConfigPath, path.dirname(deprecationConfigPath), 'utf8'));
32
+ } else {
33
+ console.warn('⚠️ deprecation-config.json not found. Cannot verify deprecations locally.');
34
+ return;
35
+ }
36
+
37
+ if (packageInfo.versions) {
38
+ const deprecatedVersions = [];
39
+ const activeVersions = [];
40
+
41
+ // Check each version for deprecation
42
+ for (const version of Object.keys(packageInfo.versions)) {
43
+ const versionInfo = packageInfo.versions[version];
44
+ if (versionInfo.deprecated) {
45
+ deprecatedVersions.push({
46
+ version,
47
+ reason: versionInfo.deprecated
48
+ });
49
+ } else {
50
+ activeVersions.push(version);
51
+ }
52
+ }
53
+
54
+ return { deprecatedVersions, activeVersions };
55
+ }
56
+ } catch (error) {
57
+ console.error('❌ Failed to get deprecation info:', error.message);
58
+ return null;
59
+ }
60
+ }
61
+
62
+ // Main verification process
63
+ async function verifyDeprecations() {
64
+ console.log('📊 Checking deprecation status...\n');
65
+
66
+ const deprecationInfo = await getDeprecationInfo();
67
+
68
+ if (!deprecationInfo) {
69
+ console.log('❌ Could not retrieve deprecation information');
70
+ return;
71
+ }
72
+
73
+ const { deprecatedVersions, activeVersions } = deprecationInfo;
74
+ const currentVersion = packageJson.version;
75
+ const deprecationList = packageJson.versionInfo.deprecations;
76
+
77
+ console.log(`📈 Total Published Versions: ${deprecatedVersions.length + activeVersions.length}`);
78
+ console.log(`✅ Deprecated Versions: ${deprecatedVersions.length}`);
79
+ console.log(`🔄 Active Versions: ${activeVersions.length}`);
80
+ console.log(`🎯 Current Version: ${currentVersion}`);
81
+ console.log(`📋 Expected Deprecations: ${deprecationList.length}`);
82
+ console.log('');
83
+
84
+ // Check if current version is active
85
+ const currentVersionActive = activeVersions.includes(currentVersion);
86
+ if (currentVersionActive) {
87
+ console.log(`✅ Current version ${currentVersion} is active (correct)`);
88
+ } else {
89
+ console.log(`❌ Current version ${currentVersion} is not active (problem)`);
90
+ }
91
+
92
+ // Check deprecated versions
93
+ console.log('\n📋 Deprecated Versions:');
94
+ if (deprecatedVersions.length > 0) {
95
+ deprecatedVersions.forEach(({ version, reason }) => {
96
+ console.log(` ${version}: ${reason}`);
97
+ });
98
+ } else {
99
+ console.log(' (None)');
100
+ }
101
+
102
+ // Check active versions (should only be current version)
103
+ console.log('\n🔄 Active Versions:');
104
+ if (activeVersions.length > 0) {
105
+ activeVersions.forEach(version => {
106
+ if (version === currentVersion) {
107
+ console.log(` ✅ ${version} (current version - correct)`);
108
+ } else {
109
+ console.log(` ⚠️ ${version} (should be deprecated)`);
110
+ }
111
+ });
112
+ } else {
113
+ console.log(' (None)');
114
+ }
115
+
116
+ // Summary
117
+ console.log('\n=====================================');
118
+ console.log('🎯 Verification Summary');
119
+ console.log('=====================================');
120
+
121
+ const expectedDeprecated = deprecationList.length;
122
+ const actualDeprecated = deprecatedVersions.length;
123
+ const successRate = expectedDeprecated > 0 ? (actualDeprecated / expectedDeprecated * 100).toFixed(1) : 0;
124
+
125
+ console.log(`📊 Expected deprecated: ${expectedDeprecated}`);
126
+ console.log(`📊 Actually deprecated: ${actualDeprecated}`);
127
+ console.log(`📊 Success rate: ${successRate}%`);
128
+
129
+ if (activeVersions.length === 1 && activeVersions[0] === currentVersion) {
130
+ console.log('✅ Status: All previous versions deprecated, current version active');
131
+ } else {
132
+ console.log('⚠️ Status: Some versions may still need deprecation');
133
+ }
134
+
135
+ console.log('=====================================');
136
+ }
137
+
138
+ // Handle command line arguments
139
+ const args = process.argv.slice(2);
140
+ if (args.includes('--help') || args.includes('-h')) {
141
+ console.log(`
142
+ i18ntk Deprecation Verification Script
143
+
144
+ Usage:
145
+ node scripts/verify-deprecations.js [options]
146
+
147
+ Description:
148
+ This script verifies that i18ntk versions have been properly deprecated.
149
+
150
+ Examples:
151
+ node scripts/verify-deprecations.js
152
+ `);
153
+ process.exit(0);
154
+ }
155
+
156
+ // Run verification
157
+ verifyDeprecations();
@@ -1,12 +1,13 @@
1
- const fs = require('fs');
2
- const path = require('path');
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const SecurityUtils = require('../utils/security');
3
4
 
4
5
  // Load all language files
5
- const localesPath = path.join(__dirname, '../ui-locales');
6
+ const localesPath = path.join(__dirname, '../resources/i18n/ui-locales');
6
7
  const files = fs.readdirSync(localesPath).filter(file => file.endsWith('.json') && file !== 'en.json');
7
8
 
8
9
  // Load English as the base for comparison
9
- const enContent = JSON.parse(fs.readFileSync(path.join(localesPath, 'en.json'), 'utf8'));
10
+ const enContent = JSON.parse(SecurityUtils.safeReadFileSync(path.join(localesPath, 'en.json'), localesPath, 'utf8'));
10
11
 
11
12
  // Function to get all keys from an object
12
13
  function getAllKeys(obj, prefix = '') {
@@ -28,7 +29,7 @@ console.log('\n🔍 Verifying translation keys across all language files...\n');
28
29
  files.forEach(file => {
29
30
  const langCode = path.basename(file, '.json');
30
31
  const filePath = path.join(localesPath, file);
31
- const content = JSON.parse(fs.readFileSync(filePath, 'utf8'));
32
+ const content = JSON.parse(SecurityUtils.safeReadFileSync(filePath, localesPath, 'utf8'));
32
33
  const langKeys = new Set(getAllKeys(content));
33
34
 
34
35
  // Find missing keys