@idealyst/cli 1.0.2 → 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 CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Command } from 'commander';
3
3
  import chalk from 'chalk';
4
4
  import path from 'path';
5
+ import { fileURLToPath } from 'url';
5
6
  import fs from 'fs-extra';
6
7
  import { spawn } from 'child_process';
7
8
  import ora from 'ora';
@@ -14,6 +15,28 @@ function validateProjectName(name) {
14
15
  function createPackageName(name) {
15
16
  return name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
16
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
+ }
17
40
  async function copyTemplate(templatePath, destPath, data) {
18
41
  const spinner = ora(`Copying template files...`).start();
19
42
  try {
@@ -72,10 +95,12 @@ async function installDependencies(projectPath, skipInstall = false) {
72
95
  spinner.succeed('Dependencies installed successfully');
73
96
  }
74
97
  catch (error) {
75
- spinner.fail('Failed to install dependencies');
98
+ spinner.fail('Failed to install dependencies with yarn');
76
99
  console.log(chalk.yellow('You can install dependencies manually by running:'));
77
100
  console.log(chalk.white(' cd ' + path.basename(projectPath)));
78
101
  console.log(chalk.white(' yarn install'));
102
+ console.log(chalk.white(' # or alternatively:'));
103
+ console.log(chalk.white(' npm install'));
79
104
  }
80
105
  }
81
106
  function runCommand(command, args, options) {
@@ -107,6 +132,8 @@ function getTemplateData(projectName, description) {
107
132
  };
108
133
  }
109
134
 
135
+ const __filename$3 = fileURLToPath(import.meta.url);
136
+ const __dirname$3 = path.dirname(__filename$3);
110
137
  async function generateNativeProject(options) {
111
138
  const { name, directory, skipInstall } = options;
112
139
  if (!validateProjectName(name)) {
@@ -114,10 +141,11 @@ async function generateNativeProject(options) {
114
141
  }
115
142
  console.log(chalk.blue(`📱 Creating React Native project: ${name}`));
116
143
  const projectPath = path.join(directory, name);
117
- const templatePath = path.join(__dirname, '..', '..', 'templates', 'native');
144
+ const templatePath = path.join(__dirname$3, '..', 'templates', 'native');
118
145
  const templateData = getTemplateData(name, `React Native app built with Idealyst Framework`);
119
146
  await copyTemplate(templatePath, projectPath, templateData);
120
147
  await installDependencies(projectPath, skipInstall);
148
+ await updateWorkspacePackageJson(name, directory);
121
149
  console.log(chalk.green('✅ React Native project created successfully!'));
122
150
  console.log(chalk.blue('📋 Project includes:'));
123
151
  console.log(chalk.white(' • React Native 0.80.1'));
@@ -129,6 +157,8 @@ async function generateNativeProject(options) {
129
157
  console.log(chalk.white(' • Babel configuration'));
130
158
  }
131
159
 
160
+ const __filename$2 = fileURLToPath(import.meta.url);
161
+ const __dirname$2 = path.dirname(__filename$2);
132
162
  async function generateWebProject(options) {
133
163
  const { name, directory, skipInstall } = options;
134
164
  if (!validateProjectName(name)) {
@@ -136,10 +166,11 @@ async function generateWebProject(options) {
136
166
  }
137
167
  console.log(chalk.blue(`🌐 Creating React Web project: ${name}`));
138
168
  const projectPath = path.join(directory, name);
139
- const templatePath = path.join(__dirname, '..', '..', 'templates', 'web');
169
+ const templatePath = path.join(__dirname$2, '..', 'templates', 'web');
140
170
  const templateData = getTemplateData(name, `React web app built with Idealyst Framework`);
141
171
  await copyTemplate(templatePath, projectPath, templateData);
142
172
  await installDependencies(projectPath, skipInstall);
173
+ await updateWorkspacePackageJson(name, directory);
143
174
  console.log(chalk.green('✅ React Web project created successfully!'));
144
175
  console.log(chalk.blue('📋 Project includes:'));
145
176
  console.log(chalk.white(' • React 19.1'));
@@ -151,6 +182,8 @@ async function generateWebProject(options) {
151
182
  console.log(chalk.white(' • React Router'));
152
183
  }
153
184
 
185
+ const __filename$1 = fileURLToPath(import.meta.url);
186
+ const __dirname$1 = path.dirname(__filename$1);
154
187
  async function generateSharedLibrary(options) {
155
188
  const { name, directory, skipInstall } = options;
156
189
  if (!validateProjectName(name)) {
@@ -158,10 +191,11 @@ async function generateSharedLibrary(options) {
158
191
  }
159
192
  console.log(chalk.blue(`📦 Creating shared library: ${name}`));
160
193
  const projectPath = path.join(directory, name);
161
- const templatePath = path.join(__dirname, '..', '..', 'templates', 'shared');
194
+ const templatePath = path.join(__dirname$1, '..', 'templates', 'shared');
162
195
  const templateData = getTemplateData(name, `Shared library built with Idealyst Framework`);
163
196
  await copyTemplate(templatePath, projectPath, templateData);
164
197
  await installDependencies(projectPath, skipInstall);
198
+ await updateWorkspacePackageJson(name, directory);
165
199
  console.log(chalk.green('✅ Shared library created successfully!'));
166
200
  console.log(chalk.blue('📋 Project includes:'));
167
201
  console.log(chalk.white(' • Cross-platform components'));
@@ -171,6 +205,8 @@ async function generateSharedLibrary(options) {
171
205
  console.log(chalk.white(' • React & React Native support'));
172
206
  }
173
207
 
208
+ const __filename = fileURLToPath(import.meta.url);
209
+ const __dirname = path.dirname(__filename);
174
210
  async function generateWorkspace(options) {
175
211
  const { name, directory, skipInstall } = options;
176
212
  if (!validateProjectName(name)) {
@@ -178,7 +214,7 @@ async function generateWorkspace(options) {
178
214
  }
179
215
  console.log(chalk.blue(`🏗️ Creating Idealyst workspace: ${name}`));
180
216
  const projectPath = path.join(directory, name);
181
- const templatePath = path.join(__dirname, '..', '..', 'templates', 'workspace');
217
+ const templatePath = path.join(__dirname, '..', 'templates', 'workspace');
182
218
  const templateData = getTemplateData(name, `Idealyst Framework monorepo workspace`);
183
219
  await copyTemplate(templatePath, projectPath, templateData);
184
220
  await installDependencies(projectPath, skipInstall);
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "CLI tool for generating Idealyst Framework projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -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.1",
16
- "@idealyst/navigation": "^1.0.1",
17
- "@idealyst/theme": "^1.0.1",
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
@@ -11,7 +11,7 @@
11
11
  "prepublishOnly": "yarn build"
12
12
  },
13
13
  "peerDependencies": {
14
- "@idealyst/theme": "^1.0.1",
14
+ "@idealyst/theme": "^1.0.3",
15
15
  "react": "^19.1.0",
16
16
  "react-native": "^0.80.1"
17
17
  },
@@ -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.1",
14
- "@idealyst/navigation": "^1.0.1",
15
- "@idealyst/theme": "^1.0.1",
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
- └── apps/ # Applications
18
- ├── mobile/ # React Native app
19
- └── web/ # React web app
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.2",
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",