Skip to content

Commit d555049

Browse files
committed
feat: cleanup styling of default template, bump deps
1 parent e44f414 commit d555049

File tree

4 files changed

+72
-422
lines changed

4 files changed

+72
-422
lines changed

index.js

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
const childProcess = require('child_process');
2-
const fs = require('fs');
3-
const http = require('http');
4-
const os = require('os');
5-
const path = require('path');
6-
const process = require('process');
7-
const util = require('util');
8-
9-
const cryptoRandomString = require('crypto-random-string');
1+
const childProcess = require('node:child_process');
2+
const fs = require('node:fs');
3+
const http = require('node:http');
4+
const os = require('node:os');
5+
const path = require('node:path');
6+
const process = require('node:process');
7+
const util = require('node:util');
8+
109
const displayNotification = require('display-notification');
1110
const getPort = require('get-port');
1211
const nodemailer = require('nodemailer');
@@ -123,11 +122,11 @@ const previewEmail = async (message, options) => {
123122
return booted;
124123
});
125124

126-
let done = false;
125+
// let done = false;
127126
const server = http.createServer((req, res) => {
128127
pEvent(res, 'close').then(() => {
129128
debug('end');
130-
done = true;
129+
// done = true;
131130
});
132131
debug('request made');
133132
res.writeHead(200, { 'Content-Type': 'text/html' });
@@ -144,6 +143,29 @@ const previewEmail = async (message, options) => {
144143
});
145144
});
146145

146+
const emlFilePath = `${options.dir}/${options.id}.eml`;
147+
await writeFile(emlFilePath, response.message);
148+
console.log('emlFilePath', emlFilePath);
149+
const xcrun = childProcess.spawn('xcrun', [
150+
'simctl',
151+
'openurl',
152+
'booted',
153+
emlFilePath
154+
]);
155+
await new Promise((resolve, reject) => {
156+
xcrun.once('error', reject);
157+
xcrun.once('close', (exitCode) => {
158+
if (exitCode === 72)
159+
return reject(
160+
new Error(
161+
`Could not open URL in booted Simulator; make sure Simulator is running.`
162+
)
163+
);
164+
resolve(xcrun);
165+
});
166+
});
167+
168+
/*
147169
const v = await cryptoRandomString({ length: 10, type: 'alphanumeric' });
148170
149171
const xcrun = childProcess.spawn('xcrun', [
@@ -166,6 +188,7 @@ const previewEmail = async (message, options) => {
166188
});
167189
168190
await pWaitFor(() => done);
191+
*/
169192

170193
// display notification
171194
await displayNotification({

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,30 @@
1111
"Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)"
1212
],
1313
"dependencies": {
14-
"ci-info": "^3.3.2",
15-
"crypto-random-string": "3.3.1",
14+
"ci-info": "^3.7.1",
1615
"display-notification": "2.0.0",
1716
"get-port": "5.1.1",
18-
"mailparser": "^3.5.0",
19-
"nodemailer": "^6.7.7",
17+
"mailparser": "^3.6.3",
18+
"nodemailer": "^6.9.1",
2019
"open": "7",
2120
"p-event": "4.2.0",
2221
"p-wait-for": "3.2.0",
2322
"pug": "^3.0.2",
24-
"uuid": "^8.3.2"
23+
"uuid": "^9.0.0"
2524
},
2625
"devDependencies": {
27-
"@commitlint/cli": "^17.0.3",
28-
"@commitlint/config-conventional": "^17.0.3",
29-
"ava": "^4.3.1",
26+
"@commitlint/cli": "^17.4.2",
27+
"@commitlint/config-conventional": "^17.4.2",
28+
"ava": "^5.2.0",
3029
"cross-env": "^7.0.3",
31-
"eslint": "^8.20.0",
30+
"eslint": "^8.33.0",
3231
"eslint-config-xo-lass": "^2.0.1",
33-
"husky": "^8.0.1",
34-
"lint-staged": "^13.0.3",
32+
"husky": "^8.0.3",
33+
"lint-staged": "^13.1.1",
3534
"nyc": "^15.1.0",
3635
"remark-cli": "^11.0.0",
3736
"remark-preset-github": "^4.0.4",
38-
"xo": "0.51"
37+
"xo": "^0.53.1"
3938
},
4039
"engines": {
4140
"node": ">=14"

0 commit comments

Comments
 (0)