@neevjs/cli 1.0.0-beta

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rahul7raj
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # @neevjs/cli
2
+
3
+ The official command-line interface for [NeevJS](https://github.com/rahul7raj/neevjs) — the plugin-driven, offline-first React framework for business applications.
4
+
5
+ ## Quick Start
6
+
7
+ Scaffold a new NeevJS project in seconds:
8
+
9
+ ```bash
10
+ npx @neevjs/cli init my-app
11
+ ```
12
+
13
+ ## Project Modes
14
+
15
+ The CLI provides an interactive prompt to choose your project architecture:
16
+
17
+ 1. **Fullstack Mode (Default)**
18
+ Scaffolds both a React client and a Node.js (`@neevjs/server`) backend. Perfect for starting a new full-stack application from scratch with unified types and shared models.
19
+
20
+ 2. **API Mode**
21
+ Scaffolds the React client only. Use this mode if you already have an existing backend (Laravel, Django, Go, etc.) and just want to use NeevJS for the frontend. You will be prompted to enter your API's base URL.
22
+
23
+ 3. **Hybrid Mode**
24
+ Scaffolds the React client with examples showing how to connect specific models to different backends simultaneously (e.g., overriding the `baseURL` for a legacy service).
25
+
26
+ ## Commands
27
+
28
+ ### `init [project-name]`
29
+ Initializes a new NeevJS project.
30
+ ```bash
31
+ npx @neevjs/cli init my-dashboard
32
+ ```
33
+
34
+ ### `version`
35
+ Displays the current version of the NeevJS CLI.
36
+ ```bash
37
+ npx @neevjs/cli version
38
+ ```
39
+
40
+ ## License
41
+
42
+ MIT License Ā© 2024 Rahul Raj Kushwaha
@@ -0,0 +1 @@
1
+ export declare function init(projectName?: string): Promise<void>;
@@ -0,0 +1,168 @@
1
+ import prompts from 'prompts';
2
+ import chalk from 'chalk';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ export async function init(projectName) {
6
+ const response = await prompts([
7
+ {
8
+ type: projectName ? null : 'text',
9
+ name: 'name',
10
+ message: 'Project name:',
11
+ initial: 'my-neev-app'
12
+ },
13
+ {
14
+ type: 'select',
15
+ name: 'mode',
16
+ message: 'Select project mode:',
17
+ choices: [
18
+ { title: 'Fullstack (Client + Server)', value: 'fullstack', description: 'React + Node.js/Express' },
19
+ { title: 'API Mode (Client Only)', value: 'api', description: 'Connect to your existing backend' },
20
+ { title: 'Hybrid Mode (Client Only)', value: 'hybrid', description: 'Connect models to multiple backends' }
21
+ ],
22
+ initial: 0
23
+ }
24
+ ]);
25
+ const name = projectName || response.name;
26
+ const mode = response.mode;
27
+ if (!name || !mode) {
28
+ console.log(chalk.red('Initialization cancelled.'));
29
+ return;
30
+ }
31
+ const projectDir = path.resolve(process.cwd(), name);
32
+ console.log(`\nšŸš€ Creating a new NeevJS project in ${chalk.cyan(projectDir)}...`);
33
+ await fs.ensureDir(projectDir);
34
+ // 1. Scaffold Client
35
+ console.log(`šŸ“¦ Scaffolding ${chalk.green('Client')}...`);
36
+ await scaffoldClient(projectDir, name, mode);
37
+ // 2. Scaffold Server if Fullstack
38
+ if (mode === 'fullstack') {
39
+ console.log(`šŸ“¦ Scaffolding ${chalk.green('Server')}...`);
40
+ await scaffoldServer(projectDir);
41
+ }
42
+ console.log(`\n✨ Project ${chalk.bold(name)} initialized successfully!`);
43
+ console.log(`\nNext steps:`);
44
+ console.log(` cd ${name}`);
45
+ console.log(` npm install`);
46
+ console.log(` npm run dev`);
47
+ }
48
+ async function scaffoldClient(dir, name, mode) {
49
+ const clientDir = mode === 'fullstack' ? path.join(dir, 'client') : dir;
50
+ await fs.ensureDir(clientDir);
51
+ // Basic package.json
52
+ const pkg = {
53
+ name: `${name}-client`,
54
+ version: '0.1.0-beta',
55
+ type: 'module',
56
+ scripts: {
57
+ "dev": "vite",
58
+ "build": "vite build"
59
+ },
60
+ dependencies: {
61
+ "@neevjs/client": "^0.1.0-beta",
62
+ "react": "^19.0.0",
63
+ "react-dom": "^19.0.0"
64
+ },
65
+ devDependencies: {
66
+ "vite": "^5.0.0",
67
+ "@types/react": "^19.0.0",
68
+ "@types/react-dom": "^19.0.0",
69
+ "typescript": "^5.3.3"
70
+ }
71
+ };
72
+ await fs.writeJson(path.join(clientDir, 'package.json'), pkg, { spaces: 2 });
73
+ // neev.ts configuration
74
+ let baseURL = mode === 'fullstack' ? '/api' : '';
75
+ if (mode === 'api') {
76
+ const { url } = await prompts({
77
+ type: 'text',
78
+ name: 'url',
79
+ message: 'Enter your API baseURL:',
80
+ initial: 'https://api.example.com/api'
81
+ });
82
+ baseURL = url;
83
+ }
84
+ const neevTs = `import { createClient, AuthPlugin, LoggerPlugin } from '@neevjs/client'
85
+
86
+ export const client = createClient({
87
+ baseURL: '${baseURL}',
88
+ })
89
+
90
+ client.use(AuthPlugin)
91
+ client.use(LoggerPlugin)
92
+ `;
93
+ await fs.ensureDir(path.join(clientDir, 'src/core'));
94
+ await fs.writeFile(path.join(clientDir, 'src/core/neev.ts'), neevTs);
95
+ // Example Component
96
+ const exampleCode = mode === 'hybrid' ?
97
+ `import { useModel } from '@neevjs/client'
98
+
99
+ export function HybridDemo() {
100
+ // Primary backend (uses global baseURL)
101
+ const { data: users } = useModel('users')
102
+
103
+ // External backend (overrides baseURL)
104
+ const { data: payments } = useModel('payments', {
105
+ baseURL: 'https://api.external-service.com/api'
106
+ })
107
+
108
+ return (
109
+ <div>
110
+ <h1>Hybrid Mode Demo</h1>
111
+ <p>Users from primary: {users.length}</p>
112
+ <p>Payments from external: {payments.length}</p>
113
+ </div>
114
+ )
115
+ }` :
116
+ `import { useModel } from '@neevjs/client'
117
+
118
+ export function Dashboard() {
119
+ const { data, loading } = useModel('users')
120
+
121
+ if (loading) return <p>Loading...</p>
122
+
123
+ return (
124
+ <div>
125
+ <h1>NeevJS Dashboard</h1>
126
+ <ul>
127
+ {data.map(user => <li key={user.id}>{user.name}</li>)}
128
+ </ul>
129
+ </div>
130
+ )
131
+ }`;
132
+ await fs.ensureDir(path.join(clientDir, 'src/features'));
133
+ await fs.writeFile(path.join(clientDir, 'src/features/Demo.tsx'), exampleCode);
134
+ }
135
+ async function scaffoldServer(dir) {
136
+ const serverDir = path.join(dir, 'server');
137
+ await fs.ensureDir(serverDir);
138
+ const pkg = {
139
+ name: "neev-server",
140
+ version: "0.1.0-beta",
141
+ type: "module",
142
+ scripts: {
143
+ "dev": "nodemon src/server.ts"
144
+ },
145
+ dependencies: {
146
+ "@neevjs/server": "^0.1.0-beta",
147
+ "express": "^4.18.2",
148
+ "cors": "^2.8.5"
149
+ },
150
+ devDependencies: {
151
+ "nodemon": "^3.0.0",
152
+ "ts-node": "^10.9.1",
153
+ "typescript": "^5.3.3"
154
+ }
155
+ };
156
+ await fs.writeJson(path.join(serverDir, 'package.json'), pkg, { spaces: 2 });
157
+ const serverTs = `import { createServer } from '@neevjs/server'
158
+
159
+ const app = createServer()
160
+ const port = 3001
161
+
162
+ app.listen(port, () => {
163
+ console.log(\`Server running at http://localhost:\${port}\`)
164
+ })
165
+ `;
166
+ await fs.ensureDir(path.join(serverDir, 'src'));
167
+ await fs.writeFile(path.join(serverDir, 'src/server.ts'), serverTs);
168
+ }
@@ -0,0 +1 @@
1
+ export declare function showVersion(): void;
@@ -0,0 +1,4 @@
1
+ import chalk from 'chalk';
2
+ export function showVersion() {
3
+ console.log(`NeevJS CLI ${chalk.cyan('v1.0.0-beta')}`);
4
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { init } from './commands/init.js';
4
+ import { showVersion } from './commands/version.js';
5
+ const program = new Command();
6
+ program
7
+ .name('neev')
8
+ .description('NeevJS CLI — build business apps, not frontend chaos.')
9
+ .version('0.1.0-beta');
10
+ program
11
+ .command('init')
12
+ .description('Initialize a new NeevJS project')
13
+ .argument('[name]', 'Project name')
14
+ .action((name) => init(name));
15
+ program
16
+ .command('version')
17
+ .description('Show NeevJS version')
18
+ .action(() => showVersion());
19
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@neevjs/cli",
3
+ "version": "1.0.0-beta",
4
+ "description": "NeevJS CLI — project scaffolding and development tools",
5
+ "main": "dist/index.js",
6
+ "bin": {
7
+ "neev": "./dist/index.js"
8
+ },
9
+ "type": "module",
10
+ "dependencies": {
11
+ "commander": "^12.0.0",
12
+ "prompts": "^2.4.2",
13
+ "fs-extra": "^11.2.0",
14
+ "chalk": "^5.3.0",
15
+ "execa": "^8.0.1"
16
+ },
17
+ "devDependencies": {
18
+ "@types/fs-extra": "^11.0.4",
19
+ "@types/prompts": "^2.4.9",
20
+ "typescript": "^5.3.3"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "dev": "tsc -w"
25
+ }
26
+ }
@@ -0,0 +1,188 @@
1
+ import prompts from 'prompts';
2
+ import chalk from 'chalk';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import { execa } from 'execa';
6
+
7
+ export async function init(projectName?: string) {
8
+ const response = await prompts([
9
+ {
10
+ type: projectName ? null : 'text',
11
+ name: 'name',
12
+ message: 'Project name:',
13
+ initial: 'my-neev-app'
14
+ },
15
+ {
16
+ type: 'select',
17
+ name: 'mode',
18
+ message: 'Select project mode:',
19
+ choices: [
20
+ { title: 'Fullstack (Client + Server)', value: 'fullstack', description: 'React + Node.js/Express' },
21
+ { title: 'API Mode (Client Only)', value: 'api', description: 'Connect to your existing backend' },
22
+ { title: 'Hybrid Mode (Client Only)', value: 'hybrid', description: 'Connect models to multiple backends' }
23
+ ],
24
+ initial: 0
25
+ }
26
+ ]);
27
+
28
+ const name = projectName || response.name;
29
+ const mode = response.mode;
30
+
31
+ if (!name || !mode) {
32
+ console.log(chalk.red('Initialization cancelled.'));
33
+ return;
34
+ }
35
+
36
+ const projectDir = path.resolve(process.cwd(), name);
37
+ console.log(`\nšŸš€ Creating a new NeevJS project in ${chalk.cyan(projectDir)}...`);
38
+
39
+ await fs.ensureDir(projectDir);
40
+
41
+ // 1. Scaffold Client
42
+ console.log(`šŸ“¦ Scaffolding ${chalk.green('Client')}...`);
43
+ await scaffoldClient(projectDir, name, mode);
44
+
45
+ // 2. Scaffold Server if Fullstack
46
+ if (mode === 'fullstack') {
47
+ console.log(`šŸ“¦ Scaffolding ${chalk.green('Server')}...`);
48
+ await scaffoldServer(projectDir);
49
+ }
50
+
51
+ console.log(`\n✨ Project ${chalk.bold(name)} initialized successfully!`);
52
+ console.log(`\nNext steps:`);
53
+ console.log(` cd ${name}`);
54
+ console.log(` npm install`);
55
+ console.log(` npm run dev`);
56
+ }
57
+
58
+ async function scaffoldClient(dir: string, name: string, mode: string) {
59
+ const clientDir = mode === 'fullstack' ? path.join(dir, 'client') : dir;
60
+ await fs.ensureDir(clientDir);
61
+
62
+ // Basic package.json
63
+ const pkg = {
64
+ name: `${name}-client`,
65
+ version: '0.1.0-beta',
66
+ type: 'module',
67
+ scripts: {
68
+ "dev": "vite",
69
+ "build": "vite build"
70
+ },
71
+ dependencies: {
72
+ "@neevjs/client": "^0.1.0-beta",
73
+ "react": "^19.0.0",
74
+ "react-dom": "^19.0.0"
75
+ },
76
+ devDependencies: {
77
+ "vite": "^5.0.0",
78
+ "@types/react": "^19.0.0",
79
+ "@types/react-dom": "^19.0.0",
80
+ "typescript": "^5.3.3"
81
+ }
82
+ };
83
+ await fs.writeJson(path.join(clientDir, 'package.json'), pkg, { spaces: 2 });
84
+
85
+ // neev.ts configuration
86
+ let baseURL = mode === 'fullstack' ? '/api' : '';
87
+ if (mode === 'api') {
88
+ const { url } = await prompts({
89
+ type: 'text',
90
+ name: 'url',
91
+ message: 'Enter your API baseURL:',
92
+ initial: 'https://api.example.com/api'
93
+ });
94
+ baseURL = url;
95
+ }
96
+
97
+ const neevTs = `import { createClient, AuthPlugin, LoggerPlugin } from '@neevjs/client'
98
+
99
+ export const client = createClient({
100
+ baseURL: '${baseURL}',
101
+ })
102
+
103
+ client.use(AuthPlugin)
104
+ client.use(LoggerPlugin)
105
+ `;
106
+
107
+ await fs.ensureDir(path.join(clientDir, 'src/core'));
108
+ await fs.writeFile(path.join(clientDir, 'src/core/neev.ts'), neevTs);
109
+
110
+ // Example Component
111
+ const exampleCode = mode === 'hybrid' ?
112
+ `import { useModel } from '@neevjs/client'
113
+
114
+ export function HybridDemo() {
115
+ // Primary backend (uses global baseURL)
116
+ const { data: users } = useModel('users')
117
+
118
+ // External backend (overrides baseURL)
119
+ const { data: payments } = useModel('payments', {
120
+ baseURL: 'https://api.external-service.com/api'
121
+ })
122
+
123
+ return (
124
+ <div>
125
+ <h1>Hybrid Mode Demo</h1>
126
+ <p>Users from primary: {users.length}</p>
127
+ <p>Payments from external: {payments.length}</p>
128
+ </div>
129
+ )
130
+ }` :
131
+ `import { useModel } from '@neevjs/client'
132
+
133
+ export function Dashboard() {
134
+ const { data, loading } = useModel('users')
135
+
136
+ if (loading) return <p>Loading...</p>
137
+
138
+ return (
139
+ <div>
140
+ <h1>NeevJS Dashboard</h1>
141
+ <ul>
142
+ {data.map(user => <li key={user.id}>{user.name}</li>)}
143
+ </ul>
144
+ </div>
145
+ )
146
+ }`;
147
+
148
+ await fs.ensureDir(path.join(clientDir, 'src/features'));
149
+ await fs.writeFile(path.join(clientDir, 'src/features/Demo.tsx'), exampleCode);
150
+ }
151
+
152
+ async function scaffoldServer(dir: string) {
153
+ const serverDir = path.join(dir, 'server');
154
+ await fs.ensureDir(serverDir);
155
+
156
+ const pkg = {
157
+ name: "neev-server",
158
+ version: "0.1.0-beta",
159
+ type: "module",
160
+ scripts: {
161
+ "dev": "nodemon src/server.ts"
162
+ },
163
+ dependencies: {
164
+ "@neevjs/server": "^0.1.0-beta",
165
+ "express": "^4.18.2",
166
+ "cors": "^2.8.5"
167
+ },
168
+ devDependencies: {
169
+ "nodemon": "^3.0.0",
170
+ "ts-node": "^10.9.1",
171
+ "typescript": "^5.3.3"
172
+ }
173
+ };
174
+ await fs.writeJson(path.join(serverDir, 'package.json'), pkg, { spaces: 2 });
175
+
176
+ const serverTs = `import { createServer } from '@neevjs/server'
177
+
178
+ const app = createServer()
179
+ const port = 3001
180
+
181
+ app.listen(port, () => {
182
+ console.log(\`Server running at http://localhost:\${port}\`)
183
+ })
184
+ `;
185
+
186
+ await fs.ensureDir(path.join(serverDir, 'src'));
187
+ await fs.writeFile(path.join(serverDir, 'src/server.ts'), serverTs);
188
+ }
@@ -0,0 +1,5 @@
1
+ import chalk from 'chalk';
2
+
3
+ export function showVersion() {
4
+ console.log(`NeevJS CLI ${chalk.cyan('v1.0.0-beta')}`);
5
+ }
package/src/index.ts ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import chalk from 'chalk';
4
+ import { init } from './commands/init.js';
5
+ import { showVersion } from './commands/version.js';
6
+
7
+ const program = new Command();
8
+
9
+ program
10
+ .name('neev')
11
+ .description('NeevJS CLI — build business apps, not frontend chaos.')
12
+ .version('0.1.0-beta');
13
+
14
+ program
15
+ .command('init')
16
+ .description('Initialize a new NeevJS project')
17
+ .argument('[name]', 'Project name')
18
+ .action((name) => init(name));
19
+
20
+ program
21
+ .command('version')
22
+ .description('Show NeevJS version')
23
+ .action(() => showVersion());
24
+
25
+ program.parse();
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "node",
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "declaration": true
12
+ },
13
+ "include": ["src/**/*"]
14
+ }