@idealyst/cli 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 +110 -0
- package/dist/index.js +287 -0
- package/dist/types/generators/index.d.ts +6 -0
- package/dist/types/generators/native.d.ts +2 -0
- package/dist/types/generators/shared.d.ts +2 -0
- package/dist/types/generators/utils.d.ts +11 -0
- package/dist/types/generators/web.d.ts +2 -0
- package/dist/types/generators/workspace.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/types.d.ts +13 -0
- package/package.json +59 -0
- package/templates/native/README.md +86 -0
- package/templates/native/app.json +5 -0
- package/templates/native/babel.config.js +14 -0
- package/templates/native/index.js +9 -0
- package/templates/native/metro.config.js +11 -0
- package/templates/native/package.json +70 -0
- package/templates/native/src/App.tsx +35 -0
- package/templates/native/tsconfig.json +30 -0
- package/templates/shared/README.md +109 -0
- package/templates/shared/package.json +42 -0
- package/templates/shared/rollup.config.js +27 -0
- package/templates/shared/src/components/SharedComponent.tsx +25 -0
- package/templates/shared/src/components/index.ts +1 -0
- package/templates/shared/src/index.ts +7 -0
- package/templates/shared/src/types/index.ts +7 -0
- package/templates/shared/src/utils/helpers.ts +32 -0
- package/templates/shared/src/utils/index.ts +1 -0
- package/templates/shared/tsconfig.json +25 -0
- package/templates/web/README.md +91 -0
- package/templates/web/index.html +13 -0
- package/templates/web/package.json +51 -0
- package/templates/web/src/App.tsx +39 -0
- package/templates/web/src/main.tsx +11 -0
- package/templates/web/tsconfig.json +27 -0
- package/templates/web/vite.config.ts +23 -0
- package/templates/workspace/README.md +78 -0
- package/templates/workspace/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @idealyst/cli
|
|
2
|
+
|
|
3
|
+
CLI tool for generating Idealyst Framework projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Install globally:
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g @idealyst/cli
|
|
10
|
+
# or
|
|
11
|
+
yarn global add @idealyst/cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
### Create a new project
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
idealyst create <project-name> [options]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Options:
|
|
23
|
+
- `-t, --type <type>` - Project type: `native`, `web`, or `shared` (default: `native`)
|
|
24
|
+
- `-d, --directory <directory>` - Output directory (default: current directory)
|
|
25
|
+
- `--skip-install` - Skip installing dependencies
|
|
26
|
+
|
|
27
|
+
### Initialize a new workspace
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
idealyst init [options]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Options:
|
|
34
|
+
- `-d, --directory <directory>` - Output directory (default: current directory)
|
|
35
|
+
- `--skip-install` - Skip installing dependencies
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
Create a React Native app:
|
|
40
|
+
```bash
|
|
41
|
+
idealyst create my-app --type native
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Create a React web app:
|
|
45
|
+
```bash
|
|
46
|
+
idealyst create my-web-app --type web
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Create a shared library:
|
|
50
|
+
```bash
|
|
51
|
+
idealyst create my-lib --type shared
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Initialize a new workspace:
|
|
55
|
+
```bash
|
|
56
|
+
idealyst init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Project Types
|
|
60
|
+
|
|
61
|
+
### Native (React Native)
|
|
62
|
+
- React Native 0.80.1
|
|
63
|
+
- Idealyst Components
|
|
64
|
+
- Idealyst Navigation
|
|
65
|
+
- Idealyst Theme
|
|
66
|
+
- TypeScript configuration
|
|
67
|
+
- Metro bundler configuration
|
|
68
|
+
- Babel configuration
|
|
69
|
+
|
|
70
|
+
### Web (React + Vite)
|
|
71
|
+
- React 19.1
|
|
72
|
+
- Vite build system
|
|
73
|
+
- Idealyst Components (web-compatible)
|
|
74
|
+
- Idealyst Navigation
|
|
75
|
+
- Idealyst Theme
|
|
76
|
+
- TypeScript configuration
|
|
77
|
+
- React Native Web support
|
|
78
|
+
|
|
79
|
+
### Shared Library
|
|
80
|
+
- Cross-platform components
|
|
81
|
+
- TypeScript definitions
|
|
82
|
+
- Rollup build system
|
|
83
|
+
- Peer dependencies for React/React Native
|
|
84
|
+
- Idealyst Theme integration
|
|
85
|
+
|
|
86
|
+
### Workspace
|
|
87
|
+
- Yarn workspace configuration
|
|
88
|
+
- Monorepo structure
|
|
89
|
+
- Version management scripts
|
|
90
|
+
- Build scripts for all packages
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
Build the CLI:
|
|
95
|
+
```bash
|
|
96
|
+
cd packages/cli
|
|
97
|
+
yarn build
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Link for local development:
|
|
101
|
+
```bash
|
|
102
|
+
yarn link
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Learn More
|
|
106
|
+
|
|
107
|
+
- [Idealyst Framework Documentation](https://github.com/your-username/idealyst-framework)
|
|
108
|
+
- [React Native Documentation](https://reactnative.dev/)
|
|
109
|
+
- [React Documentation](https://react.dev/)
|
|
110
|
+
- [Vite Documentation](https://vitejs.dev/)
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import { spawn } from 'child_process';
|
|
7
|
+
import ora from 'ora';
|
|
8
|
+
import validatePackageName from 'validate-npm-package-name';
|
|
9
|
+
|
|
10
|
+
function validateProjectName(name) {
|
|
11
|
+
const validation = validatePackageName(name);
|
|
12
|
+
return validation.validForNewPackages;
|
|
13
|
+
}
|
|
14
|
+
function createPackageName(name) {
|
|
15
|
+
return name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
|
16
|
+
}
|
|
17
|
+
async function copyTemplate(templatePath, destPath, data) {
|
|
18
|
+
const spinner = ora(`Copying template files...`).start();
|
|
19
|
+
try {
|
|
20
|
+
await fs.ensureDir(destPath);
|
|
21
|
+
await fs.copy(templatePath, destPath, {
|
|
22
|
+
filter: (src) => {
|
|
23
|
+
const relativePath = path.relative(templatePath, src);
|
|
24
|
+
return !relativePath.includes('node_modules') && !relativePath.includes('.git');
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
// Process template files
|
|
28
|
+
await processTemplateFiles(destPath, data);
|
|
29
|
+
spinner.succeed('Template files copied successfully');
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
spinner.fail('Failed to copy template files');
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async function processTemplateFiles(dir, data) {
|
|
37
|
+
const files = await fs.readdir(dir);
|
|
38
|
+
for (const file of files) {
|
|
39
|
+
const filePath = path.join(dir, file);
|
|
40
|
+
const stat = await fs.stat(filePath);
|
|
41
|
+
if (stat.isDirectory()) {
|
|
42
|
+
await processTemplateFiles(filePath, data);
|
|
43
|
+
}
|
|
44
|
+
else if (file.endsWith('.json') || file.endsWith('.js') || file.endsWith('.ts') || file.endsWith('.tsx') || file.endsWith('.md')) {
|
|
45
|
+
await processTemplateFile(filePath, data);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function processTemplateFile(filePath, data) {
|
|
50
|
+
try {
|
|
51
|
+
let content = await fs.readFile(filePath, 'utf8');
|
|
52
|
+
// Replace template variables
|
|
53
|
+
content = content.replace(/\{\{projectName\}\}/g, data.projectName);
|
|
54
|
+
content = content.replace(/\{\{packageName\}\}/g, data.packageName);
|
|
55
|
+
content = content.replace(/\{\{version\}\}/g, data.version);
|
|
56
|
+
content = content.replace(/\{\{description\}\}/g, data.description);
|
|
57
|
+
await fs.writeFile(filePath, content);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
// Skip files that can't be processed
|
|
61
|
+
console.warn(chalk.yellow(`Warning: Could not process template file ${filePath}`));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function installDependencies(projectPath, skipInstall = false) {
|
|
65
|
+
if (skipInstall) {
|
|
66
|
+
console.log(chalk.yellow('Skipping dependency installation'));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const spinner = ora('Installing dependencies...').start();
|
|
70
|
+
try {
|
|
71
|
+
await runCommand('yarn', ['install'], { cwd: projectPath });
|
|
72
|
+
spinner.succeed('Dependencies installed successfully');
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
spinner.fail('Failed to install dependencies');
|
|
76
|
+
console.log(chalk.yellow('You can install dependencies manually by running:'));
|
|
77
|
+
console.log(chalk.white(' cd ' + path.basename(projectPath)));
|
|
78
|
+
console.log(chalk.white(' yarn install'));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function runCommand(command, args, options) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
const process = spawn(command, args, {
|
|
84
|
+
cwd: options.cwd,
|
|
85
|
+
stdio: 'inherit',
|
|
86
|
+
shell: true
|
|
87
|
+
});
|
|
88
|
+
process.on('close', (code) => {
|
|
89
|
+
if (code === 0) {
|
|
90
|
+
resolve();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
reject(new Error(`Command failed with code ${code}`));
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
process.on('error', (error) => {
|
|
97
|
+
reject(error);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function getTemplateData(projectName, description) {
|
|
102
|
+
return {
|
|
103
|
+
projectName,
|
|
104
|
+
packageName: createPackageName(projectName),
|
|
105
|
+
version: '1.0.0',
|
|
106
|
+
description: description || `A new Idealyst project: ${projectName}`
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function generateNativeProject(options) {
|
|
111
|
+
const { name, directory, skipInstall } = options;
|
|
112
|
+
if (!validateProjectName(name)) {
|
|
113
|
+
throw new Error(`Invalid project name: ${name}`);
|
|
114
|
+
}
|
|
115
|
+
console.log(chalk.blue(`📱 Creating React Native project: ${name}`));
|
|
116
|
+
const projectPath = path.join(directory, name);
|
|
117
|
+
const templatePath = path.join(__dirname, '..', '..', 'templates', 'native');
|
|
118
|
+
const templateData = getTemplateData(name, `React Native app built with Idealyst Framework`);
|
|
119
|
+
await copyTemplate(templatePath, projectPath, templateData);
|
|
120
|
+
await installDependencies(projectPath, skipInstall);
|
|
121
|
+
console.log(chalk.green('✅ React Native project created successfully!'));
|
|
122
|
+
console.log(chalk.blue('📋 Project includes:'));
|
|
123
|
+
console.log(chalk.white(' • React Native 0.80.1'));
|
|
124
|
+
console.log(chalk.white(' • Idealyst Components'));
|
|
125
|
+
console.log(chalk.white(' • Idealyst Navigation'));
|
|
126
|
+
console.log(chalk.white(' • Idealyst Theme'));
|
|
127
|
+
console.log(chalk.white(' • TypeScript configuration'));
|
|
128
|
+
console.log(chalk.white(' • Metro configuration'));
|
|
129
|
+
console.log(chalk.white(' • Babel configuration'));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function generateWebProject(options) {
|
|
133
|
+
const { name, directory, skipInstall } = options;
|
|
134
|
+
if (!validateProjectName(name)) {
|
|
135
|
+
throw new Error(`Invalid project name: ${name}`);
|
|
136
|
+
}
|
|
137
|
+
console.log(chalk.blue(`🌐 Creating React Web project: ${name}`));
|
|
138
|
+
const projectPath = path.join(directory, name);
|
|
139
|
+
const templatePath = path.join(__dirname, '..', '..', 'templates', 'web');
|
|
140
|
+
const templateData = getTemplateData(name, `React web app built with Idealyst Framework`);
|
|
141
|
+
await copyTemplate(templatePath, projectPath, templateData);
|
|
142
|
+
await installDependencies(projectPath, skipInstall);
|
|
143
|
+
console.log(chalk.green('✅ React Web project created successfully!'));
|
|
144
|
+
console.log(chalk.blue('📋 Project includes:'));
|
|
145
|
+
console.log(chalk.white(' • React 19.1'));
|
|
146
|
+
console.log(chalk.white(' • Vite build system'));
|
|
147
|
+
console.log(chalk.white(' • Idealyst Components'));
|
|
148
|
+
console.log(chalk.white(' • Idealyst Navigation'));
|
|
149
|
+
console.log(chalk.white(' • Idealyst Theme'));
|
|
150
|
+
console.log(chalk.white(' • TypeScript configuration'));
|
|
151
|
+
console.log(chalk.white(' • React Router'));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function generateSharedLibrary(options) {
|
|
155
|
+
const { name, directory, skipInstall } = options;
|
|
156
|
+
if (!validateProjectName(name)) {
|
|
157
|
+
throw new Error(`Invalid project name: ${name}`);
|
|
158
|
+
}
|
|
159
|
+
console.log(chalk.blue(`📦 Creating shared library: ${name}`));
|
|
160
|
+
const projectPath = path.join(directory, name);
|
|
161
|
+
const templatePath = path.join(__dirname, '..', '..', 'templates', 'shared');
|
|
162
|
+
const templateData = getTemplateData(name, `Shared library built with Idealyst Framework`);
|
|
163
|
+
await copyTemplate(templatePath, projectPath, templateData);
|
|
164
|
+
await installDependencies(projectPath, skipInstall);
|
|
165
|
+
console.log(chalk.green('✅ Shared library created successfully!'));
|
|
166
|
+
console.log(chalk.blue('📋 Project includes:'));
|
|
167
|
+
console.log(chalk.white(' • Cross-platform components'));
|
|
168
|
+
console.log(chalk.white(' • Idealyst Theme integration'));
|
|
169
|
+
console.log(chalk.white(' • TypeScript configuration'));
|
|
170
|
+
console.log(chalk.white(' • Rollup build system'));
|
|
171
|
+
console.log(chalk.white(' • React & React Native support'));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function generateWorkspace(options) {
|
|
175
|
+
const { name, directory, skipInstall } = options;
|
|
176
|
+
if (!validateProjectName(name)) {
|
|
177
|
+
throw new Error(`Invalid project name: ${name}`);
|
|
178
|
+
}
|
|
179
|
+
console.log(chalk.blue(`🏗️ Creating Idealyst workspace: ${name}`));
|
|
180
|
+
const projectPath = path.join(directory, name);
|
|
181
|
+
const templatePath = path.join(__dirname, '..', '..', 'templates', 'workspace');
|
|
182
|
+
const templateData = getTemplateData(name, `Idealyst Framework monorepo workspace`);
|
|
183
|
+
await copyTemplate(templatePath, projectPath, templateData);
|
|
184
|
+
await installDependencies(projectPath, skipInstall);
|
|
185
|
+
console.log(chalk.green('✅ Workspace created successfully!'));
|
|
186
|
+
console.log(chalk.blue('📋 Workspace includes:'));
|
|
187
|
+
console.log(chalk.white(' • Yarn workspace configuration'));
|
|
188
|
+
console.log(chalk.white(' • Idealyst packages (theme, components, navigation)'));
|
|
189
|
+
console.log(chalk.white(' • TypeScript configuration'));
|
|
190
|
+
console.log(chalk.white(' • Build scripts'));
|
|
191
|
+
console.log(chalk.white(' • Version management scripts'));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function generateProject(options) {
|
|
195
|
+
const { type } = options;
|
|
196
|
+
switch (type) {
|
|
197
|
+
case 'native':
|
|
198
|
+
await generateNativeProject(options);
|
|
199
|
+
break;
|
|
200
|
+
case 'web':
|
|
201
|
+
await generateWebProject(options);
|
|
202
|
+
break;
|
|
203
|
+
case 'shared':
|
|
204
|
+
await generateSharedLibrary(options);
|
|
205
|
+
break;
|
|
206
|
+
case 'workspace':
|
|
207
|
+
await generateWorkspace(options);
|
|
208
|
+
break;
|
|
209
|
+
default:
|
|
210
|
+
throw new Error(`Unknown project type: ${type}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const program = new Command();
|
|
215
|
+
program
|
|
216
|
+
.name('idealyst')
|
|
217
|
+
.description('CLI tool for generating Idealyst Framework projects')
|
|
218
|
+
.version('1.0.1');
|
|
219
|
+
program
|
|
220
|
+
.command('create <project-name>')
|
|
221
|
+
.description('Create a new Idealyst project')
|
|
222
|
+
.option('-t, --type <type>', 'Project type: native, web, or shared', 'native')
|
|
223
|
+
.option('-d, --directory <directory>', 'Output directory', '.')
|
|
224
|
+
.option('--skip-install', 'Skip installing dependencies')
|
|
225
|
+
.action(async (projectName, options) => {
|
|
226
|
+
const validTypes = ['native', 'web', 'shared'];
|
|
227
|
+
if (!validTypes.includes(options.type)) {
|
|
228
|
+
console.error(chalk.red(`Invalid project type: ${options.type}`));
|
|
229
|
+
console.error(chalk.yellow(`Valid types are: ${validTypes.join(', ')}`));
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
try {
|
|
233
|
+
await generateProject({
|
|
234
|
+
name: projectName,
|
|
235
|
+
type: options.type,
|
|
236
|
+
directory: options.directory,
|
|
237
|
+
skipInstall: options.skipInstall || false
|
|
238
|
+
});
|
|
239
|
+
console.log(chalk.green(`✨ Successfully created ${projectName}!`));
|
|
240
|
+
console.log(chalk.blue(`📁 Project created in: ${options.directory}/${projectName}`));
|
|
241
|
+
if (options.type === 'native') {
|
|
242
|
+
console.log(chalk.yellow('\n📱 Next steps for React Native:'));
|
|
243
|
+
console.log(chalk.white(' cd ' + projectName));
|
|
244
|
+
console.log(chalk.white(' yarn android # or yarn ios'));
|
|
245
|
+
}
|
|
246
|
+
else if (options.type === 'web') {
|
|
247
|
+
console.log(chalk.yellow('\n🌐 Next steps for React Web:'));
|
|
248
|
+
console.log(chalk.white(' cd ' + projectName));
|
|
249
|
+
console.log(chalk.white(' yarn dev'));
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
console.log(chalk.yellow('\n📦 Next steps for Shared Library:'));
|
|
253
|
+
console.log(chalk.white(' cd ' + projectName));
|
|
254
|
+
console.log(chalk.white(' yarn build'));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
console.error(chalk.red('❌ Error creating project:'), error);
|
|
259
|
+
process.exit(1);
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
program
|
|
263
|
+
.command('init')
|
|
264
|
+
.description('Initialize a new Idealyst monorepo workspace')
|
|
265
|
+
.option('-d, --directory <directory>', 'Output directory', '.')
|
|
266
|
+
.option('--skip-install', 'Skip installing dependencies')
|
|
267
|
+
.action(async (options) => {
|
|
268
|
+
try {
|
|
269
|
+
await generateProject({
|
|
270
|
+
name: 'idealyst-workspace',
|
|
271
|
+
type: 'workspace',
|
|
272
|
+
directory: options.directory,
|
|
273
|
+
skipInstall: options.skipInstall || false
|
|
274
|
+
});
|
|
275
|
+
console.log(chalk.green('✨ Successfully initialized Idealyst workspace!'));
|
|
276
|
+
console.log(chalk.blue(`📁 Workspace created in: ${options.directory}/idealyst-workspace`));
|
|
277
|
+
console.log(chalk.yellow('\n🚀 Next steps:'));
|
|
278
|
+
console.log(chalk.white(' cd idealyst-workspace'));
|
|
279
|
+
console.log(chalk.white(' idealyst create my-app --type native'));
|
|
280
|
+
console.log(chalk.white(' idealyst create my-web-app --type web'));
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
console.error(chalk.red('❌ Error initializing workspace:'), error);
|
|
284
|
+
process.exit(1);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
program.parse();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TemplateData } from '../types';
|
|
2
|
+
export declare function validateProjectName(name: string): boolean;
|
|
3
|
+
export declare function createPackageName(name: string): string;
|
|
4
|
+
export declare function copyTemplate(templatePath: string, destPath: string, data: TemplateData): Promise<void>;
|
|
5
|
+
export declare function processTemplateFiles(dir: string, data: TemplateData): Promise<void>;
|
|
6
|
+
export declare function processTemplateFile(filePath: string, data: TemplateData): Promise<void>;
|
|
7
|
+
export declare function installDependencies(projectPath: string, skipInstall?: boolean): Promise<void>;
|
|
8
|
+
export declare function runCommand(command: string, args: string[], options: {
|
|
9
|
+
cwd: string;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
export declare function getTemplateData(projectName: string, description?: string): TemplateData;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ProjectType = 'native' | 'web' | 'shared' | 'workspace';
|
|
2
|
+
export interface GenerateProjectOptions {
|
|
3
|
+
name: string;
|
|
4
|
+
type: ProjectType;
|
|
5
|
+
directory: string;
|
|
6
|
+
skipInstall: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface TemplateData {
|
|
9
|
+
projectName: string;
|
|
10
|
+
packageName: string;
|
|
11
|
+
version: string;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@idealyst/cli",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "CLI tool for generating Idealyst Framework projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"idealyst": "dist/index.js",
|
|
9
|
+
"idealyst-cli": "dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/your-username/idealyst-framework.git",
|
|
14
|
+
"directory": "packages/cli"
|
|
15
|
+
},
|
|
16
|
+
"author": "Your Name <your.email@example.com>",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rollup -c",
|
|
23
|
+
"dev": "rollup -c -w",
|
|
24
|
+
"prepublishOnly": "yarn build",
|
|
25
|
+
"publish:npm": "npm publish"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"chalk": "^5.0.0",
|
|
29
|
+
"commander": "^11.0.0",
|
|
30
|
+
"fs-extra": "^11.0.0",
|
|
31
|
+
"inquirer": "^9.0.0",
|
|
32
|
+
"ora": "^7.0.0",
|
|
33
|
+
"validate-npm-package-name": "^5.0.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/fs-extra": "^11.0.0",
|
|
37
|
+
"@types/inquirer": "^9.0.0",
|
|
38
|
+
"@types/node": "^20.0.0",
|
|
39
|
+
"@types/validate-npm-package-name": "^4.0.0",
|
|
40
|
+
"rollup": "^3.20.0",
|
|
41
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
42
|
+
"rollup-plugin-json": "^4.0.0",
|
|
43
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
44
|
+
"rollup-plugin-typescript2": "^0.34.0",
|
|
45
|
+
"typescript": "^5.0.0"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"dist",
|
|
49
|
+
"templates"
|
|
50
|
+
],
|
|
51
|
+
"keywords": [
|
|
52
|
+
"cli",
|
|
53
|
+
"generator",
|
|
54
|
+
"react",
|
|
55
|
+
"react-native",
|
|
56
|
+
"cross-platform",
|
|
57
|
+
"idealyst"
|
|
58
|
+
]
|
|
59
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
{{description}}
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
This is a React Native application built with the Idealyst Framework.
|
|
8
|
+
|
|
9
|
+
### Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js 18+
|
|
12
|
+
- Yarn
|
|
13
|
+
- React Native development environment
|
|
14
|
+
- Android Studio (for Android development)
|
|
15
|
+
- Xcode (for iOS development)
|
|
16
|
+
|
|
17
|
+
### Installation
|
|
18
|
+
|
|
19
|
+
Install dependencies:
|
|
20
|
+
```bash
|
|
21
|
+
yarn install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Running the App
|
|
25
|
+
|
|
26
|
+
Start the Metro bundler:
|
|
27
|
+
```bash
|
|
28
|
+
yarn start
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Run on Android:
|
|
32
|
+
```bash
|
|
33
|
+
yarn android
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Run on iOS:
|
|
37
|
+
```bash
|
|
38
|
+
yarn ios
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Project Structure
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
{{projectName}}/
|
|
45
|
+
├── src/
|
|
46
|
+
│ └── App.tsx # Main app component
|
|
47
|
+
├── android/ # Android-specific code
|
|
48
|
+
├── ios/ # iOS-specific code
|
|
49
|
+
├── babel.config.js # Babel configuration
|
|
50
|
+
├── metro.config.js # Metro configuration
|
|
51
|
+
└── tsconfig.json # TypeScript configuration
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
- **Idealyst Components**: Pre-built UI components
|
|
57
|
+
- **Idealyst Navigation**: Cross-platform navigation
|
|
58
|
+
- **Idealyst Theme**: Consistent theming system
|
|
59
|
+
- **TypeScript**: Full type safety
|
|
60
|
+
- **React Native 0.80.1**: Latest stable version
|
|
61
|
+
|
|
62
|
+
### Development
|
|
63
|
+
|
|
64
|
+
The app uses the Idealyst Framework for consistent UI and navigation across platforms.
|
|
65
|
+
|
|
66
|
+
Edit `src/App.tsx` to start building your application.
|
|
67
|
+
|
|
68
|
+
### Building for Production
|
|
69
|
+
|
|
70
|
+
Build Android APK:
|
|
71
|
+
```bash
|
|
72
|
+
yarn build:android
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Testing
|
|
76
|
+
|
|
77
|
+
Run tests:
|
|
78
|
+
```bash
|
|
79
|
+
yarn test
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Learn More
|
|
83
|
+
|
|
84
|
+
- [Idealyst Framework Documentation](https://github.com/your-username/idealyst-framework)
|
|
85
|
+
- [React Native Documentation](https://reactnative.dev/)
|
|
86
|
+
- [TypeScript Documentation](https://www.typescriptlang.org/)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { getDefaultConfig } = require('@react-native/metro-config');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Metro configuration
|
|
5
|
+
* https://reactnative.dev/docs/metro
|
|
6
|
+
*
|
|
7
|
+
* @type {import('metro-config').MetroConfig}
|
|
8
|
+
*/
|
|
9
|
+
const config = getDefaultConfig(__dirname);
|
|
10
|
+
|
|
11
|
+
module.exports = config;
|