@devbro/pashmak 0.1.57 → 0.1.58

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.
@@ -2717,8 +2717,34 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2717
2717
  executor = "";
2718
2718
  packageManager = "";
2719
2719
  linter = "";
2720
- validation_library = "";
2721
- database_type = "";
2720
+ validation_library = import_clipanion10.Option.String("--validation-library", {
2721
+ description: "Validation library to use (yup, zod, none)",
2722
+ required: false
2723
+ });
2724
+ database_type = import_clipanion10.Option.String("--database-type", {
2725
+ description: "Database type to use (postgresql, mysql, sqlite)",
2726
+ required: false
2727
+ });
2728
+ cache_library = import_clipanion10.Option.String("--cache-library", {
2729
+ description: "Cache library to use (redis, memcached, none)",
2730
+ required: false
2731
+ });
2732
+ mailer_library = import_clipanion10.Option.String("--mailer-library", {
2733
+ description: "Mailer library to use (@aws-sdk/client-ses, nodemailer, none)",
2734
+ required: false
2735
+ });
2736
+ queue_library = import_clipanion10.Option.String("--queue-library", {
2737
+ description: "Queue library to use (@aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none)",
2738
+ required: false
2739
+ });
2740
+ storage_library = import_clipanion10.Option.String("--storage-library", {
2741
+ description: "Storage library to use (@aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none)",
2742
+ required: false
2743
+ });
2744
+ initGit = import_clipanion10.Option.Boolean("--git", {
2745
+ description: "Initialize a git repository (use --no-git to skip)",
2746
+ required: false
2747
+ });
2722
2748
  async folderExists(folderPath) {
2723
2749
  try {
2724
2750
  const stats = await fs7.stat(folderPath);
@@ -2872,7 +2898,7 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2872
2898
  await fs7.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
2873
2899
  }
2874
2900
  async setupGeneralPackages() {
2875
- this.validation_library = await (0, import_prompts.select)({
2901
+ this.validation_library = this.validation_library ?? await (0, import_prompts.select)({
2876
2902
  message: "Select a package you want for validation",
2877
2903
  choices: [
2878
2904
  {
@@ -2893,8 +2919,15 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2893
2919
  }
2894
2920
  ]
2895
2921
  });
2896
- this.validation_library === "none" || await this.addPackage(this.validation_library);
2897
- this.database_type = await (0, import_prompts.select)({
2922
+ if (this.validation_library === "yup" || this.validation_library === "zod") {
2923
+ await this.addPackage(this.validation_library);
2924
+ } else if (this.validation_library === "none") {
2925
+ } else {
2926
+ throw new Error(
2927
+ "unexpected validation library: " + this.validation_library + ". Valid options are: yup, zod, none"
2928
+ );
2929
+ }
2930
+ this.database_type = this.database_type ?? await (0, import_prompts.select)({
2898
2931
  message: "Select a database type (you can add more databases later)",
2899
2932
  choices: [
2900
2933
  {
@@ -2920,6 +2953,179 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2920
2953
  await this.addPackage("mysql2");
2921
2954
  } else if (this.database_type === "sqlite") {
2922
2955
  await this.addPackage("sqlite3");
2956
+ } else {
2957
+ throw new Error(
2958
+ "unexpected database type: " + this.database_type + ". Valid options are: postgresql, mysql, sqlite"
2959
+ );
2960
+ }
2961
+ this.cache_library = this.cache_library ?? await (0, import_prompts.select)({
2962
+ message: "Select a cache library",
2963
+ choices: [
2964
+ {
2965
+ name: "Redis",
2966
+ value: "redis",
2967
+ description: "Redis client for Node.js"
2968
+ },
2969
+ {
2970
+ name: "Memcached",
2971
+ value: "memcached",
2972
+ description: "Memcached client for Node.js"
2973
+ },
2974
+ new import_prompts.Separator(),
2975
+ {
2976
+ name: "None",
2977
+ value: "none",
2978
+ disabled: false
2979
+ }
2980
+ ]
2981
+ });
2982
+ if (this.cache_library === "redis") {
2983
+ await this.addPackage("redis");
2984
+ } else if (this.cache_library === "memcached") {
2985
+ await this.addPackage("memcached");
2986
+ } else if (this.cache_library === "none") {
2987
+ } else {
2988
+ throw new Error(
2989
+ "unexpected cache library: " + this.cache_library + ". Valid options are: redis, memcached, none"
2990
+ );
2991
+ }
2992
+ this.mailer_library = this.mailer_library ?? await (0, import_prompts.select)({
2993
+ message: "Select a mailer library",
2994
+ choices: [
2995
+ {
2996
+ name: "AWS SES",
2997
+ value: "@aws-sdk/client-ses",
2998
+ description: "AWS SDK for JavaScript v3 - SES client"
2999
+ },
3000
+ {
3001
+ name: "Nodemailer",
3002
+ value: "nodemailer",
3003
+ description: "Send emails with Node.js"
3004
+ },
3005
+ new import_prompts.Separator(),
3006
+ {
3007
+ name: "None",
3008
+ value: "none",
3009
+ disabled: false
3010
+ }
3011
+ ]
3012
+ });
3013
+ if (this.mailer_library === "@aws-sdk/client-ses") {
3014
+ await this.addPackage("@aws-sdk/client-ses");
3015
+ } else if (this.mailer_library === "nodemailer") {
3016
+ await this.addPackage("nodemailer");
3017
+ await this.addPackage("@types/nodemailer", true);
3018
+ } else if (this.mailer_library === "none") {
3019
+ } else {
3020
+ throw new Error(
3021
+ "unexpected mailer library: " + this.mailer_library + ". Valid options are: @aws-sdk/client-ses, nodemailer, none"
3022
+ );
3023
+ }
3024
+ this.queue_library = this.queue_library ?? await (0, import_prompts.select)({
3025
+ message: "Select a queue library",
3026
+ choices: [
3027
+ {
3028
+ name: "AWS SQS",
3029
+ value: "@aws-sdk/client-sqs",
3030
+ description: "AWS SDK for JavaScript v3 - SQS client"
3031
+ },
3032
+ {
3033
+ name: "Azure Service Bus",
3034
+ value: "@azure/service-bus",
3035
+ description: "Azure Service Bus client for Node.js"
3036
+ },
3037
+ {
3038
+ name: "Google Cloud Pub/Sub",
3039
+ value: "@google-cloud/pubsub",
3040
+ description: "Google Cloud Pub/Sub client for Node.js"
3041
+ },
3042
+ {
3043
+ name: "RabbitMQ (amqplib)",
3044
+ value: "amqplib",
3045
+ description: "AMQP 0-9-1 client for Node.js"
3046
+ },
3047
+ {
3048
+ name: "Redis",
3049
+ value: "redis",
3050
+ description: "Redis client for Node.js"
3051
+ },
3052
+ new import_prompts.Separator(),
3053
+ {
3054
+ name: "None",
3055
+ value: "none",
3056
+ disabled: false
3057
+ }
3058
+ ]
3059
+ });
3060
+ if (this.queue_library === "@aws-sdk/client-sqs") {
3061
+ await this.addPackage("@aws-sdk/client-sqs");
3062
+ } else if (this.queue_library === "@azure/service-bus") {
3063
+ await this.addPackage("@azure/service-bus");
3064
+ } else if (this.queue_library === "@google-cloud/pubsub") {
3065
+ await this.addPackage("@google-cloud/pubsub");
3066
+ } else if (this.queue_library === "amqplib") {
3067
+ await this.addPackage("amqplib");
3068
+ await this.addPackage("@types/amqplib", true);
3069
+ } else if (this.queue_library === "redis") {
3070
+ await this.addPackage("redis");
3071
+ } else if (this.queue_library === "none") {
3072
+ } else {
3073
+ throw new Error(
3074
+ "unexpected queue library: " + this.queue_library + ". Valid options are: @aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none"
3075
+ );
3076
+ }
3077
+ this.storage_library = this.storage_library ?? await (0, import_prompts.select)({
3078
+ message: "Select a storage library",
3079
+ choices: [
3080
+ {
3081
+ name: "@aws-sdk/client-s3",
3082
+ value: "@aws-sdk/client-s3",
3083
+ description: "AWS SDK for JavaScript v3 - S3 client"
3084
+ },
3085
+ {
3086
+ name: "@azure/storage-blob",
3087
+ value: "@azure/storage-blob",
3088
+ description: "Azure Storage Blob client for Node.js"
3089
+ },
3090
+ {
3091
+ name: "@google-cloud/storage",
3092
+ value: "@google-cloud/storage",
3093
+ description: "Google Cloud Storage client for Node.js"
3094
+ },
3095
+ {
3096
+ name: "basic-ftp",
3097
+ value: "basic-ftp",
3098
+ description: "FTP client for Node.js"
3099
+ },
3100
+ {
3101
+ name: "ssh2-sftp-client",
3102
+ value: "ssh2-sftp-client",
3103
+ description: "SFTP client for Node.js"
3104
+ },
3105
+ new import_prompts.Separator(),
3106
+ {
3107
+ name: "None",
3108
+ value: "none",
3109
+ disabled: false
3110
+ }
3111
+ ]
3112
+ });
3113
+ if (this.storage_library === "@aws-sdk/client-s3") {
3114
+ await this.addPackage("@aws-sdk/client-s3");
3115
+ } else if (this.storage_library === "@azure/storage-blob") {
3116
+ await this.addPackage("@azure/storage-blob");
3117
+ } else if (this.storage_library === "@google-cloud/storage") {
3118
+ await this.addPackage("@google-cloud/storage");
3119
+ } else if (this.storage_library === "basic-ftp") {
3120
+ await this.addPackage("basic-ftp");
3121
+ } else if (this.storage_library === "ssh2-sftp-client") {
3122
+ await this.addPackage("ssh2-sftp-client");
3123
+ await this.addPackage("@types/ssh2-sftp-client", true);
3124
+ } else if (this.storage_library === "none") {
3125
+ } else {
3126
+ throw new Error(
3127
+ "unexpected storage library: " + this.storage_library + " . Valid options are: @aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none"
3128
+ );
2923
3129
  }
2924
3130
  await this.addPackage("@devbro/pashmak tsconfig-paths dotenv ");
2925
3131
  await this.addPackage(
@@ -2976,7 +3182,7 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2976
3182
  });
2977
3183
  }
2978
3184
  async setupGit() {
2979
- const initGit = await (0, import_prompts.select)({
3185
+ this.initGit = this.initGit ?? await (0, import_prompts.select)({
2980
3186
  message: "Initialize a git repository?",
2981
3187
  choices: [
2982
3188
  {
@@ -2991,7 +3197,7 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2991
3197
  }
2992
3198
  ]
2993
3199
  });
2994
- if (initGit) {
3200
+ if (this.initGit) {
2995
3201
  const gitignoreContent = [
2996
3202
  "node_modules/",
2997
3203
  "dist/",
@@ -61,8 +61,34 @@ var CreateProjectCommand = class extends import_clipanion.Command {
61
61
  executor = "";
62
62
  packageManager = "";
63
63
  linter = "";
64
- validation_library = "";
65
- database_type = "";
64
+ validation_library = import_clipanion.Option.String("--validation-library", {
65
+ description: "Validation library to use (yup, zod, none)",
66
+ required: false
67
+ });
68
+ database_type = import_clipanion.Option.String("--database-type", {
69
+ description: "Database type to use (postgresql, mysql, sqlite)",
70
+ required: false
71
+ });
72
+ cache_library = import_clipanion.Option.String("--cache-library", {
73
+ description: "Cache library to use (redis, memcached, none)",
74
+ required: false
75
+ });
76
+ mailer_library = import_clipanion.Option.String("--mailer-library", {
77
+ description: "Mailer library to use (@aws-sdk/client-ses, nodemailer, none)",
78
+ required: false
79
+ });
80
+ queue_library = import_clipanion.Option.String("--queue-library", {
81
+ description: "Queue library to use (@aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none)",
82
+ required: false
83
+ });
84
+ storage_library = import_clipanion.Option.String("--storage-library", {
85
+ description: "Storage library to use (@aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none)",
86
+ required: false
87
+ });
88
+ initGit = import_clipanion.Option.Boolean("--git", {
89
+ description: "Initialize a git repository (use --no-git to skip)",
90
+ required: false
91
+ });
66
92
  async folderExists(folderPath) {
67
93
  try {
68
94
  const stats = await fs.stat(folderPath);
@@ -216,7 +242,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
216
242
  await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
217
243
  }
218
244
  async setupGeneralPackages() {
219
- this.validation_library = await (0, import_prompts.select)({
245
+ this.validation_library = this.validation_library ?? await (0, import_prompts.select)({
220
246
  message: "Select a package you want for validation",
221
247
  choices: [
222
248
  {
@@ -237,8 +263,15 @@ var CreateProjectCommand = class extends import_clipanion.Command {
237
263
  }
238
264
  ]
239
265
  });
240
- this.validation_library === "none" || await this.addPackage(this.validation_library);
241
- this.database_type = await (0, import_prompts.select)({
266
+ if (this.validation_library === "yup" || this.validation_library === "zod") {
267
+ await this.addPackage(this.validation_library);
268
+ } else if (this.validation_library === "none") {
269
+ } else {
270
+ throw new Error(
271
+ "unexpected validation library: " + this.validation_library + ". Valid options are: yup, zod, none"
272
+ );
273
+ }
274
+ this.database_type = this.database_type ?? await (0, import_prompts.select)({
242
275
  message: "Select a database type (you can add more databases later)",
243
276
  choices: [
244
277
  {
@@ -264,6 +297,179 @@ var CreateProjectCommand = class extends import_clipanion.Command {
264
297
  await this.addPackage("mysql2");
265
298
  } else if (this.database_type === "sqlite") {
266
299
  await this.addPackage("sqlite3");
300
+ } else {
301
+ throw new Error(
302
+ "unexpected database type: " + this.database_type + ". Valid options are: postgresql, mysql, sqlite"
303
+ );
304
+ }
305
+ this.cache_library = this.cache_library ?? await (0, import_prompts.select)({
306
+ message: "Select a cache library",
307
+ choices: [
308
+ {
309
+ name: "Redis",
310
+ value: "redis",
311
+ description: "Redis client for Node.js"
312
+ },
313
+ {
314
+ name: "Memcached",
315
+ value: "memcached",
316
+ description: "Memcached client for Node.js"
317
+ },
318
+ new import_prompts.Separator(),
319
+ {
320
+ name: "None",
321
+ value: "none",
322
+ disabled: false
323
+ }
324
+ ]
325
+ });
326
+ if (this.cache_library === "redis") {
327
+ await this.addPackage("redis");
328
+ } else if (this.cache_library === "memcached") {
329
+ await this.addPackage("memcached");
330
+ } else if (this.cache_library === "none") {
331
+ } else {
332
+ throw new Error(
333
+ "unexpected cache library: " + this.cache_library + ". Valid options are: redis, memcached, none"
334
+ );
335
+ }
336
+ this.mailer_library = this.mailer_library ?? await (0, import_prompts.select)({
337
+ message: "Select a mailer library",
338
+ choices: [
339
+ {
340
+ name: "AWS SES",
341
+ value: "@aws-sdk/client-ses",
342
+ description: "AWS SDK for JavaScript v3 - SES client"
343
+ },
344
+ {
345
+ name: "Nodemailer",
346
+ value: "nodemailer",
347
+ description: "Send emails with Node.js"
348
+ },
349
+ new import_prompts.Separator(),
350
+ {
351
+ name: "None",
352
+ value: "none",
353
+ disabled: false
354
+ }
355
+ ]
356
+ });
357
+ if (this.mailer_library === "@aws-sdk/client-ses") {
358
+ await this.addPackage("@aws-sdk/client-ses");
359
+ } else if (this.mailer_library === "nodemailer") {
360
+ await this.addPackage("nodemailer");
361
+ await this.addPackage("@types/nodemailer", true);
362
+ } else if (this.mailer_library === "none") {
363
+ } else {
364
+ throw new Error(
365
+ "unexpected mailer library: " + this.mailer_library + ". Valid options are: @aws-sdk/client-ses, nodemailer, none"
366
+ );
367
+ }
368
+ this.queue_library = this.queue_library ?? await (0, import_prompts.select)({
369
+ message: "Select a queue library",
370
+ choices: [
371
+ {
372
+ name: "AWS SQS",
373
+ value: "@aws-sdk/client-sqs",
374
+ description: "AWS SDK for JavaScript v3 - SQS client"
375
+ },
376
+ {
377
+ name: "Azure Service Bus",
378
+ value: "@azure/service-bus",
379
+ description: "Azure Service Bus client for Node.js"
380
+ },
381
+ {
382
+ name: "Google Cloud Pub/Sub",
383
+ value: "@google-cloud/pubsub",
384
+ description: "Google Cloud Pub/Sub client for Node.js"
385
+ },
386
+ {
387
+ name: "RabbitMQ (amqplib)",
388
+ value: "amqplib",
389
+ description: "AMQP 0-9-1 client for Node.js"
390
+ },
391
+ {
392
+ name: "Redis",
393
+ value: "redis",
394
+ description: "Redis client for Node.js"
395
+ },
396
+ new import_prompts.Separator(),
397
+ {
398
+ name: "None",
399
+ value: "none",
400
+ disabled: false
401
+ }
402
+ ]
403
+ });
404
+ if (this.queue_library === "@aws-sdk/client-sqs") {
405
+ await this.addPackage("@aws-sdk/client-sqs");
406
+ } else if (this.queue_library === "@azure/service-bus") {
407
+ await this.addPackage("@azure/service-bus");
408
+ } else if (this.queue_library === "@google-cloud/pubsub") {
409
+ await this.addPackage("@google-cloud/pubsub");
410
+ } else if (this.queue_library === "amqplib") {
411
+ await this.addPackage("amqplib");
412
+ await this.addPackage("@types/amqplib", true);
413
+ } else if (this.queue_library === "redis") {
414
+ await this.addPackage("redis");
415
+ } else if (this.queue_library === "none") {
416
+ } else {
417
+ throw new Error(
418
+ "unexpected queue library: " + this.queue_library + ". Valid options are: @aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none"
419
+ );
420
+ }
421
+ this.storage_library = this.storage_library ?? await (0, import_prompts.select)({
422
+ message: "Select a storage library",
423
+ choices: [
424
+ {
425
+ name: "@aws-sdk/client-s3",
426
+ value: "@aws-sdk/client-s3",
427
+ description: "AWS SDK for JavaScript v3 - S3 client"
428
+ },
429
+ {
430
+ name: "@azure/storage-blob",
431
+ value: "@azure/storage-blob",
432
+ description: "Azure Storage Blob client for Node.js"
433
+ },
434
+ {
435
+ name: "@google-cloud/storage",
436
+ value: "@google-cloud/storage",
437
+ description: "Google Cloud Storage client for Node.js"
438
+ },
439
+ {
440
+ name: "basic-ftp",
441
+ value: "basic-ftp",
442
+ description: "FTP client for Node.js"
443
+ },
444
+ {
445
+ name: "ssh2-sftp-client",
446
+ value: "ssh2-sftp-client",
447
+ description: "SFTP client for Node.js"
448
+ },
449
+ new import_prompts.Separator(),
450
+ {
451
+ name: "None",
452
+ value: "none",
453
+ disabled: false
454
+ }
455
+ ]
456
+ });
457
+ if (this.storage_library === "@aws-sdk/client-s3") {
458
+ await this.addPackage("@aws-sdk/client-s3");
459
+ } else if (this.storage_library === "@azure/storage-blob") {
460
+ await this.addPackage("@azure/storage-blob");
461
+ } else if (this.storage_library === "@google-cloud/storage") {
462
+ await this.addPackage("@google-cloud/storage");
463
+ } else if (this.storage_library === "basic-ftp") {
464
+ await this.addPackage("basic-ftp");
465
+ } else if (this.storage_library === "ssh2-sftp-client") {
466
+ await this.addPackage("ssh2-sftp-client");
467
+ await this.addPackage("@types/ssh2-sftp-client", true);
468
+ } else if (this.storage_library === "none") {
469
+ } else {
470
+ throw new Error(
471
+ "unexpected storage library: " + this.storage_library + " . Valid options are: @aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none"
472
+ );
267
473
  }
268
474
  await this.addPackage("@devbro/pashmak tsconfig-paths dotenv ");
269
475
  await this.addPackage(
@@ -320,7 +526,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
320
526
  });
321
527
  }
322
528
  async setupGit() {
323
- const initGit = await (0, import_prompts.select)({
529
+ this.initGit = this.initGit ?? await (0, import_prompts.select)({
324
530
  message: "Initialize a git repository?",
325
531
  choices: [
326
532
  {
@@ -335,7 +541,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
335
541
  }
336
542
  ]
337
543
  });
338
- if (initGit) {
544
+ if (this.initGit) {
339
545
  const gitignoreContent = [
340
546
  "node_modules/",
341
547
  "dist/",