tsc-app 3.2.6 → 3.3.6

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.
Files changed (3) hide show
  1. package/README.md +43 -19
  2. package/index.js +114 -31
  3. package/package.json +24 -3
package/README.md CHANGED
@@ -1,37 +1,61 @@
1
1
  # ts-app
2
2
 
3
- A minimal and fast **TypeScript project generator** — spin up a ready-to-use TypeScript + Node.js project with a single command.
3
+ A minimal and fast **TypeScript project generator** — spin up a production-ready TypeScript + Node.js environment with a single command.
4
+
5
+ ---
4
6
 
5
7
  ## ✨ Features
6
8
 
7
- - 📦 Automatic `package.json` creation with sensible defaults
8
- - Clean `tsconfig.json` optimized for Node.js
9
- - 📂 `src/` folder setup with a starter `index.ts`
10
- - 🏃 Pre-configured scripts: `start`, `build`, and `dev`
11
- - Supports CommonJS and ES Module formats via the `--module` flag
12
- - 🖥 No global install required run instantly via `npx`
13
- - Configured with the latest TypeScript best practices
9
+ - 📦 **Zero-config** `package.json` with intelligent defaults
10
+ - ⚙️ Clean and strict `tsconfig.json` optimized for modern Node.js
11
+ - 📁 Scaffolded project structure with `src/` and starter `index.ts`
12
+ - Supports both **ES Modules** and **CommonJS** via `--module` or `-m` flag
13
+ - 🚀 Pre-configured `npm` scripts for development, build, linting, and running
14
+ - 🧪 Built-in ESLint + Prettier setup for consistent, high-quality code
15
+ - 🖥️ No global install required run instantly with `npx`
16
+ - ✅ Based on the latest **TypeScript best practices** and **tooling ecosystem**
14
17
 
15
18
  ---
16
19
 
17
20
  ## 🚀 Quick Start
18
21
 
19
- ### Create a New Project
22
+ ### 1. Generate a New TypeScript Project
23
+
20
24
  ```bash
21
- npx tsc-app --app-name
25
+ npx tsc-app my-app
22
26
 
23
- Output:
24
27
 
25
- Folder Structure:
28
+ Project Structure :
26
29
  my-app/
30
+ ├── dist/ # Compiled JavaScript output
31
+ ├── node_modules/
32
+ ├── src/ # Source TypeScript files
33
+ │ └── index.ts # Entry point
34
+ ├── .gitignore
27
35
  ├── package.json
28
36
  ├── tsconfig.json
29
- ├── src/
30
- │ └── index.ts
31
- └── dist/
37
+ ├── eslint.config.js
38
+ ├── .prettierrc.json
39
+ └── README.md
40
+
41
+
42
+ Example Usage:
43
+
44
+ # Create a new project
45
+ npx tsc-app my-app
32
46
 
33
- Build the Project
34
- => npm run dev
47
+ # Move into project directory
48
+ cd my-app
49
+
50
+ # Start development mode (watch + auto-restart)
51
+ npm run dev
52
+
53
+ # Build the project
54
+ npm run build
55
+
56
+ # Run compiled code
57
+ npm start
58
+
59
+
60
+ ---
35
61
 
36
- Run Compiled Code
37
- => npm start
package/index.js CHANGED
@@ -42,62 +42,141 @@ process.chdir(projectName);
42
42
  // Init package.json
43
43
  execSync("npm init -y", { stdio: "inherit" });
44
44
 
45
- // Install dev dependencies (latest)
46
- execSync("npm i -D typescript@latest ts-node@latest @types/node@latest concurrently@latest nodemon@latest", {
47
- stdio: "inherit",
48
- });
45
+ // Install dev dependencies
46
+ execSync(
47
+ `npm i -D typescript@^5.9.2 ts-node@^10.9.2 @types/node@latest concurrently@^9.2.0 nodemon@^3.1.10 \
48
+ eslint@^9.33.0 @typescript-eslint/parser@^8.40.0 @typescript-eslint/eslint-plugin@^8.40.0 \
49
+ eslint-plugin-import@^2.32.0 eslint-config-prettier@^10.1.8 prettier@^3.6.2 typescript-eslint`,
50
+ { stdio: "inherit" }
51
+ );
49
52
 
50
- // Create tsconfig.json
53
+ // tsconfig.json
51
54
  const tsconfig = {
52
55
  compilerOptions: {
56
+ target: "ESNext",
57
+ module: "NodeNext",
58
+ moduleResolution: "NodeNext",
53
59
  rootDir: "./src",
54
60
  outDir: "./dist",
55
- module: "nodenext",
56
- target: "esnext",
57
- types: ["node"],
58
- sourceMap: true,
59
- declaration: true,
60
- declarationMap: true,
61
- noUncheckedIndexedAccess: true,
62
- exactOptionalPropertyTypes: true,
63
61
  strict: true,
64
- verbatimModuleSyntax: true,
65
- isolatedModules: true,
66
- moduleDetection: "force",
67
- skipLibCheck: true,
62
+ noImplicitAny: true,
63
+ strictNullChecks: true,
64
+ strictFunctionTypes: true,
65
+ strictBindCallApply: true,
66
+ alwaysStrict: true,
67
+ exactOptionalPropertyTypes: true,
68
+ noUncheckedIndexedAccess: true,
69
+ noImplicitReturns: true,
70
+ noFallthroughCasesInSwitch: true,
71
+ noUnusedLocals: true,
72
+ noUnusedParameters: true,
73
+ noPropertyAccessFromIndexSignature: true,
68
74
  esModuleInterop: true,
69
75
  forceConsistentCasingInFileNames: true,
70
- moduleResolution: "nodenext"
76
+ verbatimModuleSyntax: true,
77
+ isolatedModules: true,
78
+ skipLibCheck: false,
79
+ declaration: true,
80
+ declarationMap: true,
81
+ sourceMap: true
71
82
  },
72
83
  include: ["src/**/*.ts"],
73
84
  exclude: ["node_modules", "dist"]
74
85
  };
75
86
  fs.writeFileSync("tsconfig.json", JSON.stringify(tsconfig, null, 2));
76
87
 
77
- // Create src folder + entry file
88
+ // Create src/index.ts
78
89
  fs.mkdirSync("src");
79
90
  fs.writeFileSync(
80
91
  "src/index.ts",
81
- `export function hello(name: string) {
92
+ `export function hello(name: string): string {
82
93
  return \`Hello, \${name}!\`;
83
94
  }
84
95
 
85
96
  console.log(hello("World"));`
86
97
  );
87
98
 
88
- // Update package.json scripts
99
+ // Update package.json
89
100
  const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
90
101
  pkg.type = packageType;
102
+ pkg.main = "./dist/index.js";
103
+ pkg.types = "./dist/index.d.ts";
104
+ pkg.keywords = [projectName];
91
105
  pkg.scripts = {
92
- dev: 'concurrently "tsc -w" "nodemon dist/index.js"',
106
+ lint: 'eslint "src/**/*.{ts,tsx}"',
93
107
  build: "tsc",
108
+ dev: 'concurrently "tsc -w" "nodemon dist/index.js"',
94
109
  start: "node dist/index.js"
95
110
  };
96
- pkg.main = "./dist/index.js";
97
- pkg.types = "./dist/index.d.ts";
98
111
  fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2));
99
112
 
100
- // Create .gitignore
113
+ // Create eslint.config.js
114
+ fs.writeFileSync(
115
+ "eslint.config.js",
116
+ `// @ts-check
117
+
118
+ import eslint from "@eslint/js";
119
+ import tseslint from "typescript-eslint";
120
+ import importPlugin from "eslint-plugin-import";
121
+
122
+ export default tseslint.config(
123
+ eslint.configs.recommended,
124
+ ...tseslint.configs.strict,
125
+ {
126
+ languageOptions: {
127
+ parserOptions: {
128
+ project: "./tsconfig.json",
129
+ tsconfigRootDir: import.meta.dirname
130
+ }
131
+ },
132
+ plugins: {
133
+ import: importPlugin
134
+ },
135
+ rules: {
136
+ "@typescript-eslint/explicit-function-return-type": "error",
137
+ "@typescript-eslint/no-explicit-any": "error",
138
+ "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
139
+ "@typescript-eslint/consistent-type-imports": "error",
140
+ "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
141
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
142
+ "@typescript-eslint/no-inferrable-types": "off",
143
+ "no-console": "warn",
144
+ "eqeqeq": ["error", "always"],
145
+ "curly": ["error", "all"],
146
+ "no-implicit-coercion": "error",
147
+ "prefer-const": "error",
148
+ "no-var": "error",
149
+ "import/no-unresolved": "error",
150
+ "import/no-duplicates": "error",
151
+ "import/order": [
152
+ "error",
153
+ {
154
+ groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
155
+ "newlines-between": "always"
156
+ }
157
+ ]
158
+ }
159
+ }
160
+ );`
161
+ );
162
+
163
+ // .prettierrc.json
164
+ fs.writeFileSync(
165
+ ".prettierrc.json",
166
+ JSON.stringify(
167
+ {
168
+ semi: true,
169
+ singleQuote: true,
170
+ printWidth: 100,
171
+ tabWidth: 2,
172
+ trailingComma: "all"
173
+ },
174
+ null,
175
+ 2
176
+ )
177
+ );
178
+
179
+ // .gitignore
101
180
  fs.writeFileSync(
102
181
  ".gitignore",
103
182
  `node_modules
@@ -108,7 +187,7 @@ dist
108
187
  `
109
188
  );
110
189
 
111
- // Create README.md
190
+ // README.md
112
191
  fs.writeFileSync(
113
192
  "README.md",
114
193
  `# ${projectName}
@@ -116,25 +195,29 @@ fs.writeFileSync(
116
195
  > Generated with init-ts-app
117
196
 
118
197
  ## Quick Start
198
+
119
199
  \`\`\`bash
120
200
  npm install
121
201
  npm run dev
122
202
  \`\`\`
123
203
 
124
204
  ## Scripts
205
+
125
206
  - \`npm run dev\` — watch + rebuild + run dist/index.js
126
207
  - \`npm run build\` — compile TypeScript to dist/
208
+ - \`npm run lint\` — run ESLint
209
+ - \`npm start\` — run compiled output
127
210
  `
128
211
  );
129
212
 
130
- // Init Git repo
213
+ // Git init
131
214
  execSync("git init", { stdio: "inherit" });
132
215
  execSync("git add .", { stdio: "inherit" });
133
- execSync("git commit -m 'Initial commit: generated by init-ts-app'", {
216
+ execSync('git commit -m "Initial commit: generated by init-ts-app"', {
134
217
  stdio: "inherit",
135
218
  });
136
219
 
137
- console.log("\n=> Project setup complete!");
138
- console.log(`=> cd ${projectName}`);
139
- console.log("=> npm run dev");
220
+ console.log("\n Project setup complete!");
221
+ console.log(`➡ cd ${projectName}`);
222
+ console.log(" npm run dev");
140
223
 
package/package.json CHANGED
@@ -1,11 +1,32 @@
1
1
  {
2
2
  "name": "tsc-app",
3
- "version": "3.2.6",
4
- "description": "Quick TypeScript project initializer",
3
+ "version": "3.3.6",
4
+ "description": "Instantly create a clean, modern TypeScript + Node.js project with best practices.",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "tsc-app": "index.js"
8
8
  },
9
+ "type": "commonjs",
9
10
  "license": "MIT",
10
- "type": "commonjs"
11
+ "keywords": [
12
+ "typescript",
13
+ "ts",
14
+ "typescript starter",
15
+ "tsc-app",
16
+ "init typescript",
17
+ "typescript boilerplate",
18
+ "typescript generator",
19
+ "node typescript",
20
+ "ts project setup",
21
+ "create typescript app",
22
+ "typescript cli",
23
+ "typescript scaffolding",
24
+ "ts project generator"
25
+ ],
26
+ "author": "Tamilvanan",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/tamil202/ts-app"
30
+ }
11
31
  }
32
+