@idealyst/cli 1.0.20 → 1.0.22
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/dist/index.js
CHANGED
|
@@ -133,16 +133,20 @@ function getTemplateData(projectName, description, appName) {
|
|
|
133
133
|
appName
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
async function initializeReactNativeProject(projectName, directory, displayName) {
|
|
136
|
+
async function initializeReactNativeProject(projectName, directory, displayName, skipInstall) {
|
|
137
137
|
const spinner = ora('Initializing React Native project...').start();
|
|
138
138
|
try {
|
|
139
139
|
// Use the correct React Native CLI command format with specific version and yarn
|
|
140
140
|
const cliCommand = 'npx';
|
|
141
|
-
const args = ['@react-native-community/cli@latest', 'init', projectName, '--version', '0.80.1', '--pm', 'yarn'];
|
|
141
|
+
const args = ['@react-native-community/cli@latest', 'init', projectName, '--version', '0.80.1', '--pm', 'yarn', '--skip-git'];
|
|
142
142
|
// Add title if displayName is provided
|
|
143
143
|
if (displayName) {
|
|
144
144
|
args.push('--title', displayName);
|
|
145
145
|
}
|
|
146
|
+
// Skip install if requested (we'll handle it separately for workspace integration)
|
|
147
|
+
if (skipInstall) {
|
|
148
|
+
args.push('--skip-install');
|
|
149
|
+
}
|
|
146
150
|
// Run React Native initialization in the target directory
|
|
147
151
|
await runCommand(cliCommand, args, { cwd: directory });
|
|
148
152
|
spinner.succeed('React Native project initialized successfully');
|
|
@@ -150,7 +154,7 @@ async function initializeReactNativeProject(projectName, directory, displayName)
|
|
|
150
154
|
catch (error) {
|
|
151
155
|
spinner.fail('Failed to initialize React Native project');
|
|
152
156
|
console.log(chalk.yellow('Make sure you have the React Native CLI and yarn available:'));
|
|
153
|
-
console.log(chalk.white(' npx @react-native-community/cli@latest init ProjectName --version 0.80.1 --pm yarn'));
|
|
157
|
+
console.log(chalk.white(' npx @react-native-community/cli@latest init ProjectName --version 0.80.1 --pm yarn --skip-git'));
|
|
154
158
|
console.log(chalk.yellow('If you encounter issues, try:'));
|
|
155
159
|
console.log(chalk.white(' npm install -g @react-native-community/cli'));
|
|
156
160
|
console.log(chalk.white(' npm install -g yarn'));
|
|
@@ -280,9 +284,44 @@ async function promptForAppName(projectName) {
|
|
|
280
284
|
]);
|
|
281
285
|
return appName;
|
|
282
286
|
}
|
|
287
|
+
async function configureAndroidVectorIcons(projectPath) {
|
|
288
|
+
const buildGradlePath = path.join(projectPath, 'android', 'app', 'build.gradle');
|
|
289
|
+
try {
|
|
290
|
+
if (await fs.pathExists(buildGradlePath)) {
|
|
291
|
+
let content = await fs.readFile(buildGradlePath, 'utf8');
|
|
292
|
+
// Check if the vector icons line is already present
|
|
293
|
+
if (content.includes('react-native-vector-icons/fonts.gradle')) {
|
|
294
|
+
console.log(chalk.yellow('Vector icons configuration already exists in build.gradle'));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
// Find the line with jscFlavor definition and add the vector icons line after it
|
|
298
|
+
const jscFlavorRegex = /def jscFlavor = ['"][^'"]*['"]/;
|
|
299
|
+
const match = content.match(jscFlavorRegex);
|
|
300
|
+
if (match) {
|
|
301
|
+
const insertionPoint = content.indexOf(match[0]) + match[0].length;
|
|
302
|
+
const beforeInsertion = content.substring(0, insertionPoint);
|
|
303
|
+
const afterInsertion = content.substring(insertionPoint);
|
|
304
|
+
const vectorIconsLine = '\napply from: file("../../node_modules/react-native-vector-icons/fonts.gradle")';
|
|
305
|
+
content = beforeInsertion + vectorIconsLine + afterInsertion;
|
|
306
|
+
await fs.writeFile(buildGradlePath, content);
|
|
307
|
+
console.log(chalk.green('✅ Added react-native-vector-icons configuration to Android build.gradle'));
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
console.log(chalk.yellow('⚠️ Could not find jscFlavor line in build.gradle, vector icons configuration not added'));
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
console.log(chalk.yellow('⚠️ Android build.gradle not found, skipping vector icons configuration'));
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
console.log(chalk.yellow(`⚠️ Could not configure vector icons in build.gradle: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
283
321
|
|
|
284
322
|
var utils = /*#__PURE__*/Object.freeze({
|
|
285
323
|
__proto__: null,
|
|
324
|
+
configureAndroidVectorIcons: configureAndroidVectorIcons,
|
|
286
325
|
copyTemplate: copyTemplate,
|
|
287
326
|
createPackageName: createPackageName,
|
|
288
327
|
getTemplateData: getTemplateData,
|
|
@@ -314,20 +353,23 @@ async function generateNativeProject(options) {
|
|
|
314
353
|
const templatePath = path.join(__dirname$3, '..', 'templates', 'native');
|
|
315
354
|
const templateData = getTemplateData(name, `React Native app built with Idealyst Framework`, displayName);
|
|
316
355
|
try {
|
|
317
|
-
// Step 1:
|
|
318
|
-
await
|
|
319
|
-
// Step 2:
|
|
356
|
+
// Step 1: Update workspace configuration FIRST (before React Native CLI)
|
|
357
|
+
await updateWorkspacePackageJson(name, directory);
|
|
358
|
+
// Step 2: Initialize React Native project using CLI with --skip-install
|
|
359
|
+
await initializeReactNativeProject(name, directory, displayName, true);
|
|
360
|
+
// Step 3: Overlay Idealyst-specific files
|
|
320
361
|
await overlayIdealystFiles(templatePath, projectPath, templateData);
|
|
321
|
-
// Step
|
|
362
|
+
// Step 4: Configure Android vector icons
|
|
363
|
+
await configureAndroidVectorIcons(projectPath);
|
|
364
|
+
// Step 5: Install dependencies (including Idealyst packages) after workspace config is updated
|
|
322
365
|
await installDependencies(projectPath, skipInstall);
|
|
323
|
-
// Step 4: Update workspace configuration if applicable
|
|
324
|
-
await updateWorkspacePackageJson(name, directory);
|
|
325
366
|
console.log(chalk.green('✅ React Native project created successfully!'));
|
|
326
367
|
console.log(chalk.blue('📋 Project includes:'));
|
|
327
368
|
console.log(chalk.white(' • React Native with proper Android/iOS setup'));
|
|
328
369
|
console.log(chalk.white(' • Idealyst Components'));
|
|
329
370
|
console.log(chalk.white(' • Idealyst Navigation'));
|
|
330
371
|
console.log(chalk.white(' • Idealyst Theme'));
|
|
372
|
+
console.log(chalk.white(' • React Native Vector Icons (configured)'));
|
|
331
373
|
console.log(chalk.white(' • TypeScript configuration'));
|
|
332
374
|
console.log(chalk.white(' • Metro configuration'));
|
|
333
375
|
console.log(chalk.white(' • Babel configuration'));
|
|
@@ -10,9 +10,10 @@ export declare function runCommand(command: string, args: string[], options: {
|
|
|
10
10
|
cwd: string;
|
|
11
11
|
}): Promise<void>;
|
|
12
12
|
export declare function getTemplateData(projectName: string, description?: string, appName?: string): TemplateData;
|
|
13
|
-
export declare function initializeReactNativeProject(projectName: string, directory: string, displayName?: string): Promise<void>;
|
|
13
|
+
export declare function initializeReactNativeProject(projectName: string, directory: string, displayName?: string, skipInstall?: boolean): Promise<void>;
|
|
14
14
|
export declare function overlayIdealystFiles(templatePath: string, projectPath: string, data: TemplateData): Promise<void>;
|
|
15
15
|
export declare function mergePackageJsonDependencies(templatePath: string, projectPath: string): Promise<void>;
|
|
16
16
|
export declare function promptForProjectName(): Promise<string>;
|
|
17
17
|
export declare function promptForProjectType(): Promise<string>;
|
|
18
18
|
export declare function promptForAppName(projectName: string): Promise<string>;
|
|
19
|
+
export declare function configureAndroidVectorIcons(projectPath: string): Promise<void>;
|
package/package.json
CHANGED