ikramhussainsiyam-create-my-project 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/cli.js +59 -0
  4. package/package.json +31 -0
  5. package/templates/ViteJS/JavaScript/README.md +8 -0
  6. package/templates/ViteJS/JavaScript/eslint.config.js +44 -0
  7. package/templates/ViteJS/JavaScript/index.html +13 -0
  8. package/templates/ViteJS/JavaScript/package-lock.json +5648 -0
  9. package/templates/ViteJS/JavaScript/package.json +33 -0
  10. package/templates/ViteJS/JavaScript/postcss.config.js +6 -0
  11. package/templates/ViteJS/JavaScript/public/vite.svg +1 -0
  12. package/templates/ViteJS/JavaScript/src/App.jsx +3 -0
  13. package/templates/ViteJS/JavaScript/src/components/Button.jsx +5 -0
  14. package/templates/ViteJS/JavaScript/src/index.css +25 -0
  15. package/templates/ViteJS/JavaScript/src/main.jsx +10 -0
  16. package/templates/ViteJS/JavaScript/tailwind.config.js +13 -0
  17. package/templates/ViteJS/JavaScript/vite.config.js +7 -0
  18. package/templates/ViteJS/TypeScript/README.md +50 -0
  19. package/templates/ViteJS/TypeScript/eslint.config.js +35 -0
  20. package/templates/ViteJS/TypeScript/index.html +13 -0
  21. package/templates/ViteJS/TypeScript/package-lock.json +4254 -0
  22. package/templates/ViteJS/TypeScript/package.json +33 -0
  23. package/templates/ViteJS/TypeScript/postcss.config.js +6 -0
  24. package/templates/ViteJS/TypeScript/public/vite.svg +1 -0
  25. package/templates/ViteJS/TypeScript/src/App.tsx +5 -0
  26. package/templates/ViteJS/TypeScript/src/components/Button.tsx +3 -0
  27. package/templates/ViteJS/TypeScript/src/index.css +25 -0
  28. package/templates/ViteJS/TypeScript/src/main.tsx +10 -0
  29. package/templates/ViteJS/TypeScript/src/vite-env.d.ts +1 -0
  30. package/templates/ViteJS/TypeScript/tailwind.config.js +13 -0
  31. package/templates/ViteJS/TypeScript/tsconfig.app.json +25 -0
  32. package/templates/ViteJS/TypeScript/tsconfig.json +7 -0
  33. package/templates/ViteJS/TypeScript/tsconfig.node.json +23 -0
  34. package/templates/ViteJS/TypeScript/vite.config.ts +7 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ikram Hussain Siyam
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,63 @@
1
+ # My Project Template
2
+
3
+ This repository provides a CLI tool for quickly setting up new projects using predefined templates for Vite and Next.js with support for TypeScript, JavaScript, Tailwindcss Eslint and more.
4
+
5
+ ## Features
6
+
7
+ - Easily create new projects with a simple command.
8
+ - Choose between Vite and Next.js frameworks.
9
+ - Select either JavaScript or TypeScript as your programming language.
10
+ - Automatically initializes a Git repository for version control.
11
+
12
+ ## Getting Started
13
+
14
+ Follow these steps to create a new project using this template.
15
+
16
+ ### Prerequisites
17
+
18
+ - [Node.js](https://nodejs.org/) (>=12.x) and npm must be installed on your machine.
19
+ - Git must be installed and accessible from your command line.
20
+
21
+ ### Installation
22
+
23
+ To use the CLI tool, simply run the following command in your terminal:
24
+
25
+ ```bash
26
+ npx create-my-project
27
+ ```
28
+
29
+ ### CLI
30
+
31
+ ```bash
32
+ ? Enter project name: # your project name...
33
+
34
+ ? Choose your framework: # (Use arrow keys to select)
35
+ ❯ Vite
36
+ Next
37
+
38
+ ? Choose your language: # (Use arrow keys to select)
39
+ ❯ JavaScript
40
+ TypeScript
41
+ ```
42
+
43
+ ### Usage
44
+
45
+ After running the command, you will be prompted with the following questions:
46
+
47
+ 1. **Enter project name**: Provide a name for your new project.
48
+ 1. **Choose your framework**: Select either Vite or Next.
49
+ 1. **Choose your language**: Select JavaScript or TypeScript.
50
+
51
+ The tool will then create a new project in a folder named after your specified project name. It will copy the relevant template files and initialize a Git repository.
52
+
53
+ ### Git Initialization
54
+
55
+ A Git repository will be initialized automatically when you create a new project. You can start committing your changes as you develop your application.
56
+
57
+ ## License
58
+
59
+ This project is licensed under the MIT License. See the LICENSE file for details.
60
+
61
+ ## Contact
62
+
63
+ If you have any questions or feedback, please reach out to `ikramhussaindev404@gmail.com` on Mail.
package/cli.js ADDED
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execSync } from "child_process";
4
+ import fs from "fs-extra";
5
+ import inquirer from "inquirer";
6
+ import path from "path";
7
+ import { fileURLToPath } from "url";
8
+
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = path.dirname(__filename);
11
+
12
+ async function main() {
13
+ const { framework, language, projectName } = await inquirer.prompt([
14
+ { type: "input", name: "projectName", message: "Enter project name:" },
15
+ {
16
+ type: "list",
17
+ name: "framework",
18
+ message: "Choose your framework:",
19
+ choices: ["Vite", "Next"],
20
+ },
21
+ {
22
+ type: "list",
23
+ name: "language",
24
+ message: "Choose your language:",
25
+ choices: ["JavaScript", "TypeScript"],
26
+ },
27
+ ]);
28
+
29
+ const templatePath = path.join(
30
+ __dirname,
31
+ "templates",
32
+ `${framework}JS`,
33
+ language
34
+ );
35
+ const targetPath = path.join(process.cwd(), projectName);
36
+
37
+ try {
38
+ // Copy template files to the new project directory
39
+ await fs.copy(templatePath, targetPath);
40
+
41
+ // Update package.json with the project name
42
+ const packageJsonPath = path.join(targetPath, "package.json");
43
+ const packageJson = await fs.readJson(packageJsonPath);
44
+ packageJson.name = projectName;
45
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
46
+
47
+ // Initialize Git
48
+ execSync("git init", { cwd: targetPath, stdio: "inherit" });
49
+
50
+ // Install dependencies
51
+ execSync("npm install", { cwd: targetPath, stdio: "inherit" });
52
+
53
+ console.log("Project created successfully.");
54
+ } catch (error) {
55
+ console.error("Error creating project:", error);
56
+ }
57
+ }
58
+
59
+ main();
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "type": "module",
3
+ "name": "ikramhussainsiyam-create-my-project",
4
+ "version": "1.0.0",
5
+ "description": "Most used React/Next JS/TS settings and configs as a template.",
6
+ "main": "cli.js",
7
+ "bin": {
8
+ "create-my-project": "cli.js"
9
+ },
10
+ "files": [
11
+ "cli.js",
12
+ "templates"
13
+ ],
14
+ "dependencies": {
15
+ "fs-extra": "^11.2.0",
16
+ "inquirer": "^12.0.1"
17
+ },
18
+ "scripts": {
19
+ "test": "echo \"Error: no test specified\" && exit 1"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/IkramHussainSiyam/create-my-project.git"
24
+ },
25
+ "author": "IkramHussainSiyam",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/IkramHussainSiyam/create-my-project/issues"
29
+ },
30
+ "homepage": "https://github.com/IkramHussainSiyam/create-my-project#readme"
31
+ }
@@ -0,0 +1,8 @@
1
+ # React + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
@@ -0,0 +1,44 @@
1
+ import js from "@eslint/js";
2
+ import react from "eslint-plugin-react";
3
+ import reactHooks from "eslint-plugin-react-hooks";
4
+ import reactRefresh from "eslint-plugin-react-refresh";
5
+ import globals from "globals";
6
+
7
+ export default [
8
+ { ignores: ["dist"] },
9
+ {
10
+ files: ["**/*.{js,jsx}"],
11
+ languageOptions: {
12
+ ecmaVersion: 2020,
13
+ globals: globals.browser,
14
+ parserOptions: {
15
+ ecmaVersion: "latest",
16
+ ecmaFeatures: { jsx: true },
17
+ sourceType: "module",
18
+ },
19
+ },
20
+ settings: { react: { version: "18.3" } },
21
+ plugins: {
22
+ react,
23
+ "react-hooks": reactHooks,
24
+ "react-refresh": reactRefresh,
25
+ },
26
+ rules: {
27
+ ...js.configs.recommended.rules,
28
+ ...react.configs.recommended.rules,
29
+ ...react.configs["jsx-runtime"].rules,
30
+ ...reactHooks.configs.recommended.rules,
31
+ "react/jsx-no-target-blank": "off",
32
+ "no-unused-vars": [
33
+ "error",
34
+ { vars: "all", args: "after-used", ignoreRestSiblings: true },
35
+ ],
36
+ "react/prop-types": "off",
37
+ "react/no-unescaped-entities": "off",
38
+ "react-refresh/only-export-components": [
39
+ "warn",
40
+ { allowConstantExport: true },
41
+ ],
42
+ },
43
+ },
44
+ ];
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Your Project Title | Vite + React</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.jsx"></script>
12
+ </body>
13
+ </html>