start-it-cli 1.0.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.
@@ -0,0 +1,335 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.goTemplates = void 0;
4
+ exports.goTemplates = {
5
+ "Basic CLI": {
6
+ name: "Basic CLI",
7
+ description: "A basic Go CLI application",
8
+ files: [
9
+ {
10
+ path: "go.mod",
11
+ content: "module github.com/user/project\n\ngo 1.21\n",
12
+ },
13
+ {
14
+ path: "main.go",
15
+ content: `package main
16
+
17
+ import (
18
+ "fmt"
19
+ "os"
20
+ )
21
+
22
+ func main() {
23
+ if len(os.Args) < 2 {
24
+ fmt.Println("Usage: app <command>")
25
+ os.Exit(1)
26
+ }
27
+
28
+ command := os.Args[1]
29
+
30
+ switch command {
31
+ case "hello":
32
+ fmt.Println("Hello, World!")
33
+ case "version":
34
+ fmt.Println("Version 1.0.0")
35
+ default:
36
+ fmt.Printf("Unknown command: %s\\n", command)
37
+ os.Exit(1)
38
+ }
39
+ }
40
+ `,
41
+ },
42
+ {
43
+ path: "README.md",
44
+ content: `# Go CLI Application
45
+
46
+ A basic Go command-line application.
47
+
48
+ ## Build
49
+
50
+ \`\`\`bash
51
+ go build -o app
52
+ \`\`\`
53
+
54
+ ## Run
55
+
56
+ \`\`\`bash
57
+ ./app hello
58
+ ./app version
59
+ \`\`\`
60
+
61
+ ## Development
62
+
63
+ \`\`\`bash
64
+ go run main.go hello
65
+ \`\`\`
66
+ `,
67
+ },
68
+ {
69
+ path: ".gitignore",
70
+ content: `# Binaries for programs and plugins
71
+ *.exe
72
+ *.exe~
73
+ *.dll
74
+ *.so
75
+ *.so.*
76
+ *.dylib
77
+
78
+ # Test binary, built with \`go test -c\`
79
+ *.test
80
+
81
+ # Output of the go coverage tool
82
+ *.out
83
+
84
+ # Go workspace file
85
+ go.work
86
+
87
+ # Dependency directories
88
+ vendor/
89
+
90
+ # IDE
91
+ .vscode/
92
+ .idea/
93
+ *.swp
94
+ *.swo
95
+ *~
96
+ `,
97
+ },
98
+ ],
99
+ },
100
+ "Web API": {
101
+ name: "Web API",
102
+ description: "A Go web API using Gin framework",
103
+ files: [
104
+ {
105
+ path: "go.mod",
106
+ content: `module github.com/user/project
107
+
108
+ go 1.21
109
+
110
+ require github.com/gin-gonic/gin v1.9.1
111
+ `,
112
+ },
113
+ {
114
+ path: "main.go",
115
+ content: `package main
116
+
117
+ import (
118
+ "github.com/gin-gonic/gin"
119
+ )
120
+
121
+ func main() {
122
+ router := gin.Default()
123
+
124
+ // Health check endpoint
125
+ router.GET("/health", func(c *gin.Context) {
126
+ c.JSON(200, gin.H{
127
+ "status": "ok",
128
+ })
129
+ })
130
+
131
+ // API endpoints
132
+ router.GET("/api/hello", func(c *gin.Context) {
133
+ c.JSON(200, gin.H{
134
+ "message": "Hello from Go API!",
135
+ })
136
+ })
137
+
138
+ router.POST("/api/echo", func(c *gin.Context) {
139
+ var data map[string]interface{}
140
+ c.BindJSON(&data)
141
+ c.JSON(200, data)
142
+ })
143
+
144
+ router.Run(":8080")
145
+ }
146
+ `,
147
+ },
148
+ {
149
+ path: "README.md",
150
+ content: `# Go Web API
151
+
152
+ A RESTful API built with Go and Gin framework.
153
+
154
+ ## Setup
155
+
156
+ \`\`\`bash
157
+ go mod download
158
+ \`\`\`
159
+
160
+ ## Run
161
+
162
+ \`\`\`bash
163
+ go run main.go
164
+ \`\`\`
165
+
166
+ The API will be available at \`http://localhost:8080\`
167
+
168
+ ## Endpoints
169
+
170
+ - \`GET /health\` - Health check
171
+ - \`GET /api/hello\` - Hello endpoint
172
+ - \`POST /api/echo\` - Echo endpoint
173
+
174
+ ## Build
175
+
176
+ \`\`\`bash
177
+ go build -o api
178
+ ./api
179
+ \`\`\`
180
+ `,
181
+ },
182
+ {
183
+ path: ".gitignore",
184
+ content: `# Binaries for programs and plugins
185
+ *.exe
186
+ *.exe~
187
+ *.dll
188
+ *.so
189
+ *.so.*
190
+ *.dylib
191
+
192
+ # Test binary, built with \`go test -c\`
193
+ *.test
194
+
195
+ # Output of the go coverage tool
196
+ *.out
197
+
198
+ # Go workspace file
199
+ go.work
200
+
201
+ # Dependency directories
202
+ vendor/
203
+
204
+ # IDE
205
+ .vscode/
206
+ .idea/
207
+ *.swp
208
+ *.swo
209
+ *~
210
+ `,
211
+ },
212
+ ],
213
+ },
214
+ Microservice: {
215
+ name: "Microservice",
216
+ description: "A Go microservice template",
217
+ files: [
218
+ {
219
+ path: "go.mod",
220
+ content: `module github.com/user/project
221
+
222
+ go 1.21
223
+
224
+ require (
225
+ github.com/gin-gonic/gin v1.9.1
226
+ github.com/google/uuid v1.5.0
227
+ )
228
+ `,
229
+ },
230
+ {
231
+ path: "main.go",
232
+ content: `package main
233
+
234
+ import (
235
+ "github.com/gin-gonic/gin"
236
+ "github.com/google/uuid"
237
+ )
238
+
239
+ type Service struct {
240
+ ID string
241
+ Name string
242
+ }
243
+
244
+ func main() {
245
+ router := gin.Default()
246
+
247
+ service := Service{
248
+ ID: uuid.New().String(),
249
+ Name: "My Microservice",
250
+ }
251
+
252
+ // Service info endpoint
253
+ router.GET("/service/info", func(c *gin.Context) {
254
+ c.JSON(200, service)
255
+ })
256
+
257
+ // Health check
258
+ router.GET("/health", func(c *gin.Context) {
259
+ c.JSON(200, gin.H{
260
+ "status": "healthy",
261
+ "service_id": service.ID,
262
+ })
263
+ })
264
+
265
+ // Ready check
266
+ router.GET("/ready", func(c *gin.Context) {
267
+ c.JSON(200, gin.H{
268
+ "ready": true,
269
+ })
270
+ })
271
+
272
+ router.Run(":8080")
273
+ }
274
+ `,
275
+ },
276
+ {
277
+ path: "README.md",
278
+ content: `# Go Microservice
279
+
280
+ A microservice template built with Go and Gin.
281
+
282
+ ## Features
283
+
284
+ - Service discovery endpoints
285
+ - Health checks
286
+ - UUID generation
287
+
288
+ ## Run
289
+
290
+ \`\`\`bash
291
+ go mod download
292
+ go run main.go
293
+ \`\`\`
294
+
295
+ ## Endpoints
296
+
297
+ - \`GET /service/info\` - Service information
298
+ - \`GET /health\` - Health check
299
+ - \`GET /ready\` - Readiness check
300
+ `,
301
+ },
302
+ {
303
+ path: ".gitignore",
304
+ content: `# Binaries for programs and plugins
305
+ *.exe
306
+ *.exe~
307
+ *.dll
308
+ *.so
309
+ *.so.*
310
+ *.dylib
311
+
312
+ # Test binary, built with \`go test -c\`
313
+ *.test
314
+
315
+ # Output of the go coverage tool
316
+ *.out
317
+
318
+ # Go workspace file
319
+ go.work
320
+
321
+ # Dependency directories
322
+ vendor/
323
+
324
+ # IDE
325
+ .vscode/
326
+ .idea/
327
+ *.swp
328
+ *.swo
329
+ *~
330
+ `,
331
+ },
332
+ ],
333
+ },
334
+ };
335
+ //# sourceMappingURL=go.js.map
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTemplate = getTemplate;
4
+ const go_1 = require("./go");
5
+ const flutter_1 = require("./flutter");
6
+ const react_native_1 = require("./react-native");
7
+ const spring_boot_1 = require("./spring-boot");
8
+ const node_1 = require("./node");
9
+ const python_1 = require("./python");
10
+ const allTemplates = {
11
+ Go: go_1.goTemplates,
12
+ Flutter: flutter_1.flutterTemplates,
13
+ "React Native": react_native_1.reactNativeTemplates,
14
+ "Spring Boot": spring_boot_1.springBootTemplates,
15
+ "Node.js": node_1.nodeTemplates,
16
+ Python: python_1.pythonTemplates,
17
+ };
18
+ function getTemplate(framework, templateName) {
19
+ const frameworkTemplates = allTemplates[framework];
20
+ if (!frameworkTemplates) {
21
+ throw new Error(`Framework "${framework}" not found`);
22
+ }
23
+ const template = frameworkTemplates[templateName];
24
+ if (!template) {
25
+ // Return first available template as default
26
+ const firstTemplate = Object.values(frameworkTemplates)[0];
27
+ if (!firstTemplate) {
28
+ throw new Error(`No templates available for "${framework}"`);
29
+ }
30
+ return firstTemplate;
31
+ }
32
+ return template;
33
+ }
34
+ //# sourceMappingURL=index.js.map