free-email-domains 1.2.21 → 1.2.23

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.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "free-email-domains",
3
3
  "description": "A comprehensive list of all free email domain providers",
4
4
  "homepage": "https://github.com/Kikobeats/free-email-domains",
5
- "version": "1.2.21",
5
+ "version": "1.2.23",
6
6
  "main": "domains.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -52,9 +52,7 @@
52
52
  "hubspot",
53
53
  "mail"
54
54
  ],
55
- "dependencies": {
56
- "simple-get": "~4.0.1"
57
- },
55
+ "dependencies": {},
58
56
  "devDependencies": {
59
57
  "@commitlint/cli": "latest",
60
58
  "@commitlint/config-conventional": "latest",
@@ -68,11 +66,10 @@
68
66
  "should": "latest",
69
67
  "simple-git-hooks": "latest",
70
68
  "standard": "latest",
71
- "standard-markdown": "latest",
72
69
  "standard-version": "latest"
73
70
  },
74
71
  "engines": {
75
- "node": ">= 14"
72
+ "node": ">= 18"
76
73
  },
77
74
  "files": [
78
75
  "domains.js",
@@ -83,7 +80,7 @@
83
80
  "scripts": {
84
81
  "clean": "rm -rf node_modules",
85
82
  "contributors": "(npx git-authors-cli && npx finepack && git add package.json && git commit -m 'build: contributors' --no-verify) || true",
86
- "lint": "standard-markdown && standard",
83
+ "lint": "standard",
87
84
  "postinstall": "node scripts/postinstall.mjs",
88
85
  "postrelease": "npm run release:tags && npm run release:github && (ci-publish || npm publish --access=public)",
89
86
  "pretest": "npm run lint",
@@ -108,9 +105,6 @@
108
105
  "prettier-standard",
109
106
  "standard --fix"
110
107
  ],
111
- "*.md": [
112
- "standard-markdown"
113
- ],
114
108
  "package.json": [
115
109
  "finepack"
116
110
  ]
@@ -1,12 +1,4 @@
1
1
  import { writeFile } from 'node:fs/promises'
2
- import simpleGet from 'simple-get'
3
-
4
- const get = (url, opts) =>
5
- new Promise((resolve, reject) =>
6
- simpleGet.concat({ url: url.toString(), ...opts }, (err, res, data) =>
7
- err ? reject(err) : resolve({ res, data })
8
- )
9
- )
10
2
 
11
3
  /* List of free email domains by HubSpot
12
4
  https://knowledge.hubspot.com/forms/what-domains-are-blocked-when-using-the-forms-email-domains-to-block-feature */
@@ -32,13 +24,21 @@ const trim = text => text.replace(/^\s+|\s+$/g, '')
32
24
 
33
25
  const sanetize = text => text.split(/[,\n]/g).map(trim).filter(Boolean)
34
26
 
35
- try {
36
- const data = await get(URL).then(res => res.data.toString())
37
- const domains = new Set(sanetize(data))
27
+ async function main () {
28
+ const res = await fetch(URL)
29
+
30
+ if (!res.ok) throw new Error(`HTTP Error ${res.status}`)
31
+
32
+ const csvData = await res.text()
33
+
34
+ if (csvData.startsWith('<!DOCTYPE html') || csvData.includes('<html')) {
35
+ throw new Error('Received HTML instead of CSV')
36
+ }
37
+
38
+ const domains = new Set(sanetize(csvData))
38
39
  for (const domain of DOMAINS) domains.add(domain)
39
40
  const sorted = Array.from(domains).sort()
40
41
  await writeFile('domains.json', JSON.stringify(sorted, null, 2))
41
- } catch (error) {
42
- console.error(error)
43
- process.exit(1)
44
42
  }
43
+
44
+ main().catch(error => console.error(error) || process.exit(1))