|
1 | 1 | import { EmailUploader, ENGINES_MAP } from "@docsoc/libmailmerge"; |
2 | 2 | import { loadPreviewsFromSidecar, loadSidecars, EmailString } from "@docsoc/libmailmerge"; |
3 | 3 | import { createLogger } from "@docsoc/util"; |
| 4 | +import chalk from "chalk"; |
4 | 5 | // Load dotenv |
5 | 6 | import "dotenv/config"; |
6 | 7 | import { join } from "path"; |
| 8 | +import readlineSync from "readline-sync"; |
7 | 9 |
|
8 | 10 | const logger = createLogger("docsoc"); |
9 | 11 |
|
@@ -58,33 +60,32 @@ export async function uploadDrafts(directory: string) { |
58 | 60 | } |
59 | 61 |
|
60 | 62 | // Print the warning |
61 | | - // TODO: Move sent emails elsewhere |
62 | | - // console.log( |
63 | | - // chalk.yellow(`⚠️ --- WARNING --- ⚠️ |
64 | | - // You are about to upload ${pendingEmails.length} emails. |
65 | | - // This action is IRREVERSIBLE. |
66 | | - |
67 | | - // If the system crashes, you will need to manually upload the emails. |
68 | | - // Re-running this after a partial upload will end up uploading duplicate emails. |
69 | | - // Unlike with send, emails will not be moved to a different folder after upload. |
70 | | - |
71 | | - // Check that: |
72 | | - // 1. The template was correct |
73 | | - // 1. You are satisfied with ALL previews, including the HTML previews |
74 | | - // 3. You have tested the system beforehand |
75 | | - // 4. All indications this is a test have been removed |
76 | | - |
77 | | - // You are about to upload ${pendingEmails.length} emails. The esitmated time for this is ${ |
78 | | - // (20 * pendingEmails.length) / 60 / 60 |
79 | | - // } hours. |
80 | | - |
81 | | - // If you are happy to proceed, please type "Yes, upload emails" below.`), |
82 | | - // ); |
83 | | - |
84 | | - // const input = readlineSync.question(""); |
85 | | - // if (input !== "Yes, upload emails") { |
86 | | - // process.exit(0); |
87 | | - // } |
| 63 | + console.log( |
| 64 | + chalk.yellow(`⚠️ --- WARNING --- ⚠️ |
| 65 | + You are about to upload ${pendingEmails.length} emails. |
| 66 | + This action is IRREVERSIBLE. |
| 67 | +
|
| 68 | + If the system crashes, you will need to manually upload the emails. |
| 69 | + Re-running this after a partial upload will end up uploading duplicate emails. |
| 70 | + Unlike with send, emails will not be moved to a different folder after upload. |
| 71 | +
|
| 72 | + Check that: |
| 73 | + 1. The template was correct |
| 74 | + 1. You are satisfied with ALL previews, including the HTML previews |
| 75 | + 3. You have tested the system beforehand |
| 76 | + 4. All indications this is a test have been removed |
| 77 | +
|
| 78 | + You are about to upload ${pendingEmails.length} emails. The esitmated time for this is ${ |
| 79 | + (20 * pendingEmails.length) / 60 / 60 |
| 80 | + } hours. |
| 81 | +
|
| 82 | + If you are happy to proceed, please type "Yes, upload emails" below.`), |
| 83 | + ); |
| 84 | + |
| 85 | + const input = readlineSync.question(""); |
| 86 | + if (input !== "Yes, upload emails") { |
| 87 | + process.exit(0); |
| 88 | + } |
88 | 89 |
|
89 | 90 | // Send the emails |
90 | 91 | logger.info("Uploading emails..."); |
|
0 commit comments