andrud 1.0.0 → 1.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.
- package/README.md +69 -83
- package/dist/__tests__/context.test.d.ts +5 -0
- package/dist/__tests__/context.test.d.ts.map +1 -0
- package/dist/__tests__/context.test.js +86 -0
- package/dist/__tests__/context.test.js.map +1 -0
- package/dist/__tests__/generator.test.d.ts +5 -0
- package/dist/__tests__/generator.test.d.ts.map +1 -0
- package/dist/__tests__/generator.test.js +83 -0
- package/dist/__tests__/generator.test.js.map +1 -0
- package/dist/__tests__/validation.test.d.ts +5 -0
- package/dist/__tests__/validation.test.d.ts.map +1 -0
- package/dist/__tests__/validation.test.js +81 -0
- package/dist/__tests__/validation.test.js.map +1 -0
- package/dist/cli/commands/create.d.ts +10 -0
- package/dist/cli/commands/create.d.ts.map +1 -0
- package/dist/cli/commands/create.js +203 -0
- package/dist/cli/commands/create.js.map +1 -0
- package/dist/cli/commands/info.d.ts +13 -0
- package/dist/cli/commands/info.d.ts.map +1 -0
- package/dist/cli/commands/info.js +153 -0
- package/dist/cli/commands/info.js.map +1 -0
- package/dist/cli/commands/init.d.ts +15 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +141 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/list.d.ts +18 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +122 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/new.d.ts +22 -0
- package/dist/cli/commands/new.d.ts.map +1 -0
- package/dist/cli/commands/new.js +245 -0
- package/dist/cli/commands/new.js.map +1 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +99 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/config.d.ts +89 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +151 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/context.d.ts +47 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +175 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/generator.d.ts +44 -0
- package/dist/core/generator.d.ts.map +1 -0
- package/{src/core/generator.ts → dist/core/generator.js} +394 -484
- package/dist/core/generator.js.map +1 -0
- package/dist/core/types.d.ts +125 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +22 -0
- package/dist/core/types.js.map +1 -0
- package/dist/templates/index.d.ts +36 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +141 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/ui/colors.d.ts +40 -0
- package/dist/ui/colors.d.ts.map +1 -0
- package/dist/ui/colors.js +117 -0
- package/dist/ui/colors.js.map +1 -0
- package/dist/ui/output.d.ts +69 -0
- package/dist/ui/output.d.ts.map +1 -0
- package/dist/ui/output.js +199 -0
- package/dist/ui/output.js.map +1 -0
- package/dist/ui/prompts.d.ts +20 -0
- package/dist/ui/prompts.d.ts.map +1 -0
- package/dist/ui/prompts.js +118 -0
- package/dist/ui/prompts.js.map +1 -0
- package/dist/ui/spinners.d.ts +30 -0
- package/dist/ui/spinners.d.ts.map +1 -0
- package/dist/ui/spinners.js +74 -0
- package/dist/ui/spinners.js.map +1 -0
- package/dist/ui/types.d.ts +35 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/types.js +5 -0
- package/dist/ui/types.js.map +1 -0
- package/dist/utils/filesystem.d.ts +38 -0
- package/dist/utils/filesystem.d.ts.map +1 -0
- package/dist/utils/filesystem.js +181 -0
- package/dist/utils/filesystem.js.map +1 -0
- package/dist/utils/logger.d.ts +27 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +52 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/object.d.ts +140 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +385 -0
- package/dist/utils/object.js.map +1 -0
- package/dist/utils/validation.d.ts +35 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +270 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +8 -19
- package/CHANGELOG.md +0 -70
- package/CODE_REVIEW_ANALYSIS.md +0 -177
- package/CONTRIBUTING.md +0 -132
- package/FIXES_IMPLEMENTED.md +0 -546
- package/src/__tests__/context.test.ts +0 -133
- package/src/__tests__/generator.test.ts +0 -107
- package/src/__tests__/validation.test.ts +0 -105
- package/src/cli/commands/create.ts +0 -252
- package/src/cli/commands/info.ts +0 -178
- package/src/cli/commands/init.ts +0 -186
- package/src/cli/commands/list.ts +0 -156
- package/src/cli/commands/new.ts +0 -316
- package/src/cli/index.ts +0 -116
- package/src/core/config.ts +0 -172
- package/src/core/context.ts +0 -212
- package/src/core/types.ts +0 -184
- package/src/templates/index.ts +0 -162
- package/src/types/gradient-string.d.ts +0 -25
- package/src/ui/colors.ts +0 -139
- package/src/ui/output.ts +0 -230
- package/src/ui/prompts.ts +0 -170
- package/src/ui/spinners.ts +0 -95
- package/src/ui/types.ts +0 -41
- package/src/utils/filesystem.ts +0 -222
- package/src/utils/logger.ts +0 -67
- package/src/utils/object.ts +0 -456
- package/src/utils/validation.ts +0 -345
- package/tsconfig.json +0 -25
package/src/core/context.ts
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context builder for generating Android project context
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { camelCase, kebabCase, pascalCase, snakeCase } from '../utils/validation.js';
|
|
6
|
-
import { GRADLE_VERSIONS, ANDROID_SDK_DEFAULTS, getTemplateConfig } from './config.js';
|
|
7
|
-
import type { TemplateType, TemplateContext, AndroidSdkConfig, GradleConfig, ProjectFeatures, NativeCppConfig } from './types.js';
|
|
8
|
-
|
|
9
|
-
const GENERATOR_VERSION = '1.0.0';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Build default context from basic parameters
|
|
13
|
-
*/
|
|
14
|
-
export function buildDefaultProjectContext(
|
|
15
|
-
appName: string,
|
|
16
|
-
packageName: string,
|
|
17
|
-
projectDirectory: string,
|
|
18
|
-
template: TemplateType,
|
|
19
|
-
features: Partial<ProjectFeatures> = {},
|
|
20
|
-
minSdk?: number,
|
|
21
|
-
targetSdk?: number
|
|
22
|
-
): Omit<TemplateContext, 'packagePath' | 'appNameSnake' | 'appNameKebab' | 'appNamePascal' | 'appNameCamel' | 'appNameLower' | 'year' | 'generatorVersion'> {
|
|
23
|
-
// Determine language and UI framework from template
|
|
24
|
-
const isCompose = template === 'kotlin-compose';
|
|
25
|
-
const isNativeCpp = template === 'native-cpp';
|
|
26
|
-
const isKotlin = template !== 'java-xml';
|
|
27
|
-
const isXml = !isCompose;
|
|
28
|
-
|
|
29
|
-
// Get template config for version info
|
|
30
|
-
const templateConfig = getTemplateConfig(template);
|
|
31
|
-
|
|
32
|
-
// Create Android SDK config
|
|
33
|
-
const android: AndroidSdkConfig = {
|
|
34
|
-
minSdk: minSdk ?? templateConfig.minSdk,
|
|
35
|
-
targetSdk: targetSdk ?? templateConfig.targetSdk,
|
|
36
|
-
compileSdk: templateConfig.compileSdk,
|
|
37
|
-
buildToolsVersion: ANDROID_SDK_DEFAULTS.BUILD_TOOLS_VERSION
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// Create Gradle config
|
|
41
|
-
const gradle: GradleConfig = {
|
|
42
|
-
agpVersion: templateConfig.agpVersion,
|
|
43
|
-
gradleVersion: templateConfig.gradleVersion,
|
|
44
|
-
kotlinVersion: isKotlin ? templateConfig.kotlinVersion : undefined,
|
|
45
|
-
composeCompilerVersion: isCompose ? GRADLE_VERSIONS.COMPOSE_COMPILER : undefined,
|
|
46
|
-
composeBomVersion: isCompose ? GRADLE_VERSIONS.COMPOSE_BOM : undefined
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Build project features
|
|
50
|
-
const projectFeatures: ProjectFeatures = {
|
|
51
|
-
git: features.git ?? true,
|
|
52
|
-
readme: features.readme ?? true,
|
|
53
|
-
androidX: features.androidX ?? true,
|
|
54
|
-
kotlinDsl: features.kotlinDsl ?? true,
|
|
55
|
-
adaptiveIcon: features.adaptiveIcon ?? true,
|
|
56
|
-
material3: isCompose || (features.material3 ?? true),
|
|
57
|
-
viewBinding: features.viewBinding ?? isXml,
|
|
58
|
-
dataBinding: features.dataBinding ?? false,
|
|
59
|
-
jetpackCompose: isCompose ? true : (features.jetpackCompose ?? false)
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// Build native C++ config if needed
|
|
63
|
-
const nativeCpp: NativeCppConfig | undefined = isNativeCpp ? {
|
|
64
|
-
cppStandard: 'c++17',
|
|
65
|
-
ndkVersion: templateConfig.ndkVersion ?? GRADLE_VERSIONS.NDK,
|
|
66
|
-
stlType: 'c++_shared',
|
|
67
|
-
abiFilters: ['armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64']
|
|
68
|
-
} : undefined;
|
|
69
|
-
|
|
70
|
-
// Build base context - spread features at top level to match TemplateContext (which extends ProjectFeatures)
|
|
71
|
-
const baseContext = {
|
|
72
|
-
appName,
|
|
73
|
-
packageName,
|
|
74
|
-
projectDirectory,
|
|
75
|
-
template,
|
|
76
|
-
language: templateConfig.language,
|
|
77
|
-
uiFramework: templateConfig.uiFramework,
|
|
78
|
-
android,
|
|
79
|
-
gradle,
|
|
80
|
-
...projectFeatures,
|
|
81
|
-
nativeCpp
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// Cast to Omit<TemplateContext, ...> for the fields that buildTemplateContext adds
|
|
85
|
-
const contextForBuildTemplate: Omit<TemplateContext, 'packagePath' | 'appNameSnake' | 'appNameKebab' | 'appNamePascal' | 'appNameCamel' | 'appNameLower' | 'year' | 'generatorVersion'> = baseContext as unknown as Omit<TemplateContext, 'packagePath' | 'appNameSnake' | 'appNameKebab' | 'appNamePascal' | 'appNameCamel' | 'appNameLower' | 'year' | 'generatorVersion'>;
|
|
86
|
-
return contextForBuildTemplate;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Build full template context with all derived values
|
|
91
|
-
*/
|
|
92
|
-
export function buildTemplateContext(
|
|
93
|
-
context: {
|
|
94
|
-
appName: string;
|
|
95
|
-
packageName: string;
|
|
96
|
-
projectDirectory: string;
|
|
97
|
-
template: string;
|
|
98
|
-
uiFramework: string;
|
|
99
|
-
language: 'kotlin' | 'java';
|
|
100
|
-
android: { minSdk: number; targetSdk: number; compileSdk: number };
|
|
101
|
-
gradle: {
|
|
102
|
-
agpVersion: string;
|
|
103
|
-
gradleVersion: string;
|
|
104
|
-
kotlinVersion?: string;
|
|
105
|
-
composeCompilerVersion?: string;
|
|
106
|
-
composeBomVersion?: string;
|
|
107
|
-
};
|
|
108
|
-
features: Record<string, boolean>;
|
|
109
|
-
nativeCpp?: { cppStandard: string; ndkVersion?: string; stlType?: string; abiFilters?: string[] };
|
|
110
|
-
year?: string;
|
|
111
|
-
}
|
|
112
|
-
): TemplateContext {
|
|
113
|
-
// Transform app name to various cases
|
|
114
|
-
const normalizedAppName = context.appName.replace(/\s+/g, '_');
|
|
115
|
-
const appNameSnake = snakeCase(context.appName);
|
|
116
|
-
const appNameKebab = kebabCase(context.appName);
|
|
117
|
-
const appNamePascal = pascalCase(context.appName);
|
|
118
|
-
const appNameCamel = camelCase(context.appName);
|
|
119
|
-
const appNameLower = context.appName.toLowerCase().replace(/\s+/g, '');
|
|
120
|
-
|
|
121
|
-
// Convert package name to path format (e.g., "com.example.myapp" -> "com/example/myapp")
|
|
122
|
-
const packagePath = context.packageName.replace(/\./g, '/');
|
|
123
|
-
|
|
124
|
-
// Get current year
|
|
125
|
-
const year = context.year ?? new Date().getFullYear().toString();
|
|
126
|
-
|
|
127
|
-
// Build native C++ config
|
|
128
|
-
const nativeCpp: NativeCppConfig | undefined = context.nativeCpp ? {
|
|
129
|
-
cppStandard: (context.nativeCpp.cppStandard === 'c++20' ? 'c++20' : 'c++17') as 'c++17' | 'c++20',
|
|
130
|
-
ndkVersion: context.nativeCpp.ndkVersion,
|
|
131
|
-
stlType: (context.nativeCpp.stlType as NativeCppConfig['stlType']) ?? 'c++_shared',
|
|
132
|
-
abiFilters: context.nativeCpp.abiFilters
|
|
133
|
-
} : undefined;
|
|
134
|
-
|
|
135
|
-
// Build project features from context (features may be at top level or nested)
|
|
136
|
-
const featuresObj = context.features as Record<string, unknown> || {};
|
|
137
|
-
const features: ProjectFeatures = {
|
|
138
|
-
git: typeof featuresObj.git === 'boolean' ? featuresObj.git : true,
|
|
139
|
-
readme: typeof featuresObj.readme === 'boolean' ? featuresObj.readme : true,
|
|
140
|
-
androidX: typeof featuresObj.androidX === 'boolean' ? featuresObj.androidX : true,
|
|
141
|
-
kotlinDsl: typeof featuresObj.kotlinDsl === 'boolean' ? featuresObj.kotlinDsl : true,
|
|
142
|
-
adaptiveIcon: typeof featuresObj.adaptiveIcon === 'boolean' ? featuresObj.adaptiveIcon : true,
|
|
143
|
-
material3: typeof featuresObj.material3 === 'boolean' ? featuresObj.material3 : true,
|
|
144
|
-
viewBinding: typeof featuresObj.viewBinding === 'boolean' ? featuresObj.viewBinding : undefined,
|
|
145
|
-
dataBinding: typeof featuresObj.dataBinding === 'boolean' ? featuresObj.dataBinding : undefined,
|
|
146
|
-
jetpackCompose: typeof featuresObj.jetpackCompose === 'boolean' ? featuresObj.jetpackCompose : undefined
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// Build the complete template context
|
|
150
|
-
const templateContext: TemplateContext = {
|
|
151
|
-
appName: context.appName,
|
|
152
|
-
packageName: context.packageName,
|
|
153
|
-
projectDirectory: context.projectDirectory,
|
|
154
|
-
template: context.template as TemplateType,
|
|
155
|
-
language: context.language,
|
|
156
|
-
uiFramework: context.uiFramework as 'xml' | 'compose',
|
|
157
|
-
android: {
|
|
158
|
-
minSdk: context.android.minSdk,
|
|
159
|
-
targetSdk: context.android.targetSdk,
|
|
160
|
-
compileSdk: context.android.compileSdk,
|
|
161
|
-
buildToolsVersion: context.android.compileSdk > 34 ? '35.0.0' : '34.0.0'
|
|
162
|
-
},
|
|
163
|
-
gradle: {
|
|
164
|
-
agpVersion: context.gradle.agpVersion,
|
|
165
|
-
gradleVersion: context.gradle.gradleVersion,
|
|
166
|
-
kotlinVersion: context.gradle.kotlinVersion,
|
|
167
|
-
composeCompilerVersion: context.gradle.composeCompilerVersion,
|
|
168
|
-
composeBomVersion: context.gradle.composeBomVersion
|
|
169
|
-
},
|
|
170
|
-
appNameSnake,
|
|
171
|
-
appNameKebab,
|
|
172
|
-
appNamePascal,
|
|
173
|
-
appNameCamel,
|
|
174
|
-
appNameLower,
|
|
175
|
-
packagePath,
|
|
176
|
-
year,
|
|
177
|
-
generatorVersion: GENERATOR_VERSION,
|
|
178
|
-
...features,
|
|
179
|
-
nativeCpp
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
return templateContext;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Validate context has all required fields
|
|
187
|
-
*/
|
|
188
|
-
export function validateContext(context: Partial<TemplateContext>): { valid: boolean; errors: string[] } {
|
|
189
|
-
const errors: string[] = [];
|
|
190
|
-
|
|
191
|
-
if (!context.appName) errors.push('appName is required');
|
|
192
|
-
if (!context.packageName) errors.push('packageName is required');
|
|
193
|
-
if (!context.projectDirectory) errors.push('projectDirectory is required');
|
|
194
|
-
if (!context.template) errors.push('template is required');
|
|
195
|
-
if (!context.language) errors.push('language is required');
|
|
196
|
-
if (!context.uiFramework) errors.push('uiFramework is required');
|
|
197
|
-
if (!context.android) errors.push('android config is required');
|
|
198
|
-
if (!context.gradle) errors.push('gradle config is required');
|
|
199
|
-
|
|
200
|
-
if (context.android) {
|
|
201
|
-
if (!context.android.minSdk) errors.push('android.minSdk is required');
|
|
202
|
-
if (!context.android.targetSdk) errors.push('android.targetSdk is required');
|
|
203
|
-
if (!context.android.compileSdk) errors.push('android.compileSdk is required');
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (context.gradle) {
|
|
207
|
-
if (!context.gradle.agpVersion) errors.push('gradle.agpVersion is required');
|
|
208
|
-
if (!context.gradle.gradleVersion) errors.push('gradle.gradleVersion is required');
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return { valid: errors.length === 0, errors };
|
|
212
|
-
}
|
package/src/core/types.ts
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core type definitions for the Android project generator
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// Language and UI framework types
|
|
6
|
-
export type LanguageType = 'kotlin' | 'java';
|
|
7
|
-
export type UiFrameworkType = 'xml' | 'compose';
|
|
8
|
-
export type TemplateType = 'kotlin-xml' | 'kotlin-compose' | 'java-xml' | 'native-cpp';
|
|
9
|
-
|
|
10
|
-
// Android SDK configuration
|
|
11
|
-
export interface AndroidSdkConfig {
|
|
12
|
-
minSdk: number;
|
|
13
|
-
targetSdk: number;
|
|
14
|
-
compileSdk: number;
|
|
15
|
-
buildToolsVersion?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Gradle configuration
|
|
19
|
-
export interface GradleConfig {
|
|
20
|
-
agpVersion: string;
|
|
21
|
-
gradleVersion: string;
|
|
22
|
-
kotlinVersion?: string;
|
|
23
|
-
composeCompilerVersion?: string;
|
|
24
|
-
composeBomVersion?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Project features
|
|
28
|
-
export interface ProjectFeatures {
|
|
29
|
-
git: boolean;
|
|
30
|
-
readme: boolean;
|
|
31
|
-
androidX: boolean;
|
|
32
|
-
kotlinDsl: boolean;
|
|
33
|
-
adaptiveIcon: boolean;
|
|
34
|
-
material3: boolean;
|
|
35
|
-
viewBinding?: boolean;
|
|
36
|
-
dataBinding?: boolean;
|
|
37
|
-
jetpackCompose?: boolean;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Native C++ configuration
|
|
41
|
-
export interface NativeCppConfig {
|
|
42
|
-
cppStandard: 'c++17' | 'c++20';
|
|
43
|
-
ndkVersion?: string;
|
|
44
|
-
stlType?: 'c++_shared' | 'c++_static' | 'none' | 'system';
|
|
45
|
-
abiFilters?: string[];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Template context for project generation
|
|
49
|
-
export interface TemplateContext extends ProjectFeatures {
|
|
50
|
-
// Basic info
|
|
51
|
-
appName: string;
|
|
52
|
-
packageName: string;
|
|
53
|
-
projectDirectory: string;
|
|
54
|
-
template: TemplateType;
|
|
55
|
-
|
|
56
|
-
// Derived info
|
|
57
|
-
language: LanguageType;
|
|
58
|
-
uiFramework: UiFrameworkType;
|
|
59
|
-
|
|
60
|
-
// SDK and Gradle config
|
|
61
|
-
android: AndroidSdkConfig;
|
|
62
|
-
gradle: GradleConfig;
|
|
63
|
-
|
|
64
|
-
// Transformed names
|
|
65
|
-
appNameSnake: string;
|
|
66
|
-
appNameKebab: string;
|
|
67
|
-
appNamePascal: string;
|
|
68
|
-
appNameCamel: string;
|
|
69
|
-
appNameLower: string;
|
|
70
|
-
|
|
71
|
-
// Package path (e.g., "com/example/myapp")
|
|
72
|
-
packagePath: string;
|
|
73
|
-
|
|
74
|
-
// Date and version info
|
|
75
|
-
year: string;
|
|
76
|
-
generatorVersion: string;
|
|
77
|
-
|
|
78
|
-
// Native C++ config (optional)
|
|
79
|
-
nativeCpp?: NativeCppConfig;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Generation options
|
|
83
|
-
export interface GenerationOptions {
|
|
84
|
-
overwrite: boolean;
|
|
85
|
-
skipInstall: boolean;
|
|
86
|
-
dryRun: boolean;
|
|
87
|
-
verbose: boolean;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Generation result
|
|
91
|
-
export interface GenerationResult {
|
|
92
|
-
success: boolean;
|
|
93
|
-
projectPath: string;
|
|
94
|
-
generatedFiles: string[];
|
|
95
|
-
skippedFiles: string[];
|
|
96
|
-
errors: Array<{
|
|
97
|
-
file?: string;
|
|
98
|
-
message: string;
|
|
99
|
-
code?: string;
|
|
100
|
-
}>;
|
|
101
|
-
warnings: string[];
|
|
102
|
-
duration: number;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// File to be generated
|
|
106
|
-
export interface GeneratedFile {
|
|
107
|
-
path: string;
|
|
108
|
-
content: string;
|
|
109
|
-
overwrite?: boolean;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Validation result
|
|
113
|
-
export interface ValidationResult {
|
|
114
|
-
valid: boolean;
|
|
115
|
-
errors: string[];
|
|
116
|
-
warnings: string[];
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Directory structure definition
|
|
120
|
-
export interface DirectorySpec {
|
|
121
|
-
path: string;
|
|
122
|
-
description?: string;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Template metadata
|
|
126
|
-
export interface TemplateMetadata {
|
|
127
|
-
id: TemplateType;
|
|
128
|
-
name: string;
|
|
129
|
-
description: string;
|
|
130
|
-
keywords: string[];
|
|
131
|
-
features: string[];
|
|
132
|
-
language: LanguageType;
|
|
133
|
-
uiFramework: UiFrameworkType;
|
|
134
|
-
codePreview?: string;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// CLI command options
|
|
138
|
-
export interface NewCommandOptions {
|
|
139
|
-
name?: string;
|
|
140
|
-
template?: string;
|
|
141
|
-
packageName?: string;
|
|
142
|
-
directory?: string;
|
|
143
|
-
minSdk?: number;
|
|
144
|
-
targetSdk?: number;
|
|
145
|
-
force?: boolean;
|
|
146
|
-
skipInstall?: boolean;
|
|
147
|
-
git?: boolean;
|
|
148
|
-
kotlin?: boolean;
|
|
149
|
-
verbose?: boolean;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface InitCommandOptions {
|
|
153
|
-
force: boolean;
|
|
154
|
-
template?: string;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export interface InfoCommandOptions {
|
|
158
|
-
template?: string;
|
|
159
|
-
json: boolean;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface ListCommandOptions {
|
|
163
|
-
json: boolean;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Default options
|
|
167
|
-
export const DEFAULT_GENERATION_OPTIONS: GenerationOptions = {
|
|
168
|
-
overwrite: false,
|
|
169
|
-
skipInstall: false,
|
|
170
|
-
dryRun: false,
|
|
171
|
-
verbose: false
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export const DEFAULT_PROJECT_FEATURES: ProjectFeatures = {
|
|
175
|
-
git: true,
|
|
176
|
-
readme: true,
|
|
177
|
-
androidX: true,
|
|
178
|
-
kotlinDsl: true,
|
|
179
|
-
adaptiveIcon: true,
|
|
180
|
-
material3: true,
|
|
181
|
-
viewBinding: true,
|
|
182
|
-
dataBinding: false,
|
|
183
|
-
jetpackCompose: false
|
|
184
|
-
};
|
package/src/templates/index.ts
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Template registry and metadata
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import type { TemplateType } from '../core/types.js';
|
|
6
|
-
|
|
7
|
-
interface TemplateMetadata {
|
|
8
|
-
id: TemplateType;
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
keywords: string[];
|
|
12
|
-
features: string[];
|
|
13
|
-
language: 'kotlin' | 'java';
|
|
14
|
-
uiFramework: 'xml' | 'compose';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type { TemplateMetadata };
|
|
18
|
-
|
|
19
|
-
export const TEMPLATE_REGISTRY: TemplateMetadata[] = [
|
|
20
|
-
{
|
|
21
|
-
id: 'kotlin-xml',
|
|
22
|
-
name: 'Kotlin with XML Layouts',
|
|
23
|
-
description: 'Traditional Android Views with Kotlin. Best for developers who prefer XML layouts and ViewBinding.',
|
|
24
|
-
keywords: ['kotlin', 'xml', 'views', 'viewbinding', 'material'],
|
|
25
|
-
features: ['Material Design 3', 'ViewBinding', 'Kotlin Coroutines', 'RecyclerView', 'ConstraintLayout'],
|
|
26
|
-
language: 'kotlin',
|
|
27
|
-
uiFramework: 'xml'
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: 'kotlin-compose',
|
|
31
|
-
name: 'Kotlin with Jetpack Compose',
|
|
32
|
-
description: 'Modern declarative UI with Kotlin and Jetpack Compose. Latest Android UI toolkit with Material 3 support.',
|
|
33
|
-
keywords: ['kotlin', 'compose', 'declarative', 'material3', 'modern'],
|
|
34
|
-
features: ['Material Design 3', 'Compose Navigation', 'Kotlin Coroutines', 'ViewModel', 'Hilt'],
|
|
35
|
-
language: 'kotlin',
|
|
36
|
-
uiFramework: 'compose'
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 'java-xml',
|
|
40
|
-
name: 'Java with XML Layouts',
|
|
41
|
-
description: 'Traditional Android Views with Java. Ideal for teams maintaining Java codebases or preferring Java syntax.',
|
|
42
|
-
keywords: ['java', 'xml', 'views', 'viewbinding', 'legacy'],
|
|
43
|
-
features: ['Material Design 3', 'ViewBinding', 'Java 17', 'RecyclerView', 'ConstraintLayout'],
|
|
44
|
-
language: 'java',
|
|
45
|
-
uiFramework: 'xml'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: 'native-cpp',
|
|
49
|
-
name: 'Kotlin with Native C++/NDK',
|
|
50
|
-
description: 'Native C++ development with JNI integration. For high-performance code, game engines, or system-level programming.',
|
|
51
|
-
keywords: ['kotlin', 'native', 'cpp', 'ndk', 'jni', 'cmake'],
|
|
52
|
-
features: ['CMake Integration', 'JNI Bridge', 'Native Development', 'Multi-ABI Support', 'STL'],
|
|
53
|
-
language: 'kotlin',
|
|
54
|
-
uiFramework: 'xml'
|
|
55
|
-
}
|
|
56
|
-
];
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Get template metadata by ID
|
|
60
|
-
*/
|
|
61
|
-
export function getTemplateMetadata(id: TemplateType): TemplateMetadata | undefined {
|
|
62
|
-
return TEMPLATE_REGISTRY.find((t) => t.id === id);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Get all available templates
|
|
67
|
-
*/
|
|
68
|
-
export function getAllTemplates(): TemplateMetadata[] {
|
|
69
|
-
return [...TEMPLATE_REGISTRY];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Search templates by query
|
|
74
|
-
*/
|
|
75
|
-
export function searchTemplates(query: string): TemplateMetadata[] {
|
|
76
|
-
const lowerQuery = query.toLowerCase();
|
|
77
|
-
|
|
78
|
-
return TEMPLATE_REGISTRY.filter((template) => {
|
|
79
|
-
if (template.name.toLowerCase().includes(lowerQuery)) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
if (template.description.toLowerCase().includes(lowerQuery)) {
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
if (template.keywords.some((k) => k.toLowerCase().includes(lowerQuery))) {
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
if (template.id.toLowerCase().includes(lowerQuery)) {
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
return false;
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Get templates by category
|
|
97
|
-
*/
|
|
98
|
-
export function getTemplatesByCategory(category: 'kotlin' | 'java' | 'native'): TemplateMetadata[] {
|
|
99
|
-
return TEMPLATE_REGISTRY.filter((t) => {
|
|
100
|
-
switch (category) {
|
|
101
|
-
case 'kotlin':
|
|
102
|
-
return t.id === 'kotlin-xml' || t.id === 'kotlin-compose' || t.id === 'native-cpp';
|
|
103
|
-
case 'java':
|
|
104
|
-
return t.id === 'java-xml';
|
|
105
|
-
case 'native':
|
|
106
|
-
return t.id === 'native-cpp';
|
|
107
|
-
default:
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Get template preview code
|
|
115
|
-
*/
|
|
116
|
-
export function getTemplatePreview(id: TemplateType): string | undefined {
|
|
117
|
-
const previews: Record<string, string> = {
|
|
118
|
-
'kotlin-compose': `// MainActivity.kt
|
|
119
|
-
@Composable
|
|
120
|
-
fun MainScreen() {
|
|
121
|
-
var count by remember { mutableIntStateOf(0) }
|
|
122
|
-
|
|
123
|
-
Column(
|
|
124
|
-
modifier = Modifier
|
|
125
|
-
.fillMaxSize()
|
|
126
|
-
.padding(16.dp),
|
|
127
|
-
horizontalAlignment = Alignment.CenterHorizontally
|
|
128
|
-
) {
|
|
129
|
-
Text(
|
|
130
|
-
text = "Count: $count",
|
|
131
|
-
style = MaterialTheme.typography.headlineMedium
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
}`,
|
|
135
|
-
'kotlin-xml': `// MainActivity.kt
|
|
136
|
-
class MainActivity : AppCompatActivity() {
|
|
137
|
-
override fun onCreate(savedInstanceState: Bundle?) {
|
|
138
|
-
super.onCreate(savedInstanceState)
|
|
139
|
-
setContentView(R.layout.activity_main)
|
|
140
|
-
}
|
|
141
|
-
}`,
|
|
142
|
-
'java-xml': `// MainActivity.java
|
|
143
|
-
public class MainActivity extends AppCompatActivity {
|
|
144
|
-
@Override
|
|
145
|
-
protected void onCreate(Bundle savedInstanceState) {
|
|
146
|
-
super.onCreate(savedInstanceState);
|
|
147
|
-
setContentView(R.layout.activity_main);
|
|
148
|
-
}
|
|
149
|
-
}`,
|
|
150
|
-
'native-cpp': `// native-lib.cpp
|
|
151
|
-
#include <jni.h>
|
|
152
|
-
#include <string>
|
|
153
|
-
|
|
154
|
-
extern "C" JNIEXPORT jstring JNICALL
|
|
155
|
-
Java_com_example_app_NativeLib_stringFromJNI(
|
|
156
|
-
JNIEnv* env, jobject /* this */) {
|
|
157
|
-
return env->NewStringUTF("Hello from C++");
|
|
158
|
-
}`
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
return previews[id];
|
|
162
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
declare module 'gradient-string' {
|
|
2
|
-
interface Gradient {
|
|
3
|
-
(text: string): string;
|
|
4
|
-
rainbow(text: string): string;
|
|
5
|
-
pastel(text: string): string;
|
|
6
|
-
ice(text: string): string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface GradientStatic {
|
|
10
|
-
(color1: string, color2: string): Gradient;
|
|
11
|
-
rainbow: Gradient;
|
|
12
|
-
pastel: Gradient;
|
|
13
|
-
teen: Gradient;
|
|
14
|
-
mind: Gradient;
|
|
15
|
-
summer: Gradient;
|
|
16
|
-
winter: Gradient;
|
|
17
|
-
autumn: Gradient;
|
|
18
|
-
spring: Gradient;
|
|
19
|
-
forest: Gradient;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const gradient: GradientStatic;
|
|
23
|
-
export default gradient;
|
|
24
|
-
export { Gradient, GradientStatic };
|
|
25
|
-
}
|