Skip to content

Commit

Permalink
feat: Complete rewrite in TypeScript and several bug fixes and improv…
Browse files Browse the repository at this point in the history
…ements

- Run against [psl example domains](https://raw.githubusercontent.com/publicsuffix/list/master/tests/test_psl.txt). Closes #1
- Add support for international domain names. Fixes #16 #82 and #44
- Only accept hostnames instead of whole URLs. Fixes #49 and #14
- Do not auto update tries on npm install. Fixes #42 #48 and #90
- Use "node-fetch" instead of "got". Fixes #78 and #62
- Use Node's "assert" module instead of Jest for smoke test. Fixes #92 #93 #89 #91
- Recognize IPv4 and IPv6 in hostnames. Fixes #102

BREAKING CHANGE: This release is a complete rewrite in TypeScript. It fixes some long outstanding bugs and comes with improvements we were planning for quite some time. The major changes are: 1. parseDomain does not accept whole URLs anymore. Only the hostname section of a URL is allowed now. 2. We removed the options object. Custom TLDs are returned as "valid but not listed". The parse result contains both the result with private TLDs and without private TLDs. 3. Dropped Node 6 support. We recommend reading the README since the public API as changed quite a lot.
  • Loading branch information
jhnns committed Apr 23, 2020
1 parent 9246927 commit 9f38492
Show file tree
Hide file tree
Showing 85 changed files with 21,975 additions and 11,201 deletions.
5 changes: 0 additions & 5 deletions .babelrc

This file was deleted.

13 changes: 13 additions & 0 deletions .eslintrc.js
@@ -0,0 +1,13 @@
"use strict";

module.exports = {
extends: [
"peerigon",
"peerigon/node",
"peerigon/styles/no-null",
"peerigon/styles/no-default-export",
"peerigon/styles/prefer-arrow",
"prettier",
],
root: true,
};
10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- master
- beta

jobs:
prepare:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '[skip ci]')"
steps:
- run: echo "${{ github.event.head_commit.message }}"
publish:
needs: prepare
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: |
npm ci --ignore-scripts
- name: Update tries
run: |
npm run update:tries
- name: Test
run: |
npm test
env:
CI: true
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm install @semantic-release/changelog @semantic-release/git --ignore-scripts --no-save
npx semantic-release
- name: Save test coverage
uses: coverallsapp/github-action@v1.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,37 @@
name: Test

on: [push]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [8.x, 10.x, 12.x, 14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: |
npm ci --ignore-scripts
- name: Test
run: |
npm test
env:
CI: true
- name: Save test coverage
uses: coverallsapp/github-action@v1.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 3 additions & 5 deletions .gitignore
Expand Up @@ -35,8 +35,6 @@ node_modules
# Optional REPL history
.node_repl_history

# We don't check in the compiled lists. They are created upon npm publish and npm install.
build/tries

# Don't include the build target directory.
lib
# We don't check in compiled files. They are created upon npm publish and npm install.
build-esm
build-cjs
16 changes: 16 additions & 0 deletions .releaserc.json
@@ -0,0 +1,16 @@
{
"branches": ["master", {"name": "beta", "prerelease": true}],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/git",
{
"assets": ["CHANGELOG.md"]
}
],
"@semantic-release/github",
"@semantic-release/npm"
]
}
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .vscode/launch.json
@@ -0,0 +1,20 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"name": "vscode-jest-tests",
"request": "launch",
"args": ["--runInBand", "--coverage=false"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true,
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,8 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.tsdk": "node_modules/typescript/lib"
}

0 comments on commit 9f38492

Please sign in to comment.