global-tld-list 1.18.11 → 1.18.13

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Global TLD List
2
2
 
3
- List of Glogal TLDs (gTLDs) gathered from [IANA](http://data.iana.org/TLD/tlds-alpha-by-domain.txt).
3
+ List of Global TLDs (gTLDs) gathered from [IANA](http://data.iana.org/TLD/tlds-alpha-by-domain.txt).
4
4
 
5
5
  ## Installation
6
6
 
package/dist/index.js CHANGED
@@ -2,20 +2,13 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
- var _a;
6
5
  Object.defineProperty(exports, "__esModule", { value: true });
7
6
  exports.TLDs = void 0;
8
- const fs_1 = __importDefault(require("fs"));
9
- const path_1 = __importDefault(require("path"));
7
+ const serialized_json_1 = __importDefault(require("../data/serialized.json"));
10
8
  class TLDs {
11
9
  static isValid(tld) {
12
10
  return this.tlds.has(tld);
13
11
  }
14
12
  }
15
13
  exports.TLDs = TLDs;
16
- _a = TLDs;
17
- (() => {
18
- const dataFile = path_1.default.join(path_1.default.dirname(__dirname), 'data', 'serialized.txt');
19
- const serialized = fs_1.default.readFileSync(dataFile, 'utf-8');
20
- _a.tlds = new Map(JSON.parse(serialized));
21
- })();
14
+ TLDs.tlds = new Map(serialized_json_1.default);
package/dist/list.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export declare class List {
2
+ static ianaUrl: string;
3
+ static getData(): Promise<string>;
4
+ static process(data: string): Map<string, number>;
5
+ static generate(): Promise<void>;
6
+ }
@@ -12,15 +12,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.Sync = void 0;
16
- const axios_1 = __importDefault(require("axios"));
17
- const fs_1 = __importDefault(require("fs"));
18
- const path_1 = __importDefault(require("path"));
15
+ exports.List = void 0;
16
+ const node_fs_1 = __importDefault(require("node:fs"));
17
+ const node_path_1 = __importDefault(require("node:path"));
19
18
  const punycode_1 = require("punycode");
20
- class Sync {
19
+ class List {
21
20
  static getData() {
22
21
  return __awaiter(this, void 0, void 0, function* () {
23
- return axios_1.default.get(Sync.ianaUrl);
22
+ const response = yield fetch(List.ianaUrl);
23
+ return response.text();
24
24
  });
25
25
  }
26
26
  static process(data) {
@@ -39,14 +39,17 @@ class Sync {
39
39
  });
40
40
  return tlds;
41
41
  }
42
- static do() {
42
+ static generate() {
43
43
  return __awaiter(this, void 0, void 0, function* () {
44
- const response = yield Sync.getData();
45
- const tlds = Sync.process(response.data);
46
- const dataFile = path_1.default.join(path_1.default.dirname(__dirname), 'data', 'serialized.txt');
47
- yield fs_1.default.promises.writeFile(dataFile, JSON.stringify([...tlds]));
44
+ const response = yield List.getData();
45
+ const tlds = List.process(response);
46
+ const dataFile = node_path_1.default.join(node_path_1.default.dirname(__dirname), 'data', 'serialized.json');
47
+ yield node_fs_1.default.promises.writeFile(dataFile, JSON.stringify([...tlds]));
48
48
  });
49
49
  }
50
50
  }
51
- exports.Sync = Sync;
52
- Sync.ianaUrl = 'http://data.iana.org/TLD/tlds-alpha-by-domain.txt';
51
+ exports.List = List;
52
+ List.ianaUrl = 'http://data.iana.org/TLD/tlds-alpha-by-domain.txt';
53
+ (() => __awaiter(void 0, void 0, void 0, function* () {
54
+ yield List.generate();
55
+ }))();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "global-tld-list",
3
- "version": "1.18.11",
3
+ "version": "1.18.13",
4
4
  "description": "List of Global TLDs",
5
5
  "keywords": [
6
6
  "tld",
@@ -20,12 +20,16 @@
20
20
  "license": "MIT",
21
21
  "author": "Munjal Dhamecha",
22
22
  "main": "dist/index.js",
23
+ "files": [
24
+ "dist/*",
25
+ "data/*"
26
+ ],
23
27
  "scripts": {
24
28
  "build": "npm run clean && tsc --noEmitOnError",
25
29
  "build:watch": "npm run build -- --watch",
26
30
  "clean": "rimraf dist coverage",
27
31
  "commit": "git-cz",
28
- "generate": "node dist/generate.js",
32
+ "generate": "node dist/list.js",
29
33
  "lint": "eslint .",
30
34
  "lint:fix": "npm run lint -- --fix",
31
35
  "prepare": "husky",
@@ -40,28 +44,26 @@
40
44
  }
41
45
  },
42
46
  "devDependencies": {
43
- "@commitlint/cli": "^19.6.1",
44
- "@commitlint/config-conventional": "^19.6.0",
45
- "@types/axios": "^0.14.4",
47
+ "@commitlint/cli": "^19.8.0",
48
+ "@commitlint/config-conventional": "^19.8.0",
46
49
  "@types/jest": "^29.5.14",
47
- "@types/node": "^22.10.2",
48
- "@typescript-eslint/eslint-plugin": "^8.18.1",
49
- "@typescript-eslint/parser": "^8.18.1",
50
- "axios": "^1.7.9",
50
+ "@types/node": "^22.13.10",
51
+ "@typescript-eslint/eslint-plugin": "^8.26.1",
52
+ "@typescript-eslint/parser": "^8.26.1",
51
53
  "cz-conventional-changelog": "^3.3.0",
52
- "eslint": "^9.17.0",
53
- "eslint-config-prettier": "^10.0.1",
54
- "eslint-plugin-jest": "^28.9.0",
55
- "eslint-plugin-prettier": "^5.2.1",
54
+ "eslint": "^9.22.0",
55
+ "eslint-config-prettier": "^10.1.1",
56
+ "eslint-plugin-jest": "^28.11.0",
57
+ "eslint-plugin-prettier": "^5.2.3",
56
58
  "husky": "^9.1.7",
57
59
  "jest": "^29.7.0",
58
- "lint-staged": "^15.2.11",
59
- "prettier": "^3.4.2",
60
+ "lint-staged": "^15.4.3",
61
+ "prettier": "^3.5.3",
60
62
  "punycode": "^2.3.1",
61
63
  "rimraf": "^6.0.1",
62
64
  "sort-package-json": "^3.0.0",
63
65
  "standard-version": "^9.5.0",
64
- "ts-jest": "^29.2.5",
65
- "typescript": "^5.7.2"
66
+ "ts-jest": "^29.2.6",
67
+ "typescript": "^5.8.2"
66
68
  }
67
69
  }
package/.commitlintrc.cjs DELETED
@@ -1,13 +0,0 @@
1
- const configConventional = require('@commitlint/config-conventional');
2
-
3
- const typeEnum = configConventional.rules['type-enum'];
4
- typeEnum[2].push('init');
5
-
6
- module.exports = {
7
- extends: [
8
- '@commitlint/config-conventional'
9
- ],
10
- rules: {
11
- 'type-enum': typeEnum,
12
- }
13
- };
@@ -1,9 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: npm
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- time: "06:30"
8
- timezone: Asia/Kolkata
9
- open-pull-requests-limit: 20
@@ -1,28 +0,0 @@
1
- # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
-
4
- name: CI
5
-
6
- on: [push]
7
-
8
- jobs:
9
- build:
10
-
11
- runs-on: ubuntu-latest
12
-
13
- strategy:
14
- matrix:
15
- node-version: ['22.x']
16
-
17
- steps:
18
- - uses: actions/checkout@v4
19
- - name: Use Node.js ${{ matrix.node-version }}
20
- uses: actions/setup-node@v4
21
- with:
22
- node-version: ${{ matrix.node-version }}
23
- - run: npm ci
24
- - run: npm run lint --if-present
25
- - run: npm run build --if-present
26
- - run: npm test
27
- env:
28
- CI: true
@@ -1,34 +0,0 @@
1
- # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
-
4
- name: Generate List CI
5
-
6
- on:
7
- schedule:
8
- - cron: '0 1 * * *'
9
-
10
- jobs:
11
- generate:
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
- - name: Generate List & Publish
17
- uses: actions/setup-node@v4
18
- with:
19
- node-version: '22.x'
20
- registry-url: 'https://registry.npmjs.org'
21
- - run: |
22
- git config user.email "${{ secrets.GIT_USER_EMAIL }}"
23
- git config user.name "${{ secrets.GIT_USER_NAME }}"
24
- - run: npm ci
25
- - run: npm run generate
26
- - run: npm run build
27
- - run: git add .
28
- - run: "git diff --quiet && git diff --staged --quiet || git commit -m 'feat: generate new TLD list'"
29
- - run: npm run release
30
- - run: git push --follow-tags
31
- - run: npm publish
32
- env:
33
- CI: true
34
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/.husky/commit-msg DELETED
@@ -1 +0,0 @@
1
- npx --no-install commitlint --config commitlint.config.cjs --edit "$1"
package/.husky/pre-commit DELETED
@@ -1 +0,0 @@
1
- npx lint-staged
package/.prettierrc.js DELETED
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- trailingComma: 'all',
3
- singleQuote: true,
4
- endOfLine: 'auto',
5
- printWidth: 120,
6
- };