global-tld-list 1.18.12 → 1.18.14
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 +1 -1
- package/dist/index.js +2 -9
- package/dist/list.d.ts +6 -0
- package/dist/{sync.js → list.js} +16 -13
- package/package.json +6 -4
- package/.commitlintrc.cjs +0 -13
- package/.github/dependabot.yml +0 -9
- package/.github/workflows/ci.yml +0 -28
- package/.github/workflows/generate.yml +0 -34
- package/.husky/commit-msg +0 -1
- package/.husky/pre-commit +0 -1
- package/.prettierrc.js +0 -6
- package/CHANGELOG.md +0 -3759
- package/__tests__/sync.test.ts +0 -49
- package/commitlint.config.cjs +0 -3
- package/commitlint.config.js +0 -11
- package/dist/generate.d.ts +0 -1
- package/dist/generate.js +0 -15
- package/dist/sync.d.ts +0 -7
- package/eslint.config.mjs +0 -50
- package/jest.config.js +0 -13
- package/lint-staged.config.js +0 -5
- package/src/generate.ts +0 -5
- package/src/index.ts +0 -16
- package/src/sync.ts +0 -40
- package/tsconfig.json +0 -35
- /package/data/{serialized.txt → serialized.json} +0 -0
package/README.md
CHANGED
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
|
|
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
|
-
|
|
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
package/dist/{sync.js → list.js}
RENAMED
|
@@ -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.
|
|
16
|
-
const
|
|
17
|
-
const
|
|
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
|
|
19
|
+
class List {
|
|
21
20
|
static getData() {
|
|
22
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
|
|
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
|
|
42
|
+
static generate() {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const response = yield
|
|
45
|
-
const tlds =
|
|
46
|
-
const dataFile =
|
|
47
|
-
yield
|
|
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.
|
|
52
|
-
|
|
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.
|
|
3
|
+
"version": "1.18.14",
|
|
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/
|
|
32
|
+
"generate": "node dist/list.js",
|
|
29
33
|
"lint": "eslint .",
|
|
30
34
|
"lint:fix": "npm run lint -- --fix",
|
|
31
35
|
"prepare": "husky",
|
|
@@ -42,12 +46,10 @@
|
|
|
42
46
|
"devDependencies": {
|
|
43
47
|
"@commitlint/cli": "^19.8.0",
|
|
44
48
|
"@commitlint/config-conventional": "^19.8.0",
|
|
45
|
-
"@types/axios": "^0.14.4",
|
|
46
49
|
"@types/jest": "^29.5.14",
|
|
47
50
|
"@types/node": "^22.13.10",
|
|
48
51
|
"@typescript-eslint/eslint-plugin": "^8.26.1",
|
|
49
52
|
"@typescript-eslint/parser": "^8.26.1",
|
|
50
|
-
"axios": "^1.8.3",
|
|
51
53
|
"cz-conventional-changelog": "^3.3.0",
|
|
52
54
|
"eslint": "^9.22.0",
|
|
53
55
|
"eslint-config-prettier": "^10.1.1",
|
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
|
-
};
|
package/.github/dependabot.yml
DELETED
package/.github/workflows/ci.yml
DELETED
|
@@ -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
|