@idealyst/cli 1.0.3 → 1.0.5

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
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idealyst/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
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
@@ -1,9 +1,4 @@
1
- /**
2
- * @format
3
- */
4
-
5
1
  import { AppRegistry } from 'react-native';
6
2
  import App from './src/App';
7
- import { name as appName } from './app.json';
8
3
 
9
- AppRegistry.registerComponent(appName, () => App);
4
+ AppRegistry.registerComponent('{{projectName}}', () => App);
@@ -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"
@@ -9,24 +9,19 @@ UnistylesRegistry.addThemes({
9
9
  dark: darkTheme,
10
10
  });
11
11
 
12
- const App: React.FC = () => {
12
+ const App = () => {
13
13
  return (
14
14
  <Screen>
15
- <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', padding: 20 }}>
16
- <Text variant="h1" style={{ marginBottom: 20, textAlign: 'center' }}>
17
- Welcome to {{projectName}}
18
- </Text>
19
- <Text variant="body1" style={{ marginBottom: 30, textAlign: 'center' }}>
20
- Built with Idealyst Framework
15
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
16
+ <Text variant="h1">Welcome to {{projectName}}</Text>
17
+ <Text variant="body">
18
+ This is a React Native app built with the Idealyst Framework.
21
19
  </Text>
22
20
  <Button
23
21
  title="Get Started"
24
22
  onPress={() => console.log('Button pressed!')}
25
- style={{ marginBottom: 20 }}
23
+ style={{ marginTop: 20 }}
26
24
  />
27
- <Text variant="caption" style={{ textAlign: 'center', opacity: 0.7 }}>
28
- Edit src/App.tsx to start building your app
29
- </Text>
30
25
  </View>
31
26
  </Screen>
32
27
  );
@@ -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
  },
@@ -1,25 +1,41 @@
1
1
  import React from 'react';
2
2
  import { View, Text } from 'react-native';
3
+ import { useTheme } from '@idealyst/theme';
3
4
 
4
- interface SharedComponentProps {
5
+ export interface SharedComponentProps {
5
6
  title: string;
6
7
  description?: string;
7
8
  }
8
9
 
9
- export const SharedComponent: React.FC<SharedComponentProps> = ({
10
- title,
11
- description
12
- }) => {
10
+ const SharedComponent: React.FC<SharedComponentProps> = ({ title, description }) => {
11
+ const { theme } = useTheme();
12
+
13
13
  return (
14
- <View style={{ padding: 16, alignItems: 'center' }}>
15
- <Text style={{ fontSize: 18, fontWeight: 'bold', marginBottom: 8 }}>
14
+ <View style={{
15
+ padding: 16,
16
+ backgroundColor: theme.colors.surface,
17
+ borderRadius: 8,
18
+ marginBottom: 16
19
+ }}>
20
+ <Text style={{
21
+ fontSize: 18,
22
+ fontWeight: 'bold',
23
+ color: theme.colors.text,
24
+ marginBottom: 8
25
+ }}>
16
26
  {title}
17
27
  </Text>
18
28
  {description && (
19
- <Text style={{ fontSize: 14, color: '#666', textAlign: 'center' }}>
29
+ <Text style={{
30
+ fontSize: 14,
31
+ color: theme.colors.textSecondary,
32
+ lineHeight: 20
33
+ }}>
20
34
  {description}
21
35
  </Text>
22
36
  )}
23
37
  </View>
24
38
  );
25
- };
39
+ };
40
+
41
+ export default SharedComponent;
@@ -1 +1,3 @@
1
- export * from './SharedComponent';
1
+ // Export all components
2
+ export { default as SharedComponent } from './SharedComponent';
3
+ export type { SharedComponentProps } from './SharedComponent';
@@ -1,6 +1,10 @@
1
- // Export shared components, utilities, and types
1
+ // Export all components
2
2
  export * from './components';
3
+
4
+ // Export all utilities
3
5
  export * from './utils';
6
+
7
+ // Export all types
4
8
  export * from './types';
5
9
 
6
10
  // Re-export theme utilities
@@ -1,7 +1,17 @@
1
- // Basic types for the shared library
2
1
  export interface ComponentProps {
3
- children?: any;
4
2
  style?: any;
3
+ children?: React.ReactNode;
5
4
  }
6
5
 
7
- export type Theme = 'light' | 'dark';
6
+ export interface User {
7
+ id: string;
8
+ name: string;
9
+ email: string;
10
+ avatar?: string;
11
+ }
12
+
13
+ export interface ApiResponse<T> {
14
+ data: T;
15
+ message: string;
16
+ success: boolean;
17
+ }
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Format a string to title case
2
+ * Converts a string to title case
3
+ * @param str The string to convert
4
+ * @returns The string in title case
3
5
  */
4
6
  export const toTitleCase = (str: string): string => {
5
7
  return str.replace(/\w\S*/g, (txt) =>
@@ -8,25 +10,25 @@ export const toTitleCase = (str: string): string => {
8
10
  };
9
11
 
10
12
  /**
11
- * Check if a value is empty (null, undefined, empty string, empty array)
13
+ * Formats a number as currency
14
+ * @param amount The amount to format
15
+ * @param currency The currency code (default: 'USD')
16
+ * @returns The formatted currency string
12
17
  */
13
- export const isEmpty = (value: any): boolean => {
14
- if (value === null || value === undefined) return true;
15
- if (typeof value === 'string' && value.trim() === '') return true;
16
- if (Array.isArray(value) && value.length === 0) return true;
17
- return false;
18
+ export const formatCurrency = (amount: number, currency = 'USD'): string => {
19
+ return new Intl.NumberFormat('en-US', {
20
+ style: 'currency',
21
+ currency,
22
+ }).format(amount);
18
23
  };
19
24
 
20
25
  /**
21
- * Debounce function calls
26
+ * Truncates a string to a specified length
27
+ * @param str The string to truncate
28
+ * @param maxLength The maximum length
29
+ * @returns The truncated string
22
30
  */
23
- export const debounce = <T extends (...args: any[]) => any>(
24
- func: T,
25
- delay: number
26
- ): ((...args: Parameters<T>) => void) => {
27
- let timeoutId: NodeJS.Timeout;
28
- return (...args: Parameters<T>) => {
29
- clearTimeout(timeoutId);
30
- timeoutId = setTimeout(() => func(...args), delay);
31
- };
31
+ export const truncateText = (str: string, maxLength: number): string => {
32
+ if (str.length <= maxLength) return str;
33
+ return str.substring(0, maxLength) + '...';
32
34
  };
@@ -1 +1,2 @@
1
+ // Export all utilities
1
2
  export * from './helpers';
@@ -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
@@ -87,5 +87,4 @@ const styles = createStyleSheet({
87
87
 
88
88
  - [Idealyst Framework Documentation](https://github.com/your-username/idealyst-framework)
89
89
  - [React Documentation](https://react.dev/)
90
- - [Vite Documentation](https://vitejs.dev/)
91
- - [React Native Web Documentation](https://necolas.github.io/react-native-web/)
90
+ - [Vite Documentation](https://vitejs.dev/)
@@ -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",
@@ -9,29 +9,18 @@ UnistylesRegistry.addThemes({
9
9
  dark: darkTheme,
10
10
  });
11
11
 
12
- const App: React.FC = () => {
12
+ const App = () => {
13
13
  return (
14
- <View style={{
15
- flex: 1,
16
- justifyContent: 'center',
17
- alignItems: 'center',
18
- padding: 20,
19
- minHeight: '100vh'
20
- }}>
21
- <Text variant="h1" style={{ marginBottom: 20, textAlign: 'center' }}>
22
- Welcome to {{projectName}}
23
- </Text>
24
- <Text variant="body1" style={{ marginBottom: 30, textAlign: 'center' }}>
25
- Built with Idealyst Framework
14
+ <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', minHeight: '100vh' }}>
15
+ <Text variant="h1">Welcome to {{projectName}}</Text>
16
+ <Text variant="body" style={{ marginTop: 20, textAlign: 'center' }}>
17
+ This is a React web application built with the Idealyst Framework.
26
18
  </Text>
27
19
  <Button
28
20
  title="Get Started"
29
21
  onPress={() => console.log('Button pressed!')}
30
- style={{ marginBottom: 20 }}
22
+ style={{ marginTop: 20 }}
31
23
  />
32
- <Text variant="caption" style={{ textAlign: 'center', opacity: 0.7 }}>
33
- Edit src/App.tsx to start building your app
34
- </Text>
35
24
  </View>
36
25
  );
37
26
  };
@@ -1,11 +1,10 @@
1
- import React from 'react';
1
+ import { StrictMode } from 'react';
2
2
  import { createRoot } from 'react-dom/client';
3
3
  import App from './App';
4
4
 
5
- const container = document.getElementById('root');
6
- if (!container) {
7
- throw new Error('Root element not found');
8
- }
9
-
10
- const root = createRoot(container);
11
- root.render(<App />);
5
+ const root = createRoot(document.getElementById('root')!);
6
+ root.render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>
10
+ );
@@ -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",