zerostart-cli 0.0.36 → 0.0.37

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.
@@ -51,9 +51,6 @@ class TemplateManager {
51
51
  this.createTypeSpecificStructure(config);
52
52
  // Create language specific files
53
53
  switch (config.language) {
54
- case types_1.ProjectLanguage.NodeJS:
55
- await this.createNodeJSStructure(config);
56
- break;
57
54
  case types_1.ProjectLanguage.Python:
58
55
  await this.createPythonStructure(config);
59
56
  break;
@@ -66,11 +63,52 @@ class TemplateManager {
66
63
  case types_1.ProjectLanguage.React:
67
64
  await this.createReactStructure(config);
68
65
  break;
66
+ case types_1.ProjectLanguage.TypeScript:
67
+ await this.createTypeScriptStructure(config);
68
+ break;
69
69
  case types_1.ProjectLanguage.HTMLCSS:
70
70
  await this.createHTMLCSSStructure(config);
71
71
  break;
72
72
  }
73
73
  }
74
+ async createTypeScriptStructure(config) {
75
+ const packageJson = {
76
+ name: config.name,
77
+ version: "1.0.0",
78
+ description: config.description,
79
+ main: "dist/index.js",
80
+ scripts: {
81
+ build: "tsc",
82
+ start: "node dist/index.js",
83
+ dev: "ts-node src/index.ts",
84
+ test: "echo \"Error: no test specified\" && exit 1"
85
+ },
86
+ devDependencies: {
87
+ "typescript": "^5.3.3",
88
+ "ts-node": "^10.9.2",
89
+ "@types/node": "^20.11.0"
90
+ }
91
+ };
92
+ fs.writeFileSync(path.join(config.path, 'package.json'), JSON.stringify(packageJson, null, 2));
93
+ const src = path.join(config.path, 'src');
94
+ if (!fs.existsSync(src))
95
+ fs.mkdirSync(src);
96
+ fs.writeFileSync(path.join(src, 'index.ts'), 'console.log("Hello from TypeScript!");');
97
+ fs.writeFileSync(path.join(config.path, 'tsconfig.json'), `{
98
+ "compilerOptions": {
99
+ "target": "ES2020",
100
+ "module": "CommonJS",
101
+ "outDir": "./dist",
102
+ "rootDir": "./src",
103
+ "strict": true,
104
+ "esModuleInterop": true,
105
+ "skipLibCheck": true,
106
+ "forceConsistentCasingInFileNames": true
107
+ },
108
+ "include": ["src/**/*"]
109
+ }
110
+ `);
111
+ }
74
112
  createTypeSpecificStructure(config) {
75
113
  switch (config.type) {
76
114
  case types_1.ProjectType.WebApp:
@@ -97,53 +135,53 @@ class TemplateManager {
97
135
  fs.mkdirSync(fullPath, { recursive: true });
98
136
  }
99
137
  createReadme(config) {
100
- const content = `# ${config.name}
101
-
102
- ## Description
103
- ${config.description}
104
-
105
- ## Tech Stack
106
- - Language: ${config.language}
107
- - Type: ${config.type}
108
-
109
- ## Installation
110
- \`\`\`bash
111
- # Clone the repository
112
- git clone <repo-url>
113
- cd ${config.name}
114
-
115
- # Install dependencies
116
- npm install # or pip install -r requirements.txt / mvn install
117
- \`\`\`
118
-
119
- ## Usage
120
- \`\`\`bash
121
- npm start # or python main.py / java -jar target/app.jar
122
- \`\`\`
123
-
124
- ## Future Scope
125
- - Add more features
126
- - Improve UI/UX
127
- - optimize performance
138
+ const content = `# ${config.name}
139
+
140
+ ## Description
141
+ ${config.description}
142
+
143
+ ## Tech Stack
144
+ - Language: ${config.language}
145
+ - Type: ${config.type}
146
+
147
+ ## Installation
148
+ \`\`\`bash
149
+ # Clone the repository
150
+ git clone <repo-url>
151
+ cd ${config.name}
152
+
153
+ # Install dependencies
154
+ npm install # or pip install -r requirements.txt / mvn install
155
+ \`\`\`
156
+
157
+ ## Usage
158
+ \`\`\`bash
159
+ npm start # or python main.py / java -jar target/app.jar
160
+ \`\`\`
161
+
162
+ ## Future Scope
163
+ - Add more features
164
+ - Improve UI/UX
165
+ - optimize performance
128
166
  `;
129
167
  fs.writeFileSync(path.join(config.path, 'README.md'), content);
130
168
  }
131
169
  createRoadmap(config) {
132
- const content = `# Roadmap for ${config.name}
133
-
134
- - [ ] Initial Setup
135
- - [ ] Core Features Implementation
136
- - [ ] Testing & Debugging
137
- - [ ] Documentation
138
- - [ ] Deployment
170
+ const content = `# Roadmap for ${config.name}
171
+
172
+ - [ ] Initial Setup
173
+ - [ ] Core Features Implementation
174
+ - [ ] Testing & Debugging
175
+ - [ ] Documentation
176
+ - [ ] Deployment
139
177
  `;
140
178
  fs.writeFileSync(path.join(config.path, 'roadmap.md'), content);
141
179
  }
142
180
  createGitIgnore(config) {
143
181
  let content = '';
144
182
  switch (config.language) {
145
- case types_1.ProjectLanguage.NodeJS:
146
183
  case types_1.ProjectLanguage.React:
184
+ case types_1.ProjectLanguage.TypeScript:
147
185
  content = 'node_modules/\n.env\ndist/\nbuild/';
148
186
  break;
149
187
  case types_1.ProjectLanguage.Python:
@@ -158,23 +196,6 @@ npm start # or python main.py / java -jar target/app.jar
158
196
  }
159
197
  fs.writeFileSync(path.join(config.path, '.gitignore'), content);
160
198
  }
161
- async createNodeJSStructure(config) {
162
- const packageJson = {
163
- name: config.name,
164
- version: "1.0.0",
165
- description: config.description,
166
- main: "index.js",
167
- scripts: {
168
- start: "node index.js",
169
- test: "echo \"Error: no test specified\" && exit 1"
170
- },
171
- keywords: [],
172
- author: "",
173
- license: "ISC"
174
- };
175
- fs.writeFileSync(path.join(config.path, 'package.json'), JSON.stringify(packageJson, null, 2));
176
- fs.writeFileSync(path.join(config.path, 'index.js'), 'console.log("Hello, World!");');
177
- }
178
199
  async createPythonStructure(config) {
179
200
  fs.writeFileSync(path.join(config.path, 'main.py'), 'print("Hello, World!")');
180
201
  fs.writeFileSync(path.join(config.path, 'requirements.txt'), '# Add your dependencies here');
@@ -182,41 +203,39 @@ npm start # or python main.py / java -jar target/app.jar
182
203
  async createJavaStructure(config) {
183
204
  const srcDir = path.join(config.path, 'src', 'main', 'java', 'com', 'example');
184
205
  fs.mkdirSync(srcDir, { recursive: true });
185
- const mainClass = `package com.example;
186
-
187
- public class Main {
188
- public static void main(String[] args) {
189
- System.out.println("Hello, World!");
190
- }
206
+ const mainClass = `package com.example;
207
+
208
+ public class Main {
209
+ public static void main(String[] args) {
210
+ System.out.println("Hello, World!");
211
+ }
191
212
  }`;
192
213
  fs.writeFileSync(path.join(srcDir, 'Main.java'), mainClass);
193
- const pomXml = `<project>
194
- <modelVersion>4.0.0</modelVersion>
195
- <groupId>com.example</groupId>
196
- <artifactId>${config.name}</artifactId>
197
- <version>1.0-SNAPSHOT</version>
214
+ const pomXml = `<project>
215
+ <modelVersion>4.0.0</modelVersion>
216
+ <groupId>com.example</groupId>
217
+ <artifactId>${config.name}</artifactId>
218
+ <version>1.0-SNAPSHOT</version>
198
219
  </project>`;
199
220
  fs.writeFileSync(path.join(config.path, 'pom.xml'), pomXml);
200
221
  }
201
222
  async createCPPStructure(config) {
202
- const mainCpp = `#include <iostream>
203
-
204
- int main() {
205
- std::cout << "Hello, World!" << std::endl;
206
- return 0;
223
+ const mainCpp = `#include <iostream>
224
+
225
+ int main() {
226
+ std::cout << "Hello, World!" << std::endl;
227
+ return 0;
207
228
  }`;
208
229
  fs.writeFileSync(path.join(config.path, 'main.cpp'), mainCpp);
209
- const cmake = `cmake_minimum_required(VERSION 3.10)
210
- project(${config.name})
211
-
212
- set(CMAKE_CXX_STANDARD 11)
213
-
230
+ const cmake = `cmake_minimum_required(VERSION 3.10)
231
+ project(${config.name})
232
+
233
+ set(CMAKE_CXX_STANDARD 11)
234
+
214
235
  add_executable(${config.name} main.cpp)`;
215
236
  fs.writeFileSync(path.join(config.path, 'CMakeLists.txt'), cmake);
216
237
  }
217
238
  async createReactStructure(config) {
218
- // Minimal React Setup (using Vite structure conceptually but minimal for file generation speed)
219
- // Assuming users will run 'npm install' later
220
239
  const packageJson = {
221
240
  name: config.name,
222
241
  private: true,
@@ -243,155 +262,151 @@ add_executable(${config.name} main.cpp)`;
243
262
  const src = path.join(config.path, 'src');
244
263
  if (!fs.existsSync(src))
245
264
  fs.mkdirSync(src);
246
- fs.writeFileSync(path.join(src, 'App.tsx'), `
247
-
248
- function App() {
249
- return (
250
- <div>
251
- <h1>Hello React + Vite!</h1>
252
- </div>
253
- );
254
- }
255
-
256
- export default App;
265
+ fs.writeFileSync(path.join(src, 'App.tsx'), `
266
+
267
+ function App() {
268
+ return (
269
+ <div>
270
+ <h1>Hello React + Vite!</h1>
271
+ </div>
272
+ );
273
+ }
274
+
275
+ export default App;
257
276
  `);
258
- fs.writeFileSync(path.join(src, 'main.tsx'), `
259
- import React from 'react'
260
- import ReactDOM from 'react-dom/client'
261
- import App from './App.tsx'
262
-
263
- ReactDOM.createRoot(document.getElementById('root')!).render(
264
- <React.StrictMode>
265
- <App />
266
- </React.StrictMode>,
267
- )
277
+ fs.writeFileSync(path.join(src, 'main.tsx'), `
278
+ import React from 'react'
279
+ import ReactDOM from 'react-dom/client'
280
+ import App from './App.tsx'
281
+
282
+ ReactDOM.createRoot(document.getElementById('root')!).render(
283
+ <React.StrictMode>
284
+ <App />
285
+ </React.StrictMode>,
286
+ )
268
287
  `);
269
- fs.writeFileSync(path.join(config.path, 'index.html'), `
270
- <!doctype html>
271
- <html lang="en">
272
- <head>
273
- <meta charset="UTF-8" />
274
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
275
- <title>${config.name}</title>
276
- </head>
277
- <body>
278
- <div id="root"></div>
279
- <script type="module" src="/src/main.tsx"></script>
280
- </body>
281
- </html>
288
+ fs.writeFileSync(path.join(config.path, 'index.html'), `
289
+ <!doctype html>
290
+ <html lang="en">
291
+ <head>
292
+ <meta charset="UTF-8" />
293
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
294
+ <title>${config.name}</title>
295
+ </head>
296
+ <body>
297
+ <div id="root"></div>
298
+ <script type="module" src="/src/main.tsx"></script>
299
+ </body>
300
+ </html>
282
301
  `);
283
- fs.writeFileSync(path.join(config.path, 'vite.config.ts'), `
284
- import { defineConfig } from 'vite'
285
- import react from '@vitejs/plugin-react'
286
-
287
- // https://vitejs.dev/config/
288
- export default defineConfig({
289
- plugins: [react()],
290
- })
302
+ fs.writeFileSync(path.join(config.path, 'vite.config.ts'), `
303
+ import { defineConfig } from 'vite'
304
+ import react from '@vitejs/plugin-react'
305
+
306
+ // https://vitejs.dev/config/
307
+ export default defineConfig({
308
+ plugins: [react()],
309
+ })
291
310
  `);
292
- fs.writeFileSync(path.join(config.path, 'tsconfig.json'), `
293
- {
294
- "compilerOptions": {
295
- "target": "ES2020",
296
- "useDefineForClassFields": true,
297
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
298
- "module": "ESNext",
299
- "skipLibCheck": true,
300
-
301
- /* Bundler mode */
302
- "moduleResolution": "bundler",
303
- "allowImportingTsExtensions": true,
304
- "resolveJsonModule": true,
305
- "isolatedModules": true,
306
- "noEmit": true,
307
- "jsx": "react-jsx",
308
-
309
- /* Linting */
310
- "strict": true,
311
- "noUnusedLocals": true,
312
- "noUnusedParameters": true,
313
- "noFallthroughCasesInSwitch": true
314
- },
315
- "include": ["src"],
316
- "references": [{ "path": "./tsconfig.node.json" }]
317
- }
311
+ fs.writeFileSync(path.join(config.path, 'tsconfig.json'), `
312
+ {
313
+ "compilerOptions": {
314
+ "target": "ES2020",
315
+ "useDefineForClassFields": true,
316
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
317
+ "module": "ESNext",
318
+ "skipLibCheck": true,
319
+
320
+ /* Bundler mode */
321
+ "moduleResolution": "bundler",
322
+ "allowImportingTsExtensions": true,
323
+ "resolveJsonModule": true,
324
+ "isolatedModules": true,
325
+ "noEmit": true,
326
+ "jsx": "react-jsx",
327
+
328
+ /* Linting */
329
+ "strict": true,
330
+ "noUnusedLocals": true,
331
+ "noUnusedParameters": true,
332
+ "noFallthroughCasesInSwitch": true
333
+ },
334
+ "include": ["src"],
335
+ "references": [{ "path": "./tsconfig.node.json" }]
336
+ }
318
337
  `);
319
- fs.writeFileSync(path.join(config.path, 'tsconfig.node.json'), `
320
- {
321
- "compilerOptions": {
322
- "composite": true,
323
- "skipLibCheck": true,
324
- "module": "ESNext",
325
- "moduleResolution": "bundler",
326
- "allowSyntheticDefaultImports": true
327
- },
328
- "include": ["vite.config.ts"]
329
- }
338
+ fs.writeFileSync(path.join(config.path, 'tsconfig.node.json'), `
339
+ {
340
+ "compilerOptions": {
341
+ "composite": true,
342
+ "skipLibCheck": true,
343
+ "module": "ESNext",
344
+ "moduleResolution": "bundler",
345
+ "allowSyntheticDefaultImports": true
346
+ },
347
+ "include": ["vite.config.ts"]
348
+ }
330
349
  `);
331
350
  this.createNetlifyConfig(config);
332
351
  }
333
352
  async createHTMLCSSStructure(config) {
334
- fs.writeFileSync(path.join(config.path, 'index.html'), `
335
- <!DOCTYPE html>
336
- <html lang="en">
337
- <head>
338
- <meta charset="UTF-8">
339
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
340
- <title>${config.name}</title>
341
- <link rel="stylesheet" href="style.css">
342
- </head>
343
- <body>
344
- <div class="container">
345
- <h1>Welcome to ${config.name}</h1>
346
- <p>This is a simple HTML/CSS project created by ZeroStart CLI!</p>
347
- </div>
348
- <script src="script.js"></script>
349
- </body>
350
- </html>
353
+ fs.writeFileSync(path.join(config.path, 'index.html'), `
354
+ <!DOCTYPE html>
355
+ <html lang="en">
356
+ <head>
357
+ <meta charset="UTF-8">
358
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
359
+ <title>${config.name}</title>
360
+ <link rel="stylesheet" href="style.css">
361
+ </head>
362
+ <body>
363
+ <div class="container">
364
+ <h1>Welcome to ${config.name}</h1>
365
+ <p>This is a simple HTML/CSS project created by ZeroStart CLI!</p>
366
+ </div>
367
+ <script src="script.js"></script>
368
+ </body>
369
+ </html>
351
370
  `);
352
- fs.writeFileSync(path.join(config.path, 'style.css'), `
353
- body {
354
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
355
- background-color: #f4f4f9;
356
- color: #333;
357
- display: flex;
358
- justify-content: center;
359
- align-items: center;
360
- height: 100vh;
361
- margin: 0;
362
- }
363
-
364
- .container {
365
- text-align: center;
366
- background: white;
367
- padding: 2rem;
368
- border-radius: 8px;
369
- box-shadow: 0 4px 6px rgba(0,0,0,0.1);
370
- }
371
-
372
- h1 {
373
- color: #007bff;
374
- }
371
+ fs.writeFileSync(path.join(config.path, 'style.css'), `
372
+ body {
373
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
374
+ background-color: #f4f4f9;
375
+ color: #333;
376
+ display: flex;
377
+ justify-content: center;
378
+ align-items: center;
379
+ height: 100vh;
380
+ margin: 0;
381
+ }
382
+
383
+ .container {
384
+ text-align: center;
385
+ background: white;
386
+ padding: 2rem;
387
+ border-radius: 8px;
388
+ box-shadow: 0 4px 6px rgba(0,0,0,0.1);
389
+ }
390
+
391
+ h1 {
392
+ color: #007bff;
393
+ }
375
394
  `);
376
- fs.writeFileSync(path.join(config.path, 'script.js'), `
377
- console.log("${config.name} initialized!");
395
+ fs.writeFileSync(path.join(config.path, 'script.js'), `
396
+ console.log("${config.name} initialized!");
378
397
  `);
379
- // No netlify.toml needed for static sites if direct deploy path is known,
380
- // but we'll create a simple one for consistency.
381
- const netlifyContent = `[build]
382
- publish = "."
398
+ const netlifyContent = `[build]
399
+ publish = "."
383
400
  `;
384
401
  fs.writeFileSync(path.join(config.path, 'netlify.toml'), netlifyContent);
385
402
  }
386
403
  createNetlifyConfig(config) {
387
- // Only relevant for web apps (React, etc)
388
- // For now, we assume Vite + React
389
- const content = `[build]
390
- command = "npm run build"
391
- publish = "dist"
392
-
393
- [dev]
394
- command = "npm run dev"
404
+ const content = `[build]
405
+ command = "npm run build"
406
+ publish = "dist"
407
+
408
+ [dev]
409
+ command = "npm run dev"
395
410
  `;
396
411
  fs.writeFileSync(path.join(config.path, 'netlify.toml'), content);
397
412
  }
package/out/types.js CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProjectType = exports.ProjectLanguage = void 0;
4
4
  var ProjectLanguage;
5
5
  (function (ProjectLanguage) {
6
- ProjectLanguage["NodeJS"] = "Node.js";
7
6
  ProjectLanguage["React"] = "React";
7
+ ProjectLanguage["TypeScript"] = "TypeScript";
8
8
  ProjectLanguage["HTMLCSS"] = "HTML/CSS";
9
9
  ProjectLanguage["Python"] = "Python";
10
10
  ProjectLanguage["Java"] = "Java";
package/package.json CHANGED
@@ -1,55 +1,48 @@
1
- {
2
- "name": "zerostart-cli",
3
- "displayName": "ZeroStart",
4
- "bin": {
5
- "zerostart": "./out/cli.js"
6
- },
7
- "description": "Create and deploy a complete project with one command.",
8
- "version": "0.0.36",
9
- "engines": {
10
- "vscode": "^1.85.0"
11
- },
12
- "categories": [
13
- "Other"
14
- ],
15
- "activationEvents": [],
16
- "main": "./out/extension.js",
17
- "contributes": {
18
- "commands": [
19
- {
20
- "command": "zerostart.create",
21
- "title": "ZeroStart"
22
- }
23
- ]
24
- },
25
- "scripts": {
26
- "vscode:prepublish": "npm run compile",
27
- "compile": "tsc -p ./",
28
- "watch": "tsc -watch -p ./",
29
- "pretest": "npm run compile && npm run lint",
30
- "lint": "eslint src --ext ts",
31
- "test": "node ./out/test/runTest.js"
32
- },
33
- "devDependencies": {
34
- "@types/glob": "^8.1.0",
35
- "@types/inquirer": "^9.0.9",
36
- "@types/mocha": "^10.0.6",
37
- "@types/node": "18.x",
38
- "@types/ora": "^3.1.0",
39
- "@types/vscode": "^1.85.0",
40
- "@typescript-eslint/eslint-plugin": "^6.13.1",
41
- "@typescript-eslint/parser": "^6.13.1",
42
- "@vscode/test-electron": "^2.3.8",
43
- "eslint": "^8.54.0",
44
- "glob": "^10.3.10",
45
- "mocha": "^10.2.0",
46
- "typescript": "^5.3.2"
47
- },
48
- "dependencies": {
49
- "@octokit/rest": "^19.0.13",
50
- "chalk": "^4.1.2",
51
- "commander": "^14.0.3",
52
- "inquirer": "^9.3.8",
53
- "ora": "^5.4.1"
54
- }
1
+ {
2
+ "name": "zerostart-cli",
3
+ "displayName": "ZeroStart",
4
+ "bin": {
5
+ "zerostart": "./out/cli.js"
6
+ },
7
+ "description": "Create and deploy a complete project with one command.",
8
+ "version": "0.0.37",
9
+ "engines": {
10
+ "vscode": "^1.85.0"
11
+ },
12
+ "categories": [
13
+ "Other"
14
+ ],
15
+ "activationEvents": [],
16
+ "main": "./out/extension.js",
17
+ "contributes": {
18
+ "commands": [
19
+ {
20
+ "command": "zerostart.create",
21
+ "title": "ZeroStart"
22
+ }
23
+ ]
24
+ },
25
+ "scripts": {
26
+ "vscode:prepublish": "npm run compile",
27
+ "compile": "tsc -p ./",
28
+ "watch": "tsc -watch -p ./",
29
+ "lint": "eslint src --ext ts"
30
+ },
31
+ "devDependencies": {
32
+ "@types/inquirer": "^9.0.9",
33
+ "@types/node": "18.x",
34
+ "@types/ora": "^3.1.0",
35
+ "@types/vscode": "^1.85.0",
36
+ "@typescript-eslint/eslint-plugin": "^6.13.1",
37
+ "@typescript-eslint/parser": "^6.13.1",
38
+ "eslint": "^8.54.0",
39
+ "typescript": "^5.3.2"
40
+ },
41
+ "dependencies": {
42
+ "@octokit/rest": "^19.0.13",
43
+ "chalk": "^4.1.2",
44
+ "commander": "^14.0.3",
45
+ "inquirer": "^9.3.8",
46
+ "ora": "^5.4.1"
47
+ }
55
48
  }