ikramhussainsiyam-create-my-project 1.0.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
package/cli.js CHANGED
@@ -1,4 +1,6 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
+
3
+ // TODO (for later): update in `package.json` deps from `react-toastify` to `sonner`.
2
4
 
3
5
  import { execSync } from "child_process";
4
6
  import fs from "fs-extra";
@@ -10,7 +12,11 @@ const __filename = fileURLToPath(import.meta.url);
10
12
  const __dirname = path.dirname(__filename);
11
13
 
12
14
  async function main() {
13
- const { framework, language, projectName } = await inquirer.prompt([
15
+ const {
16
+ framework,
17
+ language,
18
+ projectName: rawProjectName,
19
+ } = await inquirer.prompt([
14
20
  { type: "input", name: "projectName", message: "Enter project name:" },
15
21
  {
16
22
  type: "list",
@@ -26,18 +32,31 @@ async function main() {
26
32
  },
27
33
  ]);
28
34
 
35
+ // Determine the actual project name
36
+ const projectName =
37
+ rawProjectName === "." ? path.basename(process.cwd()) : rawProjectName;
38
+
29
39
  const templatePath = path.join(
30
40
  __dirname,
31
41
  "templates",
32
42
  `${framework}JS`,
33
43
  language
34
44
  );
35
- const targetPath = path.join(process.cwd(), projectName);
45
+ const targetPath = path.join(
46
+ process.cwd(),
47
+ rawProjectName === "." ? "" : projectName
48
+ );
36
49
 
37
50
  try {
38
51
  // Copy template files to the new project directory
39
52
  await fs.copy(templatePath, targetPath);
40
53
 
54
+ // Rename gitignore-template to .gitignore in the target directory
55
+ await fs.rename(
56
+ path.join(targetPath, "gitignore-template"),
57
+ path.join(targetPath, ".gitignore")
58
+ );
59
+
41
60
  // Update package.json with the project name
42
61
  const packageJsonPath = path.join(targetPath, "package.json");
43
62
  const packageJson = await fs.readJson(packageJsonPath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "ikramhussainsiyam-create-my-project",
4
- "version": "1.0.0",
4
+ "version": "1.2.1",
5
5
  "description": "Most used React/Next JS/TS settings and configs as a template.",
6
6
  "main": "cli.js",
7
7
  "bin": {
@@ -0,0 +1,24 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
@@ -10,9 +10,15 @@
10
10
  "preview": "vite preview"
11
11
  },
12
12
  "dependencies": {
13
+ "@tailwindcss/aspect-ratio": "^0.4.2",
14
+ "@tailwindcss/forms": "^0.5.9",
15
+ "clsx": "^2.1.1",
16
+ "tailwind-merge": "^2.5.4",
17
+ "react-hook-form": "^7.53.2",
13
18
  "react": "^18.3.1",
14
19
  "react-dom": "^18.3.1",
15
- "use-immer": "^0.10.0"
20
+ "use-immer": "^0.10.0",
21
+ "react-toastify": "^10.0.6"
16
22
  },
17
23
  "devDependencies": {
18
24
  "@eslint/js": "^9.11.1",
@@ -24,7 +30,6 @@
24
30
  "eslint-plugin-react": "^7.37.0",
25
31
  "eslint-plugin-react-hooks": "^5.1.0-rc.0",
26
32
  "eslint-plugin-react-refresh": "^0.4.12",
27
-
28
33
  "globals": "^15.9.0",
29
34
  "postcss": "^8.4.47",
30
35
  "tailwindcss": "^3.4.14",
@@ -1,10 +1,11 @@
1
+ @import url("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Raleway:ital,wght@0,100..900;1,100..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");
1
2
  @tailwind base;
2
3
  @tailwind components;
3
4
  @tailwind utilities;
4
5
 
5
6
  @layer base {
6
7
  body {
7
- @apply font-recursive_sans bg-white h-[200vh];
8
+ @apply font-inter bg-white;
8
9
  }
9
10
 
10
11
  /* scroll bar styling */
@@ -0,0 +1,10 @@
1
+ import clsx from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+
4
+ export function cn(...classes) {
5
+ return twMerge(clsx(classes));
6
+ }
7
+
8
+ export function getRandomID() {
9
+ return Math.random().toString(36).substring(2, 9);
10
+ }
@@ -1,13 +1,18 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
+ import aspectRatio from "@tailwindcss/aspect-ratio";
3
+ import forms from "@tailwindcss/forms";
4
+
2
5
  export default {
3
6
  content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
4
7
  theme: {
5
8
  extend: {
6
9
  fontFamily: {
7
- inter: ["Inter", "Sans serif"],
8
- recursive_sans: ["Recursive Sans Casual", "Monospace"],
10
+ inter: ["Inter", "sans-serif"],
11
+ },
12
+ container: {
13
+ center: true,
9
14
  },
10
15
  },
11
16
  },
12
- plugins: [],
17
+ plugins: [forms, aspectRatio],
13
18
  };
@@ -1,5 +0,0 @@
1
- export default function Button() {
2
- return (
3
- <div>Button</div>
4
- )
5
- }
@@ -1,50 +0,0 @@
1
- # React + TypeScript + 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
9
-
10
- ## Expanding the ESLint configuration
11
-
12
- If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13
-
14
- - Configure the top-level `parserOptions` property like this:
15
-
16
- ```js
17
- export default tseslint.config({
18
- languageOptions: {
19
- // other options...
20
- parserOptions: {
21
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
22
- tsconfigRootDir: import.meta.dirname,
23
- },
24
- },
25
- })
26
- ```
27
-
28
- - Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
29
- - Optionally add `...tseslint.configs.stylisticTypeChecked`
30
- - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
31
-
32
- ```js
33
- // eslint.config.js
34
- import react from 'eslint-plugin-react'
35
-
36
- export default tseslint.config({
37
- // Set the react version
38
- settings: { react: { version: '18.3' } },
39
- plugins: {
40
- // Add the react plugin
41
- react,
42
- },
43
- rules: {
44
- // other rules...
45
- // Enable its recommended rules
46
- ...react.configs.recommended.rules,
47
- ...react.configs['jsx-runtime'].rules,
48
- },
49
- })
50
- ```
@@ -1,35 +0,0 @@
1
- import js from "@eslint/js";
2
- import reactHooks from "eslint-plugin-react-hooks";
3
- import reactRefresh from "eslint-plugin-react-refresh";
4
- import globals from "globals";
5
- import tseslint from "typescript-eslint";
6
-
7
- export default tseslint.config(
8
- { ignores: ["dist"] },
9
- {
10
- extends: [js.configs.recommended, ...tseslint.configs.recommended],
11
- files: ["**/*.{ts,tsx}"],
12
- languageOptions: {
13
- ecmaVersion: 2020,
14
- globals: globals.browser,
15
- },
16
- plugins: {
17
- "react-hooks": reactHooks,
18
- "react-refresh": reactRefresh,
19
- },
20
- rules: {
21
- ...reactHooks.configs.recommended.rules,
22
- "react/jsx-no-target-blank": "off",
23
- "no-unused-vars": [
24
- "error",
25
- { vars: "all", args: "after-used", ignoreRestSiblings: true },
26
- ],
27
- "react/prop-types": "off",
28
- "react/no-unescaped-entities": "off",
29
- "react-refresh/only-export-components": [
30
- "warn",
31
- { allowConstantExport: true },
32
- ],
33
- },
34
- }
35
- );
@@ -1,13 +0,0 @@
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 + TS</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.tsx"></script>
12
- </body>
13
- </html>