Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hoverinc/hover-javascript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.92.0
Choose a base ref
...
head repository: hoverinc/hover-javascript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jul 3, 2022

  1. fix(config/jest): set ts-jest transform unconditionally

    This reverts commit 0badbb3.
    jrolfs committed Jul 3, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    03df4f9 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    cca61de View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    edea114 View commit details
  4. fix(api/test): forward ts-jest utils from ts-jest, remove mocked

    See: https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md#deprecations
    See: jestjs/jest#12089
    
    BREAKING CHANGE: `api/test` no longer exports `mocked()`, it's available
    at `jest.mocked()` now
    jrolfs committed Jul 3, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    56756f9 View commit details
  5. feat(config/eslint): dissallow default exports in strict configuration

    BREAKING CHANGE: default exports are no longer allowed when using
    **@hover/javascript/eslint/strict**
    jrolfs committed Jul 3, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    1fbee33 View commit details
  6. feat(scripts/test): upgrade Jest to 28.x

    BREAKING CHANGE: upgrades Jest a major version (27 to 28)
    jrolfs committed Jul 3, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    0c67b80 View commit details

Commits on Jul 6, 2022

  1. feat(scripts/ci-after-success): use Semantic Release 19

    BREAKING CHANGE: using new major version of Semantic Release in `ci-after-success`
    jrolfs committed Jul 6, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    9e87c79 View commit details
  2. feat(config/release): specify next as a pre-release channel as well

    BREAKING CHANGE: the `next` branch will now be treated as pre-releases too
    jrolfs committed Jul 6, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    5ace598 View commit details

Commits on Sep 7, 2022

  1. feat(scripts/test): upgrade Jest to 29.x

    BREAKING CHANGE: upgrades Jest a major version (28 to 29)
    BREAKING CHANGE: Node 12 is no longer supported
    jrolfs committed Sep 7, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    955ea31 View commit details
  2. feat(scripts/test): upgrade Jest to 29.x

    BREAKING CHANGE: upgrades Jest a major version (28 to 29)
    BREAKING CHANGE: Node 12 is no longer supported
    jrolfs committed Sep 7, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    01dadec View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    67d8f1e View commit details
  4. build: deduplicate lockfile

    jrolfs committed Sep 7, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    639f4fa View commit details
  5. feat(config/test): use **@swc/jest** as default Jest transform

    BREAKING CHANGE: **@swc/jest** is now the default Jest transform and
    **ts-jest** is no longer installed by default. To preserve the old transform
    behavior, install **ts-jest** as a \`devDependency\` in you project. ∙ BREAKING
    CHANGE: the \`@hover/javascript/api/test\` API has been removed as **ts-jest**
    is no longer installed by default. If you're still using **ts-jest**, import
    its helpers directly from **ts-jest** instead of the \`/api/test\` entrypoint.
    jrolfs committed Sep 7, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    bf86aac View commit details

Commits on Sep 25, 2022

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    d2e9873 View commit details
  2. build: use latest Node 16

    jrolfs committed Sep 25, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    be54bb5 View commit details

Commits on Sep 29, 2022

  1. fix(config/jest): add jest-environment-jsdom as a dependency

    Jest no longer bundles it as of 28.x... which makes sense as installing
    JSDOM when we're using the default `testEnvironment` (`node`) is
    pretty silly. For now I'm opting to continue bundling it for the sake
    of simplicity, but we should probably consider modularizing
    @hover/javascript in the future.
    jrolfs committed Sep 29, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    c81409e View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    7627f06 View commit details

Commits on Dec 9, 2022

  1. build: use Node 18

    jrolfs committed Dec 9, 2022
    Copy the full SHA
    9997545 View commit details
  2. feat(api/commit): add support for excluding directories in ls.dirs()

    BREAKING CHANGE: `ls.dirs()` from `api/commit` now takes an options
    object as the second parameter instead of a `prefix`. If you're using
    a prefix you'll need to make the following change:
    
    ```ts
    // Before
    ls.dirs('./packages', 'my-prefix');
    
    // After
    ls.dirs('./packages', { prefix: 'my-prefix' });
    ```
    
    BREAKING CHANGE: `ls.dirs()` now excludes `node_modules` directories
    by default. If for some reason you want to include \`node_modules\`,
    you'll need to explicitly set \`exclude\` to \`null\`:
    
    ```ts
    // Before
    ls.dirs('./packages');
    
    // After
    ls.dirs('./packages', { exclude: null });
    ```
    jrolfs committed Dec 9, 2022
    Copy the full SHA
    8648a39 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    a5d4057 View commit details
  4. Copy the full SHA
    12c307b View commit details
  5. Copy the full SHA
    fcb02d2 View commit details
  6. build: move shared TypeScript configuration to project root instead o…

    …f extending
    
    For consistency, up until now, the shared TypeScript configuration has lived in
    `src/config` with all of the other shared configurations that this package
    provides. For all of the other configurations we're able to simple re-export
    the configuration at the project root to provide it to consumers at
    `require('@hover/javascript/[config]')`. Because the TypeScript configuration
    is JSON, however, we were using `extends` instead of re-exporting. This has been
    causing all kinds of trouble within this package since we were extending from the
    `dist` directory. This finally moves the canonical TypeScript configuration
    to the root, so that we don't need to `extends` from `dist/` while preserving
    `src/config/tsconfig.json` via `extends` just in case. The actual configuration
    for this project itself still lives at `src/tsconfig.json`, but this prevents
    issues when anything (like the `ts-node` that gets loaded in `commitlint`
    from trying to read a non-existent `dist/tsconfig.json` if it does read
    the `tsconfig.json` at the root of the project.
    jrolfs committed Dec 9, 2022
    Copy the full SHA
    8ba039c View commit details

Commits on Dec 17, 2022

  1. feat(deps): update eslint

    renovate[bot] authored and jrolfs committed Dec 17, 2022
    Copy the full SHA
    17e60e0 View commit details
  2. Copy the full SHA
    3f56e8a View commit details
  3. Copy the full SHA
    5e14147 View commit details
  4. Copy the full SHA
    c58825a View commit details

Commits on Jan 7, 2023

  1. build(deps): bump json5 from 1.0.1 to 1.0.2

    Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
    - [Release notes](https://github.com/json5/json5/releases)
    - [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
    - [Commits](json5/json5@v1.0.1...v1.0.2)
    
    ---
    updated-dependencies:
    - dependency-name: json5
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and kodiakhq[bot] committed Jan 7, 2023
    Copy the full SHA
    5e94f75 View commit details

Commits on Jan 10, 2023

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    446707a View commit details

Commits on Jan 18, 2023

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    6bb9799 View commit details
  2. feat(deps): upgrade all dependencies to latest

    BREAKING CHANGE: potential breaking change as some upgrades were major
    jrolfs committed Jan 18, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    82d6fdd View commit details

Commits on Jan 19, 2023

  1. Merge branch 'main' into beta

    # Conflicts:
    #	package.json
    #	yarn.lock
    jrolfs committed Jan 19, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    17ce718 View commit details
  2. Merge pull request #782 from hoverinc/beta

    🔖 Beta
    jrolfs authored Jan 19, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ad6df53 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    03ea9b1 View commit details
  4. Merge branch 'main' into next

    # Conflicts:
    #	jest.config.js
    #	package.json
    #	src/config/jest.config.js
    #	yarn.lock
    jrolfs committed Jan 19, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    62e4012 View commit details
  5. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    c01832f View commit details
  6. chore: remove discrepancy in Jest configuration

    I have to merge `next` to appease Semantic Release... my fault
    for abandoning it I guess 😩 EINVALIDNEXTVERSION
    jrolfs committed Jan 19, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    e0f0875 View commit details
  7. Merge pull request #829 from hoverinc/next

    Ugh I abandoned this branch/release channel because I rebased it and fucked up semantic-release... now it won't let me release on main (EINVALIDNEXTVERSION) until this is merged so hopefully merging it with a minimal diff appeases semantic-release otherwise I'm ditching it for good for Changesets 🖕🏻
    jrolfs authored Jan 19, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6f208dd View commit details

Commits on Feb 27, 2023

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    33c2fcd View commit details
  2. fix(scripts/commit-msg): prevent commitlint from ever type-checking c…

    …onfiguration
    
    **@commitlint/cli** added support for TypeScript-based configurations via `ts-node`, and that has caused a good deal of grief:
    
    conventional-changelog/commitlint#3420
    conventional-changelog/commitlint#3351
    conventional-changelog/commitlint#3218
    conventional-changelog/commitlint#3256
    
    hoverinc/web-react#1792
    
    Both because it's a heavy-ass dependency and because it requires configuration to
    work properly. It seems like project-local configuration can affect it's invocation
    of ts-node, which happens even JavaScript configuration files now?... lame.
    
    Anyways, this ensures we avoid any type-checking that happens in it's ts-node
    invocation until we get a better solution upstream (or contribute one). Ideally,
    installing ts-node would be opt-in etc.
    jrolfs committed Feb 27, 2023

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    b195b15 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    6801d01 View commit details
  4. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    f95265d View commit details
  5. Merge pull request #873 from hoverinc/fix/post-seven-dot-oh

    🐛 Post 7.0 fixes
    jrolfs authored Feb 27, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    567aaf9 View commit details
  6. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    9a3be51 View commit details

Commits on Feb 28, 2023

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    5e2c409 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    ffaf7e8 View commit details
  3. Merge pull request #874 from hoverinc/feature/allow-some-default-exports

    ✨ Allow default exports in some specific cases
    jrolfs authored Feb 28, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b08c0ab View commit details
  4. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    jrolfs Jamie Rolfs
    Copy the full SHA
    0d9a28c View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f821282 View commit details

Commits on Mar 6, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    65d5c06 View commit details
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ jobs:
if: ${{ needs.deduplicate.outputs.should_skip != 'true' }}
strategy:
matrix:
node: ['12', '14', '16']
node: ['14', '16', '18']

steps:
- name: Get Yarn cache path
@@ -45,7 +45,7 @@ jobs:
node-version: ${{ matrix.node }}

- name: Load Yarn cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
@@ -59,7 +59,7 @@ jobs:

- name: Upload Coverage / Release
run: yarn ci-after-success
if: ${{ matrix.node == '14' }}
if: ${{ matrix.node == '16' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -5,4 +5,13 @@ dist
.opt-out
.DS_Store
.eslintcache
.idea
.idea

# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/patches
!.yarn/releases
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
.pnp.*
2 changes: 1 addition & 1 deletion .kodiak.toml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ versions = ["patch"]
usernames = ["dependabot"]

[approve]
auto_approve_usernames = ["dependabot"]
auto_approve_usernames = ["renovate"]

[update]
ignored_usernames = ["dependabot"]
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.0
18.20.8
363 changes: 363 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

875 changes: 875 additions & 0 deletions .yarn/releases/yarn-3.8.7.cjs

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
enableInlineBuilds: true

changesetBaseRefs:
- HEAD

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: '@yarnpkg/plugin-typescript'
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.8.7.cjs
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -146,7 +146,13 @@ module.exports = require('@hover/javascript/prettier')

Or, for Jest in `jest.config.js`:

> ℹ️ If **ts-jest** is installed, it will automatically be used as the `preset`
> ⚠️ Starting with
> [**7.0**](https://github.com/hoverinc/hover-javascript/releases/tag/v7.0.0),
> the default Jest `transform` is
> [**@swc-node/jest**](https://github.com/swc-project/swc-node/#swc-nodejest).
> If you want to continue using
> [**ts-jest**](https://kulshekhar.github.io/ts-jest/), simpy install `ts-jest`
> in your project and it will automatically be used as the `transform` instead.
```js
const config = require('@hover/javascript/jest')
@@ -294,7 +300,7 @@ This project is actively maintained by engineers at
[license-badge]: https://img.shields.io/npm/l/@hover/javascript.svg
[license-link]: https://github.com/hoverinc/hover-javascript/blob/master/LICENSE
[node-link]: https://nodejs.org/en/download/
[node-badge]: https://img.shields.io/badge/node-v16.13.0-green
[node-badge]: https://img.shields.io/badge/node-v18.12.1-green
[prettier-badge]:
https://img.shields.io/badge/code_style-prettier-ff69b4.svg?logo=prettier
[prettier-link]: https://prettierjs.org/en/download/
10 changes: 0 additions & 10 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -10,14 +10,4 @@ module.exports = {
roots: ['<rootDir>/src'],
coverageThreshold: null,
transformIgnorePatterns: [...transformIgnorePatterns, '.prettierrc.js'],
globals: {
'ts-jest': {
...globals['ts-jest'],
tsconfig: './src/tsconfig.json',
diagnostics: {
warnOnly: true,
exclude: ['**/*'],
},
},
},
}
112 changes: 60 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
@@ -3,9 +3,7 @@
"version": "0.0.0-semantically-released",
"description": "CLI toolbox for common scripts for JavaScript + TypeScript projects",
"engines": {
"node": ">=v12.22.12",
"npm": ">=6",
"yarn": ">=1.22.19"
"node": ">=14.21.3"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
@@ -14,7 +12,7 @@
"hover-scripts": "dist/index.js"
},
"scripts": {
"build": "run-p build:*",
"build": "run-p 'build:*'",
"build:source": "babel --source-maps --out-dir dist --ignore '**/__tests__/**','**/__mocks__/**' --copy-files --no-copy-ignored src",
"build:types": "tsc -p src/",
"ci-after-success": "node src ci-after-success",
@@ -23,10 +21,10 @@
"format": "node src format",
"lint": "node src lint",
"prepublishOnly": "yarn build",
"start": "run-p start:*",
"start": "run-p 'start:*'",
"start:source": "yarn build:source --watch",
"start:types": "tsc -b -w --preserveWatchOutput src/",
"test": "node src test",
"test": "SWC_NODE_PROJECT=src/tsconfig.json node src test",
"test:update": "node src test --updateSnapshot",
"validate": "node src validate",
"prepare": "husky install"
@@ -37,7 +35,6 @@
"dist",
"commitlint.js",
"config.js",
"dist",
"eslint-react.js",
"eslint",
"jest.js",
@@ -50,51 +47,52 @@
"author": "Jamie Rolfs <jamie.rolfs@hover.to>",
"license": "MIT",
"dependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.2.1",
"@commitlint/prompt": "^16.1.0",
"@types/jest": "^27.0.2",
"@types/lodash.has": "^4.5.7",
"@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.8.1",
"@commitlint/prompt": "^17.8.1",
"@swc-node/jest": "^1.5.6",
"@swc/core": "^1.3.38",
"@swc/helpers": "^0.4.14",
"@types/jest": "^29.5.4",
"@types/lodash.has": "^4.5.9",
"@types/mkdirp": "^1.0.2",
"@types/node": ">=17.x",
"@types/node": "^18.19.100",
"@types/rimraf": "^3.0.2",
"@types/which": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"arrify": "^2.0.1",
"commitizen": "^4.2.6",
"concurrently": "^7.0.0",
"cosmiconfig": "^7.0.1",
"@types/which": "^2.0.2",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"commitizen": "^4.3.1",
"concurrently": "^7.6.0",
"cosmiconfig": "^8.3.6",
"cross-env": "^7.0.3",
"cross-spawn": "^7.0.3",
"depcheck": "^1.4.3",
"doctoc": "^2.1.0",
"eslint": "^8.29.0",
"cross-spawn": "^7.0.6",
"doctoc": "^2.2.1",
"eslint": "^8.57.1",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.9.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.11",
"eslint-plugin-react-hooks": "^4.6.0",
"glob": "^8.0.3",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.2",
"glob": "^8.1.0",
"is-ci": "^3.0.1",
"jest": "^27.5.1",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-github-actions-reporter": "^1.0.3",
"jest-watch-typeahead": "^1.0.0",
"lint-staged": "^12.3.4",
"jest-watch-typeahead": "^2.2.2",
"lint-staged": "^13.3.0",
"lodash.has": "^4.5.2",
"mkdirp": "^1.0.4",
"prettier": "^2.5.1",
"mkdirp": "^2.1.3",
"prettier": "^2.8.8",
"read-pkg-up": "^7.0.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.1.3",
"tslib": "^2.4.0",
"typescript": "^4",
"which": "^2.0.2",
"yargs-parser": "^21.0.1"
"rimraf": "^4.1.1",
"tslib": "^2.8.1",
"typescript": "^4.9.5",
"which": "^3.0.0",
"yargs-parser": "^21.1.1"
},
"eslintConfig": {
"parserOptions": {
@@ -110,7 +108,8 @@
"import/no-unassigned-import": "off",
"no-console": "off",
"no-nested-ternary": "off",
"no-useless-catch": "off"
"no-useless-catch": "off",
"jest/prefer-snapshot-hint": "off"
}
},
"eslintIgnore": [
@@ -127,15 +126,24 @@
},
"homepage": "https://github.com/hoverinc/hover-javascript#readme",
"devDependencies": {
"@babel/cli": "^7.17.10",
"@babel/core": "^7.17.2",
"@babel/preset-env": "^7.16.11",
"@types/cross-spawn": "^6.0.2",
"babel-jest": "^28.1.0",
"eslint-config-kentcdodds": "^20.0.1",
"husky": "^7.0.4",
"@babel/cli": "^7.27.2",
"@babel/core": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@types/cross-spawn": "^6.0.6",
"depcheck": "^1.4.7",
"eslint-config-kentcdodds": "^20.5.0",
"husky": "^8.0.3",
"jest-in-case": "^1.0.2",
"npm-run-all": "^4.1.5",
"slash": "^3.0.0"
}
},
"peerDependencies": {
"ts-jest": "^29.0.0"
},
"peerDependenciesMeta": {
"ts-jest": {
"optional": true
}
},
"packageManager": "yarn@3.8.7"
}
13 changes: 0 additions & 13 deletions renovate.json

This file was deleted.

19 changes: 19 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
extends: [
'github>jrolfs/renovate:npm.json5',
'github>jrolfs/renovate:npm-feat.json5',
':widenPeerDependencies',
],
packageRules: [
{
matchPackagePatterns: ['eslint'],
groupName: 'eslint',
},

// Overriding hoverinc/renovate to merge _all_ minor
// updates (not just devDependencies) because, technically,
// @hover/javascript itself is one big devDependency
{matchUpdateTypes: ['patch', 'minor'], automerge: true},
],
}
1 change: 1 addition & 0 deletions src/api/__tests__/__fixtures__/ls/dirs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!node_modules
Empty file.
20 changes: 19 additions & 1 deletion src/api/__tests__/commit.js
Original file line number Diff line number Diff line change
@@ -26,11 +26,29 @@ describe('ls', () => {
})

test('with prefix', () => {
const result = ls.dirs(`${fixtures}/ls/dirs`, 'prefix')
const result = ls.dirs(`${fixtures}/ls/dirs`, {prefix: 'prefix'})

const expected = ['prefix/.baz', 'prefix/bar', 'prefix/foo']

expect(result.sort()).toEqual(expected.sort())
})

test('with custom exclude (string)', () => {
const result = ls.dirs(`${fixtures}/ls/dirs`, {exclude: 'foo'})

const expected = ['.baz', 'bar', 'node_modules']

expect(result.sort()).toEqual(expected.sort())
})

test('with custom exclude (RegExp)', () => {
const result = ls.dirs(`${fixtures}/ls/dirs`, {
exclude: /(^node_modules|^bar)/,
})

const expected = ['.baz', 'foo']

expect(result.sort()).toEqual(expected.sort())
})
})
})
11 changes: 0 additions & 11 deletions src/api/__tests__/test.js

This file was deleted.

30 changes: 26 additions & 4 deletions src/api/commit.js
Original file line number Diff line number Diff line change
@@ -44,17 +44,39 @@ const configs = path =>
)}`,
)

/**
* @typedef DirsOptions
* @property {string} [prefix] prefix to prepend to each scope entry (e.g:
* `{ prefix: 'prefix' }` becomes `type(prefix/scope)`)
* @property {RegExp | string | null} [exclude] expression for excluding
* directories, defaults to `^node_modules`
*/

/**
* Enumerate one level of directories
*
* @param {string} path - directory to enumerate
* @param {string} [prefix] - prefix for each scope entry (e.g: `prefix/entry`)
* @param {DirsOptions} [options] - options
*/
const dirs = (path, prefix) =>
readdirSync(path)
.filter(f => statSync(join(path, f)).isDirectory())
const dirs = (path, options) => {
const {exclude, prefix} = {exclude: /^node_modules/, ...options}

/**
* @param {string} f filename
*/
const test = f => {
if (!exclude) return true

return !(typeof exclude === 'string'
? f.includes(exclude)
: exclude.test(f))
}

return readdirSync(path)
.filter(f => statSync(join(path, f)).isDirectory() && test(f))
.map(item => (prefix ? `${prefix}/${item}` : item))
.map(item => item.toLowerCase())
}

const ls = {configs, dirs}

2 changes: 1 addition & 1 deletion src/api/depcheck/depcheck.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs')
const depcheck = require('depcheck')
const hoverSpecials = require('./specials')
const {hasFile, uniq} = require('../../utils')
const hoverSpecials = require('./specials')

/**
* @typedef Config
1 change: 0 additions & 1 deletion src/api/test.js

This file was deleted.

19 changes: 17 additions & 2 deletions src/config/__tests__/__snapshots__/eslintrc.js.snap
Original file line number Diff line number Diff line change
@@ -113,12 +113,13 @@ Object {
"jest/**",
"test/**",
"e2e/**",
"**/*.config.{js,cjs,ts}",
"**/*.config.{js,cjs,ts,mjs}",
],
"optionalDependencies": false,
},
],
"import/prefer-default-export": "off",
"jest/prefer-snapshot-hint": "off",
"no-implied-eval": "error",
"no-throw-literal": "error",
"no-void": Array [
@@ -245,12 +246,13 @@ Object {
"jest/**",
"test/**",
"e2e/**",
"**/*.config.{js,cjs,ts}",
"**/*.config.{js,cjs,ts,mjs}",
],
"optionalDependencies": false,
},
],
"import/prefer-default-export": "off",
"jest/prefer-snapshot-hint": "off",
"no-implied-eval": "error",
"no-throw-literal": "error",
"no-void": Array [
@@ -286,7 +288,20 @@ Object {
exports[`Strict ESLint configuration 1`] = `
Object {
"overrides": Array [
Object {
"files": Array [
"**/*.d.ts",
"**/__mocks__/**/*",
"**/*.config.{js,cjs,ts,mjs}",
],
"rules": Object {
"import/no-default-export": "off",
},
},
],
"rules": Object {
"import/no-default-export": "error",
"import/order": Array [
"error",
Object {
9 changes: 9 additions & 0 deletions src/config/eslintrc-strict.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
rules: {
'import/no-default-export': 'error',
'import/order': [
'error',
{
@@ -15,4 +16,12 @@ module.exports = {
],
'sort-imports': ['error', {ignoreDeclarationSort: true}],
},
overrides: [
{
files: ['**/*.d.ts', '**/__mocks__/**/*', '**/*.config.{js,cjs,ts,mjs}'],
rules: {
'import/no-default-export': 'off',
},
},
],
}
4 changes: 3 additions & 1 deletion src/config/helpers/build-eslint.js
Original file line number Diff line number Diff line change
@@ -62,13 +62,15 @@ const buildConfig = ({withReact = false} = {}) => {
'jest/**',
'test/**',
'e2e/**',
'**/*.config.{js,cjs,ts}',
'**/*.config.{js,cjs,ts,mjs}',
]),
optionalDependencies: false,
},
],
'no-void': ['error', {allowAsStatement: true}],
'prettier/prettier': 'error',
// TODO: consider enabling this as a warning?
'jest/prefer-snapshot-hint': 'off',
...parserRules(false, isReact),
},
overrides: [
2 changes: 1 addition & 1 deletion src/config/helpers/build-lint-staged.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ const {resolveHoverScripts, resolveBin} = require('../../utils')
const hoverScripts = resolveHoverScripts()
const doctoc = resolveBin('doctoc')

const defaultTestCommand = `${hoverScripts} test --findRelatedTests`
const defaultTestCommand = `${hoverScripts} test --findRelatedTests --passWithNoTests`

const sourceExtensions = ['js', 'jsx', 'ts', 'tsx']

55 changes: 29 additions & 26 deletions src/config/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/** @typedef {import('@jest/types').Config.InitialOptions} JestConfig */

const {jsWithTs: preset} = require('ts-jest/presets')

const {ifAnyDep, hasAnyDep, hasFile, fromRoot} = require('../utils')
const {ifAnyDep, hasFile, fromRoot, hasDevDep} = require('../utils')

const {
testMatch,
@@ -22,13 +20,37 @@ const ignores = [
/** @type JestConfig */
const jestConfig = {
roots: [fromRoot('.')],
// Here we're preserving Jest <= 28 snapshot format to prevent the need
// to update snapshots when upgrading Jest via @hover/javascript, see:
// https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
snapshotFormat: {escapeString: true, printBasicPrototype: true},
testEnvironment: ifAnyDep(['webpack', 'rollup', 'react'], 'jsdom', 'node'),
testURL: 'http://localhost',
testEnvironmentOptions: {url: 'http://localhost'},
moduleFileExtensions: testMatchExtensions.concat('json'),
collectCoverageFrom: [`**/${testMatchGlob}`],
testMatch,
testPathIgnorePatterns: [...ignores, '<rootDir>/dist'],
testLocationInResults: true,
// The default transform is now SWC, however, `ts-jest` will
// still be used if it is installed in the host project
transform: hasDevDep('ts-jest')
? Object.fromEntries(
// Ensure we can resolve the preset even when
// it's in a nested `node_modules` installation
Object.entries(require('ts-jest/presets').jsWithTs.transform).map(
([glob, [transformer, options]]) => [
glob,
[
require.resolve(transformer),
{
...options,
diagnostics: false,
},
],
],
),
)
: {'^.+\\.(t|j)sx?$': [require.resolve('@swc-node/jest')]},
coveragePathIgnorePatterns: [
...ignores,
'src/(umd|cjs|esm)-entry.js$',
@@ -51,28 +73,9 @@ const jestConfig = {
require.resolve('jest-watch-typeahead/filename'),
require.resolve('jest-watch-typeahead/testname'),
],
globals: {},
}

if (hasAnyDep('ts-jest') || hasFile('tsconfig.json')) {
jestConfig.transform = Object.fromEntries(
// Ensure we can resolve the preset even when
// it's in a nested `node_modules` installation
Object.entries(preset.transform).map(([key, value]) => [
key,
require.resolve(value),
]),
)

jestConfig.globals['ts-jest'] = {
diagnostics: {
warnOnly: true,
},
}
}

if (hasFile('tests/setup-env.js')) {
jestConfig.setupFilesAfterEnv = [fromRoot('tests/setup-env.js')]
setupFilesAfterEnv: hasFile('tests/setup-env.js')
? [fromRoot('tests/setup-env.js')]
: undefined,
}

module.exports = jestConfig
2 changes: 1 addition & 1 deletion src/config/release.config.js
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@ module.exports = {
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'master',
'next',
'next-major',
{name: 'next', prerelease: true},
{name: 'alpha', prerelease: true},
{name: 'beta', prerelease: true},
],
24 changes: 1 addition & 23 deletions src/config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
{
"compilerOptions": {
"alwaysStrict": true,
"declaration": true,
"esModuleInterop": true,
"importHelpers": true,
"jsx": "react",
"lib": ["dom", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "es5"
}
"extends": "../../tsconfig.json"
}
14 changes: 7 additions & 7 deletions src/scripts/__tests__/__snapshots__/ci-after-success.js.snap
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ Array [

exports[`ci-after-success calls concurrently with both scripts when on ci 3`] = `
Array [
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release'",
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release'",
]
`;

@@ -28,7 +28,7 @@ Array [

exports[`ci-after-success calls concurrently with both scripts when on github actions 3`] = `
Array [
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release'",
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release'",
]
`;

@@ -44,7 +44,7 @@ Array [

exports[`ci-after-success calls concurrently with both scripts when on travis 3`] = `
Array [
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release'",
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release'",
]
`;

@@ -60,7 +60,7 @@ Array [

exports[`ci-after-success configures semantic release with internal configuration when no local configuration exists 3`] = `
Array [
concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release --extends ./src/config/release.config.js'",
concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release --extends ./src/config/release.config.js'",
]
`;

@@ -108,7 +108,7 @@ Array [

exports[`ci-after-success does not do the codecov script when opted out 3`] = `
Array [
concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release'",
concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release'",
]
`;

@@ -124,7 +124,7 @@ Array [

exports[`ci-after-success does not do the codecov script when there is no coverage directory 3`] = `
Array [
concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release'",
concurrently --prefix [{name}] --names release --prefix-colors bgBlue.bold.reset "echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release'",
]
`;

@@ -158,6 +158,6 @@ Array [

exports[`ci-after-success runs autorelease script on alternate release branch "next" 3`] = `
Array [
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release'",
concurrently --prefix [{name}] --names codecov,release --prefix-colors bgBlue.bold.reset,bgGreen.bold.reset "echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'" "echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release'",
]
`;
12 changes: 6 additions & 6 deletions src/scripts/__tests__/__snapshots__/commit-msg.js.snap
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`commit-msg adds env flag with HUSKY_GIT_PARAMS when available 1`] = `commitlint --env HUSKY_GIT_PARAMS --config ./src/config/commitlint.config.js`;
exports[`commit-msg adds env flag with HUSKY_GIT_PARAMS when available 1`] = `TS_NODE_TRANSPILE_ONLY=true commitlint --env HUSKY_GIT_PARAMS --config ./src/config/commitlint.config.js`;

exports[`commit-msg calls @commitlint/cli with default args 1`] = `commitlint --config ./src/config/commitlint.config.js --edit`;
exports[`commit-msg calls @commitlint/cli with default args 1`] = `TS_NODE_TRANSPILE_ONLY=true commitlint --config ./src/config/commitlint.config.js --edit`;

exports[`commit-msg defaults to \`--edit\` when no args are passed and HUSKY_GIT_PARAMS is not available 1`] = `commitlint --config ./src/config/commitlint.config.js --edit`;
exports[`commit-msg defaults to \`--edit\` when no args are passed and HUSKY_GIT_PARAMS is not available 1`] = `TS_NODE_TRANSPILE_ONLY=true commitlint --config ./src/config/commitlint.config.js --edit`;

exports[`commit-msg does not use built-in config with --config 1`] = `commitlint --config ./custom-config.js`;
exports[`commit-msg does not use built-in config with --config 1`] = `TS_NODE_TRANSPILE_ONLY=true commitlint --config ./custom-config.js`;

exports[`commit-msg does not use built-in config with commitlint.config.js file 1`] = `commitlint --edit`;
exports[`commit-msg does not use built-in config with commitlint.config.js file 1`] = `TS_NODE_TRANSPILE_ONLY=true commitlint --edit`;

exports[`commit-msg forwards args 1`] = `commitlint --config ./src/config/commitlint.config.js --edit .git/COMMIT_EDITMSG`;
exports[`commit-msg forwards args 1`] = `TS_NODE_TRANSPILE_ONLY=true commitlint --config ./src/config/commitlint.config.js --edit .git/COMMIT_EDITMSG`;
2 changes: 1 addition & 1 deletion src/scripts/__tests__/__snapshots__/pre-commit.js.snap
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ Array [
exports[`pre-commit disables DocToc and forwards args 2`] = `
Array [
.test-tmp/hover-javascriptTMPSUFFIX/.lintstaged.json,
{"*.+(js|jsx|json|json5|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx|vue)":["./src/index.js format"],"*.+(js|jsx|ts|tsx)":["./src/index.js lint"],"*.+(tsx|ts|jsx|js)":["./src/index.js test --findRelatedTests"]},
{"*.+(js|jsx|json|json5|yml|yaml|css|less|scss|ts|tsx|md|graphql|mdx|vue)":["./src/index.js format"],"*.+(js|jsx|ts|tsx)":["./src/index.js lint"],"*.+(tsx|ts|jsx|js)":["./src/index.js test --findRelatedTests --passWithNoTests"]},
]
`;

2 changes: 1 addition & 1 deletion src/scripts/ci-after-success.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ const branch =
const isCI = parseEnv('TRAVIS', false) || parseEnv('CI', false)

const codecovCommand = `echo installing codecov && npx -p codecov@3 -c 'echo running codecov && codecov'`
const releaseCommand = `echo installing semantic-release && npx -p semantic-release@17 -c 'echo running semantic-release && semantic-release${
const releaseCommand = `echo installing semantic-release && npx -p semantic-release@19 -c 'echo running semantic-release && semantic-release${
hasLocalConfig('release')
? ''
: ` --extends ${hereRelative('../config/release.config.js')}`
4 changes: 3 additions & 1 deletion src/scripts/commit-msg.js
Original file line number Diff line number Diff line change
@@ -22,7 +22,9 @@ const config = useBuiltinConfig
: []

const result = spawn.sync(
resolveBin('@commitlint/cli', {executable: 'commitlint'}),
`TS_NODE_TRANSPILE_ONLY=true ${resolveBin('@commitlint/cli', {
executable: 'commitlint',
})}`,
[...env, ...config, ...args, ...defaultEdit],
{
stdio: 'inherit',
2 changes: 1 addition & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"emitDeclarationOnly": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "../dist",
"rootDir": "."
}
59 changes: 44 additions & 15 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ const fs = require('fs')
const path = require('path')
const rimraf = require('rimraf')
const mkdirp = require('mkdirp')
const arrify = require('arrify')
const has = require('lodash.has')
const readPkgUp = require('read-pkg-up')
const which = require('which')
@@ -66,19 +65,42 @@ function resolveBin(
const fromRoot = (/** @type {string[]} */ ...p) => path.join(appDirectory, ...p)
const hasFile = (/** @type {string[]} */ ...p) => fs.existsSync(fromRoot(...p))

const ifFile = (
/** @type {*} */ files,
/** @type {*} */ t,
/** @type {*} */ f,
) => (arrify(files).some((/** @type {*} */ file) => hasFile(file)) ? t : f)
/**
* @param {string | string[]} stringOrArray
*/
const liftStringArray = stringOrArray =>
typeof stringOrArray === 'string' ? [stringOrArray] : stringOrArray

/**
*
* @template T
* @template F
*
* @param {string | string[]} files
* @param {T} t
* @param {F} f
*/
const ifFile = (files, t, f) =>
liftStringArray(files).some(file => hasFile(file)) ? t : f

const getPkgName = () => pkg.name

const hasPkgProp = (/** @type {*} */ props) =>
arrify(props).some((/** @type {*} */ prop) => has(pkg, prop))
/**
* @param {string | string[]} props
*/
const hasPkgProp = props => liftStringArray(props).some(prop => has(pkg, prop))

const hasPkgSubProp = (/** @type {*} */ pkgProp) => (/** @type {*} */ props) =>
hasPkgProp(arrify(props).map((/** @type {*} */ p) => `${pkgProp}.${p}`))
/**
* @param {string} pkgProp
*/
const hasPkgSubProp =
pkgProp =>
/**
* @param {string | string[]} props
* @returns
*/
props =>
hasPkgProp(liftStringArray(props).map(p => `${pkgProp}.${p}`))

const ifPkgSubProp =
(/** @type {*} */ pkgProp) =>
@@ -95,11 +117,17 @@ const hasAnyDep = (/** @type {*} */ args) =>
const ifPeerDep = ifPkgSubProp('peerDependencies')
const ifDep = ifPkgSubProp('dependencies')
const ifDevDep = ifPkgSubProp('devDependencies')
const ifAnyDep = (
/** @type {*} */ deps,
/** @type {*} */ t,
/** @type {*} */ f,
) => (hasAnyDep(arrify(deps)) ? t : f)

/**
* @template T
* @template F
*
* @param {string | string[]} deps
* @param {T} t
* @param {F} f
*/
const ifAnyDep = (deps, t, f) => (hasAnyDep(liftStringArray(deps)) ? t : f)

const ifScript = ifPkgSubProp('scripts')

function parseEnv(/** @type {string} */ name, /** @type {*} */ def) {
@@ -244,6 +272,7 @@ module.exports = {
getConcurrentlyArgs,
getPkgName,
hasAnyDep,
hasDevDep,
hasFile,
hasLocalConfig,
hasPkgProp,
23 changes: 21 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
{
"extends": "./dist/config/tsconfig",
"compilerOptions": {
"allowJs": true
"alwaysStrict": true,
"declaration": true,
"esModuleInterop": true,
"importHelpers": true,
"jsx": "react",
"lib": ["dom", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": false,
"noUnusedParameters": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"strictPropertyInitialization": true,
"target": "es5"
}
}
22,570 changes: 13,996 additions & 8,574 deletions yarn.lock

Large diffs are not rendered by default.