Skip to content

Commit

Permalink
Repository maintenance (#9)
Browse files Browse the repository at this point in the history
* remove extraneous files; switch to yarn

* remove more stuff

* upgrade all dependencies

* fix broken tests

* various updates

* deep tests for everything

* fix actions

* try to fix CI linting

* try to fix CI linting

* try to fix CI linting

* add some more types

* remove skipLibCheck

* change TS include

* try to fix CI linting

* try to fix CI linting

* remove node v12 as an option

* reinstate node v12

* reinstate node v12, but properly this time

* node v12 is too old for some dependency, so leave that out, but add v18

* cleanup codeQL yml
  • Loading branch information
patik authored Jan 3, 2023
1 parent 402d207 commit 6ef7327
Show file tree
Hide file tree
Showing 19 changed files with 6,356 additions and 20,428 deletions.
3 changes: 0 additions & 3 deletions .env

This file was deleted.

4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
},
env: {
jest: true,
node: true,
},
}
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

27 changes: 0 additions & 27 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

36 changes: 0 additions & 36 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

42 changes: 0 additions & 42 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'

on:
Expand All @@ -33,23 +22,15 @@ jobs:
fail-fast: false
matrix:
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run coverage
- run: yarn install
- run: yarn build
- run: yarn test
- run: yarn run coverage
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ jobs:
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
run: yarn install
run: yarn build
- name: Test
run: npm test
run: yarn test
- name: Build
run: npm run build
run: yarn run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Code Coverage
run: npm run coverage
run: yarn run coverage
48 changes: 0 additions & 48 deletions .vscode/launch.json

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022, Craig Patik <http://patik.com>
Copyright (c) 2023, Craig Patik <http://patik.com>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
41 changes: 22 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
[![Code Coverage][codecov-img]][codecov-url]
[![Semantic Release][semantic-release-img]][semantic-release-url]


## Description

`kind()` returns a *useful* name for a variable's type. It breaks down objects into more precise terms: array, null, element, etc.
Expand All @@ -20,6 +19,7 @@ Examples:
|:---------------|:--------|:------------|
| `[1, 2, 3]` | `"object"` | `"array"` |
| `null` | `"object"` | `"null"` |
| `new Promise(() => null)` | `"object"` | `"promise"` |
| `document.getElementById('id')` | `"object"` | `"element"` |
| `document.getElementsByTagName('div')` | `"object"` | `"nodelist"` |
| `document.createTextNode('')` | `"object"` | `"node"` |
Expand All @@ -34,7 +34,6 @@ Examples:

## Usage


```ts
import kind from 'kindjs';

Expand Down Expand Up @@ -82,26 +81,31 @@ A complete list is noted below
## Supported types

- All standard types normally returned by `typeof`:
+ `function`, `undefined`, `boolean`
+ `string`
* Deep option returns either `string` or `emptystring`
+ `number`
* Deep option returns either `integer` or `float`
- `function`, `undefined`, `boolean`, `symbol`
- `string`
- Deep option returns either `string` or `emptystring`
- `number`
- Deep option returns either `integer` or `float`
- `array`
- `arraylike`
+ A non-array object with a `.length` property
- A non-array object with a `.length` property
- `null`
- `element`
- `node`
+ Deep options from [this list](https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeType) (e.g. `text`, `comment`)
- Deep options from [this list](https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeType) (e.g. `text`, `comment`)
- `nodelist`
- `event`
+ Deep options from [this list](https://developer.mozilla.org/en-US/docs/Web/Events) (e.g. `mouseevent`, `keyboardevent`)
- Deep options from [this list](https://developer.mozilla.org/en-US/docs/Web/Events) (e.g. `mouseevent`, `keyboardevent`)
- `regexp`
- `date`
- `error`
- `errorevent`
- `math`
- `promise`
- `set`
- `url` (i.e. an instance of the `URL()` constructor)
- `urlsearchparams`
- `map`

## Features

Expand All @@ -110,14 +114,14 @@ A complete list is noted below
- Handles undefined or undeclared variables
- Optimized to check for the most common types first
- Excellent browser support, including many very old browsers
+ IE 6+ (and maybe older)
+ Chrome
+ Firefox
+ Safari
+ Android 1+
+ Opera (pre-Blink)
+ Netscape 4 (in theory!)
+ Probably anything that runs JavaScript and supports regular expressions
- IE 6+ (and maybe older)
- Chrome
- Firefox
- Safari
- Android 1+
- Opera (pre-Blink)
- Netscape 4 (in theory!)
- Probably anything that runs JavaScript and supports regular expressions

[build-img]: https://github.com/patik/kind/actions/workflows/release.yml/badge.svg
[build-url]: https://github.com/patik/kind/actions/workflows/release.yml
Expand All @@ -131,4 +135,3 @@ A complete list is noted below
[codecov-url]: https://codecov.io/gh/patik/kind
[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[semantic-release-url]: https://github.com/semantic-release/semantic-release

6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jest-environment-jsdom',
testMatch: ['**/test/**/*.spec.ts'],
collectCoverageFrom: ['<rootDir>/src/**/*.ts', '!<rootDir>/src/types/**/*.ts'],
globals: {
'ts-jest': {
diagnostics: false,
isolatedModules: true,
transform: {
'^.+\\.tsx?$': ['ts-jest', { diagnostics: false, isolatedModules: true }],
},
},
}
Loading

0 comments on commit 6ef7327

Please sign in to comment.