rnsup 1.0.0 → 1.0.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/README.md CHANGED
@@ -1,8 +1,13 @@
1
+ <img width="1536" height="1024" alt="1000241861" src="https://github.com/user-attachments/assets/3a35bc32-3413-40e5-8355-5db4806923a4" />
2
+
3
+
1
4
  # RNSUP — React Native Support CLI
2
5
 
6
+ ![npm](https://img.shields.io/npm/v/rnsup?color=blue&label=npm)&nbsp;![license](https://img.shields.io/badge/license-MIT-green)&nbsp;![node](https://img.shields.io/badge/node-%3E%3D18-brightgreen)
7
+
3
8
  **RNSUP** is a developer productivity CLI that converts a fresh React Native CLI project into a production-ready architecture.
4
9
 
5
- Instead of spending 23 days configuring navigation, alias paths, reanimated, gesture handler, axios setup and folder structure, you can do everything with **one command**.
10
+ Instead of spending 36 hours configuring navigation, alias paths, reanimated, gesture handler, axios setup and folder structure, you can do everything with **one command**.
6
11
 
7
12
  ---
8
13
 
@@ -60,6 +65,37 @@ src/
60
65
  * Image import TypeScript support
61
66
  * Clean folder structure
62
67
 
68
+ ---
69
+
70
+ ## Installed packages (default)
71
+
72
+ RNSUP installs a curated set of libraries into your project. These are added automatically when you run `npx rnsup setup` (some are optional via prompt):
73
+
74
+ - `@react-navigation/native`
75
+ - `react-native-screens`
76
+ - `react-native-gesture-handler`
77
+ - `react-native-reanimated`
78
+ - `react-native-worklets` (Babel plugin integration)
79
+ - `react-native-vector-icons`
80
+ - `zustand`
81
+ - `axios`
82
+ - `@tanstack/react-query`
83
+ - `react-native-mmkv`
84
+ - navigation extras (conditional): `@react-navigation/native-stack`, `@react-navigation/bottom-tabs`, `@react-navigation/drawer`
85
+ - optional (prompted): `react-native-svg`, `lucide-react-native`
86
+
87
+ <div style="background:#fff3cd;border-left:6px solid #ffeeba;padding:12px;border-radius:6px">
88
+ <strong>⚠️ Warning</strong>
89
+ <p style="margin:6px 0 0">Many of the packages above include native code. After installation you <strong>must</strong> verify and complete any required native configuration (for iOS and Android). Common steps include:</p>
90
+ <ul style="margin:6px 0 0;padding-left:20px">
91
+ <li>Run <code>cd ios && pod install</code> on macOS</li>
92
+ <li>Follow the official docs for Reanimated, MMKV, react-native-svg and React Navigation</li>
93
+ <li>Check Android Gradle / manifest changes for native modules</li>
94
+ </ul>
95
+ <p style="margin:6px 0 0">If something looks off (build errors, missing icons, or runtime crashes), consult the package docs first — RNSUP does not (and cannot) run platform-specific installs for you.</p>
96
+ </div>
97
+
98
+ ---
63
99
  ### Developer Experience
64
100
 
65
101
  * Auto import aliases (`@components`, `@services`, etc.)
@@ -83,9 +119,10 @@ npx rnsup setup
83
119
  ## Quick Start
84
120
 
85
121
  ### 1) Create React Native Project
122
+ for creating latest cli project !
86
123
 
87
124
  ```bash
88
- npx react-native@latest init MyApp
125
+ npx create-rn
89
126
  cd MyApp
90
127
  ```
91
128
 
@@ -120,6 +157,9 @@ npx rnsup setup
120
157
 
121
158
  ### Generate Screen
122
159
 
160
+ > Here `s` mean `screen`, and `g` mean `generate`
161
+
162
+
123
163
  ```
124
164
  rnsup g s Login
125
165
  rnsup g s auth/Login
@@ -138,6 +178,8 @@ src/features/auth/LoginScreen.tsx
138
178
 
139
179
  ### Generate Component
140
180
 
181
+ > Here `c` mean `component`
182
+
141
183
  ```
142
184
  rnsup g c Button
143
185
  rnsup g c ui/forms/Input
@@ -152,6 +194,42 @@ src/components/ui/forms/Input.tsx
152
194
 
153
195
  ---
154
196
 
197
+ ### Generate Folder / Directory
198
+
199
+ > Here `d` mean `directory`, and `g` mean `generate`
200
+
201
+ Create folders/directories at any location with automatic alias registration and optional `index.ts` generation:
202
+
203
+ ```
204
+ rnsup g d features
205
+ rnsup g d src/store
206
+ rnsup g d src/utils/helpers
207
+ ```
208
+
209
+ Examples created:
210
+
211
+ ```
212
+ features/
213
+ src/store/
214
+ src/utils/helpers/
215
+ ```
216
+
217
+ **Features:**
218
+
219
+ - 📁 Colored output showing folder details
220
+ - ✅ Confirmation before creating
221
+ - 📝 Optional `index.ts` file generation (for exports)
222
+ - 🔗 Auto-alias registration for `src/` folders
223
+ - 📋 History tracking
224
+
225
+ **Notes:**
226
+
227
+ - If folder path starts with `src/`, it will be created inside `src/` and alias will be registered
228
+ - If just a name is provided (e.g., `rnsup g d config`), folder is created at project root
229
+ - Supports nested paths: `rnsup g d src/features/auth/screens`
230
+
231
+ ---
232
+
155
233
  ## Auto Alias Support
156
234
 
157
235
  You can import without relative paths.
@@ -244,79 +322,6 @@ Recommended workflow:
244
322
 
245
323
  This ensures aliases and exports always remain correct.
246
324
 
247
- ---
248
-
249
- ## Publishing to NPM
250
-
251
- ### 1) Login
252
-
253
- Create an account at:
254
- https://www.npmjs.com
255
-
256
- Then:
257
-
258
- ```bash
259
- npm login
260
- ```
261
-
262
- ---
263
-
264
- ### 2) Prepare package.json
265
-
266
- Make sure:
267
-
268
- ```json
269
- {
270
- "name": "rnsup",
271
- "version": "1.0.0",
272
- "bin": {
273
- "rnsup": "bin/rnsup.js"
274
- }
275
- }
276
- ```
277
-
278
- ---
279
-
280
- ### 3) Build project
281
-
282
- ```
283
- npm run build
284
- ```
285
-
286
- ---
287
-
288
- ### 4) Publish
289
-
290
- ```
291
- npm publish --access public
292
- ```
293
-
294
- Your package is now live.
295
-
296
- ---
297
-
298
- ## Using After Publish
299
-
300
- Anyone can run:
301
-
302
- ```bash
303
- npx rnsup setup
304
- ```
305
-
306
- No installation required.
307
-
308
- ---
309
-
310
- ## Updating Package
311
-
312
- After changes:
313
-
314
- ```
315
- npm version patch
316
- npm publish
317
- ```
318
-
319
- ---
320
325
 
321
326
  ## Contribution
322
327
 
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateFolder = generateFolder;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const inquirer_1 = __importDefault(require("inquirer"));
10
+ const chalk_1 = __importDefault(require("chalk"));
11
+ const history_1 = require("../utils/history");
12
+ const aliasManager_1 = require("../utils/aliasManager");
13
+ async function generateFolder(input) {
14
+ try {
15
+ // normalize slashes and clean input
16
+ let cleaned = input.replace(/\\/g, '/').trim();
17
+ // resolve folder path
18
+ let fullDir;
19
+ let relativeDir;
20
+ // if path starts with src/, use as-is
21
+ if (cleaned.startsWith('src/')) {
22
+ relativeDir = cleaned;
23
+ fullDir = path_1.default.join(process.cwd(), cleaned);
24
+ }
25
+ // if path contains /, but doesn't start with src/
26
+ else if (cleaned.includes('/')) {
27
+ fullDir = path_1.default.join(process.cwd(), cleaned);
28
+ relativeDir = cleaned;
29
+ }
30
+ // just a folder name, create at root
31
+ else {
32
+ fullDir = path_1.default.join(process.cwd(), cleaned);
33
+ relativeDir = cleaned;
34
+ }
35
+ const folderName = path_1.default.basename(fullDir);
36
+ // show colored info
37
+ console.log('\n' + chalk_1.default.cyan.bold('📁 Folder Creation Details'));
38
+ console.log(chalk_1.default.gray('─'.repeat(50)));
39
+ console.log(chalk_1.default.yellow('Folder Name:'), chalk_1.default.white(folderName));
40
+ console.log(chalk_1.default.yellow('Location: '), chalk_1.default.white(relativeDir));
41
+ console.log(chalk_1.default.yellow('Full Path: '), chalk_1.default.dim(fullDir));
42
+ console.log(chalk_1.default.gray('─'.repeat(50)));
43
+ // check if folder already exists
44
+ if (await fs_extra_1.default.pathExists(fullDir)) {
45
+ console.log(chalk_1.default.yellow(`\n⚠️ Folder ${relativeDir} already exists.`));
46
+ const { proceed } = await inquirer_1.default.prompt([
47
+ {
48
+ type: 'confirm',
49
+ name: 'proceed',
50
+ message: 'Do you want to continue anyway?',
51
+ default: false
52
+ }
53
+ ]);
54
+ if (!proceed) {
55
+ console.log(chalk_1.default.yellow('Cancelled.'));
56
+ return;
57
+ }
58
+ }
59
+ // ask to create index.ts
60
+ const { createIndex } = await inquirer_1.default.prompt([
61
+ {
62
+ type: 'confirm',
63
+ name: 'createIndex',
64
+ message: 'Create index.ts file?',
65
+ default: true
66
+ }
67
+ ]);
68
+ // final confirmation
69
+ const { confirm } = await inquirer_1.default.prompt([
70
+ {
71
+ type: 'confirm',
72
+ name: 'confirm',
73
+ message: chalk_1.default.green(`Create folder ${chalk_1.default.bold(folderName)}?`),
74
+ default: true
75
+ }
76
+ ]);
77
+ if (!confirm) {
78
+ console.log(chalk_1.default.yellow('Cancelled.'));
79
+ return;
80
+ }
81
+ // create folder
82
+ await fs_extra_1.default.ensureDir(fullDir);
83
+ // register alias if it's under src/
84
+ if (relativeDir.startsWith('src/')) {
85
+ await (0, aliasManager_1.registerAlias)(relativeDir);
86
+ }
87
+ // create index.ts if requested
88
+ if (createIndex) {
89
+ const indexFile = path_1.default.join(fullDir, 'index.ts');
90
+ if (!(await fs_extra_1.default.pathExists(indexFile))) {
91
+ await fs_extra_1.default.writeFile(indexFile, '// Add your exports here\n');
92
+ }
93
+ }
94
+ await (0, history_1.addHistory)(`Created folder ${relativeDir}`);
95
+ console.log(chalk_1.default.green(`\n✨ Folder ${chalk_1.default.bold(folderName)} created successfully!`));
96
+ console.log(chalk_1.default.gray(`Location: ${relativeDir}`));
97
+ console.log();
98
+ }
99
+ catch (err) {
100
+ console.error(chalk_1.default.red('Error creating folder:'), err);
101
+ }
102
+ }
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ const commander_1 = require("commander");
4
4
  const setup_1 = require("./commands/setup");
5
5
  const generateScreen_1 = require("./commands/generateScreen");
6
6
  const generateComponent_1 = require("./commands/generateComponent");
7
+ const generateFolder_1 = require("./commands/generateFolder");
7
8
  const program = new commander_1.Command();
8
9
  program
9
10
  .name('rnsup')
@@ -24,11 +25,18 @@ generate
24
25
  .alias('s')
25
26
  .description('Generate a screen')
26
27
  .action(generateScreen_1.generateScreen);
28
+ /* ---------- Component ---------- */
27
29
  generate
28
30
  .command('component <name>')
29
31
  .alias('c')
30
32
  .description('Generate a component')
31
33
  .action(generateComponent_1.generateComponent);
34
+ /* ---------- Folder ---------- */
35
+ generate
36
+ .command('folder <name>')
37
+ .alias('d')
38
+ .description('Create a folder / directory')
39
+ .action(generateFolder_1.generateFolder);
32
40
  /* attach to main program */
33
41
  program.addCommand(generate);
34
42
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rnsup",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "RNSUP is a CLI tool that converts a fresh React Native CLI project into a production-ready architecture with navigation, alias paths, utilities and code generators.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
@@ -64,4 +64,4 @@
64
64
  "ts-node": "^10.9.2",
65
65
  "typescript": "^5.9.3"
66
66
  }
67
- }
67
+ }