Skip to content

Commit

Permalink
feat: add TS type defs
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Nov 10, 2023
1 parent 9f8a0de commit cf18df5
Show file tree
Hide file tree
Showing 24 changed files with 8,580 additions and 9,825 deletions.
10 changes: 10 additions & 0 deletions .babelrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-env node, es2018 */
module.exports = function (api) {
const base = require('@jcoreio/toolchain-esnext/.babelrc.cjs')(api)
return {
...base,
plugins: base.plugins.filter(
(p) => !/babel-plugin-flow-react-proptypes/.test(p)
),
}
}
26 changes: 0 additions & 26 deletions .babelrc.js

This file was deleted.

44 changes: 24 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
version: 2
# created by @jcoreio/toolchain-circle

version: 2.1
jobs:
build:
docker:
- image: circleci/node:14
- image: cimg/node:20.3.0

steps:
- checkout

- run:
name: Setup NPM Token
command: |
yarn config set registry "https://registry.npmjs.org/"
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc
# https://github.com/atlassian/react-beautiful-dnd/issues/1007#issuecomment-446415426
npm config set \
"//registry.npmjs.org/:_authToken=$NPM_TOKEN" \
"registry=https://registry.npmjs.org/"
- run:
name: Workaround for Flow crashing
command: echo "server.max_workers=1" >> .flowconfig

name: Corepack enable
command: sudo corepack enable
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile

command: pnpm install --frozen-lockfile
- run:
name: build
command: yarn run prepublishOnly
- run:
name: upload test coverage
command: yarn codecov
name: Prepublish
command: |
[[ $(netstat -tnlp | grep -F 'circleci-agent') ]] || pnpm run tc prepublish
- run:
name: release
command: yarn run semantic-release
name: Release
command: |
[[ $(netstat -tnlp | grep -F 'circleci-agent') ]] || pnpm run tc release
workflows:
build:
jobs:
- build:
context:
- npm-release
- github-release
22 changes: 0 additions & 22 deletions .eslintrc

This file was deleted.

10 changes: 10 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-env node, es2018 */
module.exports = {
extends: [require.resolve('@jcoreio/toolchain/eslint.config.cjs')],
env: {
es2017: true,
},
rules: {
'@typescript-eslint/ban-types': 0,
},
}
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<PROJECT_ROOT>/node_modules/.*/fbjs/.*
<PROJECT_ROOT>/node_modules/fbjs/.*
<PROJECT_ROOT>/node_modules/.*/config-chain/.*
<PROJECT_ROOT>/dist/.*
.*/malformed_package_json/.*

[include]
./src
Expand Down
17 changes: 3 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
/coverage
/.nyc_output
/dist
.nyc_output
node_modules
/lib
/es
.eslintcache
*.js
*.js.flow
*.ts
!/flow-typed/**/*.js
!/src/**/*.js
!/src/**/*.ts
!/test/**/*.js
!/.babelrc.js
!/webpack.config.js
/coverage
6 changes: 6 additions & 0 deletions .mocharc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint-env node, es2018 */
const base = require('@jcoreio/toolchain-mocha/.mocharc.cjs')
module.exports = {
...base,
exit: true,
}
13 changes: 0 additions & 13 deletions .npmignore

This file was deleted.

5 changes: 5 additions & 0 deletions githooks.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-env node, es2018 */
const base = require('@jcoreio/toolchain/githooks.cjs')
module.exports = {
...base,
}
5 changes: 5 additions & 0 deletions lint-staged.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-env node, es2018 */
const base = require('@jcoreio/toolchain/lint-staged.config.cjs')
module.exports = {
...base,
}
5 changes: 5 additions & 0 deletions nyc.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* eslint-env node, es2018 */
const base = require('@jcoreio/toolchain-mocha/nyc.config.cjs')
module.exports = {
...base,
}
142 changes: 46 additions & 96 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,14 @@
"name": "react-router-parsed",
"version": "0.0.0-development",
"description": "<Route> wrapper to handle param/query parsing",
"main": "index.js",
"sideEffects": false,
"scripts": {
"lint": "eslint $npm_package_config_eslint",
"lint:fix": "eslint --fix $npm_package_config_eslint",
"prettier": "prettier --write $npm_package_config_prettier",
"prettier:check": "prettier --list-different $npm_package_config_prettier",
"flow": "flow",
"flow:coverage": "for file in src/**.js test/**.js; do echo $file; flow coverage $file; done",
"clean": "rimraf es lib $(cd src; ls) *.js.flow *.d.ts",
"build": "npm run clean && babel src --out-dir es && flow-copy-source -v src/ es && copy src/**/*.d.ts es && cross-env BABEL_ENV=es5 babel src --out-dir . && flow-copy-source -v src/ . && copy src/**/*.d.ts .",
"test": "cross-env NODE_ENV=test BABEL_ENV=es5 mocha $npm_package_config_mocha && cross-env NODE_ENV=test BABEL_ENV=coverage nyc --reporter=lcov --reporter=text mocha $npm_package_config_mocha",
"test:watch": "cross-env NODE_ENV=test BABEL_ENV=test mocha --watch $npm_package_config_mocha",
"test:debug": "cross-env NODE_ENV=test BABEL_ENV=test mocha --inspect-brk $npm_package_config_mocha",
"codecov": "nyc report --reporter=text-lcov > coverage.lcov; codecov",
"prepublishOnly": "npm run clean && npm run prettier:check && npm run lint && flow && npm test && npm run build",
"open:coverage": "open coverage/lcov-report/index.html",
"semantic-release": "semantic-release",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged && npm run lint && flow",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-push": "npm test"
}
},
"lint-staged": {
"*.{js,json,css,md,ts}": [
"prettier --write"
]
},
"commitlint": {
"extends": [
"@jedwards1211/commitlint-config"
]
},
"prettier": {
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
},
"config": {
"mocha": "-r @babel/register -r jsdom-global/register test/configure.js 'test/**/*.js'",
"eslint": "src test --cache",
"prettier": "*.{json,md,js} {src,test}/**/*.{js,ts}",
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"nyc": {
"include": [
"src/**/*.js"
],
"require": [
"@babel/register"
],
"sourceMap": false,
"instrument": false
"build-storybook": "build-storybook",
"tc": "toolchain",
"toolchain": "toolchain",
"test": "toolchain test",
"prepublishOnly": "echo This package is meant to be published by semantic-release from the dist build directory. && exit 1"
},
"repository": {
"type": "git",
Expand All @@ -78,63 +26,65 @@
},
"homepage": "https://github.com/jcoreio/react-router-parsed#readme",
"devDependencies": {
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/eslint-parser": "^7.12.13",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-export-default-from": "^7.12.1",
"@babel/plugin-proposal-export-namespace-from": "^7.12.1",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-runtime": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/preset-flow": "^7.12.1",
"@babel/preset-react": "^7.12.10",
"@babel/register": "^7.12.10",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@jedwards1211/commitlint-config": "^1.0.2",
"@jedwards1211/eslint-config": "^2.0.2",
"@jedwards1211/eslint-config-flow": "^3.0.0",
"@jedwards1211/eslint-config-react": "^4.0.0",
"babel-eslint": "^10.1.0",
"babel-plugin-flow-react-proptypes": "^26.0.0",
"babel-plugin-istanbul": "^6.0.0",
"chai": "^4.2.0",
"@babel/plugin-syntax-flow": "^7.14.5",
"@babel/plugin-transform-react-jsx": "^7.14.9",
"@jcoreio/toolchain": "^3.2.0",
"@jcoreio/toolchain-circle": "^3.2.0",
"@jcoreio/toolchain-esnext": "^3.2.0",
"@jcoreio/toolchain-flow": "^3.2.0",
"@jcoreio/toolchain-mocha": "^3.2.0",
"@jcoreio/toolchain-react": "^3.2.0",
"@jcoreio/toolchain-semantic-release": "^3.2.0",
"@jcoreio/toolchain-typescript": "^3.2.0",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"chai": "^4.3.7",
"chai-subset": "^1.6.0",
"codecov": "^3.8.1",
"copy": "^0.3.2",
"cross-env": "^7.0.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^7.18.0",
"eslint": "^8.43.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-react": "^7.32.2",
"flow-bin": "^0.143.1",
"flow-copy-source": "https://github.com/jedwards1211/flow-copy-source#no-watch",
"husky": "^4.3.8",
"jsdom": "^16.4.0",
"jsdom-global": "^3.0.2",
"lint-staged": "^10.5.3",
"mocha": "^8.2.1",
"nyc": "^15.1.0",
"prettier": "^2.2.1",
"prettier-eslint": "^12.0.0",
"global-jsdom": "^9.0.1",
"jsdom": "^22.1.0",
"mocha": "^10.2.0",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-router": "^5.2.0",
"rimraf": "^3.0.2",
"semantic-release": "^17.3.7",
"sinon": "^6.1.3",
"typescript": "^4.1.3"
"typescript": "^5.1.0"
},
"dependencies": {
"@babel/runtime": "^7.12.5",
"@babel/runtime": "^7.18.6",
"@types/history": "^4.0.0",
"@types/react-router": "^5.1.0",
"prop-types": "^15.7.2"
},
"peerDependencies": {
"react": "^16.0.0 || ^17.0.0",
"react-router": "^5.0.0"
}
},
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
"./package.json": "./dist/package.json",
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./*": {
"types": "./dist/*.d.ts",
"default": "./dist/*.js"
}
},
"engines": {
"node": ">=16"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit cf18df5

Please sign in to comment.