Skip to content

Commit

Permalink
Require Node.js 8, add TypeScript definition (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender authored and sindresorhus committed Apr 17, 2019
1 parent cb1d76e commit 9541b58
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 41 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
yarn.lock
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
language: node_js
node_js:
- '10'
- '8'
- '6'
- '4'
3 changes: 3 additions & 0 deletions html-tags-void.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const voidHtmlTags: readonly string[];

export = voidHtmlTags;
3 changes: 3 additions & 0 deletions html-tags.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare const htmlTags: readonly string[];

export = htmlTags;
14 changes: 14 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
List of standard HTML tags.
@example
```
import htmlTags = require('html-tags');
console.log(htmlTags);
//=> ['a', 'abbr', 'acronym', ...]
```
*/
declare const htmlTags: readonly string[];

export = htmlTags;
14 changes: 14 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {expectType, expectError} from 'tsd';
import htmlTags = require('.');
import voidHtmlTags = require('./void');
import htmlTagsJson = require('./html-tags.json');
import voidHtmlTagsJson = require('./html-tags-void.json');

expectType<readonly string[]>(htmlTags);
expectError(htmlTags.push(""));
expectType<readonly string[]>(voidHtmlTags);
expectError(voidHtmlTags.push(""));
expectType<readonly string[]>(htmlTagsJson);
expectError(htmlTagsJson.push(""));
expectType<readonly string[]>(voidHtmlTagsJson);
expectError(voidHtmlTagsJson.push(""));
79 changes: 42 additions & 37 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,44 @@
{
"name": "html-tags",
"version": "2.0.0",
"description": "List of standard HTML tags",
"license": "MIT",
"repository": "sindresorhus/html-tags",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"void.js",
"html-tags.json",
"html-tags-void.json"
],
"keywords": [
"html",
"html5",
"tags",
"elements",
"list",
"whatwg",
"w3c",
"void",
"self-closing"
],
"devDependencies": {
"ava": "*",
"xo": "*"
}
"name": "html-tags",
"version": "2.0.0",
"description": "List of standard HTML tags",
"license": "MIT",
"repository": "sindresorhus/html-tags",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts",
"void.js",
"void.d.ts",
"html-tags.json",
"html-tags.json.d.ts",
"html-tags-void.json",
"html-tags-void.json.d.ts"
],
"keywords": [
"html",
"html5",
"tags",
"elements",
"list",
"whatwg",
"w3c",
"void",
"self-closing"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
14 changes: 14 additions & 0 deletions void.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
List of void (self-closing) HTML tags.
@example
```
import voidHtmlTags = require('html-tags/void');
console.log(voidHtmlTags);
//=> ['area', 'base', 'br', ...]
```
*/
declare const voidHtmlTags: readonly string[];

export = voidHtmlTags;

0 comments on commit 9541b58

Please sign in to comment.