inikit 1.2.3 → 2.0.0
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 +281 -31
- package/dist/index.js +87 -98
- package/dist/package.json +4 -4
- package/dist/tli.js +59 -0
- package/dist/utils.js +28 -10
- package/package.json +68 -68
package/README.md
CHANGED
|
@@ -1,31 +1,281 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# Inikit 🚀
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/inikit)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://github.com/askv-in/inikit/issues)
|
|
8
|
+
[](https://github.com/askv-in/inikit/stargazers)
|
|
9
|
+
[](https://github.com/askv-in/inikit/network)
|
|
10
|
+
[](https://github.com/askv-in/inikit/graphs/contributors)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
> The best way to get started with Next.js and React projects.
|
|
15
|
+
|
|
16
|
+
Inikit is a powerful, open-source CLI tool that scaffolds modern web
|
|
17
|
+
applications with industry-standard development tools and configurations. Built
|
|
18
|
+
for developers, by developers, to streamline the project setup process and
|
|
19
|
+
enforce best practices from day one.
|
|
20
|
+
|
|
21
|
+
<!-- ## 🌟 Why Inikit?
|
|
22
|
+
|
|
23
|
+
In the fast-paced world of web development, setting up a new project with all
|
|
24
|
+
the necessary tools and configurations can be time-consuming and error-prone.
|
|
25
|
+
Inikit solves this by providing:
|
|
26
|
+
|
|
27
|
+
- **Zero Configuration**: Get started immediately with sensible, battle-tested
|
|
28
|
+
defaults
|
|
29
|
+
- **Best Practices**: Industry-standard tools and configurations out of the box
|
|
30
|
+
- **Developer Experience**: Consistent setup across teams and projects
|
|
31
|
+
- **Modern Stack**: Latest versions of popular tools and frameworks
|
|
32
|
+
- **Flexibility**: Choose only the tools you need for your project
|
|
33
|
+
|
|
34
|
+
## ✨ Features
|
|
35
|
+
|
|
36
|
+
- 🎯 **Framework Support**: Next.js and React (with Vite)
|
|
37
|
+
- 📝 **TypeScript Ready**: Full TypeScript support out of the box
|
|
38
|
+
- 🎨 **Styling**: Tailwind CSS integration
|
|
39
|
+
- ✅ **Code Quality**: ESLint, Prettier, and Commitlint pre-configured
|
|
40
|
+
- 🔧 **Git Hooks**: Husky for automated code quality checks
|
|
41
|
+
- 🚀 **Zero Configuration**: Get started immediately with sensible defaults
|
|
42
|
+
- 📦 **Modern Tooling**: Latest versions of all dependencies -->
|
|
43
|
+
|
|
44
|
+
## 🚀 Quick Start
|
|
45
|
+
|
|
46
|
+
### Using npx (Recommended)
|
|
47
|
+
|
|
48
|
+
The fastest way to scaffold a new project:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx inikit@latest
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Global Installation
|
|
55
|
+
|
|
56
|
+
For repeated use, install globally:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install -g inikit
|
|
60
|
+
inikit
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### System Requirements
|
|
64
|
+
|
|
65
|
+
- **Node.js**: 18.0 or higher
|
|
66
|
+
- **npm**: 7.0 or higher (or **yarn**/**pnpm** equivalent)
|
|
67
|
+
- **Git**: For version control (recommended)
|
|
68
|
+
|
|
69
|
+
## 🛠️ What You Get
|
|
70
|
+
|
|
71
|
+
### Frameworks
|
|
72
|
+
|
|
73
|
+
- **Next.js** - Full-stack React framework with App Router
|
|
74
|
+
- **React** - Modern React with Vite for fast development
|
|
75
|
+
|
|
76
|
+
### Development Tools
|
|
77
|
+
|
|
78
|
+
- **TypeScript** - Type-safe JavaScript development
|
|
79
|
+
- **Tailwind CSS** - Utility-first CSS framework
|
|
80
|
+
- **Prettier** - Opinionated code formatter
|
|
81
|
+
- **ESLint** - JavaScript/TypeScript linter
|
|
82
|
+
- **Commitlint + Husky** - Enforce conventional commit messages
|
|
83
|
+
|
|
84
|
+
## 📋 Usage
|
|
85
|
+
|
|
86
|
+
When you run Inikit, you'll be prompted to:
|
|
87
|
+
|
|
88
|
+
1. **Project Name**: Enter your project name (lowercase, no spaces)
|
|
89
|
+
2. **Framework**: Choose between Next.js or React
|
|
90
|
+
3. **TypeScript**: Enable/disable TypeScript support
|
|
91
|
+
4. **Dev Tools**: Select from Tailwind CSS, Prettier, and Husky+Commitlint
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
$ npx inikit@latest
|
|
95
|
+
|
|
96
|
+
Welcome to Inikit v1.2.4
|
|
97
|
+
|
|
98
|
+
✔ Enter the project name › my-awesome-app
|
|
99
|
+
✔ Select a framework › Next.js
|
|
100
|
+
✔ Do you want to use TypeScript? › Yes
|
|
101
|
+
✔ Select dev tools › Tailwind CSS, Prettier, Husky
|
|
102
|
+
|
|
103
|
+
✅ Project initialized successfully!
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 🏗️ Local Development
|
|
107
|
+
|
|
108
|
+
Want to contribute to Inikit or test changes locally? Here's how to get started:
|
|
109
|
+
|
|
110
|
+
### Prerequisites
|
|
111
|
+
|
|
112
|
+
- Node.js 18.0 or higher
|
|
113
|
+
- npm 7.0 or higher
|
|
114
|
+
- Git
|
|
115
|
+
|
|
116
|
+
### Clone and Setup
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Clone the repository
|
|
120
|
+
git clone https://github.com/askv-in/inikit.git
|
|
121
|
+
cd Inikit
|
|
122
|
+
|
|
123
|
+
# Install dependencies
|
|
124
|
+
npm install
|
|
125
|
+
|
|
126
|
+
# Run in development mode
|
|
127
|
+
npm run dev
|
|
128
|
+
|
|
129
|
+
# Build the project
|
|
130
|
+
npm run build
|
|
131
|
+
|
|
132
|
+
# Test the CLI locally (creates a global symlink)
|
|
133
|
+
npm link
|
|
134
|
+
inikit
|
|
135
|
+
|
|
136
|
+
# Unlink when done testing
|
|
137
|
+
npm unlink -g inikit
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Available Scripts
|
|
141
|
+
|
|
142
|
+
| Script | Description |
|
|
143
|
+
| ---------------------- | ------------------------------------------- |
|
|
144
|
+
| `npm run dev` | Run the CLI in development mode with `tsx` |
|
|
145
|
+
| `npm run build` | Build the project for production |
|
|
146
|
+
| `npm run lint` | Run ESLint to check for code issues |
|
|
147
|
+
| `npm run lint:fix` | Auto-fix ESLint issues where possible |
|
|
148
|
+
| `npm run format` | Format code with Prettier |
|
|
149
|
+
| `npm run format:check` | Check if code is properly formatted |
|
|
150
|
+
| `npm run clean` | Remove the `dist` directory |
|
|
151
|
+
| `npm run deploy` | Build and publish to npm (maintainers only) |
|
|
152
|
+
|
|
153
|
+
### Project Structure
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
Inikit/
|
|
157
|
+
├── index.ts # Main CLI entry point
|
|
158
|
+
├── utils.ts # Core utility functions
|
|
159
|
+
├── package.json # Project configuration
|
|
160
|
+
├── templates/ # Template files for different tools
|
|
161
|
+
│ ├── commitlint/ # Commitlint configuration
|
|
162
|
+
│ ├── husky/ # Git hooks
|
|
163
|
+
│ ├── prettier/ # Prettier configuration
|
|
164
|
+
│ └── tailwind/ # Tailwind CSS files
|
|
165
|
+
├── dist/ # Compiled output (created after build)
|
|
166
|
+
└── README.md # This file
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 📄 Project Policies & Community Files
|
|
170
|
+
|
|
171
|
+
For details on contributing, security, and community standards, see:
|
|
172
|
+
|
|
173
|
+
- [LICENSE](./LICENSE)
|
|
174
|
+
- [Code of Conduct](./CODE_OF_CONDUCT.md)
|
|
175
|
+
- [Contributing Guidelines](./CONTRIBUTING.md)
|
|
176
|
+
- [Security Policy](./SECURITY.md)
|
|
177
|
+
|
|
178
|
+
## 🐛 Issues and Support
|
|
179
|
+
|
|
180
|
+
We're here to help! If you encounter any issues or have questions:
|
|
181
|
+
|
|
182
|
+
### 🚨 Bug Reports
|
|
183
|
+
|
|
184
|
+
- **GitHub Issues**:
|
|
185
|
+
[Report bugs here](https://github.com/askv-in/inikit/issues)
|
|
186
|
+
- Please use our bug report template for faster resolution
|
|
187
|
+
|
|
188
|
+
### 💡 Feature Requests
|
|
189
|
+
|
|
190
|
+
- **GitHub Discussions**:
|
|
191
|
+
[Suggest new features](https://github.com/askv-in/inikit/discussions)
|
|
192
|
+
- Help us understand your use case and requirements
|
|
193
|
+
|
|
194
|
+
### ❓ Questions and Support
|
|
195
|
+
|
|
196
|
+
- **GitHub Discussions**:
|
|
197
|
+
[Ask questions here](https://github.com/askv-in/inikit/discussions)
|
|
198
|
+
- **Documentation**: Check our README for common use cases
|
|
199
|
+
- **Examples**: Look at the templates directory for configuration examples
|
|
200
|
+
|
|
201
|
+
### 🔍 Before Reporting
|
|
202
|
+
|
|
203
|
+
1. **Search existing issues** to avoid duplicates
|
|
204
|
+
2. **Check the latest version** - your issue might already be fixed
|
|
205
|
+
3. **Review the documentation** - the answer might already be there
|
|
206
|
+
4. **Test with a minimal example** - helps us reproduce the issue
|
|
207
|
+
|
|
208
|
+
## 🌟 Community
|
|
209
|
+
|
|
210
|
+
Join our growing community of developers:
|
|
211
|
+
|
|
212
|
+
- ⭐ **Star the project** on GitHub to show your support
|
|
213
|
+
- 🐛 **Report issues** to help us improve
|
|
214
|
+
- 💬 **Join discussions** to share ideas and ask questions
|
|
215
|
+
- 🤝 **Contribute code** to make Inikit even better
|
|
216
|
+
- 📢 **Share with others** who might find Inikit useful
|
|
217
|
+
|
|
218
|
+
## 🔒 Security
|
|
219
|
+
|
|
220
|
+
If you discover a security vulnerability, please report it privately by emailing
|
|
221
|
+
[ajaykumarn3000@gmail.com](mailto:ajaykumarn3000@gmail.com). Please do not
|
|
222
|
+
report security vulnerabilities through public GitHub issues.
|
|
223
|
+
|
|
224
|
+
## 📊 Project Stats
|
|
225
|
+
|
|
226
|
+
- **Language**: TypeScript
|
|
227
|
+
- **Package Manager**: npm
|
|
228
|
+
- **License**: MIT
|
|
229
|
+
- **Maintained**: ✅ Actively maintained
|
|
230
|
+
- **Node.js**: 18.0+ required
|
|
231
|
+
|
|
232
|
+
## 🗺️ Roadmap
|
|
233
|
+
|
|
234
|
+
We're continuously working to improve Inikit. Here's what's on our radar:
|
|
235
|
+
|
|
236
|
+
- [ ] **Framework Support**: Vue.js, Svelte, Angular
|
|
237
|
+
- [ ] **Additional Tools**: Vitest, Jest, Cypress
|
|
238
|
+
- [ ] **Package Managers**: Yarn, pnpm support
|
|
239
|
+
- [ ] **Templates**: More starter templates
|
|
240
|
+
- [ ] **CI/CD**: GitHub Actions, GitLab CI templates
|
|
241
|
+
- [ ] **Database**: Prisma, Drizzle integration options
|
|
242
|
+
- [ ] **UI Libraries**: More component library options
|
|
243
|
+
|
|
244
|
+
Want to contribute to any of these? We'd love your help!
|
|
245
|
+
|
|
246
|
+
## 📜 License
|
|
247
|
+
|
|
248
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
249
|
+
for details.
|
|
250
|
+
|
|
251
|
+
## 🙏 Acknowledgments
|
|
252
|
+
|
|
253
|
+
Inikit stands on the shoulders of giants. We're grateful to:
|
|
254
|
+
|
|
255
|
+
- **Open Source Community**: For the amazing tools and libraries we integrate
|
|
256
|
+
- **Framework Teams**: Next.js, React, Vite, and TypeScript teams for their
|
|
257
|
+
excellent work
|
|
258
|
+
- **Tool Maintainers**: ESLint, Prettier, Husky, and Commitlint contributors
|
|
259
|
+
- **Contributors**: Everyone who has contributed code, reported issues, or
|
|
260
|
+
shared feedback
|
|
261
|
+
- **Users**: The developer community that uses and trusts Inikit
|
|
262
|
+
- **Inspiration**: Projects like create-next-app, create-react-app, and
|
|
263
|
+
create-vite
|
|
264
|
+
|
|
265
|
+
Special thanks to all the developers who believe in making development tools
|
|
266
|
+
better and more accessible.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
<div align="center">
|
|
271
|
+
|
|
272
|
+
**Made with ❤️ by [ASKV](https://github.com/askv-in/)**
|
|
273
|
+
|
|
274
|
+
_Building tools that developers love to use_
|
|
275
|
+
|
|
276
|
+
[⭐ Star on GitHub](https://github.com/askv-in/inikit) •
|
|
277
|
+
[🐛 Report Bug](https://github.com/askv-in/inikit/issues) •
|
|
278
|
+
[💡 Request Feature](https://github.com/askv-in/inikit/discussions) •
|
|
279
|
+
[🤝 Contribute](https://github.com/askv-in/inikit/blob/main/CONTRIBUTING.md)
|
|
280
|
+
|
|
281
|
+
</div>
|
package/dist/index.js
CHANGED
|
@@ -1,115 +1,104 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as p from '@clack/prompts';
|
|
3
3
|
import { chalkStderr } from 'chalk';
|
|
4
|
-
import {
|
|
4
|
+
import { addCommitlint, addGit, addPrettier, createNextApp, createReactApp, addTailwind, titleCase, runTaskAnimation, validateProjectName, } from './utils.js';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import packageJSON from './package.json' with { type: 'json' };
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
7
|
+
import { getDevtools, getFramework, getProjectName, getTypeScript, } from './tli.js';
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
const { green, yellow } = chalkStderr;
|
|
10
|
+
const handleSigTerm = () => process.exit(0);
|
|
11
|
+
process.on('SIGINT', handleSigTerm);
|
|
12
|
+
process.on('SIGTERM', handleSigTerm);
|
|
13
|
+
async function main() {
|
|
14
|
+
const program = new Command(packageJSON.name)
|
|
15
|
+
.version(packageJSON.version, '-v, --version', 'Output the current version of Inikit.')
|
|
16
|
+
.argument('[directory]')
|
|
17
|
+
.usage('[directory] [options]')
|
|
18
|
+
.helpOption('-h, --help', 'Display this help message.')
|
|
19
|
+
.option('--next, --nextjs', 'Initialize as a Next.js project.')
|
|
20
|
+
.option('--react, --reactjs', 'Initialize as a React project.')
|
|
21
|
+
.option('--ts, --typescript', 'Initialize as a TypeScript project. (default)')
|
|
22
|
+
.option('--js, --javascript', 'Initialize as a JavaScript project.')
|
|
23
|
+
.option('--tailwind, --tailwindcss', 'Initialize with Tailwind CSS config. (default)')
|
|
24
|
+
.option('--eslint', 'Initialize with ESLint config. (default)')
|
|
25
|
+
.option('--prettier', 'Initialize with Prettier config. (default)')
|
|
26
|
+
.option('--commitlint', 'Initialize with Commitlint + Husky config. (default)')
|
|
27
|
+
.option('--no-git', 'Skip git initialization.')
|
|
28
|
+
.option('--tools', 'Use recommended dev tools. (default)')
|
|
29
|
+
.option(`--no-tools`, 'Skip all dev tools setup.')
|
|
30
|
+
.allowUnknownOption()
|
|
31
|
+
.parse(process.argv);
|
|
32
|
+
const opts = program.opts(); // Get options
|
|
33
|
+
const { args } = program; // Get positional arguments (ProjectName)
|
|
34
|
+
if (opts.typescript && opts.javascript) {
|
|
35
|
+
p.log.error('Cannot use both --typescript and --javascript flags together.');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
if (opts.nextjs && opts.reactjs) {
|
|
39
|
+
p.log.error('Cannot use both --nextjs and --reactjs flags together.');
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
p.log.info(`Welcome to ${green(titleCase(packageJSON.name) + ' v' + packageJSON.version)}`);
|
|
43
|
+
const projectNameError = validateProjectName(args[0] ?? 'my-app');
|
|
44
|
+
if (typeof projectNameError === 'string') {
|
|
45
|
+
p.log.error(projectNameError);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
const projectName = args[0] ?? (await getProjectName());
|
|
49
|
+
const framework = opts.nextjs
|
|
50
|
+
? 'next'
|
|
51
|
+
: opts.reactjs
|
|
52
|
+
? 'react'
|
|
53
|
+
: await getFramework();
|
|
54
|
+
const typeScript = opts.typescript
|
|
55
|
+
? true
|
|
56
|
+
: opts.javascript
|
|
57
|
+
? false
|
|
58
|
+
: await getTypeScript();
|
|
59
|
+
let devTools = new Set();
|
|
60
|
+
if (opts.tools === true) {
|
|
61
|
+
devTools.add('tailwind');
|
|
62
|
+
devTools.add('prettier');
|
|
63
|
+
devTools.add('commitlint');
|
|
64
|
+
}
|
|
65
|
+
else if (opts.tailwindcss || opts.prettier || opts.commitlint) {
|
|
66
|
+
if (opts.tailwindcss)
|
|
67
|
+
devTools.add('tailwind');
|
|
68
|
+
if (opts.prettier)
|
|
69
|
+
devTools.add('prettier');
|
|
70
|
+
if (opts.commitlint)
|
|
71
|
+
devTools.add('commitlint');
|
|
72
|
+
}
|
|
73
|
+
else if (opts.tools === false) {
|
|
74
|
+
// No dev tools
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
devTools = await getDevtools();
|
|
78
|
+
}
|
|
77
79
|
const projectPath = path.resolve(process.cwd(), projectName);
|
|
78
80
|
if (framework === 'next') {
|
|
79
|
-
|
|
80
|
-
nextSpinner.start(`Creating a new Next.js app in ${yellow(projectPath)}`);
|
|
81
|
-
await createNextApp(projectName, typeScript, devTools.includes('tailwind'));
|
|
82
|
-
nextSpinner.stop(`Created ${projectName} at ${projectPath}`);
|
|
81
|
+
await runTaskAnimation(`Creating a new Next.js app in ${yellow(projectPath)}`, `Created ${projectName} at ${projectPath}`, () => createNextApp(projectName, typeScript, devTools.has('tailwind')));
|
|
83
82
|
}
|
|
84
83
|
else if (framework === 'react') {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
reactSpinner.stop(`Created ${projectName} at ${projectPath}`);
|
|
89
|
-
if (devTools.includes('tailwind')) {
|
|
90
|
-
const tailwindSpinner = p.spinner();
|
|
91
|
-
tailwindSpinner.start(`Adding Tailwind CSS to the project`);
|
|
92
|
-
await addTailwind(projectPath, typeScript);
|
|
93
|
-
tailwindSpinner.stop(`Added Tailwind CSS configuration`);
|
|
84
|
+
await runTaskAnimation(`Creating a new React app in ${yellow(projectPath)}`, `Created ${projectName} at ${projectPath}`, () => createReactApp(projectName, typeScript));
|
|
85
|
+
if (devTools.has('tailwind')) {
|
|
86
|
+
await runTaskAnimation(`Adding Tailwind CSS to the project`, `Added Tailwind CSS configuration`, () => addTailwind(projectPath, typeScript));
|
|
94
87
|
}
|
|
95
88
|
}
|
|
96
|
-
if (devTools.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
if (devTools.has('prettier')) {
|
|
90
|
+
await runTaskAnimation(`Adding prettier to the project`, `Added prettier configuration`, () => addPrettier(projectPath));
|
|
91
|
+
}
|
|
92
|
+
if (devTools.has('commitlint')) {
|
|
93
|
+
await runTaskAnimation(`Adding husky and commitlint to the project`, `Added husky and commitlint configuration`, () => addCommitlint(projectPath));
|
|
101
94
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const commitlintSpinner = p.spinner();
|
|
105
|
-
commitlintSpinner.start(`Adding husky and commitlint to the project`);
|
|
106
|
-
await addCommitlint(projectPath);
|
|
107
|
-
commitlintSpinner.stop(`Added husky and commitlint configuration`);
|
|
95
|
+
if (opts.git !== false) {
|
|
96
|
+
await runTaskAnimation(`Initializing git repository`, `Initialized git repository`, () => addGit(projectPath));
|
|
108
97
|
}
|
|
109
|
-
p.outro(green(
|
|
98
|
+
p.outro(green(`Project initialized successfully! Happy coding!`));
|
|
110
99
|
process.exit(0);
|
|
111
|
-
}
|
|
112
|
-
|
|
100
|
+
}
|
|
101
|
+
main().catch(err => {
|
|
113
102
|
console.error(err);
|
|
114
103
|
p.outro('An error occurred: ' + err.message);
|
|
115
104
|
process.exit(1);
|
package/dist/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inikit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Best way to get started with Next.js and React project.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
7
|
"build": "npx eslint . && npm run clean && tsc && cp -r templates dist/templates",
|
|
9
8
|
"clean": "rm -rf dist",
|
|
10
9
|
"lint": "eslint . ",
|
|
@@ -23,7 +22,7 @@
|
|
|
23
22
|
],
|
|
24
23
|
"repository": {
|
|
25
24
|
"type": "git",
|
|
26
|
-
"url": "https://github.com/
|
|
25
|
+
"url": "https://github.com/askv-in/inikit.git"
|
|
27
26
|
},
|
|
28
27
|
"keywords": [
|
|
29
28
|
"inikit",
|
|
@@ -39,7 +38,7 @@
|
|
|
39
38
|
],
|
|
40
39
|
"author": {
|
|
41
40
|
"username": "ajaykumarn3000",
|
|
42
|
-
"url": "https://ajaykumarn3000.
|
|
41
|
+
"url": "https://ajaykumarn3000.in",
|
|
43
42
|
"name": "Ajaykumar Nadar",
|
|
44
43
|
"email": "ajaykumarn3000@gmail.com"
|
|
45
44
|
},
|
|
@@ -62,6 +61,7 @@
|
|
|
62
61
|
"dependencies": {
|
|
63
62
|
"@clack/prompts": "^0.11.0",
|
|
64
63
|
"chalk": "^5.4.1",
|
|
64
|
+
"commander": "^14.0.0",
|
|
65
65
|
"execa": "^9.5.3",
|
|
66
66
|
"tsx": "^4.19.4"
|
|
67
67
|
}
|
package/dist/tli.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
2
|
+
import { chalkStderr } from 'chalk';
|
|
3
|
+
import { validateProjectName } from './utils.js';
|
|
4
|
+
const { cyan } = chalkStderr;
|
|
5
|
+
export async function getProjectName() {
|
|
6
|
+
const projectName = await p.text({
|
|
7
|
+
message: `Enter the ${cyan('project name')}`,
|
|
8
|
+
placeholder: 'my-app',
|
|
9
|
+
defaultValue: 'my-app',
|
|
10
|
+
validate: validateProjectName,
|
|
11
|
+
});
|
|
12
|
+
if (p.isCancel(projectName)) {
|
|
13
|
+
p.cancel('Operation cancelled.');
|
|
14
|
+
return process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
return projectName;
|
|
17
|
+
}
|
|
18
|
+
export async function getFramework() {
|
|
19
|
+
const framework = await p.select({
|
|
20
|
+
message: `Select a ${cyan('framework')}`,
|
|
21
|
+
options: [
|
|
22
|
+
{ value: 'next', label: 'Next.js', hint: 'using create-next-app' },
|
|
23
|
+
{ value: 'react', label: 'React', hint: 'using vite' },
|
|
24
|
+
],
|
|
25
|
+
});
|
|
26
|
+
if (p.isCancel(framework)) {
|
|
27
|
+
p.cancel('Operation cancelled.');
|
|
28
|
+
return process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
return framework;
|
|
31
|
+
}
|
|
32
|
+
export async function getTypeScript() {
|
|
33
|
+
const typeScript = await p.confirm({
|
|
34
|
+
message: `Do you want to use ${cyan('TypeScript?')}`,
|
|
35
|
+
initialValue: true, // Yes
|
|
36
|
+
});
|
|
37
|
+
if (p.isCancel(typeScript)) {
|
|
38
|
+
p.cancel('Operation cancelled.');
|
|
39
|
+
return process.exit(0);
|
|
40
|
+
}
|
|
41
|
+
return typeScript;
|
|
42
|
+
}
|
|
43
|
+
export async function getDevtools() {
|
|
44
|
+
const devTools = await p.multiselect({
|
|
45
|
+
message: `Select ${cyan('dev tools')}`,
|
|
46
|
+
options: [
|
|
47
|
+
{ value: 'tailwind', label: 'Tailwind CSS' },
|
|
48
|
+
{ value: 'prettier', label: 'Prettier' },
|
|
49
|
+
{ value: 'commitlint', label: 'Husky', hint: 'commitlint + husky' },
|
|
50
|
+
],
|
|
51
|
+
initialValues: ['tailwind', 'prettier', 'commitlint'],
|
|
52
|
+
required: false,
|
|
53
|
+
});
|
|
54
|
+
if (p.isCancel(devTools)) {
|
|
55
|
+
p.cancel('Operation cancelled.');
|
|
56
|
+
return process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
return new Set(devTools);
|
|
59
|
+
}
|
package/dist/utils.js
CHANGED
|
@@ -1,39 +1,56 @@
|
|
|
1
|
+
import * as p from '@clack/prompts';
|
|
1
2
|
import { $ } from 'execa';
|
|
2
3
|
import { copyFileSync, existsSync, cpSync } from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
import { fileURLToPath } from 'url';
|
|
5
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
7
|
const templateDir = path.join(__dirname, 'templates');
|
|
8
|
+
export const validateProjectName = (input) => {
|
|
9
|
+
if (input && input !== '.' && input !== './') {
|
|
10
|
+
if (input.includes(' '))
|
|
11
|
+
return 'Project name cannot contain spaces';
|
|
12
|
+
if (input.toLowerCase() !== input)
|
|
13
|
+
return 'Project name must be lowercase';
|
|
14
|
+
if (input.startsWith('./'))
|
|
15
|
+
return 'Project name cannot start with "./"';
|
|
16
|
+
if (/[^a-zA-Z0-9-_]/.test(input))
|
|
17
|
+
return 'Project name can only contain letters, numbers, dashes, and underscores';
|
|
18
|
+
}
|
|
19
|
+
};
|
|
7
20
|
export const titleCase = (str) => {
|
|
8
21
|
return str
|
|
9
22
|
.split(' ')
|
|
10
23
|
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
11
24
|
.join(' ');
|
|
12
25
|
};
|
|
26
|
+
export const runTaskAnimation = async (startMessage, stopMessage, callback) => {
|
|
27
|
+
const nextSpinner = p.spinner();
|
|
28
|
+
nextSpinner.start(startMessage);
|
|
29
|
+
await callback();
|
|
30
|
+
nextSpinner.stop(stopMessage);
|
|
31
|
+
};
|
|
13
32
|
export const createNextApp = async (appName, typeScript, tailwind = true) => {
|
|
14
33
|
await $({
|
|
15
34
|
cwd: process.cwd(),
|
|
16
|
-
}) `
|
|
17
|
-
npm install -g create-next-app@latest
|
|
35
|
+
}) `
|
|
36
|
+
npm install -g create-next-app@latest
|
|
18
37
|
`;
|
|
19
|
-
|
|
38
|
+
await $({
|
|
20
39
|
cwd: process.cwd(),
|
|
21
40
|
}) `npx create-next-app ${appName} ${typeScript ? '--ts' : '--js'} ${tailwind ? '--tailwind' : '--no-tailwind'} --eslint --app --turbopack --use-npm --yes --disable-git`;
|
|
22
|
-
return stdout;
|
|
23
41
|
};
|
|
24
42
|
export const createReactApp = async (appName, typeScript) => {
|
|
25
43
|
await $({
|
|
26
44
|
cwd: process.cwd(),
|
|
27
|
-
}) `
|
|
28
|
-
npm install -g create-vite@latest
|
|
45
|
+
}) `
|
|
46
|
+
npm install -g create-vite@latest
|
|
29
47
|
`;
|
|
30
|
-
|
|
48
|
+
await $({
|
|
31
49
|
cwd: process.cwd(),
|
|
32
|
-
}) `
|
|
50
|
+
}) `npx create-vite ${appName} --- --template ${typeScript ? 'react-ts' : 'react'}`;
|
|
33
51
|
await $({
|
|
34
52
|
cwd: path.resolve(process.cwd(), appName),
|
|
35
53
|
}) `npm install`;
|
|
36
|
-
return stdout;
|
|
37
54
|
};
|
|
38
55
|
export const addTailwind = async (appPath, typeScript) => {
|
|
39
56
|
await $({
|
|
@@ -53,7 +70,8 @@ export const addPrettier = async (appPath) => {
|
|
|
53
70
|
};
|
|
54
71
|
export const addGit = async (appPath) => {
|
|
55
72
|
if (existsSync(path.resolve(appPath, '.git'))) {
|
|
56
|
-
return 'Git already initialized';
|
|
73
|
+
// return 'Git already initialized';
|
|
74
|
+
return;
|
|
57
75
|
}
|
|
58
76
|
await $({
|
|
59
77
|
cwd: appPath,
|
package/package.json
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "inikit",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Best way to get started with Next.js and React project.",
|
|
5
|
-
"main": "./dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"lint": "eslint . ",
|
|
11
|
-
"
|
|
12
|
-
"format
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
"@commitlint/
|
|
50
|
-
"@
|
|
51
|
-
"@eslint/
|
|
52
|
-
"@eslint/
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"typescript": "^
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"execa": "^9.5.3",
|
|
66
|
-
"tsx": "^4.19.4"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "inikit",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Best way to get started with Next.js and React project.",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npx eslint . && npm run clean && tsc && cp -r templates dist/templates",
|
|
8
|
+
"clean": "rm -rf dist",
|
|
9
|
+
"lint": "eslint . ",
|
|
10
|
+
"lint:fix": "eslint . --fix",
|
|
11
|
+
"format:check": "prettier --check .",
|
|
12
|
+
"format": "prettier --write .",
|
|
13
|
+
"dev": "tsx index.ts",
|
|
14
|
+
"deploy": "npm run build && npm publish --access public",
|
|
15
|
+
"prepare": "husky"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"inikit": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/askv-in/inikit.git"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"inikit",
|
|
29
|
+
"cli",
|
|
30
|
+
"nextjs",
|
|
31
|
+
"typescript",
|
|
32
|
+
"eslint",
|
|
33
|
+
"prettier",
|
|
34
|
+
"commitlint",
|
|
35
|
+
"scaffold",
|
|
36
|
+
"development",
|
|
37
|
+
"tools"
|
|
38
|
+
],
|
|
39
|
+
"author": {
|
|
40
|
+
"username": "ajaykumarn3000",
|
|
41
|
+
"url": "https://ajaykumarn3000.in",
|
|
42
|
+
"name": "Ajaykumar Nadar",
|
|
43
|
+
"email": "ajaykumarn3000@gmail.com"
|
|
44
|
+
},
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"type": "module",
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@commitlint/cli": "^19.8.1",
|
|
49
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
50
|
+
"@eslint/js": "^9.27.0",
|
|
51
|
+
"@eslint/json": "^0.12.0",
|
|
52
|
+
"@eslint/markdown": "^6.4.0",
|
|
53
|
+
"@types/node": "^22.15.21",
|
|
54
|
+
"eslint": "^9.27.0",
|
|
55
|
+
"globals": "^16.2.0",
|
|
56
|
+
"husky": "^9.1.7",
|
|
57
|
+
"prettier": "^3.5.3",
|
|
58
|
+
"typescript": "^5.8.3",
|
|
59
|
+
"typescript-eslint": "^8.32.1"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@clack/prompts": "^0.11.0",
|
|
63
|
+
"chalk": "^5.4.1",
|
|
64
|
+
"commander": "^14.0.0",
|
|
65
|
+
"execa": "^9.5.3",
|
|
66
|
+
"tsx": "^4.19.4"
|
|
67
|
+
}
|
|
68
|
+
}
|