create-ern-boilerplate 0.0.9 โ 0.0.11
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
CHANGED
|
@@ -1,274 +1,171 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ๐ create-ern-boilerplate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI untuk membuat proyek **React Native Expo** dengan cepat menggunakan berbagai template yang sudah disiapkan.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Dengan alat ini, kamu bisa membuat project baru hanya dalam hitungan detik โ baik secara interaktif maupun langsung (tanpa prompt).
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- โ
**TypeScript** - Type-safe development
|
|
9
|
-
- โ
**NativeWind (Tailwind CSS)** - Utility-first styling
|
|
10
|
-
- โ
**Authentication Context** - Global auth state management
|
|
11
|
-
- โ
**Theme Support** - Light/Dark mode with system preference
|
|
12
|
-
- โ
**Mock API Server** - JSON Server for development
|
|
13
|
-
- โ
**Secure Storage** - Expo SecureStore for sensitive data
|
|
14
|
-
- โ
**Path Aliases** - Clean imports with `@` prefix
|
|
15
|
-
- โ
**Form Validation** - Built-in validation utilities
|
|
16
|
-
- โ
**Reusable Components** - Button, Input, Card, Loading, etc.
|
|
7
|
+
---
|
|
17
8
|
|
|
18
|
-
##
|
|
9
|
+
## ๐ฆ Instalasi
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
โโโ app
|
|
23
|
-
โ โโโ (admin) # Halaman & route khusus admin
|
|
24
|
-
โ โโโ (auth) # Halaman auth (login, register, dsb)
|
|
25
|
-
โ โโโ (protected) # Halaman yang membutuhkan autentikasi
|
|
26
|
-
โ โโโ _layout.tsx # Root layout untuk Expo Router
|
|
27
|
-
โ
|
|
28
|
-
โโโ server
|
|
29
|
-
โ โโโ db.json # Mock data untuk JSON Server
|
|
30
|
-
โ
|
|
31
|
-
โโโ src
|
|
32
|
-
โ โโโ assets # Gambar, font, dan aset statis
|
|
33
|
-
โ โโโ components # Komponen UI reusable
|
|
34
|
-
โ โโโ contexts # Context API (Auth, Theme, dsb)
|
|
35
|
-
โ โโโ hooks # Custom React hooks
|
|
36
|
-
โ โโโ services # API service (Axios, interceptors, dll)
|
|
37
|
-
โ โโโ theme # Konfigurasi tema (warna, dark mode)
|
|
38
|
-
โ โโโ types # TypeScript type definitions
|
|
39
|
-
โ โโโ utils # Helper functions & constants
|
|
40
|
-
โ
|
|
41
|
-
โโโ app.json # Konfigurasi Expo project
|
|
42
|
-
โโโ babel.config.js # Konfigurasi Babel
|
|
43
|
-
โโโ expo-env.d.ts # Type definitions untuk Expo environment
|
|
44
|
-
โโโ global.css # Global style untuk Tailwind / NativeWind
|
|
45
|
-
โโโ index.ts # Entry point utama aplikasi
|
|
46
|
-
โโโ LICENSE # Lisensi project
|
|
47
|
-
โโโ metro.config.js # Konfigurasi Metro bundler
|
|
48
|
-
โโโ nativewind-env.d.ts # Type support untuk NativeWind
|
|
49
|
-
โโโ package.json # Dependency & script project
|
|
50
|
-
โโโ package-lock.json # Lock file npm
|
|
51
|
-
โโโ README.md # Dokumentasi project
|
|
52
|
-
โโโ structure.txt # Struktur folder (auto-generated)
|
|
53
|
-
โโโ tailwind.config.js # Konfigurasi TailwindCSS
|
|
54
|
-
โโโ tsconfig.json # Konfigurasi TypeScript
|
|
11
|
+
Kamu **tidak perlu menginstal package ini secara global**.
|
|
12
|
+
Cukup jalankan menggunakan **npx**:
|
|
55
13
|
|
|
14
|
+
```bash
|
|
15
|
+
npx create-ern-boilerplate
|
|
56
16
|
```
|
|
57
17
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Prerequisites
|
|
61
|
-
|
|
62
|
-
- Node.js 18+
|
|
63
|
-
- npm or yarn
|
|
64
|
-
- Expo CLI
|
|
18
|
+
---
|
|
65
19
|
|
|
66
|
-
|
|
20
|
+
## ๐ง Contoh Penggunaan
|
|
67
21
|
|
|
68
|
-
1.
|
|
69
|
-
```bash
|
|
70
|
-
git clone <your-repo-url>
|
|
71
|
-
cd <your-repo-folder>
|
|
72
|
-
```
|
|
22
|
+
### ๐ข 1. Mode Interaktif (Default)
|
|
73
23
|
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
npm install
|
|
77
|
-
```
|
|
24
|
+
Jalankan tanpa argumen tambahan:
|
|
78
25
|
|
|
79
|
-
3. Start the development server:
|
|
80
26
|
```bash
|
|
81
|
-
|
|
27
|
+
npx create-ern-boilerplate
|
|
82
28
|
```
|
|
83
29
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### Available Scripts
|
|
87
|
-
|
|
88
|
-
- `npm start` - Start Expo development server
|
|
89
|
-
- `npm run android` - Run on Android
|
|
90
|
-
- `npm run ios` - Run on iOS
|
|
91
|
-
- `npm run web` - Run on web
|
|
92
|
-
- `npm run lint` - Run ESLint
|
|
93
|
-
- `npm run type-check` - Run TypeScript type checking
|
|
94
|
-
|
|
95
|
-
## Configuration
|
|
30
|
+
Kamu akan ditanya:
|
|
96
31
|
|
|
97
|
-
|
|
32
|
+
- Nama project
|
|
33
|
+
- Deskripsi
|
|
34
|
+
- Template yang ingin digunakan
|
|
35
|
+
- Apakah ingin langsung install dependencies
|
|
98
36
|
|
|
99
|
-
|
|
37
|
+
**Contoh:**
|
|
100
38
|
|
|
101
|
-
```typescript
|
|
102
|
-
export const API_CONFIG = {
|
|
103
|
-
BASE_URL: __DEV__ ? 'http://localhost:3001' : 'https://api.yourapp.com',
|
|
104
|
-
TIMEOUT: 10000,
|
|
105
|
-
};
|
|
106
39
|
```
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
```typescript
|
|
113
|
-
export const colors = {
|
|
114
|
-
light: {
|
|
115
|
-
primary: '#3b82f6',
|
|
116
|
-
// ... other colors
|
|
117
|
-
},
|
|
118
|
-
dark: {
|
|
119
|
-
primary: '#3b82f6',
|
|
120
|
-
// ... other colors
|
|
121
|
-
},
|
|
122
|
-
};
|
|
40
|
+
? Nama project kamu: my-expo-app
|
|
41
|
+
? Deskripsi singkat: Aplikasi keren dengan Expo
|
|
42
|
+
? Pilih template: redux
|
|
43
|
+
? Langsung install dependencies setelah membuat project? Yes
|
|
123
44
|
```
|
|
124
45
|
|
|
125
|
-
|
|
46
|
+
---
|
|
126
47
|
|
|
127
|
-
|
|
48
|
+
### ๐ก 2. Mode Cepat (Tanpa Prompt)
|
|
128
49
|
|
|
129
|
-
|
|
50
|
+
Langsung buat project baru tanpa pertanyaan:
|
|
130
51
|
|
|
131
|
-
|
|
132
|
-
-
|
|
52
|
+
```bash
|
|
53
|
+
npx create-ern-boilerplate my-app -y
|
|
54
|
+
```
|
|
133
55
|
|
|
134
|
-
|
|
56
|
+
โ
Otomatis pakai **template default (`minimal`)**
|
|
57
|
+
โ
Langsung install dependencies
|
|
135
58
|
|
|
136
|
-
|
|
137
|
-
import { useAuth } from '@hooks/useAuth';
|
|
59
|
+
---
|
|
138
60
|
|
|
139
|
-
|
|
140
|
-
const { user, login, logout, isAuthenticated } = useAuth();
|
|
141
|
-
|
|
142
|
-
// Use authentication methods
|
|
143
|
-
}
|
|
144
|
-
```
|
|
61
|
+
### ๐ต 3. Mode Cepat + Custom Deskripsi + Template
|
|
145
62
|
|
|
146
|
-
|
|
63
|
+
Kamu bisa langsung menentukan deskripsi dan template yang digunakan:
|
|
147
64
|
|
|
148
|
-
|
|
65
|
+
```bash
|
|
66
|
+
npx create-ern-boilerplate my-app -y --desc "Boilerplate lengkap" --template redux
|
|
67
|
+
```
|
|
149
68
|
|
|
150
|
-
|
|
151
|
-
|
|
69
|
+
๐ Akan langsung generate project **my-app**
|
|
70
|
+
๐ Isi deskripsi otomatis
|
|
71
|
+
๐งฉ Menggunakan template **redux**
|
|
72
|
+
โ๏ธ Auto install dependencies
|
|
152
73
|
|
|
153
|
-
|
|
154
|
-
const { theme, colors, setThemeMode } = useTheme();
|
|
155
|
-
|
|
156
|
-
// theme: 'light' | 'dark'
|
|
157
|
-
// colors: current theme colors
|
|
158
|
-
// setThemeMode: 'light' | 'dark' | 'auto'
|
|
159
|
-
}
|
|
160
|
-
```
|
|
74
|
+
---
|
|
161
75
|
|
|
162
|
-
##
|
|
76
|
+
## โ๏ธ Argumen & Opsi CLI
|
|
163
77
|
|
|
164
|
-
|
|
78
|
+
| Opsi | Alias | Deskripsi | Contoh |
|
|
79
|
+
|------|--------|------------|--------|
|
|
80
|
+
| `-y` / `--yes` | | Jalankan mode cepat tanpa prompt | `npx create-ern-boilerplate my-app -y` |
|
|
81
|
+
| `--desc` | | Tambahkan deskripsi project | `--desc "Aplikasi keren"` |
|
|
82
|
+
| `--template` | | Pilih template tertentu | `--template redux` |
|
|
83
|
+
| `--install` | | Auto install dependencies di mode cepat | `-y --install` |
|
|
165
84
|
|
|
166
|
-
|
|
167
|
-
import { newsService } from '@services/newsService';
|
|
85
|
+
---
|
|
168
86
|
|
|
169
|
-
|
|
170
|
-
const news = await newsService.getNews({ limit: 10 });
|
|
87
|
+
## ๐งฉ Struktur Template
|
|
171
88
|
|
|
172
|
-
|
|
173
|
-
const newsItem = await newsService.getNewsById('1');
|
|
89
|
+
Semua template disimpan di folder:
|
|
174
90
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
91
|
+
```
|
|
92
|
+
/templates
|
|
93
|
+
โโโ minimal
|
|
94
|
+
โโโ redux
|
|
95
|
+
โโโ default
|
|
96
|
+
โโโ ...
|
|
181
97
|
```
|
|
182
98
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
### useAuth
|
|
99
|
+
Kamu dapat menambahkan template baru cukup dengan menambahkan folder baru di dalam direktori `templates`.
|
|
186
100
|
|
|
187
|
-
|
|
101
|
+
---
|
|
188
102
|
|
|
189
|
-
|
|
103
|
+
## ๐ ๏ธ Cara Kerja
|
|
190
104
|
|
|
191
|
-
|
|
105
|
+
1. CLI membaca argumen dari perintah yang kamu jalankan.
|
|
106
|
+
2. Jika mode interaktif: akan menampilkan prompt dengan `inquirer`.
|
|
107
|
+
3. Template yang dipilih akan disalin ke folder project baru.
|
|
108
|
+
4. `package.json` dan `app.json` akan di-update otomatis:
|
|
109
|
+
- Nama project
|
|
110
|
+
- Deskripsi
|
|
111
|
+
- Bundle identifier (iOS / Android)
|
|
112
|
+
5. Jika dipilih, dependencies akan langsung diinstall.
|
|
192
113
|
|
|
193
|
-
|
|
114
|
+
---
|
|
194
115
|
|
|
195
|
-
|
|
116
|
+
## ๐งพ Contoh Hasil
|
|
196
117
|
|
|
197
|
-
|
|
198
|
-
<Button
|
|
199
|
-
title="Click Me"
|
|
200
|
-
variant="primary"
|
|
201
|
-
size="md"
|
|
202
|
-
onPress={() => {}}
|
|
203
|
-
loading={false}
|
|
204
|
-
fullWidth
|
|
205
|
-
/>
|
|
206
|
-
```
|
|
118
|
+
Setelah menjalankan perintah:
|
|
207
119
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
```typescript
|
|
211
|
-
<Input
|
|
212
|
-
label="Email"
|
|
213
|
-
placeholder="Enter email"
|
|
214
|
-
value={email}
|
|
215
|
-
onChangeText={setEmail}
|
|
216
|
-
error={emailError}
|
|
217
|
-
secureTextEntry
|
|
218
|
-
/>
|
|
120
|
+
```bash
|
|
121
|
+
npx create-ern-boilerplate my-expo-app -y --desc "Boilerplate lengkap" --template redux
|
|
219
122
|
```
|
|
220
123
|
|
|
221
|
-
|
|
124
|
+
CLI akan menghasilkan struktur seperti:
|
|
222
125
|
|
|
223
|
-
```typescript
|
|
224
|
-
<Card className="mb-4">
|
|
225
|
-
<Text>Card content</Text>
|
|
226
|
-
</Card>
|
|
227
126
|
```
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
127
|
+
my-expo-app/
|
|
128
|
+
โโโ app.json
|
|
129
|
+
โโโ package.json
|
|
130
|
+
โโโ App.js
|
|
131
|
+
โโโ src/
|
|
132
|
+
โ โโโ components/
|
|
133
|
+
โ โโโ screens/
|
|
134
|
+
โ โโโ redux/
|
|
135
|
+
โ โโโ ...
|
|
136
|
+
โโโ ...
|
|
233
137
|
```
|
|
234
138
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
Use clean imports with configured path aliases:
|
|
139
|
+
Dan kamu bisa langsung menjalankan:
|
|
238
140
|
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
import { newsService } from '@services/newsService';
|
|
141
|
+
```bash
|
|
142
|
+
cd my-expo-app
|
|
143
|
+
npm run start
|
|
243
144
|
```
|
|
244
145
|
|
|
245
|
-
|
|
146
|
+
---
|
|
246
147
|
|
|
247
|
-
### Building for Production
|
|
248
148
|
|
|
249
|
-
|
|
250
|
-
# For Android
|
|
251
|
-
eas build --platform android
|
|
149
|
+
---
|
|
252
150
|
|
|
253
|
-
|
|
254
|
-
eas build --platform ios
|
|
151
|
+
## ๐ก Tips
|
|
255
152
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
153
|
+
- Jalankan `--template` dengan nama folder template yang tersedia.
|
|
154
|
+
- Tambahkan flag `--install` untuk auto install di mode cepat.
|
|
155
|
+
- Kamu bisa menambahkan template buatan sendiri di folder `templates`.
|
|
156
|
+
|
|
157
|
+
---
|
|
259
158
|
|
|
260
|
-
|
|
159
|
+
---
|
|
261
160
|
|
|
262
|
-
|
|
263
|
-
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
264
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
265
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
266
|
-
5. Open a Pull Request
|
|
161
|
+
## ๐ชช Lisensi
|
|
267
162
|
|
|
268
|
-
|
|
163
|
+
Lisensi: [MIT](./LICENSE)
|
|
269
164
|
|
|
270
|
-
|
|
165
|
+
---
|
|
271
166
|
|
|
272
|
-
##
|
|
167
|
+
## ๐ฌ Penulis
|
|
273
168
|
|
|
274
|
-
|
|
169
|
+
Dibuat dengan โค๏ธ oleh **[Zedfar]**
|
|
170
|
+
๐ง Kontak: ulfar.far@gmail.com
|
|
171
|
+
๐ GitHub: [@zedfar](https://github.com/zedfar)
|