inikit 1.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ajaykumar Nadar
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,23 @@
1
+ # Inikit
2
+
3
+ Inikit is a Node.js project designed to streamline your development workflow.
4
+
5
+ ## Features
6
+
7
+ - Modular and scalable architecture
8
+ - Easy setup and configuration
9
+ - Built with modern JavaScript
10
+
11
+ ## Getting Started
12
+
13
+ ```sh
14
+ npx inikit@latest
15
+ ```
16
+
17
+ ## Contributing
18
+
19
+ Contributions are welcome! Please open issues or submit pull requests.
20
+
21
+ ## License
22
+
23
+ This project is licensed under the MIT License.
package/dist/index.js ADDED
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+ import * as p from '@clack/prompts';
3
+ import { chalkStderr } from 'chalk';
4
+ import { titleCase, addCommitlint, addGit, addPrettier, createNextApp, } from './utils.js';
5
+ import path from 'node:path';
6
+ import packageJSON from './package.json' with { type: 'json' };
7
+ const { cyan, green, yellow } = chalkStderr;
8
+ const response = async () => await p.group({
9
+ projectName: () => {
10
+ p.log.info(`Welcome to ${green(titleCase(packageJSON.name) + ' v' + packageJSON.version)}\n- ${packageJSON.author.name} (${packageJSON.author.username})`);
11
+ return p.text({
12
+ message: `Enter the ${cyan('project name')}`,
13
+ placeholder: 'my-app',
14
+ defaultValue: 'my-app',
15
+ validate(input) {
16
+ if (input) {
17
+ if (input.includes(' '))
18
+ return 'Project name cannot contain spaces';
19
+ if (input.toLowerCase() !== input)
20
+ return 'Project name must be lowercase';
21
+ if (input.startsWith('./'))
22
+ return 'Project name cannot start with "./"';
23
+ if (/[^a-zA-Z0-9-_]/.test(input))
24
+ return 'Project name can only contain letters, numbers, dashes, and underscores';
25
+ }
26
+ },
27
+ });
28
+ },
29
+ framework: () => p.select({
30
+ message: `Select a ${cyan('framework')}`,
31
+ options: [
32
+ { value: 'next', label: 'Next.js', hint: 'recommended' },
33
+ // { value: 'react', label: 'React' },
34
+ ],
35
+ }),
36
+ typeScript: () => p.confirm({
37
+ message: `Do you want to use ${cyan('TypeScript?')}`,
38
+ initialValue: true, // Yes
39
+ }),
40
+ devTools: () => {
41
+ p.note('Press space to select/deselect, enter to confirm\nYou can select multiple options');
42
+ return p.multiselect({
43
+ message: `Select ${cyan('dev tools')}`,
44
+ options: [
45
+ { value: 'eslint', label: 'ESLint' },
46
+ { value: 'prettier', label: 'Prettier' },
47
+ {
48
+ value: 'commitlint',
49
+ label: 'Husky',
50
+ hint: 'commitlint + husky + lint-staged',
51
+ },
52
+ ],
53
+ initialValues: ['eslint', 'prettier', 'commitlint'],
54
+ });
55
+ },
56
+ // libraries: () =>
57
+ // p.multiselect({
58
+ // message: `Select ${cyan('libraries')}`,
59
+ // options: [
60
+ // { value: 'shadcn', label: 'Shadcn/ui' },
61
+ // { value: 'prisma', label: 'Prisma' },
62
+ // { value: 'authjs', label: 'Auth.js' },
63
+ // ],
64
+ // }),
65
+ }, {
66
+ // On Cancel callback that wraps the group
67
+ // So if the user cancels one of the prompts in the group this function will be called
68
+ onCancel: () => {
69
+ p.cancel('Operation cancelled.');
70
+ process.exit(0);
71
+ },
72
+ });
73
+ response()
74
+ .then(async (res) => {
75
+ const { projectName, typeScript, devTools } = res;
76
+ const projectPath = path.resolve(process.cwd(), projectName);
77
+ const nextSpinner = p.spinner();
78
+ nextSpinner.start(`Creating a new Next.js app in ${yellow(projectPath)}`);
79
+ await createNextApp(projectName, typeScript, devTools.includes('eslint'));
80
+ nextSpinner.stop(`Created ${projectName} at ${projectPath}`);
81
+ if (devTools.includes('prettier')) {
82
+ const prettierSpinner = p.spinner();
83
+ prettierSpinner.start(`Adding prettier to the project`);
84
+ await addPrettier(projectPath);
85
+ prettierSpinner.stop(`Added prettier configuration`);
86
+ }
87
+ await addGit(projectPath);
88
+ if (devTools.includes('commitlint')) {
89
+ const commitlintSpinner = p.spinner();
90
+ commitlintSpinner.start(`Adding husky and commitlint to the project`);
91
+ await addCommitlint(projectPath);
92
+ commitlintSpinner.stop(`Added husky and commitlint configuration`);
93
+ }
94
+ p.outro(green('Project initialized successfully!'));
95
+ process.exit(0);
96
+ })
97
+ .catch(err => {
98
+ console.error(err);
99
+ p.outro('An error occurred: ' + err.message);
100
+ process.exit(1);
101
+ });
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "inikit",
3
+ "version": "1.1.0",
4
+ "description": "Inikit is a CLI tool that scaffolds modern Next.js projects with integrated support for TypeScript, ESLint, Prettier, and commitlint to enforce a robust development workflow.",
5
+ "main": "./dist/index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "npx eslint . && npm run clean && tsc && cp -r templates dist/templates",
9
+ "clean": "rm -rf dist",
10
+ "dev": "tsx index.ts",
11
+ "prepare": "husky",
12
+ "deploy": "npm run build && npm publish --access public"
13
+ },
14
+ "bin": {
15
+ "inikit": "./dist/index.js"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "keywords": [
21
+ "inikit",
22
+ "cli",
23
+ "nextjs",
24
+ "typescript",
25
+ "eslint",
26
+ "prettier",
27
+ "commitlint",
28
+ "scaffold",
29
+ "development",
30
+ "tools"
31
+ ],
32
+ "author": {
33
+ "username": "ajaykumarn3000",
34
+ "url": "https://ajaykumarn3000.github.io",
35
+ "name": "Ajaykumar Nadar",
36
+ "email": "ajaykumarn3000@gmail.com"
37
+ },
38
+ "license": "MIT",
39
+ "type": "module",
40
+ "devDependencies": {
41
+ "@commitlint/cli": "^19.8.1",
42
+ "@commitlint/config-conventional": "^19.8.1",
43
+ "@eslint/js": "^9.27.0",
44
+ "@eslint/json": "^0.12.0",
45
+ "@eslint/markdown": "^6.4.0",
46
+ "@types/node": "^22.15.21",
47
+ "eslint": "^9.27.0",
48
+ "globals": "^16.2.0",
49
+ "husky": "^9.1.7",
50
+ "prettier": "^3.5.3",
51
+ "typescript": "^5.8.3",
52
+ "typescript-eslint": "^8.32.1"
53
+ },
54
+ "dependencies": {
55
+ "@clack/prompts": "^0.11.0",
56
+ "chalk": "^5.4.1",
57
+ "execa": "^9.5.3",
58
+ "tsx": "^4.19.4"
59
+ }
60
+ }
@@ -0,0 +1,26 @@
1
+ const config = {
2
+ extends: ['@commitlint/config-conventional'],
3
+ rules: {
4
+ 'header-max-length': [2, 'always', 100], // Enforce a 100-character limit for commit messages
5
+ 'type-enum': [
6
+ 2,
7
+ 'always',
8
+ [
9
+ 'feat',
10
+ 'fix',
11
+ 'docs',
12
+ 'style',
13
+ 'refactor',
14
+ 'perf',
15
+ 'test',
16
+ 'build',
17
+ 'ci',
18
+ 'chore',
19
+ 'revert',
20
+ ],
21
+ ],
22
+ },
23
+ };
24
+
25
+ // eslint-disable-next-line no-undef
26
+ module.exports = config;
@@ -0,0 +1 @@
1
+ npx commitlint --edit $1
@@ -0,0 +1,2 @@
1
+ npm run lint
2
+ npx prettier . --write
@@ -0,0 +1,5 @@
1
+ node_modules
2
+ public
3
+ build
4
+ .prettierignore
5
+ .prettierrc
@@ -0,0 +1,16 @@
1
+ {
2
+ "arrowParens": "avoid",
3
+ "bracketSpacing": true,
4
+ "endOfLine": "lf",
5
+ "bracketSameLine": true,
6
+ "cursorOffset": -1,
7
+ "printWidth": 80,
8
+ "plugins": ["prettier-plugin-tailwindcss"],
9
+ "proseWrap": "always",
10
+ "jsxSingleQuote": true,
11
+ "trailingComma": "es5",
12
+ "tabWidth": 2,
13
+ "semi": true,
14
+ "singleQuote": true,
15
+ "useTabs": true
16
+ }
package/dist/utils.js ADDED
@@ -0,0 +1,51 @@
1
+ import { $ } from 'execa';
2
+ import { copyFileSync, existsSync, cpSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'url';
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ const templateDir = path.join(__dirname, 'templates');
7
+ export const titleCase = (str) => {
8
+ return str
9
+ .split(' ')
10
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
11
+ .join(' ');
12
+ };
13
+ export const createNextApp = async (appName, typeScript, eslint) => {
14
+ const { stdout } = await $({
15
+ cwd: process.cwd(),
16
+ }) `npx create-next-app@latest ${appName} ${typeScript ? '--ts' : '--js'} ${eslint ? '--eslint' : '--no-eslint'} --app --turbopack --use-npm --yes --disable-git`;
17
+ return stdout;
18
+ };
19
+ export const addPrettier = async (appPath) => {
20
+ await $({
21
+ cwd: appPath,
22
+ }) `npm install -D prettier prettier-plugin-tailwindcss`;
23
+ cpSync(path.join(templateDir, 'prettier'), path.resolve(appPath), {
24
+ force: true,
25
+ recursive: true,
26
+ });
27
+ };
28
+ export const addGit = async (appPath) => {
29
+ if (existsSync(path.resolve(appPath, '.git'))) {
30
+ return 'Git already initialized';
31
+ }
32
+ await $({
33
+ cwd: appPath,
34
+ }) `git init`;
35
+ };
36
+ export const addCommitlint = async (appPath) => {
37
+ await $({
38
+ cwd: appPath,
39
+ }) `npm install -D husky @commitlint/config-conventional @commitlint/cli`;
40
+ await $({
41
+ cwd: appPath,
42
+ }) `npx husky init`;
43
+ cpSync(path.join(templateDir, 'husky'), path.resolve(appPath, '.husky'), {
44
+ force: true,
45
+ recursive: true,
46
+ });
47
+ copyFileSync(path.join(templateDir, 'commitlint', 'commitlint.config.js'), path.resolve(appPath, 'commitlint.config.js'));
48
+ await $({
49
+ cwd: appPath,
50
+ }) `npm run prepare`;
51
+ };
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "inikit",
3
+ "version": "1.1.0",
4
+ "description": "Inikit is a CLI tool that scaffolds modern Next.js projects with integrated support for TypeScript, ESLint, Prettier, and commitlint to enforce a robust development workflow.",
5
+ "main": "./dist/index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "npx eslint . && npm run clean && tsc && cp -r templates dist/templates",
9
+ "clean": "rm -rf dist",
10
+ "dev": "tsx index.ts",
11
+ "prepare": "husky",
12
+ "deploy": "npm run build && npm publish --access public"
13
+ },
14
+ "bin": {
15
+ "inikit": "./dist/index.js"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "keywords": [
21
+ "inikit",
22
+ "cli",
23
+ "nextjs",
24
+ "typescript",
25
+ "eslint",
26
+ "prettier",
27
+ "commitlint",
28
+ "scaffold",
29
+ "development",
30
+ "tools"
31
+ ],
32
+ "author": {
33
+ "username": "ajaykumarn3000",
34
+ "url": "https://ajaykumarn3000.github.io",
35
+ "name": "Ajaykumar Nadar",
36
+ "email": "ajaykumarn3000@gmail.com"
37
+ },
38
+ "license": "MIT",
39
+ "type": "module",
40
+ "devDependencies": {
41
+ "@commitlint/cli": "^19.8.1",
42
+ "@commitlint/config-conventional": "^19.8.1",
43
+ "@eslint/js": "^9.27.0",
44
+ "@eslint/json": "^0.12.0",
45
+ "@eslint/markdown": "^6.4.0",
46
+ "@types/node": "^22.15.21",
47
+ "eslint": "^9.27.0",
48
+ "globals": "^16.2.0",
49
+ "husky": "^9.1.7",
50
+ "prettier": "^3.5.3",
51
+ "typescript": "^5.8.3",
52
+ "typescript-eslint": "^8.32.1"
53
+ },
54
+ "dependencies": {
55
+ "@clack/prompts": "^0.11.0",
56
+ "chalk": "^5.4.1",
57
+ "execa": "^9.5.3",
58
+ "tsx": "^4.19.4"
59
+ }
60
+ }