kasy-cli 1.14.0 → 1.16.0
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/bin/kasy.js +18 -5
- package/lib/commands/icon.js +29 -1
- package/lib/commands/ios.js +8 -2
- package/lib/commands/reset.js +100 -2
- package/lib/commands/run.js +61 -2
- package/lib/commands/splash.js +11 -0
- package/lib/scaffold/backends/api/pubspec.yaml.tpl +4 -2
- package/lib/scaffold/backends/supabase/pubspec.yaml.tpl +4 -2
- package/lib/utils/apple-release.js +30 -0
- package/lib/utils/checks.js +41 -2
- package/lib/utils/debug.js +75 -0
- package/lib/utils/friendly-error.js +91 -0
- package/lib/utils/i18n/messages-en.js +977 -0
- package/lib/utils/i18n/messages-es.js +975 -0
- package/lib/utils/i18n/messages-pt.js +975 -0
- package/lib/utils/i18n.js +21 -2818
- package/lib/utils/png-padding.js +252 -0
- package/package.json +8 -3
- package/templates/firebase/android/app/src/main/kotlin/com/aicrus/firebase/kit/MyWidget.kt +12 -11
- package/templates/firebase/android/app/src/main/res/drawable-hdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-hdpi/ic_launcher_background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-mdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-mdpi/ic_launcher_background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-hdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-mdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxxhdpi/android12splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png +0 -0
- package/templates/firebase/android/app/src/main/res/layout/widget_preview.xml +18 -11
- package/templates/firebase/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +9 -0
- package/templates/firebase/assets/images/icon_android.png +0 -0
- package/templates/firebase/assets/images/icon_foreground_empty.png +0 -0
- package/templates/firebase/assets/images/splash_logo_dark_android12.png +0 -0
- package/templates/firebase/assets/images/splash_logo_light_android12.png +0 -0
- package/templates/firebase/lib/components/components.dart +1 -0
- package/templates/firebase/lib/components/kasy_avatar.dart +88 -57
- package/templates/firebase/lib/components/kasy_avatar_presets.dart +116 -74
- package/templates/firebase/lib/components/kasy_tabs.dart +431 -0
- package/templates/firebase/lib/core/home_widgets/home_widget_mywidget_service.dart +12 -6
- package/templates/firebase/lib/features/home/home_components_page.dart +1 -1
- package/templates/firebase/lib/features/home/home_components_preview_registry.dart +316 -93
- package/templates/firebase/pubspec.yaml +4 -2
- package/templates/firebase/web/index.html +9 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map common errors to actionable hints for non-technical users.
|
|
3
|
+
*
|
|
4
|
+
* Pattern: takes an Error and the current translator (t), returns a string
|
|
5
|
+
* with both the original message and a one-line "→ try this" suggestion.
|
|
6
|
+
* Falls back to just the message when no pattern matches.
|
|
7
|
+
*
|
|
8
|
+
* Used by bin/kasy.js global error handler.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const kleur = require('kleur');
|
|
14
|
+
|
|
15
|
+
// Each rule: { match: RegExp | (err) => boolean, hintKey: i18n key, hintFallback: english fallback }
|
|
16
|
+
// Order matters — more specific rules first.
|
|
17
|
+
const RULES = [
|
|
18
|
+
{
|
|
19
|
+
match: /pubspec\.yaml/i,
|
|
20
|
+
hintKey: 'error.hint.notFlutterProject',
|
|
21
|
+
hintFallback: 'You\'re not inside a Flutter project. Try `kasy new` to create one, or cd into an existing one.',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
match: /flutter[^a-z]+not found|ENOENT.*flutter/i,
|
|
25
|
+
hintKey: 'error.hint.flutterMissing',
|
|
26
|
+
hintFallback: 'Flutter is not installed or not on your PATH. Run `kasy doctor` to diagnose.',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
match: /EACCES|permission denied/i,
|
|
30
|
+
hintKey: 'error.hint.permission',
|
|
31
|
+
hintFallback: 'A file or folder is read-only. Check the parent directory permissions or try again from your home folder.',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
match: /ENOSPC|No space left/i,
|
|
35
|
+
hintKey: 'error.hint.noSpace',
|
|
36
|
+
hintFallback: 'Disk is full. Free up space (Flutter/Xcode builds need 5-15 GB) and try again.',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
match: /ECONNREFUSED|ENOTFOUND|getaddrinfo|network/i,
|
|
40
|
+
hintKey: 'error.hint.network',
|
|
41
|
+
hintFallback: 'Network problem — check your internet connection and try again.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
match: /firebase.*not.*log(ged|in)|firebase login/i,
|
|
45
|
+
hintKey: 'error.hint.firebaseLogin',
|
|
46
|
+
hintFallback: 'You are not logged into Firebase. Run: firebase login',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
match: /supabase.*not.*log(ged|in)|supabase login/i,
|
|
50
|
+
hintKey: 'error.hint.supabaseLogin',
|
|
51
|
+
hintFallback: 'You are not logged into Supabase. Run: supabase login',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
match: /gcloud.*not authenticated|gcloud auth/i,
|
|
55
|
+
hintKey: 'error.hint.gcloudAuth',
|
|
56
|
+
hintFallback: 'You need to authenticate with gcloud. Run: gcloud auth login',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
match: /flutter run exited|flutter exited/i,
|
|
60
|
+
hintKey: 'error.hint.flutterRunFailed',
|
|
61
|
+
hintFallback: 'Flutter could not run the app. Run again with --verbose to see the full Flutter output.',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
function findHint(message) {
|
|
66
|
+
const text = String(message || '');
|
|
67
|
+
for (const rule of RULES) {
|
|
68
|
+
const isMatch = typeof rule.match === 'function' ? rule.match({ message: text }) : rule.match.test(text);
|
|
69
|
+
if (isMatch) return rule;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Format an error for terminal output. Returns a string with the red ✗ line
|
|
76
|
+
* plus, when we recognize the pattern, a dim hint line beneath it.
|
|
77
|
+
*/
|
|
78
|
+
function formatError(err, t) {
|
|
79
|
+
const message = err && err.message ? err.message : String(err);
|
|
80
|
+
const lines = [kleur.red(`\n✗ ${message}`)];
|
|
81
|
+
const hint = findHint(message);
|
|
82
|
+
if (hint) {
|
|
83
|
+
const text = t ? t(hint.hintKey) : null;
|
|
84
|
+
// Translator returns the key itself when missing — fall back to English.
|
|
85
|
+
const hintText = (text && text !== hint.hintKey) ? text : hint.hintFallback;
|
|
86
|
+
lines.push(kleur.dim(` → ${hintText}`));
|
|
87
|
+
}
|
|
88
|
+
return lines.join('\n');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = { formatError, findHint };
|