create-granite-app 0.1.0 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # create-granite-app
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 32c6959: Allow empty string for project name in `create-granite-app` to use the default value.
8
+
9
+ ## 0.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - d675415: Improve scaffolding to provide a better showcase UI
14
+ - 10a5f3f: empty
15
+
3
16
  ## 0.1.0
4
17
 
5
18
  ### Minor Changes
package/dist/index.js CHANGED
@@ -5032,6 +5032,9 @@ function getAppName(appPath) {
5032
5032
  function assertValidAppName(input) {
5033
5033
  const appName = getAppName(input);
5034
5034
  const kebabCaseAppName = kebabCase(appName);
5035
+ if (appName === "") {
5036
+ return;
5037
+ }
5035
5038
  if (kebabCaseAppName !== appName) {
5036
5039
  throw new Error(`Project name must be in kebab-case (e.g. ${kebabCaseAppName})`);
5037
5040
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-granite-app",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "cba": "./bin.js",
@@ -21,12 +21,13 @@
21
21
  "build": "tsup src/index.ts --format esm",
22
22
  "dev": "tsup src/index.ts --format esm --watch",
23
23
  "typecheck": "tsc --noEmit",
24
- "test:no-parallel": "vitest --no-watch"
24
+ "test:no-parallel": "vitest --no-watch --coverage"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/kill-port": "^2.0.1",
28
28
  "@types/node": "^22.10.2",
29
29
  "@types/yargs": "^17.0.33",
30
+ "@vitest/coverage-v8": "^2.1.8",
30
31
  "es-toolkit": "^1.30.1",
31
32
  "execa": "^9.5.2",
32
33
  "kill-port": "^2.0.1",
@@ -8,8 +8,8 @@
8
8
  "typecheck": "tsc --noEmit"
9
9
  },
10
10
  "dependencies": {
11
- "@granite-js/react-native": "0.1.0",
12
- "@granite-js/native": "0.1.0",
11
+ "@granite-js/react-native": "0.1.2",
12
+ "@granite-js/native": "0.1.2",
13
13
  "react": "18.2.0",
14
14
  "react-native": "0.72.6"
15
15
  },
@@ -21,9 +21,9 @@
21
21
  "@types/jest": "^29.5.14",
22
22
  "@types/node": "^22.10.2",
23
23
  "@types/react": "18.3.3",
24
- "@granite-js/plugin-router": "0.1.0",
25
- "@granite-js/plugin-hermes": "0.1.0",
26
- "babel-preset-granite": "0.1.0",
24
+ "@granite-js/plugin-router": "0.1.2",
25
+ "@granite-js/plugin-hermes": "0.1.2",
26
+ "babel-preset-granite": "0.1.2",
27
27
  "react-test-renderer": "18.2.0",
28
28
  "jest": "^29.7.0",
29
29
  "typescript": "^5.8.3"
@@ -0,0 +1 @@
1
+ export { Route } from 'pages/about';
@@ -1,16 +1 @@
1
- import React from 'react';
2
- import { Text, View } from 'react-native';
3
- import { createRoute } from '@granite-js/react-native';
4
-
5
- export const Route = createRoute('/', {
6
- validateParams: (params) => params,
7
- component: Index,
8
- });
9
-
10
- export function Index() {
11
- return (
12
- <View>
13
- <Text>Hello Index</Text>
14
- </View>
15
- );
16
- }
1
+ export { Route } from 'pages/index';
@@ -0,0 +1,70 @@
1
+ import { createRoute } from '@granite-js/react-native';
2
+ import React from 'react';
3
+ import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
4
+
5
+ export const Route = createRoute('/about', {
6
+ component: Page,
7
+ });
8
+
9
+ function Page() {
10
+ const navigation = Route.useNavigation();
11
+
12
+ const handleGoBack = () => {
13
+ navigation.goBack();
14
+ };
15
+
16
+ return (
17
+ <View style={styles.container}>
18
+ <Text style={styles.title}>About Granite</Text>
19
+ <Text style={styles.description}>Granite is a powerful and flexible React Native Framework 🚀</Text>
20
+ <TouchableOpacity style={styles.button} onPress={handleGoBack}>
21
+ <Text style={styles.buttonText}>Go Back</Text>
22
+ </TouchableOpacity>
23
+ </View>
24
+ );
25
+ }
26
+
27
+ const styles = StyleSheet.create({
28
+ container: {
29
+ flex: 1,
30
+ padding: 24,
31
+ backgroundColor: '#F7FAFC',
32
+ alignItems: 'center',
33
+ justifyContent: 'center',
34
+ },
35
+ title: {
36
+ fontSize: 28,
37
+ fontWeight: 'bold',
38
+ color: '#1A202C',
39
+ marginBottom: 16,
40
+ textAlign: 'center',
41
+ },
42
+ description: {
43
+ fontSize: 18,
44
+ color: '#4A5568',
45
+ textAlign: 'center',
46
+ marginBottom: 12,
47
+ lineHeight: 26,
48
+ },
49
+ button: {
50
+ marginTop: 24,
51
+ backgroundColor: '#0064FF',
52
+ paddingVertical: 12,
53
+ paddingHorizontal: 32,
54
+ borderRadius: 8,
55
+ shadowColor: '#000',
56
+ shadowOffset: {
57
+ width: 0,
58
+ height: 2,
59
+ },
60
+ shadowOpacity: 0.25,
61
+ shadowRadius: 3.84,
62
+ elevation: 5,
63
+ },
64
+ buttonText: {
65
+ color: 'white',
66
+ fontSize: 16,
67
+ fontWeight: 'bold',
68
+ textAlign: 'center',
69
+ },
70
+ });
@@ -0,0 +1,104 @@
1
+ import { createRoute } from '@granite-js/react-native';
2
+ import React from 'react';
3
+ import { StyleSheet, View, Text, TouchableOpacity } from 'react-native';
4
+
5
+ export const Route = createRoute('/', {
6
+ component: Page,
7
+ });
8
+
9
+ function Page() {
10
+ const navigation = Route.useNavigation();
11
+
12
+ const goToAboutPage = () => {
13
+ navigation.navigate('/about');
14
+ };
15
+
16
+ return (
17
+ <Container>
18
+ <Text style={styles.title}>🎉 Welcome! 🎉</Text>
19
+ <Text style={styles.subtitle}>
20
+ This is a demo page for the <Text style={styles.brandText}>Granite</Text> Framework.
21
+ </Text>
22
+ <Text style={styles.description}>This page was created to showcase the features of the Granite.</Text>
23
+ <TouchableOpacity style={styles.button} onPress={goToAboutPage}>
24
+ <Text style={styles.buttonText}>Go to About Page</Text>
25
+ </TouchableOpacity>
26
+ </Container>
27
+ );
28
+ }
29
+
30
+ function Container({ children }: { children: React.ReactNode }) {
31
+ return <View style={styles.container}>{children}</View>;
32
+ }
33
+
34
+ const styles = StyleSheet.create({
35
+ container: {
36
+ flex: 1,
37
+ padding: 16,
38
+ backgroundColor: 'white',
39
+ justifyContent: 'center',
40
+ alignItems: 'center',
41
+ },
42
+ brandText: {
43
+ color: '#0064FF',
44
+ fontWeight: 'bold',
45
+ },
46
+ text: {
47
+ fontSize: 24,
48
+ color: '#202632',
49
+ textAlign: 'center',
50
+ marginBottom: 10,
51
+ },
52
+ title: {
53
+ fontSize: 32,
54
+ fontWeight: 'bold',
55
+ color: '#1A202C',
56
+ textAlign: 'center',
57
+ marginBottom: 16,
58
+ },
59
+ subtitle: {
60
+ fontSize: 18,
61
+ color: '#4A5568',
62
+ textAlign: 'center',
63
+ marginBottom: 24,
64
+ },
65
+ description: {
66
+ fontSize: 16,
67
+ color: '#718096',
68
+ textAlign: 'center',
69
+ marginBottom: 32,
70
+ lineHeight: 24,
71
+ },
72
+ button: {
73
+ backgroundColor: '#0064FF',
74
+ paddingVertical: 12,
75
+ paddingHorizontal: 32,
76
+ borderRadius: 8,
77
+ shadowColor: '#000',
78
+ shadowOffset: {
79
+ width: 0,
80
+ height: 2,
81
+ },
82
+ shadowOpacity: 0.25,
83
+ shadowRadius: 3.84,
84
+ elevation: 5,
85
+ },
86
+ buttonText: {
87
+ color: 'white',
88
+ fontSize: 16,
89
+ fontWeight: 'bold',
90
+ textAlign: 'center',
91
+ },
92
+ codeContainer: {
93
+ padding: 8,
94
+ backgroundColor: '#333',
95
+ borderRadius: 4,
96
+ width: '100%',
97
+ },
98
+ code: {
99
+ color: 'white',
100
+ fontFamily: 'monospace',
101
+ letterSpacing: 0.5,
102
+ fontSize: 14,
103
+ },
104
+ });
@@ -1,9 +1,11 @@
1
1
  /* eslint-disable */
2
2
  // This file is auto-generated by @granite-js/react-native. DO NOT EDIT.
3
- import { Route as _IndexRoute } from '../pages';
3
+ import { Route as _AboutRoute } from '../pages/about';
4
+ import { Route as _IndexRoute } from '../pages/';
4
5
 
5
6
  declare module '@granite-js/react-native' {
6
7
  interface RegisterScreen {
8
+ '/about': ReturnType<typeof _AboutRoute.useParams>;
7
9
  '/': ReturnType<typeof _IndexRoute.useParams>;
8
10
  }
9
11
  }