diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe284ad..638184c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,8 +7,8 @@ jobs: name: ${{matrix.node}} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: dcodeIO/setup-node-nvm@master + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 with: node-version: ${{matrix.node}} - run: npm install @@ -17,5 +17,5 @@ jobs: strategy: matrix: node: - - lts/erbium + - lts/hydrogen - node diff --git a/.gitignore b/.gitignore index c977c85..15c4d8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -.DS_Store -*.d.ts -*.log coverage/ node_modules/ +*.d.ts +*.log +.DS_Store yarn.lock diff --git a/index.js b/index.js index 33f4850..a2ddd00 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ * * @type {string[]} */ -export var vendors = [ +export const vendors = [ 'ah', 'apple', 'atsc', diff --git a/package.json b/package.json index a4de4f2..1535f13 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vendors", - "version": "2.0.0", + "version": "2.0.1", "description": "List of vendor prefixes known to the web platform", "license": "MIT", "keywords": [ @@ -32,24 +32,22 @@ "index.js" ], "devDependencies": { - "@types/tape": "^4.0.0", + "@types/node": "^18.0.0", "c8": "^7.0.0", "prettier": "^2.0.0", - "remark-cli": "^9.0.0", - "remark-preset-wooorm": "^8.0.0", - "rimraf": "^3.0.0", - "tape": "^5.0.0", + "remark-cli": "^11.0.0", + "remark-preset-wooorm": "^9.0.0", + "type-coverage": "^2.0.0", "typescript": "^4.0.0", - "xo": "^0.38.0" + "xo": "^0.52.0" }, "scripts": { - "prepublishOnly": "npm run build", + "prepack": "npm run build && npm run format", + "build": "tsc --build --clean && tsc --build && type-coverage", "format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix", - "prebuild": "rimraf \"*.d.ts\"", - "build": "tsc", - "test-api": "node test", - "test-coverage": "c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js", - "test": "npm run format && npm run build && npm run test-coverage" + "test-api": "node --conditions development test.js", + "test-coverage": "c8 --check-coverage --100 --reporter lcov npm run test-api", + "test": "npm run build && npm run format && npm run test-coverage" }, "prettier": { "tabWidth": 2, @@ -60,16 +58,17 @@ "trailingComma": "none" }, "xo": { - "prettier": true, - "rules": { - "import/no-mutable-exports": "off", - "no-var": "off", - "prefer-arrow-callback": "off" - } + "prettier": true }, "remarkConfig": { "plugins": [ "preset-wooorm" ] + }, + "typeCoverage": { + "atLeast": 100, + "detail": true, + "strict": true, + "ignoreCatch": true } } diff --git a/readme.md b/readme.md index 63aa2ad..1ce22c2 100644 --- a/readme.md +++ b/readme.md @@ -5,25 +5,56 @@ [![Downloads][downloads-badge]][downloads] [![Size][size-badge]][size] - - -List of (real) vendor prefixes known to the web platform. +List of vendor prefixes. + +## Contents + +* [What is this?](#what-is-this) +* [When should I use this?](#when-should-i-use-this) +* [Install](#install) +* [Use](#use) +* [API](#api) + * [`vendors`](#vendors-1) +* [Types](#types) +* [Compatibility](#compatibility) +* [Security](#security) +* [Contribute](#contribute) +* [License](#license) + +## What is this? + +This is a little list of real (as in, `mso-` and `prince-` are not included +because they are not valid) vendor prefixes known to the web platform. From [Wikipedia][wiki] and the [CSS 2.1 spec][spec]. -† — real, as in, `mso-` and `prince-` are not included because they are -not valid. +## When should I use this? -## Install +You can use this package if you’re dealing with parsing and transforming CSS and +you don’t want to copy/paste these prefixes into each project. -This package is ESM only: Node 12+ is needed to use it and it must be `import`ed -instead of `require`d. +## Install -[npm][]: +This package is [ESM only][esm]. +In Node.js (version 14.14+, 16.0+), install with [npm][]: ```sh npm install vendors ``` +In Deno with [`esm.sh`][esmsh]: + +```js +import {vendors} from 'https://esm.sh/vendors@2' +``` + +In browsers with [`esm.sh`][esmsh]: + +```html + +``` + ## Use ```js @@ -56,13 +87,33 @@ Yields: ## API -This package exports the following identifiers: `vendors`. +This package exports the identifier `vendors`. There is no default export. ### `vendors` List of vendor prefixes (`string[]`). +## Types + +This package is fully typed with [TypeScript][]. +It exports no additional types. + +## Compatibility + +This package is at least compatible with all maintained versions of Node.js. +As of now, that is Node.js 14.14+ and 16.0+. +It also works in Deno and modern browsers. + +## Security + +This package is safe. + +## Contribute + +Yes please! +See [How to Contribute to Open Source][contribute]. + ## License [MIT][license] © [Titus Wormer][author] @@ -87,10 +138,18 @@ List of vendor prefixes (`string[]`). [npm]: https://docs.npmjs.com/cli/install +[esmsh]: https://esm.sh + [license]: license [author]: https://wooorm.com +[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c + +[typescript]: https://www.typescriptlang.org + +[contribute]: https://opensource.guide/how-to-contribute/ + [wiki]: https://en.wikipedia.org/wiki/CSS_hack#Browser_prefixes -[spec]: https://www.w3.org/TR/CSS21/syndata.html#vendor-keyword-history +[spec]: https://www.w3.org/TR/CSS22/syndata.html#vendor-keyword-history diff --git a/test.js b/test.js index 49036a5..8faa57c 100644 --- a/test.js +++ b/test.js @@ -1,18 +1,17 @@ -import test from 'tape' +import assert from 'node:assert/strict' +import test from 'node:test' import {vendors} from './index.js' -test('vendors', function (t) { - var index = -1 +test('vendors', function () { + let index = -1 - t.ok(Array.isArray(vendors), 'should be an `array`') + assert.ok(Array.isArray(vendors), 'should be an `array`') while (++index < vendors.length) { - t.equal( + assert.equal( typeof vendors[index], 'string', '`' + vendors[index] + '` should be a string' ) } - - t.end() }) diff --git a/tsconfig.json b/tsconfig.json index 8ac10fe..016d1f4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,17 @@ { - "files": ["index.js"], - "include": ["*.js"], + "include": ["**/**.js"], + "exclude": ["coverage", "node_modules"], "compilerOptions": { - "target": "ES2020", - "lib": ["ES2020"], - "module": "ES2020", - "moduleResolution": "node", - "allowJs": true, "checkJs": true, "declaration": true, "emitDeclarationOnly": true, - "allowSyntheticDefaultImports": true, - "skipLibCheck": true + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "lib": ["es2020"], + "module": "node16", + "newLine": "lf", + "skipLibCheck": true, + "strict": true, + "target": "es2020" } }