create-gramstax 0.0.1 → 0.0.3

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 (56) hide show
  1. package/dist/src/index.cjs +13 -0
  2. package/dist/src/index.cjs.map +1 -0
  3. package/dist/src/index.d.cts +1 -0
  4. package/dist/src/index.d.ts +0 -2
  5. package/dist/src/index.js +12 -25
  6. package/dist/src/index.js.map +1 -0
  7. package/dist/src/templates/README.md +1 -1
  8. package/dist/src/templates/package.json +4 -4
  9. package/dist/src/templates/tsconfig.json +1 -1
  10. package/package.json +5 -4
  11. package/dist/package.json +0 -57
  12. package/dist/src/create-OLD.d.ts +0 -83
  13. package/dist/src/create-OLD.d.ts.map +0 -1
  14. package/dist/src/create-OLD.js +0 -676
  15. package/dist/src/create.d.ts +0 -34
  16. package/dist/src/create.d.ts.map +0 -1
  17. package/dist/src/create.js +0 -367
  18. package/dist/src/index.d.ts.map +0 -1
  19. package/dist/src/templates/src/env.d.ts +0 -8
  20. package/dist/src/utils/logger.d.ts +0 -3
  21. package/dist/src/utils/logger.d.ts.map +0 -1
  22. package/dist/src/utils/logger.js +0 -2
  23. package/src/create-OLD.ts +0 -783
  24. package/src/create.ts +0 -415
  25. package/src/index.ts +0 -28
  26. package/src/templates/.env.example +0 -17
  27. package/src/templates/.prettierignore +0 -1
  28. package/src/templates/.prettierrc +0 -23
  29. package/src/templates/LICENSE +0 -0
  30. package/src/templates/README.md +0 -121
  31. package/src/templates/bunfig.toml +0 -2
  32. package/src/templates/ecosystem.config.cjs +0 -26
  33. package/src/templates/package.json +0 -55
  34. package/src/templates/src/base/general.ts +0 -3
  35. package/src/templates/src/base/guard.ts +0 -3
  36. package/src/templates/src/base/page.ts +0 -3
  37. package/src/templates/src/base/repository.ts +0 -1
  38. package/src/templates/src/base/service.ts +0 -1
  39. package/src/templates/src/core/bot.ts +0 -22
  40. package/src/templates/src/db/index.ts +0 -3
  41. package/src/templates/src/env.d.ts +0 -8
  42. package/src/templates/src/guards/user.ts +0 -19
  43. package/src/templates/src/index.ts +0 -17
  44. package/src/templates/src/pages/general-error-input-notfound.ts +0 -34
  45. package/src/templates/src/pages/general-error.ts +0 -51
  46. package/src/templates/src/pages/help.ts +0 -56
  47. package/src/templates/src/pages/start.ts +0 -63
  48. package/src/templates/src/pages/username-notfound.ts +0 -41
  49. package/src/templates/src/repositories/example.ts +0 -5
  50. package/src/templates/src/services/example.ts +0 -4
  51. package/src/templates/src/templates/example.html +0 -7
  52. package/src/templates/src/threads/main.ts +0 -9
  53. package/src/templates/src/utils/log.ts +0 -3
  54. package/src/templates/tsconfig.json +0 -38
  55. package/src/utils/logger.ts +0 -3
  56. /package/dist/src/templates/{ecosystem.config.cjs → ecosystem.config.js} +0 -0
package/src/create.ts DELETED
@@ -1,415 +0,0 @@
1
- import * as fs from "fs"
2
- import * as path from "path"
3
- import { log } from "./utils/logger"
4
- import { spawn } from "child_process"
5
- import enquirer from "enquirer"
6
-
7
- type Runtime = `bun` | `node`
8
- type PackageManager = `bun` | `npm` | `pnpm` | `yarn`
9
- type ProjectConfig = {
10
- projectName: string
11
- projectPath: string
12
- packageManager: PackageManager
13
- runtime: Runtime
14
- setupEslint: boolean
15
- }
16
-
17
- export class Create {
18
- private config: ProjectConfig | undefined
19
-
20
- public constructor(private projectDirectory?: string, private version?: string) {
21
- // Constructor hanya menerima parameter, tidak melakukan execution
22
- }
23
-
24
- public printBanner() {
25
- const banner = `
26
- $$$$$$\\ $$\\
27
- $$ __$$\\ $$ |
28
- $$ / \\__| $$$$$$\\ $$$$$$\\ $$$$$$\\$$$$\\ $$$$$$$\\ $$$$$$\\ $$$$$$\\ $$\\ $$\\
29
- $$ |$$$$\\ $$ __$$\\ \\____$$\\ $$ _$$ _$$\\ $$ _____|\\_$$ _| \\____$$\\ \\$$\\ $$ |
30
- $$ |\\_$$ |$$ | \\__|$$$$$$$ |$$ / $$ / $$ |\\$$$$$$\\ $$ | $$$$$$$ | \\$$$$ /
31
- $$ | $$ |$$ | $$ __$$ |$$ | $$ | $$ | \\____$$\\ $$ |$$\\ $$ __$$ | $$ $$<
32
- \\$$$$$$ |$$ | \\$$$$$$$ |$$ | $$ | $$ |$$$$$$$ | \\$$$$ |\\$$$$$$$ |$$ /\\$$\\
33
- \\______/ \\__| \\_______|\\__| \\__| \\__|\\_______/ \\____/ \\_______|\\__/ \\__|
34
-
35
- `
36
- console.log(banner)
37
- }
38
-
39
- private getPackageManagerCommands(packageManager: PackageManager) {
40
- const commands = {
41
- bun: {
42
- install: `bun install`,
43
- dev: `bun dev`,
44
- start: `bun start`,
45
- "pm2:start": `bun run pm2:start`,
46
- "pm2:stop": `bun run pm2:stop`,
47
- "pm2:restart": `bun run pm2:restart`,
48
- "pm2:delete": `bun run pm2:delete`,
49
- "pm2:logs": `bun run pm2:logs`,
50
- "pm2:monit": `bun run pm2:monit`
51
- },
52
- npm: {
53
- install: `npm install`,
54
- dev: `npm run dev`,
55
- start: `npm start`,
56
- "pm2:start": `npm run pm2:start`,
57
- "pm2:stop": `npm run pm2:stop`,
58
- "pm2:restart": `npm run pm2:restart`,
59
- "pm2:delete": `npm run pm2:delete`,
60
- "pm2:logs": `npm run pm2:logs`,
61
- "pm2:monit": `npm run pm2:monit`
62
- },
63
- pnpm: {
64
- install: `pnpm install`,
65
- dev: `pnpm dev`,
66
- start: `pnpm start`,
67
- "pm2:start": `pnpm pm2:start`,
68
- "pm2:stop": `pnpm pm2:stop`,
69
- "pm2:restart": `pnpm pm2:restart`,
70
- "pm2:delete": `pnpm pm2:delete`,
71
- "pm2:logs": `pnpm pm2:logs`,
72
- "pm2:monit": `pnpm pm2:monit`
73
- },
74
- yarn: {
75
- install: `yarn install`,
76
- dev: `yarn dev`,
77
- start: `yarn start`,
78
- "pm2:start": `yarn pm2:start`,
79
- "pm2:stop": `yarn pm2:stop`,
80
- "pm2:restart": `yarn pm2:restart`,
81
- "pm2:delete": `yarn pm2:delete`,
82
- "pm2:logs": `yarn pm2:logs`,
83
- "pm2:monit": `yarn pm2:monit`
84
- }
85
- }
86
- return commands[packageManager]
87
- }
88
-
89
- /**
90
- * Recursively copy directory structure
91
- */
92
- private copyDirectorySync(source: string, destination: string, variables: Record<string, string> = {}) {
93
- // Create destination directory if it doesn't exist
94
- if (!fs.existsSync(destination)) {
95
- fs.mkdirSync(destination, { recursive: true })
96
- }
97
-
98
- // Read all items in source directory
99
- const items = fs.readdirSync(source, { withFileTypes: true })
100
-
101
- for (const item of items) {
102
- const sourcePath = path.join(source, item.name)
103
- const destPath = path.join(destination, item.name)
104
-
105
- if (item.isDirectory()) {
106
- // Recursively copy subdirectories
107
- this.copyDirectorySync(sourcePath, destPath, variables)
108
- } else if (item.isFile()) {
109
- // Copy file and replace variables if needed
110
- let content = fs.readFileSync(sourcePath, `utf-8`)
111
-
112
- // Replace template variables in content
113
- content = this.replaceTemplateVariables(content, variables)
114
-
115
- fs.writeFileSync(destPath, content)
116
- }
117
- }
118
- }
119
-
120
- /**
121
- * Replace template variables in content
122
- */
123
- private replaceTemplateVariables(content: string, variables: Record<string, string>): string {
124
- let result = content
125
- for (const [key, value] of Object.entries(variables)) {
126
- result = result.replace(new RegExp(`{{${key}}}`, `g`), value)
127
- }
128
- return result
129
- }
130
-
131
- private async promptForProjectName(): Promise<string> {
132
- const response = await enquirer.prompt<{ projectName: string }>({
133
- type: `input`,
134
- name: `projectName`,
135
- message: `What is your project named?`,
136
- initial: ``,
137
- validate: (value: string) => {
138
- if (value === ``) {
139
- return true
140
- }
141
-
142
- if (!/^[a-z0-9-_]+$/i.test(value)) {
143
- return `Project name can only contain letters, numbers, hyphens, and underscores`
144
- }
145
- return true
146
- }
147
- })
148
-
149
- return response.projectName
150
- }
151
-
152
- private async promptForConfiguration(): Promise<{ packageManager: PackageManager; runtime: Runtime; eslint: boolean }> {
153
- const questions: any[] = []
154
-
155
- // Package manager selection
156
- questions.push({
157
- type: `select`,
158
- name: `packageManager`,
159
- message: `Which package manager would you like to use?`,
160
- choices: [
161
- { name: `bun`, message: `Bun (recommended)`, value: `bun` },
162
- { name: `npm`, message: `npm`, value: `npm` },
163
- { name: `pnpm`, message: `pnpm`, value: `pnpm` },
164
- { name: `yarn`, message: `Yarn`, value: `yarn` }
165
- ],
166
- initial: 0
167
- })
168
-
169
- // Runtime selection
170
- questions.push({
171
- type: `select`,
172
- name: `runtime`,
173
- message: `Which runtime would you like to use?`,
174
- choices: [
175
- { name: `bun`, message: `Bun (recommended)`, value: `bun` },
176
- { name: `node`, message: `Node.js`, value: `node` }
177
- ],
178
- initial: 0
179
- })
180
-
181
- // ESLint
182
- questions.push({
183
- type: `confirm`,
184
- name: `eslint`,
185
- message: `Would you like to use ESLint?`,
186
- initial: true
187
- })
188
-
189
- const answers = await enquirer.prompt<{
190
- packageManager?: PackageManager
191
- runtime: Runtime
192
- eslint?: boolean
193
- }>(questions)
194
-
195
- return {
196
- packageManager: answers.packageManager as any,
197
- runtime: answers.runtime,
198
- eslint: answers.eslint as boolean
199
- }
200
- }
201
-
202
- private async installDependencies(projectPath: string, packageManager: PackageManager): Promise<boolean> {
203
- return await new Promise((resolve, reject) => {
204
- const installCommand = packageManager
205
- const installArgs = [`install`]
206
- const installProcess = spawn(installCommand, installArgs, {
207
- cwd: projectPath,
208
- stdio: `inherit`,
209
- shell: true
210
- })
211
-
212
- installProcess.on(`close`, (code) => {
213
- if (code === 0) {
214
- resolve(true)
215
- } else {
216
- log.fail(`Dependencies installation failed`)
217
- resolve(false)
218
- }
219
- })
220
-
221
- installProcess.on(`error`, (error) => {
222
- log.fail(`Dependencies installation failed: ${error.message}`)
223
- resolve(false)
224
- })
225
- })
226
- }
227
-
228
- /**
229
- * Step 1: Gather all project configuration through prompts
230
- * NO EXECUTION - hanya mengumpulkan data dan validasi ringan
231
- */
232
- private async gatherProjectConfig(): Promise<ProjectConfig> {
233
- // Display ASCII art banner
234
- this.printBanner()
235
-
236
- // ========== PHASE 1: GET PROJECT NAME ==========
237
- let projectName = this.projectDirectory
238
- let projectPath: string
239
- let useCurrentDir = false
240
-
241
- if (!projectName) {
242
- // PROMPT untuk project name
243
- projectName = await this.promptForProjectName()
244
- if (projectName === ``) {
245
- // Empty name means use current directory
246
- projectName = path.basename(process.cwd())
247
- projectPath = process.cwd()
248
- useCurrentDir = true
249
- } else {
250
- projectPath = path.resolve(process.cwd(), projectName)
251
- useCurrentDir = false
252
- }
253
- } else {
254
- projectPath = path.resolve(process.cwd(), projectName)
255
- useCurrentDir = false
256
- }
257
-
258
- // PROMPT untuk configuration
259
- const config = await this.promptForConfiguration()
260
- const packageManager = config.packageManager
261
- const runtime = config.runtime
262
- const setupEslint = config.eslint
263
-
264
- // ========== SEMUA PROMPT SELESAI, SEKARANG VALIDASI ==========
265
- log.info(`Create-gramstax v${this.version}`)
266
- log.info(`Project: ${projectName}`)
267
- log.info(`Location: ${projectPath}`)
268
- log.info(`Package Manager: ${packageManager}`)
269
- log.info(`Runtime: ${runtime}`)
270
- log.info(`ESLint: ${setupEslint ? `Yes` : `No`}`)
271
-
272
- // Validasi setelah semua prompt selesai
273
- if (useCurrentDir) {
274
- // Check if current directory is empty
275
- const files = fs.readdirSync(projectPath)
276
- if (files.length > 0) {
277
- log.error(`Current directory is not empty!`)
278
- process.exit(1)
279
- }
280
- } else {
281
- // Check if directory already exists
282
- if (fs.existsSync(projectPath)) {
283
- log.error(`Directory "${projectName}" already exists!`)
284
- process.exit(1)
285
- }
286
- }
287
-
288
- return {
289
- projectName,
290
- projectPath,
291
- packageManager,
292
- runtime,
293
- setupEslint
294
- }
295
- }
296
-
297
- /**
298
- * Step 2: Execute project generation based on gathered config
299
- */
300
- private async executeProjectGeneration(config: ProjectConfig): Promise<void> {
301
- const { projectName, projectPath, packageManager, runtime, setupEslint } = config
302
-
303
- // Task 1: Create project directory
304
- log.info(`Creating project directory..`)
305
- if (!fs.existsSync(projectPath)) {
306
- fs.mkdirSync(projectPath, { recursive: true })
307
- }
308
-
309
- // Task 2: Copy template files
310
- log.info(`Copying template files..`)
311
- const templatesPath = path.join(__dirname, `templates`)
312
- const commands = this.getPackageManagerCommands(packageManager)
313
-
314
- const variables = {
315
- projectName,
316
- installCmd: commands.install,
317
- runDevCmd: commands.dev,
318
- runStartCmd: commands.start,
319
- runPm2StartCmd: commands[`pm2:start`],
320
- runPm2StopCmd: commands[`pm2:stop`],
321
- runPm2RestartCmd: commands[`pm2:restart`],
322
- runPm2DeleteCmd: commands[`pm2:delete`],
323
- runPm2LogsCmd: commands[`pm2:logs`],
324
- runPm2MonitCmd: commands[`pm2:monit`]
325
- }
326
-
327
- this.copyDirectorySync(templatesPath, projectPath, variables)
328
-
329
- // Task 3: Create logs directory
330
- log.info(`Creating logs directory..`)
331
- fs.mkdirSync(path.join(projectPath, `logs`), { recursive: true })
332
- fs.writeFileSync(path.join(projectPath, `logs/.gitkeep`), ``)
333
-
334
- // Task 4: Create .env.example
335
- const envPath = path.join(projectPath, `.env`)
336
- const envExamplePath = path.join(projectPath, `.env.example`)
337
- if (fs.existsSync(envExamplePath)) {
338
- log.info(`Creating .env file..`)
339
- fs.renameSync(envExamplePath, envPath)
340
- }
341
-
342
- // Task 5: Remove bunfig.toml if runtime is NOT bun
343
- if (runtime !== `bun`) {
344
- log.info(`Removing bunfig.toml for Node.js runtime..`)
345
- const bunfigPath = path.join(projectPath, `bunfig.toml`)
346
- if (fs.existsSync(bunfigPath)) {
347
- fs.unlinkSync(bunfigPath)
348
- }
349
- }
350
-
351
- // Task 6: Install dependencies
352
- log.info(`Installing dependencies..`)
353
- if (!(await this.installDependencies(projectPath, packageManager))) {
354
- log.fail(`Project created failed!`)
355
- return process.exit()
356
- }
357
-
358
- // Task 7: Setup ESLint if requested
359
- if (setupEslint) {
360
- log.info(`Setting up ESLint..`)
361
- await this.setupEslintConfig(projectPath, packageManager)
362
- }
363
-
364
- // Final success message
365
- log.info(`Project created successfully!`)
366
- log.info(`Next steps: ${config.projectPath !== process.cwd() ? `cd ${projectName} && ` : ` `}${commands.install} && ${commands.dev}`)
367
- log.info(`For production: ${commands[`pm2:start`]}`)
368
- log.info(`Done..`)
369
- }
370
-
371
- private async setupEslintConfig(projectPath: string, packageManager: PackageManager): Promise<void> {
372
- return new Promise((resolve) => {
373
- const initProcess = spawn(`npm`, [`init`, `@eslint/config@latest`], {
374
- cwd: projectPath,
375
- stdio: `inherit`,
376
- shell: true
377
- })
378
-
379
- initProcess.on(`close`, (code) => {
380
- if (code === 0) {
381
- resolve()
382
- } else {
383
- log.fail(`ESLint setup failed. You can set it up later with: npm init @eslint/config`)
384
- resolve()
385
- }
386
- })
387
-
388
- initProcess.on(`error`, (error) => {
389
- log.fail(`ESLint setup failed: ${error.message}`)
390
- log.info(`You can set it up later with: npm init @eslint/config`)
391
- resolve()
392
- })
393
- })
394
- }
395
-
396
- /**
397
- * Main public method: Prompt first, then execute
398
- */
399
- public async createProject() {
400
- try {
401
- // Step 1: Gather all configuration through prompts
402
- this.config = await this.gatherProjectConfig()
403
-
404
- // Step 2: Execute project generation with the gathered config
405
- await this.executeProjectGeneration(this.config)
406
- } catch (error) {
407
- if (error instanceof Error) {
408
- log.error(`Failed to create project: ${error.message}`)
409
- } else {
410
- log.error(`Failed to create project: ${String(error)}`)
411
- }
412
- process.exit(1)
413
- }
414
- }
415
- }
package/src/index.ts DELETED
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
- import * as fs from "fs"
3
- import * as path from "path"
4
- import { log } from "./utils/logger"
5
- import { Create } from "./create"
6
- import { Command } from "commander"
7
-
8
- // Read version from package.json
9
- const packageJsonPath = path.join(__dirname, `../package.json`)
10
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, `utf-8`))
11
- const version = packageJson.version || `0.0.0`
12
- const program = new Command()
13
-
14
- program
15
- .name(`create-gramstax`)
16
- .description(`CLI to create a new Gramstax Telegram bot project`)
17
- .version(version)
18
- .argument(`[project-directory]`, `Directory to create the project in`)
19
- .action(async (projectDirectory?: string) => {
20
- try {
21
- await new Create(projectDirectory, version).createProject()
22
- } catch (error) {
23
- log.error(`Failed to create project: ${String(error)}`)
24
- process.exit(1)
25
- }
26
- })
27
-
28
- program.parse()
@@ -1,17 +0,0 @@
1
- # Telegram Bot Token
2
- BOT_TOKEN=your_bot_token_here
3
-
4
- # Bot Deployment Mode
5
- # Options:
6
- # - polling (default, recommended for development)
7
- # - webhook:https://yourdomain.com (for production)
8
- BOT_DEPLOY=polling
9
-
10
- # Environment
11
- NODE_ENV=development
12
-
13
- # Cache configuration for session
14
- # Options:
15
- # - memory
16
- # - redis://... (use redis)
17
- CACHE_SESSION=memory
@@ -1 +0,0 @@
1
- *.html
@@ -1,23 +0,0 @@
1
- {
2
- "overrides": [
3
- {
4
- "files": "*.{json,sol}",
5
- "options": {
6
- "tabWidth": 2,
7
- "printWidth": 200
8
- }
9
- },
10
- {
11
- "files": "*.{ts,js}",
12
- "options": {
13
- "printWidth": 300,
14
- "tabWidth": 2,
15
- "useTabs": false,
16
- "semi": false,
17
- "arrowParens": "always",
18
- "trailingComma": "none",
19
- "bracketSameLine": false
20
- }
21
- }
22
- ]
23
- }
File without changes
@@ -1,121 +0,0 @@
1
- # {{projectName}}
2
-
3
- A Telegram bot built with Gramstax framework.
4
-
5
- ## Getting Started
6
-
7
- ### Development
8
-
9
- 1. Install dependencies:
10
-
11
- ```bash
12
- {{installCmd}}
13
- ```
14
-
15
- 2. Set up your environment variables:
16
-
17
- Copy `.env.example` to `.env` and add your Telegram bot token:
18
-
19
- ```bash
20
- BOT_TOKEN=your_bot_token_here
21
- ```
22
-
23
- 3. Run the development server:
24
-
25
- ```bash
26
- {{runDevCmd}}
27
- ```
28
-
29
- ### Production
30
-
31
- #### Using PM2 (Recommended)
32
-
33
- PM2 is a production process manager for Node.js applications with built-in load balancer.
34
-
35
- 1. Install dependencies:
36
-
37
- ```bash
38
- {{installCmd}}
39
- ```
40
-
41
- 2. Set up production environment:
42
-
43
- ```bash
44
- cp .env.example .env
45
- # Edit .env with your production BOT_TOKEN
46
- ```
47
-
48
- 3. Start with PM2:
49
-
50
- ```bash
51
- {{runPm2StartCmd}}
52
- ```
53
-
54
- 4. PM2 Management Commands:
55
-
56
- ```bash
57
- # View logs
58
- {{runPm2LogsCmd}}
59
-
60
- # Monitor processes
61
- {{runPm2MonitCmd}}
62
-
63
- # Restart bot
64
- {{runPm2RestartCmd}}
65
-
66
- # Stop bot
67
- {{runPm2StopCmd}}
68
-
69
- # Delete from PM2
70
- {{runPm2DeleteCmd}}
71
- ```
72
-
73
- 5. Setup PM2 to start on system boot:
74
-
75
- ```bash
76
- pm2 startup
77
- pm2 save
78
- ```
79
-
80
- #### Using Bun directly
81
-
82
- ```bash
83
- {{runStartCmd}}
84
- ```
85
-
86
- ## Project Structure
87
-
88
- - `src/base/` - Base classes for your bot components
89
- - `src/core/` - Core bot configuration and hooks
90
- - `src/pages/` - Bot pages/screens
91
- - `src/guards/` - Route guards and middleware
92
- - `src/services/` - Business logic services
93
- - `src/repositories/` - Data access layer
94
- - `src/templates/` - Message templates
95
- - `src/utils/` - Utility functions
96
- - `logs/` - Application logs (created automatically)
97
-
98
- ## Configuration
99
-
100
- ### Environment Variables
101
-
102
- - `BOT_TOKEN` - Your Telegram bot token (required)
103
- - `NODE_ENV` - Environment mode (development/production)
104
- - `CACHE_SESSION` - Cache type configuration (optional)
105
-
106
- ### PM2 Configuration
107
-
108
- The `ecosystem.config.cjs` file contains PM2 configuration:
109
-
110
- - **instances**: Number of instances (default: 1)
111
- - **exec_mode**: Execution mode (cluster/fork)
112
- - **max_memory_restart**: Auto-restart if memory exceeds limit
113
- - **autorestart**: Auto-restart on crash
114
- - **error_file/out_file**: Log file locations
115
-
116
- ## Learn More
117
-
118
- - [Gramstax Documentation](https://github.com/gramstax/gramstax)
119
- - [Grammy Documentation](https://grammy.dev/)
120
- - [Telegram Bot API](https://core.telegram.org/bots/api)
121
- - [PM2 Documentation](https://pm2.keymetrics.io/)
@@ -1,2 +0,0 @@
1
- [run]
2
- console.depth = 4
@@ -1,26 +0,0 @@
1
- module.exports = {
2
- apps: [
3
- {
4
- name: `{{projectName}}`, // Process name (appears in 'pm2 list')
5
- script: `bun`, // Main command to run (using Bun runtime)
6
- args: `src/index.ts`, // Arguments for the command (entry file)
7
- instances: 1, // Number of instances (use 'max' for multi-core)
8
- exec_mode: `fork`, // Cluster mode (PM2 will balance across cores)
9
- autorestart: true, // Automatically restart if the process crashes
10
- watch: false, // Disable auto-reload on file changes (set true for dev)
11
- max_memory_restart: undefined, // Restart if memory usage exceeds (default undefined)
12
- env: {
13
- NODE_ENV: `production`, // Default environment variables
14
- },
15
- env_production: {
16
- NODE_ENV: `production`, // Environment variables for production mode
17
- },
18
- error_file: `./logs/err.log`, // Error log file
19
- out_file: `./logs/out.log`, // Standard output log file
20
- log_file: `./logs/combined.log`, // Combined log file
21
- time: false, // Add timestamps to logs
22
- merge_logs: false, // Merge logs from multiple instances
23
- log_date_format: `YYYY-MM-DD HH:mm:ss Z`, // Log date format
24
- },
25
- ],
26
- };
@@ -1,55 +0,0 @@
1
- {
2
- "name": "{{projectName}}",
3
- "version": "0.1.0",
4
- "private": true,
5
- "description": "",
6
- "type": "module",
7
- "repository": {
8
- "type": "git",
9
- "url": ""
10
- },
11
- "bugs": {
12
- "url": ""
13
- },
14
- "homepage": "",
15
- "author": "",
16
- "license": "MIT",
17
- "main": "./dist/src/index.js",
18
- "types": "./dist/src/index.d.ts",
19
- "exports": {
20
- ".": {
21
- "types": "./dist/src/index.d.ts",
22
- "import": "./dist/src/index.js",
23
- "default": "./dist/src/index.js"
24
- }
25
- },
26
- "files": [
27
- "dist",
28
- "src"
29
- ],
30
- "scripts": {
31
- "dev": "bun --watch src/index.ts",
32
- "start": "bun src/index.ts",
33
- "build": "bun build src/index.ts --outdir dist --target bun",
34
- "lint": "eslint '**/*.ts'",
35
- "lint:fix": "eslint '**/*.ts' --fix",
36
- "pm2:start": "pm2 start ecosystem.config.cjs",
37
- "pm2:stop": "pm2 stop ecosystem.config.cjs",
38
- "pm2:restart": "pm2 restart ecosystem.config.cjs",
39
- "pm2:delete": "pm2 delete ecosystem.config.cjs",
40
- "pm2:logs": "pm2 logs",
41
- "pm2:monit": "pm2 monit"
42
- },
43
- "dependencies": {
44
- "gramstax": "latest",
45
- "grammy": "^1.38.3",
46
- "logging-pretty": "^3.0.0"
47
- },
48
- "peerDependencies": {
49
- "typescript": "latest"
50
- },
51
- "devDependencies": {
52
- "@types/bun": "latest",
53
- "pm2": "^5.3.0"
54
- }
55
- }
@@ -1,3 +0,0 @@
1
- import { BaseGeneral } from "gramstax"
2
-
3
- export abstract class GeneralBase extends BaseGeneral {}