@idealyst/cli 1.0.3 → 1.0.4
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 +28 -1
- package/dist/types/generators/utils.d.ts +1 -0
- package/package.json +1 -1
- package/templates/native/.yarnrc.yml +19 -0
- package/templates/native/package.json +3 -4
- package/templates/shared/.yarnrc.yml +19 -0
- package/templates/shared/package.json +1 -1
- package/templates/web/.yarnrc.yml +19 -0
- package/templates/web/package.json +3 -3
- package/templates/workspace/.yarnrc.yml +26 -0
- package/templates/workspace/README.md +5 -3
- package/templates/workspace/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,6 +15,28 @@ function validateProjectName(name) {
|
|
|
15
15
|
function createPackageName(name) {
|
|
16
16
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
|
17
17
|
}
|
|
18
|
+
async function updateWorkspacePackageJson(projectName, directory) {
|
|
19
|
+
// Look for package.json in the directory to see if we're in a workspace
|
|
20
|
+
const packageJsonPath = path.join(directory, 'package.json');
|
|
21
|
+
if (await fs.pathExists(packageJsonPath)) {
|
|
22
|
+
try {
|
|
23
|
+
const packageJson = await fs.readJSON(packageJsonPath);
|
|
24
|
+
// Check if this is a workspace (has workspaces property)
|
|
25
|
+
if (packageJson.workspaces && Array.isArray(packageJson.workspaces)) {
|
|
26
|
+
// Add the new project to workspaces if not already present
|
|
27
|
+
if (!packageJson.workspaces.includes(projectName)) {
|
|
28
|
+
packageJson.workspaces.push(projectName);
|
|
29
|
+
await fs.writeJSON(packageJsonPath, packageJson, { spaces: 2 });
|
|
30
|
+
console.log(chalk.green(`✅ Added ${projectName} to workspace configuration`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// Silently ignore if we can't read/write package.json
|
|
36
|
+
console.log(chalk.yellow(`⚠️ Could not update workspace configuration: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
18
40
|
async function copyTemplate(templatePath, destPath, data) {
|
|
19
41
|
const spinner = ora(`Copying template files...`).start();
|
|
20
42
|
try {
|
|
@@ -73,10 +95,12 @@ async function installDependencies(projectPath, skipInstall = false) {
|
|
|
73
95
|
spinner.succeed('Dependencies installed successfully');
|
|
74
96
|
}
|
|
75
97
|
catch (error) {
|
|
76
|
-
spinner.fail('Failed to install dependencies');
|
|
98
|
+
spinner.fail('Failed to install dependencies with yarn');
|
|
77
99
|
console.log(chalk.yellow('You can install dependencies manually by running:'));
|
|
78
100
|
console.log(chalk.white(' cd ' + path.basename(projectPath)));
|
|
79
101
|
console.log(chalk.white(' yarn install'));
|
|
102
|
+
console.log(chalk.white(' # or alternatively:'));
|
|
103
|
+
console.log(chalk.white(' npm install'));
|
|
80
104
|
}
|
|
81
105
|
}
|
|
82
106
|
function runCommand(command, args, options) {
|
|
@@ -121,6 +145,7 @@ async function generateNativeProject(options) {
|
|
|
121
145
|
const templateData = getTemplateData(name, `React Native app built with Idealyst Framework`);
|
|
122
146
|
await copyTemplate(templatePath, projectPath, templateData);
|
|
123
147
|
await installDependencies(projectPath, skipInstall);
|
|
148
|
+
await updateWorkspacePackageJson(name, directory);
|
|
124
149
|
console.log(chalk.green('✅ React Native project created successfully!'));
|
|
125
150
|
console.log(chalk.blue('📋 Project includes:'));
|
|
126
151
|
console.log(chalk.white(' • React Native 0.80.1'));
|
|
@@ -145,6 +170,7 @@ async function generateWebProject(options) {
|
|
|
145
170
|
const templateData = getTemplateData(name, `React web app built with Idealyst Framework`);
|
|
146
171
|
await copyTemplate(templatePath, projectPath, templateData);
|
|
147
172
|
await installDependencies(projectPath, skipInstall);
|
|
173
|
+
await updateWorkspacePackageJson(name, directory);
|
|
148
174
|
console.log(chalk.green('✅ React Web project created successfully!'));
|
|
149
175
|
console.log(chalk.blue('📋 Project includes:'));
|
|
150
176
|
console.log(chalk.white(' • React 19.1'));
|
|
@@ -169,6 +195,7 @@ async function generateSharedLibrary(options) {
|
|
|
169
195
|
const templateData = getTemplateData(name, `Shared library built with Idealyst Framework`);
|
|
170
196
|
await copyTemplate(templatePath, projectPath, templateData);
|
|
171
197
|
await installDependencies(projectPath, skipInstall);
|
|
198
|
+
await updateWorkspacePackageJson(name, directory);
|
|
172
199
|
console.log(chalk.green('✅ Shared library created successfully!'));
|
|
173
200
|
console.log(chalk.blue('📋 Project includes:'));
|
|
174
201
|
console.log(chalk.white(' • Cross-platform components'));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TemplateData } from '../types';
|
|
2
2
|
export declare function validateProjectName(name: string): boolean;
|
|
3
3
|
export declare function createPackageName(name: string): string;
|
|
4
|
+
export declare function updateWorkspacePackageJson(projectName: string, directory: string): Promise<void>;
|
|
4
5
|
export declare function copyTemplate(templatePath: string, destPath: string, data: TemplateData): Promise<void>;
|
|
5
6
|
export declare function processTemplateFiles(dir: string, data: TemplateData): Promise<void>;
|
|
6
7
|
export declare function processTemplateFile(filePath: string, data: TemplateData): Promise<void>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
nodeLinker: "node-modules"
|
|
2
|
+
|
|
3
|
+
# Enable network for package downloads
|
|
4
|
+
enableNetwork: true
|
|
5
|
+
|
|
6
|
+
# Timeout for HTTP requests (in milliseconds)
|
|
7
|
+
httpTimeout: 60000
|
|
8
|
+
|
|
9
|
+
# Number of retry attempts for HTTP requests
|
|
10
|
+
httpRetry: 3
|
|
11
|
+
|
|
12
|
+
# Registry configuration
|
|
13
|
+
npmRegistryServer: "https://registry.yarnpkg.com"
|
|
14
|
+
|
|
15
|
+
# Enable progress bars
|
|
16
|
+
enableProgressBars: true
|
|
17
|
+
|
|
18
|
+
# Enable colors in output
|
|
19
|
+
enableColors: true
|
|
@@ -12,9 +12,9 @@
|
|
|
12
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
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@idealyst/components": "^1.0.
|
|
16
|
-
"@idealyst/navigation": "^1.0.
|
|
17
|
-
"@idealyst/theme": "^1.0.
|
|
15
|
+
"@idealyst/components": "^1.0.3",
|
|
16
|
+
"@idealyst/navigation": "^1.0.3",
|
|
17
|
+
"@idealyst/theme": "^1.0.3",
|
|
18
18
|
"@react-native-vector-icons/common": "^12.0.1",
|
|
19
19
|
"@react-native-vector-icons/material-design-icons": "^12.0.1",
|
|
20
20
|
"@react-native/new-app-screen": "0.80.1",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
52
52
|
"eslint": "^8.19.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
|
-
"metro-react-native-babel-preset": "^0.80.1",
|
|
55
54
|
"prettier": "^2.8.8",
|
|
56
55
|
"react-test-renderer": "19.1.0",
|
|
57
56
|
"typescript": "^5.0.4"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
nodeLinker: "node-modules"
|
|
2
|
+
|
|
3
|
+
# Enable network for package downloads
|
|
4
|
+
enableNetwork: true
|
|
5
|
+
|
|
6
|
+
# Timeout for HTTP requests (in milliseconds)
|
|
7
|
+
httpTimeout: 60000
|
|
8
|
+
|
|
9
|
+
# Number of retry attempts for HTTP requests
|
|
10
|
+
httpRetry: 3
|
|
11
|
+
|
|
12
|
+
# Registry configuration
|
|
13
|
+
npmRegistryServer: "https://registry.yarnpkg.com"
|
|
14
|
+
|
|
15
|
+
# Enable progress bars
|
|
16
|
+
enableProgressBars: true
|
|
17
|
+
|
|
18
|
+
# Enable colors in output
|
|
19
|
+
enableColors: true
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
nodeLinker: "node-modules"
|
|
2
|
+
|
|
3
|
+
# Enable network for package downloads
|
|
4
|
+
enableNetwork: true
|
|
5
|
+
|
|
6
|
+
# Timeout for HTTP requests (in milliseconds)
|
|
7
|
+
httpTimeout: 60000
|
|
8
|
+
|
|
9
|
+
# Number of retry attempts for HTTP requests
|
|
10
|
+
httpRetry: 3
|
|
11
|
+
|
|
12
|
+
# Registry configuration
|
|
13
|
+
npmRegistryServer: "https://registry.yarnpkg.com"
|
|
14
|
+
|
|
15
|
+
# Enable progress bars
|
|
16
|
+
enableProgressBars: true
|
|
17
|
+
|
|
18
|
+
# Enable colors in output
|
|
19
|
+
enableColors: true
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"preview": "vite preview"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@idealyst/components": "^1.0.
|
|
14
|
-
"@idealyst/navigation": "^1.0.
|
|
15
|
-
"@idealyst/theme": "^1.0.
|
|
13
|
+
"@idealyst/components": "^1.0.3",
|
|
14
|
+
"@idealyst/navigation": "^1.0.3",
|
|
15
|
+
"@idealyst/theme": "^1.0.3",
|
|
16
16
|
"@mdi/js": "^7.4.47",
|
|
17
17
|
"@mdi/react": "^1.6.1",
|
|
18
18
|
"@react-native/normalize-colors": "^0.80.1",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
nodeLinker: "node-modules"
|
|
2
|
+
|
|
3
|
+
# Enable transparent workspaces for better workspace dependency resolution
|
|
4
|
+
enableTransparentWorkspaces: true
|
|
5
|
+
|
|
6
|
+
# Enable network for package downloads
|
|
7
|
+
enableNetwork: true
|
|
8
|
+
|
|
9
|
+
# Timeout for HTTP requests (in milliseconds)
|
|
10
|
+
httpTimeout: 60000
|
|
11
|
+
|
|
12
|
+
# Number of retry attempts for HTTP requests
|
|
13
|
+
httpRetry: 3
|
|
14
|
+
|
|
15
|
+
# Registry configuration
|
|
16
|
+
npmRegistryServer: "https://registry.yarnpkg.com"
|
|
17
|
+
|
|
18
|
+
# Enable progress bars
|
|
19
|
+
enableProgressBars: true
|
|
20
|
+
|
|
21
|
+
# Enable colors in output
|
|
22
|
+
enableColors: true
|
|
23
|
+
|
|
24
|
+
# Prevent hoisting to avoid React Native issues
|
|
25
|
+
# This ensures React Native dependencies stay in their local node_modules
|
|
26
|
+
nmHoistingLimits: workspaces
|
|
@@ -14,9 +14,9 @@ This workspace contains your Idealyst Framework packages and applications.
|
|
|
14
14
|
│ ├── theme/ # Theme configuration
|
|
15
15
|
│ ├── components/ # UI components
|
|
16
16
|
│ └── utils/ # Shared utilities
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
├── mobile-app/ # React Native app (generated)
|
|
18
|
+
├── web-app/ # React web app (generated)
|
|
19
|
+
└── shared-lib/ # Shared library (generated)
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
### Development
|
|
@@ -53,6 +53,8 @@ Generate a new shared library:
|
|
|
53
53
|
idealyst create shared-lib --type shared
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
**Note:** The CLI will automatically add new projects to the workspace configuration when run from the workspace root.
|
|
57
|
+
|
|
56
58
|
### Publishing
|
|
57
59
|
|
|
58
60
|
Publish all packages:
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"workspaces": [
|
|
7
7
|
"packages/*"
|
|
8
8
|
],
|
|
9
|
-
"packageManager": "yarn@4.0
|
|
9
|
+
"packageManager": "yarn@4.1.0",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"publish:all": "yarn workspaces foreach --include '@/*' npm publish",
|
|
12
12
|
"version:patch": "yarn workspaces foreach --include '@/*' version patch",
|