package-installer-cli 1.4.0 → 1.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 843580113d2bde12d1b5493fc438626b5c7a077759f9a8552e0bb9515c97f8b4
4
- data.tar.gz: df54555ab0ea46711a958deb11ba2c3d976007550d96d1e1b96fdd35db5d7396
3
+ metadata.gz: a04b77dc511589c007e918aa5b3cf114c966f9371a855d2c70f9378189f35da2
4
+ data.tar.gz: 38f143aff70a88a281d55847019b6b089d65e553f2d82906f8b8980bde9fdbb3
5
5
  SHA512:
6
- metadata.gz: 5c733f50d2b1011e2a531e1ada10da5341617ae4f965a3ae6e928759927f686b40ded5c393a1f1f30ab0d6f829c6eda05798c1b387751bc141300ce9a859e1d7
7
- data.tar.gz: c59614c7fc058dcf51c7d5a109365e5fd0eadc665753575059120bed178e2f5773c600f8687767c88c0031fe2c057bb6f2b640aa88d43bb4be02350fb97f5dce
6
+ metadata.gz: 186e74b8451d77fc683045e471bc1cddd6e80211c222f7a6d05b33f9a1ca3001c3e1649f9da779f088703799ab2c1f7722442bba46b0b7e9d27031577a19baa8
7
+ data.tar.gz: a9413784cca428e9ce2a51b665a4e401f8d9116bef3b316e04ba08c96eff6ade26744018d7daacac45158d9a069fcedabed8f10fff48711b84dd75a54dbbf776
@@ -7,7 +7,7 @@ import path from 'path';
7
7
  import fs from 'fs-extra';
8
8
  import { createStandardHelp } from '../utils/helpFormatter.js';
9
9
  import { displayCommandBanner } from '../utils/banner.js';
10
- import { generateEmailTemplate, generateTestEmailTemplate, collectBugReportData, collectFeatureRequestData, collectTemplateRequestData, collectQuestionData, collectImprovementData, collectDocsData, collectContactInfo, collectQuickFeedback } from '../email-templates/index.js';
10
+ import { generateEmailTemplate, generateTestEmailTemplate, collectBugReportData, collectFeatureRequestData, collectTemplateRequestData, collectQuestionData, collectImprovementData, collectDocsData, collectCustomMessageData, collectContactInfo, collectQuickFeedback } from '../email-templates/index.js';
11
11
  const EMAIL_CATEGORIES = [
12
12
  {
13
13
  name: 'šŸ› Bug Report',
@@ -50,6 +50,13 @@ const EMAIL_CATEGORIES = [
50
50
  description: 'Report issues with documentation',
51
51
  emoji: 'šŸ“–',
52
52
  template: 'docs-issue'
53
+ },
54
+ {
55
+ name: 'āœ‰ļø Custom Message',
56
+ value: 'custom',
57
+ description: 'Send a custom formatted message',
58
+ emoji: 'āœ‰ļø',
59
+ template: 'custom-message'
53
60
  }
54
61
  ];
55
62
  /**
@@ -1054,6 +1061,9 @@ export async function emailCommand(category, options = {}) {
1054
1061
  case 'docs':
1055
1062
  categoryData = await collectDocsData();
1056
1063
  break;
1064
+ case 'custom':
1065
+ categoryData = await collectCustomMessageData();
1066
+ break;
1057
1067
  default:
1058
1068
  categoryData = await collectQuestionData(); // Fallback
1059
1069
  }
@@ -0,0 +1,48 @@
1
+ import inquirer from 'inquirer';
2
+ import chalk from 'chalk';
3
+ /**
4
+ * Collect custom message information from user with formatting instructions
5
+ */
6
+ export async function collectCustomMessageData() {
7
+ console.log(chalk.hex('#00d2d3')('\nšŸ“ Custom Message Guidelines:'));
8
+ console.log(chalk.hex('#95afc0')('• Use clear, concise subject line'));
9
+ console.log(chalk.hex('#95afc0')('• Write body in plain text or HTML format'));
10
+ console.log(chalk.hex('#95afc0')('• Use \\n for line breaks in plain text'));
11
+ console.log(chalk.hex('#95afc0')('• HTML tags will be automatically formatted'));
12
+ console.log(chalk.hex('#95afc0')('• Example HTML: <p>Hello</p><br><strong>Important:</strong> Details'));
13
+ console.log(chalk.hex('#ffa502')('• Your message will be professionally formatted with CSS styling\n'));
14
+ const answers = await inquirer.prompt([
15
+ {
16
+ type: 'input',
17
+ name: 'title',
18
+ message: 'Email subject:',
19
+ validate: (input) => input.length > 0 || 'Subject is required'
20
+ },
21
+ {
22
+ type: 'editor',
23
+ name: 'description',
24
+ message: 'Email body (opens in your default editor):',
25
+ validate: (input) => input.length > 10 || 'Please provide a detailed message (min 10 characters)'
26
+ },
27
+ {
28
+ type: 'list',
29
+ name: 'format',
30
+ message: 'Body format:',
31
+ choices: [
32
+ { name: 'Plain Text (will be formatted automatically)', value: 'plain' },
33
+ { name: 'HTML (advanced formatting)', value: 'html' }
34
+ ]
35
+ },
36
+ {
37
+ type: 'list',
38
+ name: 'priority',
39
+ message: 'Message priority:',
40
+ choices: [
41
+ { name: 'Normal', value: 'normal' },
42
+ { name: 'High', value: 'high' },
43
+ { name: 'Urgent', value: 'urgent' }
44
+ ]
45
+ }
46
+ ]);
47
+ return answers;
48
+ }
@@ -5,4 +5,5 @@ export { collectTemplateRequestData } from './templateRequest.js';
5
5
  export { collectQuestionData } from './question.js';
6
6
  export { collectImprovementData } from './improvement.js';
7
7
  export { collectDocsData } from './docs.js';
8
+ export { collectCustomMessageData } from './customMessage.js';
8
9
  export { collectContactInfo, collectQuickFeedback } from './common.js';
@@ -0,0 +1,135 @@
1
+ import { EMAIL_CSS } from './styles.js';
2
+ /**
3
+ * Format text content based on format type
4
+ */
5
+ function formatContent(content, format) {
6
+ if (format === 'html') {
7
+ // If user provided HTML, wrap it in a content div for consistent styling
8
+ return `<div class="custom-content">${content}</div>`;
9
+ }
10
+ else {
11
+ // Convert plain text to HTML with line breaks and basic formatting
12
+ return `<div class="custom-content">${content
13
+ .replace(/\n\n/g, '</p><p>')
14
+ .replace(/\n/g, '<br>')
15
+ .replace(/^/, '<p>')
16
+ .replace(/$/, '</p>')
17
+ .replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
18
+ .replace(/\*(.*?)\*/g, '<em>$1</em>')
19
+ .replace(/`(.*?)`/g, '<code>$1</code>')}</div>`;
20
+ }
21
+ }
22
+ export function generateCustomMessageTemplate(data, systemInfo) {
23
+ const priorityClass = data.priority === 'high' ? 'priority-high' :
24
+ data.priority === 'urgent' ? 'priority-critical' : '';
25
+ const priorityBadge = data.priority === 'high' ? 'priority-high-badge' :
26
+ data.priority === 'urgent' ? 'priority-critical-badge' :
27
+ 'priority-low';
28
+ const priorityText = data.priority === 'urgent' ? 'Urgent' :
29
+ data.priority === 'high' ? 'High Priority' :
30
+ 'Normal Priority';
31
+ const formattedContent = formatContent(data.description, data.format || 'plain');
32
+ return {
33
+ subject: `[Package Installer CLI] āœ‰ļø ${data.title}`,
34
+ htmlBody: `
35
+ ${EMAIL_CSS}
36
+ <style>
37
+ .custom-content {
38
+ background: white;
39
+ padding: 20px;
40
+ border-radius: 6px;
41
+ border: 1px solid #dee2e6;
42
+ margin: 15px 0;
43
+ line-height: 1.6;
44
+ }
45
+ .custom-content p {
46
+ margin: 10px 0;
47
+ }
48
+ .custom-content code {
49
+ background: #f8f9fa;
50
+ padding: 2px 6px;
51
+ border-radius: 4px;
52
+ font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
53
+ font-size: 0.9em;
54
+ }
55
+ .header.custom {
56
+ background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
57
+ }
58
+ </style>
59
+ <body>
60
+ <div class="email-container">
61
+ <div class="header custom">
62
+ <span class="emoji">āœ‰ļø</span>
63
+ <h1>Custom Message</h1>
64
+ <p style="margin: 5px 0 0 0; opacity: 0.9;">Package Installer CLI</p>
65
+ </div>
66
+
67
+ <div class="content">
68
+ <div class="section ${priorityClass}">
69
+ <h3>Subject
70
+ <span class="priority-badge ${priorityBadge}">${priorityText}</span>
71
+ </h3>
72
+ <p><strong>${data.title}</strong></p>
73
+ </div>
74
+
75
+ <div class="section">
76
+ <h3>Message</h3>
77
+ ${formattedContent}
78
+ </div>
79
+
80
+ ${data.additional ? `
81
+ <div class="section">
82
+ <h3>Additional Information</h3>
83
+ <p>${data.additional}</p>
84
+ </div>
85
+ ` : ''}
86
+
87
+ <div class="system-info">
88
+ <strong>System Information:</strong><br>
89
+ - OS: ${systemInfo.platform} (${systemInfo.arch})<br>
90
+ - Node.js: ${systemInfo.nodeVersion}<br>
91
+ - CLI Version: ${systemInfo.cliVersion}<br>
92
+ - Working Directory: ${systemInfo.workingDirectory}
93
+ </div>
94
+
95
+ ${data.name || data.email ? `
96
+ <div class="contact-info">
97
+ <strong>Contact Information:</strong><br>
98
+ ${data.name ? `Name: ${data.name}<br>` : ''}
99
+ ${data.email ? `Email: ${data.email}` : ''}
100
+ </div>
101
+ ` : ''}
102
+ </div>
103
+
104
+ <div class="footer">
105
+ <div class="timestamp">Sent at: ${systemInfo.timestamp}</div>
106
+ <p style="margin: 10px 0 0 0;">Package Installer CLI - Custom Message šŸ’¬</p>
107
+ </div>
108
+ </div>
109
+ </body>
110
+ `,
111
+ plainBody: `Hi Shariq,
112
+
113
+ Custom message from Package Installer CLI user.
114
+
115
+ Subject: ${data.title}
116
+
117
+ Priority: ${priorityText}
118
+
119
+ Message:
120
+ ${data.description}
121
+
122
+ ${data.additional ? `Additional Information:\n${data.additional}\n` : ''}
123
+ System Information:
124
+ - OS: ${systemInfo.platform} (${systemInfo.arch})
125
+ - Node.js: ${systemInfo.nodeVersion}
126
+ - CLI Version: ${systemInfo.cliVersion}
127
+ - Working Directory: ${systemInfo.workingDirectory}
128
+
129
+ Sent at: ${systemInfo.timestamp}
130
+
131
+ Best regards,
132
+ ${data.name || 'Anonymous User'}
133
+ ${data.email ? `Contact: ${data.email}` : ''}`
134
+ };
135
+ }
@@ -4,6 +4,7 @@ import { generateTemplateRequestTemplate } from './templateRequest.js';
4
4
  import { generateQuestionTemplate } from './question.js';
5
5
  import { generateImprovementTemplate } from './improvement.js';
6
6
  import { generateDocsTemplate } from './docs.js';
7
+ import { generateCustomMessageTemplate } from './customMessage.js';
7
8
  /**
8
9
  * Generate HTML email template using modular template functions
9
10
  */
@@ -35,6 +36,8 @@ export function generateEmailTemplate(category, data, systemInfo) {
35
36
  docSection: data.section,
36
37
  issue: data.problems,
37
38
  suggestion: data.suggestions,
39
+ // Custom message specific
40
+ format: data.format,
38
41
  // Common fields
39
42
  priority: data.priority,
40
43
  additional: data.additional,
@@ -55,6 +58,8 @@ export function generateEmailTemplate(category, data, systemInfo) {
55
58
  return generateImprovementTemplate(templateData, systemInfo);
56
59
  case 'docs':
57
60
  return generateDocsTemplate(templateData, systemInfo);
61
+ case 'custom':
62
+ return generateCustomMessageTemplate(templateData, systemInfo);
58
63
  default:
59
64
  // Fallback to question template for unknown categories
60
65
  return generateQuestionTemplate(templateData, systemInfo);
@@ -8,6 +8,7 @@ export { generateTemplateRequestTemplate } from './templateRequest.js';
8
8
  export { generateQuestionTemplate } from './question.js';
9
9
  export { generateImprovementTemplate } from './improvement.js';
10
10
  export { generateDocsTemplate } from './docs.js';
11
+ export { generateCustomMessageTemplate } from './customMessage.js';
11
12
  export { generateTestEmailTemplate } from './testEmail.js';
12
13
  export { generateEmailTemplate } from './generator.js';
13
14
  // Data collectors
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: package-installer-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sharique
@@ -99,12 +99,14 @@ files:
99
99
  - dist/email-templates/bugReport.js
100
100
  - dist/email-templates/collectors/bugReport.js
101
101
  - dist/email-templates/collectors/common.js
102
+ - dist/email-templates/collectors/customMessage.js
102
103
  - dist/email-templates/collectors/docs.js
103
104
  - dist/email-templates/collectors/featureRequest.js
104
105
  - dist/email-templates/collectors/improvement.js
105
106
  - dist/email-templates/collectors/index.js
106
107
  - dist/email-templates/collectors/question.js
107
108
  - dist/email-templates/collectors/templateRequest.js
109
+ - dist/email-templates/customMessage.js
108
110
  - dist/email-templates/docs.js
109
111
  - dist/email-templates/featureRequest.js
110
112
  - dist/email-templates/generator.js