@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.
@@ -55,8 +55,34 @@ var CreateProjectCommand = class extends import_clipanion.Command {
55
55
  executor = "";
56
56
  packageManager = "";
57
57
  linter = "";
58
- validation_library = "";
59
- database_type = "";
58
+ validation_library = import_clipanion.Option.String("--validation-library", {
59
+ description: "Validation library to use (yup, zod, none)",
60
+ required: false
61
+ });
62
+ database_type = import_clipanion.Option.String("--database-type", {
63
+ description: "Database type to use (postgresql, mysql, sqlite)",
64
+ required: false
65
+ });
66
+ cache_library = import_clipanion.Option.String("--cache-library", {
67
+ description: "Cache library to use (redis, memcached, none)",
68
+ required: false
69
+ });
70
+ mailer_library = import_clipanion.Option.String("--mailer-library", {
71
+ description: "Mailer library to use (@aws-sdk/client-ses, nodemailer, none)",
72
+ required: false
73
+ });
74
+ queue_library = import_clipanion.Option.String("--queue-library", {
75
+ description: "Queue library to use (@aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none)",
76
+ required: false
77
+ });
78
+ storage_library = import_clipanion.Option.String("--storage-library", {
79
+ description: "Storage library to use (@aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none)",
80
+ required: false
81
+ });
82
+ initGit = import_clipanion.Option.Boolean("--git", {
83
+ description: "Initialize a git repository (use --no-git to skip)",
84
+ required: false
85
+ });
60
86
  async folderExists(folderPath) {
61
87
  try {
62
88
  const stats = await fs.stat(folderPath);
@@ -210,7 +236,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
210
236
  await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
211
237
  }
212
238
  async setupGeneralPackages() {
213
- this.validation_library = await (0, import_prompts.select)({
239
+ this.validation_library = this.validation_library ?? await (0, import_prompts.select)({
214
240
  message: "Select a package you want for validation",
215
241
  choices: [
216
242
  {
@@ -231,8 +257,15 @@ var CreateProjectCommand = class extends import_clipanion.Command {
231
257
  }
232
258
  ]
233
259
  });
234
- this.validation_library === "none" || await this.addPackage(this.validation_library);
235
- this.database_type = await (0, import_prompts.select)({
260
+ if (this.validation_library === "yup" || this.validation_library === "zod") {
261
+ await this.addPackage(this.validation_library);
262
+ } else if (this.validation_library === "none") {
263
+ } else {
264
+ throw new Error(
265
+ "unexpected validation library: " + this.validation_library + ". Valid options are: yup, zod, none"
266
+ );
267
+ }
268
+ this.database_type = this.database_type ?? await (0, import_prompts.select)({
236
269
  message: "Select a database type (you can add more databases later)",
237
270
  choices: [
238
271
  {
@@ -258,6 +291,179 @@ var CreateProjectCommand = class extends import_clipanion.Command {
258
291
  await this.addPackage("mysql2");
259
292
  } else if (this.database_type === "sqlite") {
260
293
  await this.addPackage("sqlite3");
294
+ } else {
295
+ throw new Error(
296
+ "unexpected database type: " + this.database_type + ". Valid options are: postgresql, mysql, sqlite"
297
+ );
298
+ }
299
+ this.cache_library = this.cache_library ?? await (0, import_prompts.select)({
300
+ message: "Select a cache library",
301
+ choices: [
302
+ {
303
+ name: "Redis",
304
+ value: "redis",
305
+ description: "Redis client for Node.js"
306
+ },
307
+ {
308
+ name: "Memcached",
309
+ value: "memcached",
310
+ description: "Memcached client for Node.js"
311
+ },
312
+ new import_prompts.Separator(),
313
+ {
314
+ name: "None",
315
+ value: "none",
316
+ disabled: false
317
+ }
318
+ ]
319
+ });
320
+ if (this.cache_library === "redis") {
321
+ await this.addPackage("redis");
322
+ } else if (this.cache_library === "memcached") {
323
+ await this.addPackage("memcached");
324
+ } else if (this.cache_library === "none") {
325
+ } else {
326
+ throw new Error(
327
+ "unexpected cache library: " + this.cache_library + ". Valid options are: redis, memcached, none"
328
+ );
329
+ }
330
+ this.mailer_library = this.mailer_library ?? await (0, import_prompts.select)({
331
+ message: "Select a mailer library",
332
+ choices: [
333
+ {
334
+ name: "AWS SES",
335
+ value: "@aws-sdk/client-ses",
336
+ description: "AWS SDK for JavaScript v3 - SES client"
337
+ },
338
+ {
339
+ name: "Nodemailer",
340
+ value: "nodemailer",
341
+ description: "Send emails with Node.js"
342
+ },
343
+ new import_prompts.Separator(),
344
+ {
345
+ name: "None",
346
+ value: "none",
347
+ disabled: false
348
+ }
349
+ ]
350
+ });
351
+ if (this.mailer_library === "@aws-sdk/client-ses") {
352
+ await this.addPackage("@aws-sdk/client-ses");
353
+ } else if (this.mailer_library === "nodemailer") {
354
+ await this.addPackage("nodemailer");
355
+ await this.addPackage("@types/nodemailer", true);
356
+ } else if (this.mailer_library === "none") {
357
+ } else {
358
+ throw new Error(
359
+ "unexpected mailer library: " + this.mailer_library + ". Valid options are: @aws-sdk/client-ses, nodemailer, none"
360
+ );
361
+ }
362
+ this.queue_library = this.queue_library ?? await (0, import_prompts.select)({
363
+ message: "Select a queue library",
364
+ choices: [
365
+ {
366
+ name: "AWS SQS",
367
+ value: "@aws-sdk/client-sqs",
368
+ description: "AWS SDK for JavaScript v3 - SQS client"
369
+ },
370
+ {
371
+ name: "Azure Service Bus",
372
+ value: "@azure/service-bus",
373
+ description: "Azure Service Bus client for Node.js"
374
+ },
375
+ {
376
+ name: "Google Cloud Pub/Sub",
377
+ value: "@google-cloud/pubsub",
378
+ description: "Google Cloud Pub/Sub client for Node.js"
379
+ },
380
+ {
381
+ name: "RabbitMQ (amqplib)",
382
+ value: "amqplib",
383
+ description: "AMQP 0-9-1 client for Node.js"
384
+ },
385
+ {
386
+ name: "Redis",
387
+ value: "redis",
388
+ description: "Redis client for Node.js"
389
+ },
390
+ new import_prompts.Separator(),
391
+ {
392
+ name: "None",
393
+ value: "none",
394
+ disabled: false
395
+ }
396
+ ]
397
+ });
398
+ if (this.queue_library === "@aws-sdk/client-sqs") {
399
+ await this.addPackage("@aws-sdk/client-sqs");
400
+ } else if (this.queue_library === "@azure/service-bus") {
401
+ await this.addPackage("@azure/service-bus");
402
+ } else if (this.queue_library === "@google-cloud/pubsub") {
403
+ await this.addPackage("@google-cloud/pubsub");
404
+ } else if (this.queue_library === "amqplib") {
405
+ await this.addPackage("amqplib");
406
+ await this.addPackage("@types/amqplib", true);
407
+ } else if (this.queue_library === "redis") {
408
+ await this.addPackage("redis");
409
+ } else if (this.queue_library === "none") {
410
+ } else {
411
+ throw new Error(
412
+ "unexpected queue library: " + this.queue_library + ". Valid options are: @aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none"
413
+ );
414
+ }
415
+ this.storage_library = this.storage_library ?? await (0, import_prompts.select)({
416
+ message: "Select a storage library",
417
+ choices: [
418
+ {
419
+ name: "@aws-sdk/client-s3",
420
+ value: "@aws-sdk/client-s3",
421
+ description: "AWS SDK for JavaScript v3 - S3 client"
422
+ },
423
+ {
424
+ name: "@azure/storage-blob",
425
+ value: "@azure/storage-blob",
426
+ description: "Azure Storage Blob client for Node.js"
427
+ },
428
+ {
429
+ name: "@google-cloud/storage",
430
+ value: "@google-cloud/storage",
431
+ description: "Google Cloud Storage client for Node.js"
432
+ },
433
+ {
434
+ name: "basic-ftp",
435
+ value: "basic-ftp",
436
+ description: "FTP client for Node.js"
437
+ },
438
+ {
439
+ name: "ssh2-sftp-client",
440
+ value: "ssh2-sftp-client",
441
+ description: "SFTP client for Node.js"
442
+ },
443
+ new import_prompts.Separator(),
444
+ {
445
+ name: "None",
446
+ value: "none",
447
+ disabled: false
448
+ }
449
+ ]
450
+ });
451
+ if (this.storage_library === "@aws-sdk/client-s3") {
452
+ await this.addPackage("@aws-sdk/client-s3");
453
+ } else if (this.storage_library === "@azure/storage-blob") {
454
+ await this.addPackage("@azure/storage-blob");
455
+ } else if (this.storage_library === "@google-cloud/storage") {
456
+ await this.addPackage("@google-cloud/storage");
457
+ } else if (this.storage_library === "basic-ftp") {
458
+ await this.addPackage("basic-ftp");
459
+ } else if (this.storage_library === "ssh2-sftp-client") {
460
+ await this.addPackage("ssh2-sftp-client");
461
+ await this.addPackage("@types/ssh2-sftp-client", true);
462
+ } else if (this.storage_library === "none") {
463
+ } else {
464
+ throw new Error(
465
+ "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"
466
+ );
261
467
  }
262
468
  await this.addPackage("@devbro/pashmak tsconfig-paths dotenv ");
263
469
  await this.addPackage(
@@ -314,7 +520,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
314
520
  });
315
521
  }
316
522
  async setupGit() {
317
- const initGit = await (0, import_prompts.select)({
523
+ this.initGit = this.initGit ?? await (0, import_prompts.select)({
318
524
  message: "Initialize a git repository?",
319
525
  choices: [
320
526
  {
@@ -329,7 +535,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
329
535
  }
330
536
  ]
331
537
  });
332
- if (initGit) {
538
+ if (this.initGit) {
333
539
  const gitignoreContent = [
334
540
  "node_modules/",
335
541
  "dist/",
package/dist/cjs/index.js CHANGED
@@ -2700,8 +2700,34 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2700
2700
  executor = "";
2701
2701
  packageManager = "";
2702
2702
  linter = "";
2703
- validation_library = "";
2704
- database_type = "";
2703
+ validation_library = import_clipanion10.Option.String("--validation-library", {
2704
+ description: "Validation library to use (yup, zod, none)",
2705
+ required: false
2706
+ });
2707
+ database_type = import_clipanion10.Option.String("--database-type", {
2708
+ description: "Database type to use (postgresql, mysql, sqlite)",
2709
+ required: false
2710
+ });
2711
+ cache_library = import_clipanion10.Option.String("--cache-library", {
2712
+ description: "Cache library to use (redis, memcached, none)",
2713
+ required: false
2714
+ });
2715
+ mailer_library = import_clipanion10.Option.String("--mailer-library", {
2716
+ description: "Mailer library to use (@aws-sdk/client-ses, nodemailer, none)",
2717
+ required: false
2718
+ });
2719
+ queue_library = import_clipanion10.Option.String("--queue-library", {
2720
+ description: "Queue library to use (@aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none)",
2721
+ required: false
2722
+ });
2723
+ storage_library = import_clipanion10.Option.String("--storage-library", {
2724
+ description: "Storage library to use (@aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none)",
2725
+ required: false
2726
+ });
2727
+ initGit = import_clipanion10.Option.Boolean("--git", {
2728
+ description: "Initialize a git repository (use --no-git to skip)",
2729
+ required: false
2730
+ });
2705
2731
  async folderExists(folderPath) {
2706
2732
  try {
2707
2733
  const stats = await fs7.stat(folderPath);
@@ -2855,7 +2881,7 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2855
2881
  await fs7.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
2856
2882
  }
2857
2883
  async setupGeneralPackages() {
2858
- this.validation_library = await (0, import_prompts.select)({
2884
+ this.validation_library = this.validation_library ?? await (0, import_prompts.select)({
2859
2885
  message: "Select a package you want for validation",
2860
2886
  choices: [
2861
2887
  {
@@ -2876,8 +2902,15 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2876
2902
  }
2877
2903
  ]
2878
2904
  });
2879
- this.validation_library === "none" || await this.addPackage(this.validation_library);
2880
- this.database_type = await (0, import_prompts.select)({
2905
+ if (this.validation_library === "yup" || this.validation_library === "zod") {
2906
+ await this.addPackage(this.validation_library);
2907
+ } else if (this.validation_library === "none") {
2908
+ } else {
2909
+ throw new Error(
2910
+ "unexpected validation library: " + this.validation_library + ". Valid options are: yup, zod, none"
2911
+ );
2912
+ }
2913
+ this.database_type = this.database_type ?? await (0, import_prompts.select)({
2881
2914
  message: "Select a database type (you can add more databases later)",
2882
2915
  choices: [
2883
2916
  {
@@ -2903,6 +2936,179 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2903
2936
  await this.addPackage("mysql2");
2904
2937
  } else if (this.database_type === "sqlite") {
2905
2938
  await this.addPackage("sqlite3");
2939
+ } else {
2940
+ throw new Error(
2941
+ "unexpected database type: " + this.database_type + ". Valid options are: postgresql, mysql, sqlite"
2942
+ );
2943
+ }
2944
+ this.cache_library = this.cache_library ?? await (0, import_prompts.select)({
2945
+ message: "Select a cache library",
2946
+ choices: [
2947
+ {
2948
+ name: "Redis",
2949
+ value: "redis",
2950
+ description: "Redis client for Node.js"
2951
+ },
2952
+ {
2953
+ name: "Memcached",
2954
+ value: "memcached",
2955
+ description: "Memcached client for Node.js"
2956
+ },
2957
+ new import_prompts.Separator(),
2958
+ {
2959
+ name: "None",
2960
+ value: "none",
2961
+ disabled: false
2962
+ }
2963
+ ]
2964
+ });
2965
+ if (this.cache_library === "redis") {
2966
+ await this.addPackage("redis");
2967
+ } else if (this.cache_library === "memcached") {
2968
+ await this.addPackage("memcached");
2969
+ } else if (this.cache_library === "none") {
2970
+ } else {
2971
+ throw new Error(
2972
+ "unexpected cache library: " + this.cache_library + ". Valid options are: redis, memcached, none"
2973
+ );
2974
+ }
2975
+ this.mailer_library = this.mailer_library ?? await (0, import_prompts.select)({
2976
+ message: "Select a mailer library",
2977
+ choices: [
2978
+ {
2979
+ name: "AWS SES",
2980
+ value: "@aws-sdk/client-ses",
2981
+ description: "AWS SDK for JavaScript v3 - SES client"
2982
+ },
2983
+ {
2984
+ name: "Nodemailer",
2985
+ value: "nodemailer",
2986
+ description: "Send emails with Node.js"
2987
+ },
2988
+ new import_prompts.Separator(),
2989
+ {
2990
+ name: "None",
2991
+ value: "none",
2992
+ disabled: false
2993
+ }
2994
+ ]
2995
+ });
2996
+ if (this.mailer_library === "@aws-sdk/client-ses") {
2997
+ await this.addPackage("@aws-sdk/client-ses");
2998
+ } else if (this.mailer_library === "nodemailer") {
2999
+ await this.addPackage("nodemailer");
3000
+ await this.addPackage("@types/nodemailer", true);
3001
+ } else if (this.mailer_library === "none") {
3002
+ } else {
3003
+ throw new Error(
3004
+ "unexpected mailer library: " + this.mailer_library + ". Valid options are: @aws-sdk/client-ses, nodemailer, none"
3005
+ );
3006
+ }
3007
+ this.queue_library = this.queue_library ?? await (0, import_prompts.select)({
3008
+ message: "Select a queue library",
3009
+ choices: [
3010
+ {
3011
+ name: "AWS SQS",
3012
+ value: "@aws-sdk/client-sqs",
3013
+ description: "AWS SDK for JavaScript v3 - SQS client"
3014
+ },
3015
+ {
3016
+ name: "Azure Service Bus",
3017
+ value: "@azure/service-bus",
3018
+ description: "Azure Service Bus client for Node.js"
3019
+ },
3020
+ {
3021
+ name: "Google Cloud Pub/Sub",
3022
+ value: "@google-cloud/pubsub",
3023
+ description: "Google Cloud Pub/Sub client for Node.js"
3024
+ },
3025
+ {
3026
+ name: "RabbitMQ (amqplib)",
3027
+ value: "amqplib",
3028
+ description: "AMQP 0-9-1 client for Node.js"
3029
+ },
3030
+ {
3031
+ name: "Redis",
3032
+ value: "redis",
3033
+ description: "Redis client for Node.js"
3034
+ },
3035
+ new import_prompts.Separator(),
3036
+ {
3037
+ name: "None",
3038
+ value: "none",
3039
+ disabled: false
3040
+ }
3041
+ ]
3042
+ });
3043
+ if (this.queue_library === "@aws-sdk/client-sqs") {
3044
+ await this.addPackage("@aws-sdk/client-sqs");
3045
+ } else if (this.queue_library === "@azure/service-bus") {
3046
+ await this.addPackage("@azure/service-bus");
3047
+ } else if (this.queue_library === "@google-cloud/pubsub") {
3048
+ await this.addPackage("@google-cloud/pubsub");
3049
+ } else if (this.queue_library === "amqplib") {
3050
+ await this.addPackage("amqplib");
3051
+ await this.addPackage("@types/amqplib", true);
3052
+ } else if (this.queue_library === "redis") {
3053
+ await this.addPackage("redis");
3054
+ } else if (this.queue_library === "none") {
3055
+ } else {
3056
+ throw new Error(
3057
+ "unexpected queue library: " + this.queue_library + ". Valid options are: @aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none"
3058
+ );
3059
+ }
3060
+ this.storage_library = this.storage_library ?? await (0, import_prompts.select)({
3061
+ message: "Select a storage library",
3062
+ choices: [
3063
+ {
3064
+ name: "@aws-sdk/client-s3",
3065
+ value: "@aws-sdk/client-s3",
3066
+ description: "AWS SDK for JavaScript v3 - S3 client"
3067
+ },
3068
+ {
3069
+ name: "@azure/storage-blob",
3070
+ value: "@azure/storage-blob",
3071
+ description: "Azure Storage Blob client for Node.js"
3072
+ },
3073
+ {
3074
+ name: "@google-cloud/storage",
3075
+ value: "@google-cloud/storage",
3076
+ description: "Google Cloud Storage client for Node.js"
3077
+ },
3078
+ {
3079
+ name: "basic-ftp",
3080
+ value: "basic-ftp",
3081
+ description: "FTP client for Node.js"
3082
+ },
3083
+ {
3084
+ name: "ssh2-sftp-client",
3085
+ value: "ssh2-sftp-client",
3086
+ description: "SFTP client for Node.js"
3087
+ },
3088
+ new import_prompts.Separator(),
3089
+ {
3090
+ name: "None",
3091
+ value: "none",
3092
+ disabled: false
3093
+ }
3094
+ ]
3095
+ });
3096
+ if (this.storage_library === "@aws-sdk/client-s3") {
3097
+ await this.addPackage("@aws-sdk/client-s3");
3098
+ } else if (this.storage_library === "@azure/storage-blob") {
3099
+ await this.addPackage("@azure/storage-blob");
3100
+ } else if (this.storage_library === "@google-cloud/storage") {
3101
+ await this.addPackage("@google-cloud/storage");
3102
+ } else if (this.storage_library === "basic-ftp") {
3103
+ await this.addPackage("basic-ftp");
3104
+ } else if (this.storage_library === "ssh2-sftp-client") {
3105
+ await this.addPackage("ssh2-sftp-client");
3106
+ await this.addPackage("@types/ssh2-sftp-client", true);
3107
+ } else if (this.storage_library === "none") {
3108
+ } else {
3109
+ throw new Error(
3110
+ "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"
3111
+ );
2906
3112
  }
2907
3113
  await this.addPackage("@devbro/pashmak tsconfig-paths dotenv ");
2908
3114
  await this.addPackage(
@@ -2959,7 +3165,7 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2959
3165
  });
2960
3166
  }
2961
3167
  async setupGit() {
2962
- const initGit = await (0, import_prompts.select)({
3168
+ this.initGit = this.initGit ?? await (0, import_prompts.select)({
2963
3169
  message: "Initialize a git repository?",
2964
3170
  choices: [
2965
3171
  {
@@ -2974,7 +3180,7 @@ var CreateProjectCommand = class extends import_clipanion10.Command {
2974
3180
  }
2975
3181
  ]
2976
3182
  });
2977
- if (initGit) {
3183
+ if (this.initGit) {
2978
3184
  const gitignoreContent = [
2979
3185
  "node_modules/",
2980
3186
  "dist/",
@@ -8,8 +8,13 @@ declare class CreateProjectCommand extends Command {
8
8
  executor: string;
9
9
  packageManager: string;
10
10
  linter: string;
11
- validation_library: string;
12
- database_type: string;
11
+ validation_library: string | undefined;
12
+ database_type: string | undefined;
13
+ cache_library: string | undefined;
14
+ mailer_library: string | undefined;
15
+ queue_library: string | undefined;
16
+ storage_library: string | undefined;
17
+ initGit: boolean | undefined;
13
18
  folderExists(folderPath: string): Promise<boolean>;
14
19
  execute(): Promise<void>;
15
20
  processTplFolder(src: string, dest: string, data?: any): Promise<void>;