Skip to content

Commit

Permalink
chore: update project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Apr 24, 2022
1 parent 38b6ed8 commit 805b4c6
Show file tree
Hide file tree
Showing 38 changed files with 1,011 additions and 300 deletions.
5 changes: 5 additions & 0 deletions .depcheckrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ignores:
- "@commitlint/*"
- "@size-limit/*"
- "@types/jest"
- typedoc*
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ node_modules
.idea

# project folders
dist*
lib*
out*
cjs
dist
docs
esm
lib
out
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
],
"eslint.enable": true,
"cSpell.words": [
"codeql",
"jsnext",
"tersible",
"tersify"
Expand Down
42 changes: 8 additions & 34 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
const isCI = require('is-ci')
module.exports = isCI ? {
'collectCoverageFrom': [
'<rootDir>/src/**/*.[jt]s',
'!<rootDir>/src/bin.[jt]s',
'!<rootDir>/src/type-checker/*'
module.exports = {
collectCoverageFrom: [
'<rootDir>/ts/**/*.[jt]s'
],
'roots': [
'<rootDir>/src',
roots: [
'<rootDir>/ts',
],
'reporters': [
'default',
[
'jest-junit',
{
'output': '.reports/junit/js-test-results.xml',
},
],
],
'testEnvironment': 'node',
'testMatch': ['**/?(*.)+(spec|test|integrate|accept|system|unit).[jt]s?(x)'],
} : {
'collectCoverageFrom': [
'<rootDir>/src/**/*.[jt]s'
],
'reporters': [
'default',
'jest-progress-tracker',
// ['jest-audio-reporter', { volume: 0.3 }],
],
'roots': [
'<rootDir>/src',
],
'testEnvironment': 'node',
'testMatch': ['**/?(*.)+(spec|test|integrate|accept|system|unit).[jt]s?(x)'],
'watchPlugins': [
testEnvironment: 'node',
testMatch: ['**/?(*.)+(spec|test|integrate|accept|system|unit).[jt]s?(x)'],
watchPlugins: [
'jest-watch-suspend',
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
Expand Down
46 changes: 28 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,26 @@
"name": "Homa Wong (unional)",
"email": "[email protected]"
},
"main": "cjs/index.js",
"module": "esm/index.js",
"jsnext:main": "esm/index.js",
"typings": "cjs/index.d.ts",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
"cjs",
"esm",
"src"
"lib"
],
"scripts": {
"build": "tsc -p tsconfig.es5.json && tsc -p tsconfig.esnext.json",
"clean": "rimraf lib esm",
"build": "tsc -p tsconfig.build.json",
"build:doc": "typedoc",
"clean": "rimraf cjs lib esm coverage",
"coverage": "jest --coverage",
"dependency-check": "dependency-check . --unused --no-dev && dependency-check . --missing --no-dev",
"depcheck": "depcheck",
"lint": "eslint --ext=js,ts .",
"test": "jest --reporters=default",
"verify": "yarn lint && yarn build && yarn dependency-check && jest --coverage --reporters=default",
"nuke": "yarn clean && rimraf node_modules",
"prepare": "husky install",
"release": "npx semantic-release",
"size-limit": "size-limit",
"test": "jest",
"test:types": "tsc",
"verify": "run-p verify:build lint test:types coverage",
"verify:build": "npm-run-all clean build -p depcheck size-limit",
"watch": "jest --watch",
"watch:type": "tsc --watch"
},
Expand All @@ -40,28 +43,35 @@
},
"devDependencies": {
"@babel/core": "7.17.9",
"@babel/plugin-proposal-class-properties": "7.16.7",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.16.7",
"@babel/plugin-proposal-optional-chaining": "7.16.7",
"@babel/preset-env": "7.16.11",
"@babel/preset-typescript": "7.16.7",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@size-limit/preset-small-lib": "^7.0.8",
"@types/jest": "27.4.1",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"assertron": "9.0.5",
"dependency-check": "^4.1.0",
"depcheck": "^1.4.3",
"eslint": "8.14.0",
"eslint-plugin-harmony": "^6.0.3",
"husky": "^7.0.4",
"is-ci": "^3.0.1",
"jest": "27.5.1",
"jest-junit": "^13.2.0",
"jest-validate": "27.5.1",
"jest-watch-suspend": "^1.1.2",
"jest-watch-toggle-config": "^2.0.1",
"jest-watch-typeahead": "^1.0.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"size-limit": "^7.0.8",
"type-plus": "4.9.0",
"typedoc": "^0.22.15",
"typedoc-plugin-extras": "^2.2.3",
"typescript": "4.6.3"
}
},
"size-limit": [
{
"limit": "10 kb"
}
]
}
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/createSatisfier.ts → ts/createSatisfier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function diff(expected: any, actual: any, path: Diff['path'] = [], _index?: numb
}]
}

// tslint:disable-next-line: strict-type-predicates valid-typeof
if (typeof expected === 'bigint') {
return actual === expected ? noDiff : [{
path,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/some.ts → ts/some.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { tersible, tersify } from 'tersify'
import { createSatisfier } from './createSatisfier'
import { createSatisfier, Expectation } from './createSatisfier'

/**
* Check if an array have at least one entry satisfying the expectation.
* @param expectation expectation
*/
export function some(expectation: any) {
export function some<E extends Expectation>(expectation: E) {
const s = createSatisfier(expectation)
return tersible((e: any) => e && Array.isArray(e) && e.some(v => s.test(v)), () => `some(${tersify(expectation)})`)
}
File renamed without changes.
File renamed without changes.
23 changes: 0 additions & 23 deletions tsconfig.base.json

This file was deleted.

30 changes: 30 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": [
"DOM",
"ES2020"
],
"module": "CommonJS",
"moduleResolution": "node",
"newLine": "LF",
"noUnusedLocals": true,
"noUnusedParameters": false,
"outDir": "lib",
"sourceMap": true,
"inlineSources": true,
"strict": true,
"stripInternal": true,
"target": "ES2020",
"useDefineForClassFields": true
},
"include": [
"typings"
],
"files": [
"ts/index.ts"
]
}
8 changes: 0 additions & 8 deletions tsconfig.es5.json

This file was deleted.

11 changes: 0 additions & 11 deletions tsconfig.esnext.json

This file was deleted.

17 changes: 14 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{
"extends": "./tsconfig.esnext.json",
"extends": "./tsconfig.build.json",
"compilerOptions": {
"noEmit": true
},
"include": [
"src",
"ts",
"typings"
]
],
"typedocOptions": {
"customTitle": "A purposely loose comparison tool.",
"customTitleLink": "https://github.com/unional/satisfier",
"entryPoints": [
"src/index.ts"
],
"out": "docs"
}
}
Loading

0 comments on commit 805b4c6

Please sign in to comment.