@idealyst/cli 1.0.4 → 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/package.json +1 -1
- package/templates/native/index.js +1 -6
- package/templates/native/src/App.tsx +6 -11
- package/templates/shared/src/components/SharedComponent.tsx +25 -9
- package/templates/shared/src/components/index.ts +3 -1
- package/templates/shared/src/index.ts +5 -1
- package/templates/shared/src/types/index.ts +13 -3
- package/templates/shared/src/utils/helpers.ts +19 -17
- package/templates/shared/src/utils/index.ts +1 -0
- package/templates/web/README.md +1 -2
- package/templates/web/src/App.tsx +6 -17
- package/templates/web/src/main.tsx +7 -8
package/package.json
CHANGED
|
@@ -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(
|
|
4
|
+
AppRegistry.registerComponent('{{projectName}}', () => App);
|
|
@@ -9,24 +9,19 @@ UnistylesRegistry.addThemes({
|
|
|
9
9
|
dark: darkTheme,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
const App
|
|
12
|
+
const App = () => {
|
|
13
13
|
return (
|
|
14
14
|
<Screen>
|
|
15
|
-
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center'
|
|
16
|
-
<Text variant="h1"
|
|
17
|
-
|
|
18
|
-
|
|
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={{
|
|
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
|
);
|
|
@@ -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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) => {
|
|
10
|
+
const SharedComponent: React.FC<SharedComponentProps> = ({ title, description }) => {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
|
|
13
13
|
return (
|
|
14
|
-
<View style={{
|
|
15
|
-
|
|
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={{
|
|
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,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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
*
|
|
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
|
|
24
|
-
|
|
25
|
-
|
|
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
|
};
|
package/templates/web/README.md
CHANGED
|
@@ -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/)
|
|
@@ -9,29 +9,18 @@ UnistylesRegistry.addThemes({
|
|
|
9
9
|
dark: darkTheme,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
const App
|
|
12
|
+
const App = () => {
|
|
13
13
|
return (
|
|
14
|
-
<View style={{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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={{
|
|
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
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import App from './App';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
root.render(<App />);
|
|
5
|
+
const root = createRoot(document.getElementById('root')!);
|
|
6
|
+
root.render(
|
|
7
|
+
<StrictMode>
|
|
8
|
+
<App />
|
|
9
|
+
</StrictMode>
|
|
10
|
+
);
|