@idealyst/cli 1.0.13 → 1.0.14
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
|
@@ -131,6 +131,94 @@ function getTemplateData(projectName, description) {
|
|
|
131
131
|
description: description || `A new Idealyst project: ${projectName}`
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
+
async function initializeReactNativeProject(projectName, directory) {
|
|
135
|
+
const spinner = ora('Initializing React Native project...').start();
|
|
136
|
+
try {
|
|
137
|
+
// Use the correct React Native CLI command format with specific version and yarn
|
|
138
|
+
const cliCommand = 'npx';
|
|
139
|
+
const args = ['@react-native-community/cli@latest', 'init', projectName, '--version', '0.80.1', '--pm', 'yarn'];
|
|
140
|
+
// Run React Native initialization in the target directory
|
|
141
|
+
await runCommand(cliCommand, args, { cwd: directory });
|
|
142
|
+
spinner.succeed('React Native project initialized successfully');
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
spinner.fail('Failed to initialize React Native project');
|
|
146
|
+
console.log(chalk.yellow('Make sure you have the React Native CLI and yarn available:'));
|
|
147
|
+
console.log(chalk.white(' npx @react-native-community/cli@latest init ProjectName --version 0.80.1 --pm yarn'));
|
|
148
|
+
console.log(chalk.yellow('If you encounter issues, try:'));
|
|
149
|
+
console.log(chalk.white(' npm install -g @react-native-community/cli'));
|
|
150
|
+
console.log(chalk.white(' npm install -g yarn'));
|
|
151
|
+
console.log(chalk.white(' # or'));
|
|
152
|
+
console.log(chalk.white(' yarn global add @react-native-community/cli'));
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function overlayIdealystFiles(templatePath, projectPath, data) {
|
|
157
|
+
const spinner = ora('Applying Idealyst Framework files...').start();
|
|
158
|
+
try {
|
|
159
|
+
// Copy Idealyst-specific files over the React Native project
|
|
160
|
+
await fs.copy(templatePath, projectPath, {
|
|
161
|
+
overwrite: true,
|
|
162
|
+
filter: (src) => {
|
|
163
|
+
const relativePath = path.relative(templatePath, src);
|
|
164
|
+
// Skip package.json as we'll merge it separately
|
|
165
|
+
return !relativePath.includes('node_modules') &&
|
|
166
|
+
!relativePath.includes('.git') &&
|
|
167
|
+
!relativePath.endsWith('package.json');
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
// Process template files
|
|
171
|
+
await processTemplateFiles(projectPath, data);
|
|
172
|
+
// Merge package.json dependencies
|
|
173
|
+
await mergePackageJsonDependencies(templatePath, projectPath);
|
|
174
|
+
spinner.succeed('Idealyst Framework files applied successfully');
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
spinner.fail('Failed to apply Idealyst Framework files');
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async function mergePackageJsonDependencies(templatePath, projectPath) {
|
|
182
|
+
const templatePackageJsonPath = path.join(templatePath, 'package.json');
|
|
183
|
+
const projectPackageJsonPath = path.join(projectPath, 'package.json');
|
|
184
|
+
try {
|
|
185
|
+
// Read both package.json files
|
|
186
|
+
const templatePackageJson = await fs.readJSON(templatePackageJsonPath);
|
|
187
|
+
const projectPackageJson = await fs.readJSON(projectPackageJsonPath);
|
|
188
|
+
// Merge dependencies
|
|
189
|
+
const idealystDependencies = {
|
|
190
|
+
'@idealyst/components': '^1.0.3',
|
|
191
|
+
'@idealyst/navigation': '^1.0.3',
|
|
192
|
+
'@idealyst/theme': '^1.0.3',
|
|
193
|
+
'@react-native-vector-icons/common': '^12.0.1',
|
|
194
|
+
'@react-native-vector-icons/material-design-icons': '^12.0.1',
|
|
195
|
+
'@react-navigation/bottom-tabs': '^7.4.2',
|
|
196
|
+
'@react-navigation/drawer': '^7.5.3',
|
|
197
|
+
'@react-navigation/native': '^7.1.14',
|
|
198
|
+
'@react-navigation/native-stack': '^7.3.21',
|
|
199
|
+
'react-native-edge-to-edge': '^1.6.2',
|
|
200
|
+
'react-native-gesture-handler': '^2.27.1',
|
|
201
|
+
'react-native-nitro-modules': '^0.26.3',
|
|
202
|
+
'react-native-reanimated': '^3.18.0',
|
|
203
|
+
'react-native-safe-area-context': '^5.5.1',
|
|
204
|
+
'react-native-screens': '^4.11.1',
|
|
205
|
+
'react-native-unistyles': '^3.0.4',
|
|
206
|
+
'react-native-vector-icons': '^10.2.0'
|
|
207
|
+
};
|
|
208
|
+
// Merge the dependencies
|
|
209
|
+
projectPackageJson.dependencies = {
|
|
210
|
+
...projectPackageJson.dependencies,
|
|
211
|
+
...idealystDependencies
|
|
212
|
+
};
|
|
213
|
+
// Write back the merged package.json
|
|
214
|
+
await fs.writeJSON(projectPackageJsonPath, projectPackageJson, { spaces: 2 });
|
|
215
|
+
console.log(chalk.green('✅ Merged Idealyst dependencies into package.json'));
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
console.warn(chalk.yellow('⚠️ Could not merge package.json dependencies'));
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
134
222
|
|
|
135
223
|
const __filename$3 = fileURLToPath(import.meta.url);
|
|
136
224
|
const __dirname$3 = path.dirname(__filename$3);
|
|
@@ -143,18 +231,31 @@ async function generateNativeProject(options) {
|
|
|
143
231
|
const projectPath = path.join(directory, name);
|
|
144
232
|
const templatePath = path.join(__dirname$3, '..', 'templates', 'native');
|
|
145
233
|
const templateData = getTemplateData(name, `React Native app built with Idealyst Framework`);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
234
|
+
try {
|
|
235
|
+
// Step 1: Initialize React Native project using CLI
|
|
236
|
+
await initializeReactNativeProject(name, directory);
|
|
237
|
+
// Step 2: Overlay Idealyst-specific files
|
|
238
|
+
await overlayIdealystFiles(templatePath, projectPath, templateData);
|
|
239
|
+
// Step 3: Install dependencies (including Idealyst packages)
|
|
240
|
+
await installDependencies(projectPath, skipInstall);
|
|
241
|
+
// Step 4: Update workspace configuration if applicable
|
|
242
|
+
await updateWorkspacePackageJson(name, directory);
|
|
243
|
+
console.log(chalk.green('✅ React Native project created successfully!'));
|
|
244
|
+
console.log(chalk.blue('📋 Project includes:'));
|
|
245
|
+
console.log(chalk.white(' • React Native with proper Android/iOS setup'));
|
|
246
|
+
console.log(chalk.white(' • Idealyst Components'));
|
|
247
|
+
console.log(chalk.white(' • Idealyst Navigation'));
|
|
248
|
+
console.log(chalk.white(' • Idealyst Theme'));
|
|
249
|
+
console.log(chalk.white(' • TypeScript configuration'));
|
|
250
|
+
console.log(chalk.white(' • Metro configuration'));
|
|
251
|
+
console.log(chalk.white(' • Babel configuration'));
|
|
252
|
+
console.log(chalk.white(' • Native platform directories (android/, ios/)'));
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
console.error(chalk.red('❌ Error creating React Native project:'));
|
|
256
|
+
console.error(error);
|
|
257
|
+
throw error;
|
|
258
|
+
}
|
|
158
259
|
}
|
|
159
260
|
|
|
160
261
|
const __filename$2 = fileURLToPath(import.meta.url);
|
|
@@ -10,3 +10,6 @@ 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): TemplateData;
|
|
13
|
+
export declare function initializeReactNativeProject(projectName: string, directory: string): Promise<void>;
|
|
14
|
+
export declare function overlayIdealystFiles(templatePath: string, projectPath: string, data: TemplateData): Promise<void>;
|
|
15
|
+
export declare function mergePackageJsonDependencies(templatePath: string, projectPath: string): Promise<void>;
|
package/package.json
CHANGED
|
@@ -3,67 +3,8 @@
|
|
|
3
3
|
"version": "{{version}}",
|
|
4
4
|
"description": "{{description}}",
|
|
5
5
|
"private": true,
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"lint": "eslint .",
|
|
10
|
-
"start": "react-native start",
|
|
11
|
-
"test": "jest",
|
|
12
|
-
"build:android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"
|
|
13
|
-
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@idealyst/components": "^1.0.3",
|
|
16
|
-
"@idealyst/navigation": "^1.0.3",
|
|
17
|
-
"@idealyst/theme": "^1.0.3",
|
|
18
|
-
"@react-native-vector-icons/common": "^12.0.1",
|
|
19
|
-
"@react-native-vector-icons/material-design-icons": "^12.0.1",
|
|
20
|
-
"@react-native/new-app-screen": "0.80.1",
|
|
21
|
-
"@react-native/normalize-colors": "^0.80.1",
|
|
22
|
-
"@react-navigation/bottom-tabs": "^7.4.2",
|
|
23
|
-
"@react-navigation/drawer": "^7.5.3",
|
|
24
|
-
"@react-navigation/native": "^7.1.14",
|
|
25
|
-
"@react-navigation/native-stack": "^7.3.21",
|
|
26
|
-
"react": "19.1.0",
|
|
27
|
-
"react-native": "0.80.1",
|
|
28
|
-
"react-native-edge-to-edge": "^1.6.2",
|
|
29
|
-
"react-native-gesture-handler": "^2.27.1",
|
|
30
|
-
"react-native-nitro-modules": "^0.26.3",
|
|
31
|
-
"react-native-reanimated": "^3.18.0",
|
|
32
|
-
"react-native-safe-area-context": "^5.5.1",
|
|
33
|
-
"react-native-screens": "^4.11.1",
|
|
34
|
-
"react-native-unistyles": "^3.0.4",
|
|
35
|
-
"react-native-vector-icons": "^10.2.0"
|
|
36
|
-
},
|
|
37
|
-
"devDependencies": {
|
|
38
|
-
"@babel/core": "^7.25.2",
|
|
39
|
-
"@babel/preset-env": "^7.25.3",
|
|
40
|
-
"@babel/runtime": "^7.27.6",
|
|
41
|
-
"@react-native-community/cli": "19.0.0",
|
|
42
|
-
"@react-native-community/cli-platform-android": "19.0.0",
|
|
43
|
-
"@react-native-community/cli-platform-ios": "19.0.0",
|
|
44
|
-
"@react-native/babel-preset": "0.80.1",
|
|
45
|
-
"@react-native/eslint-config": "0.80.1",
|
|
46
|
-
"@react-native/metro-config": "0.80.1",
|
|
47
|
-
"@react-native/typescript-config": "0.80.1",
|
|
48
|
-
"@types/jest": "^29.5.13",
|
|
49
|
-
"@types/react": "^19.1.0",
|
|
50
|
-
"@types/react-test-renderer": "^19.1.0",
|
|
51
|
-
"babel-plugin-module-resolver": "^5.0.2",
|
|
52
|
-
"eslint": "^8.19.0",
|
|
53
|
-
"jest": "^29.7.0",
|
|
54
|
-
"prettier": "^2.8.8",
|
|
55
|
-
"react-test-renderer": "19.1.0",
|
|
56
|
-
"typescript": "^5.0.4"
|
|
57
|
-
},
|
|
58
|
-
"jest": {
|
|
59
|
-
"preset": "react-native",
|
|
60
|
-
"moduleFileExtensions": [
|
|
61
|
-
"ts",
|
|
62
|
-
"tsx",
|
|
63
|
-
"js",
|
|
64
|
-
"jsx",
|
|
65
|
-
"json",
|
|
66
|
-
"node"
|
|
67
|
-
]
|
|
6
|
+
"idealyst": {
|
|
7
|
+
"framework": "react-native",
|
|
8
|
+
"version": "1.0.3"
|
|
68
9
|
}
|
|
69
10
|
}
|