Skip to content

Commit

Permalink
fix(vest-utils): use correct package path in imported types
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Aug 11, 2022
1 parent 3f18579 commit 4c9f3b8
Show file tree
Hide file tree
Showing 38 changed files with 374 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -60,6 +60,7 @@ module.exports = {
'import/extensions': [2, 'never'],
'import/first': 2,
'import/newline-after-import': 1,
'import/no-duplicates': 2,
'import/no-self-import': 2,
'import/no-unresolved': [2],
'import/no-useless-path-segments': 2,
Expand Down Expand Up @@ -87,7 +88,6 @@ module.exports = {
'jest/no-standalone-expect': 0,
'max-params': [1, { max: 4 }],
'no-console': 2,
'no-duplicate-imports': 2,
'no-implicit-globals': 2,
'no-lonely-if': 2,
'no-multi-spaces': 1,
Expand Down
3 changes: 1 addition & 2 deletions .husky/pre-commit
@@ -1,5 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn vx tsconfig
npx pretty-quick --staged
yarn vx precommit
3 changes: 3 additions & 0 deletions packages/anyone/package.json
Expand Up @@ -10,6 +10,9 @@
"build": "vx build",
"release": "vx release"
},
"dependencies": {
"vest-utils": "^0.0.2"
},
"module": "./dist/es/anyone.production.js",
"exports": {
"./all": {
Expand Down
12 changes: 11 additions & 1 deletion packages/anyone/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/context/src/context.ts
@@ -1,4 +1,4 @@
import { CB } from 'utilityTypes';
import type { CB } from 'vest-utils';
import {
assign,
defaultTo,
Expand Down
7 changes: 6 additions & 1 deletion packages/context/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/n4s/src/lib/enforceUtilityTypes.ts
@@ -1,4 +1,4 @@
import { CB, DropFirst } from 'utilityTypes';
import type { CB, DropFirst } from 'vest-utils';

export type EnforceCustomMatcher<F extends CB, R> = (
...args: DropFirst<Parameters<F>>
Expand Down
2 changes: 1 addition & 1 deletion packages/n4s/src/lib/ruleReturn.ts
@@ -1,4 +1,4 @@
import type { Stringable } from 'utilityTypes';
import type { Stringable } from 'vest-utils';
import { defaultTo } from 'vest-utils';

export default function ruleReturn(
Expand Down
3 changes: 1 addition & 2 deletions packages/n4s/src/runtime/genEnforceLazy.ts
@@ -1,5 +1,4 @@
import { CB, Stringable } from 'utilityTypes';
import { mapFirst, optionalFunctionValue } from 'vest-utils';
import { mapFirst, optionalFunctionValue, CB, Stringable } from 'vest-utils';

import eachEnforceRule from 'eachEnforceRule';
import { ctx } from 'enforceContext';
Expand Down
2 changes: 1 addition & 1 deletion packages/n4s/src/runtime/runtimeRules.ts
@@ -1,4 +1,4 @@
import type { DropFirst } from 'utilityTypes';
import type { DropFirst } from 'vest-utils';

import type { RuleReturn } from 'ruleReturn';
import rules from 'rules';
Expand Down
56 changes: 55 additions & 1 deletion packages/n4s/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion packages/vast/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/vest-utils/src/bus.ts
@@ -1,4 +1,4 @@
import { CB } from 'utilityTypes';
import type { CB } from 'utilityTypes';

export function createBus(): {
on: (event: string, handler: CB) => OnReturn;
Expand Down
2 changes: 1 addition & 1 deletion packages/vest-utils/src/callEach.ts
@@ -1,4 +1,4 @@
import { CB } from 'utilityTypes';
import type { CB } from 'utilityTypes';

export default function callEach(arr: CB[]): void {
return arr.forEach(fn => fn());
Expand Down
2 changes: 1 addition & 1 deletion packages/vest-utils/src/invariant.ts
@@ -1,5 +1,5 @@
import optionalFunctionValue from 'optionalFunctionValue';
import { Stringable } from 'utilityTypes';
import type { Stringable } from 'utilityTypes';

export default function invariant(
condition: any,
Expand Down
5 changes: 5 additions & 0 deletions packages/vest-utils/src/vest-utils.ts
Expand Up @@ -29,3 +29,8 @@ export { isUndefined, isNotUndefined } from 'isUndefined';
export { isArray, isNotArray } from 'isArrayValue';
export { isEmpty, isNotEmpty } from 'isEmpty';
export { isPositive } from 'isPositive';

export type { DropFirst } from 'utilityTypes';
export type { Stringable } from 'utilityTypes';
export type { CB } from 'utilityTypes';
export type { ValueOf } from 'utilityTypes';
40 changes: 39 additions & 1 deletion packages/vest-utils/tsconfig.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/vest/package.json
Expand Up @@ -20,6 +20,7 @@
"url": "https://github.com/ealush/vest.git/issues"
},
"dependencies": {
"vast": "^1.0.12",
"context": "^3.0.1",
"n4s": "^4.2.1",
"vest-utils": "^0.0.2"
Expand Down
3 changes: 1 addition & 2 deletions packages/vest/src/core/ctx/ctx.ts
@@ -1,6 +1,5 @@
import { createCascade } from 'context';
import { CB } from 'utilityTypes';
import { assign } from 'vest-utils';
import { assign, CB } from 'vest-utils';

import { Isolate, IsolateTypes } from 'IsolateTypes';
import { Modes } from 'Modes';
Expand Down
3 changes: 1 addition & 2 deletions packages/vest/src/core/isolate/generateIsolate.ts
@@ -1,6 +1,5 @@
import { createIsolateCursor } from './isolateCursor';

import { Isolate, IsolateTypes } from 'IsolateTypes';
import { createIsolateCursor } from 'isolateCursor';

export function generateIsolate(
type: IsolateTypes,
Expand Down
3 changes: 1 addition & 2 deletions packages/vest/src/core/isolate/isolate.ts
@@ -1,11 +1,10 @@
import { nestedArray, invariant, isFunction } from 'vest-utils';

import { useCurrentPath, useCursor, useIsolate } from './isolateHooks';

import { IsolateTypes } from 'IsolateTypes';
import VestTest from 'VestTest';
import ctx from 'ctx';
import { generateIsolate } from 'generateIsolate';
import { useCurrentPath, useCursor, useIsolate } from 'isolateHooks';
import { usePrevKeys } from 'key';
import { useSetTests } from 'stateHooks';

Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/core/isolate/isolates/omitWhen.ts
@@ -1,4 +1,4 @@
import { CB } from 'utilityTypes';
import type { CB } from 'vest-utils';
import { optionalFunctionValue } from 'vest-utils';

import { IsolateTypes } from 'IsolateTypes';
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/core/isolate/isolates/skipWhen.ts
@@ -1,4 +1,4 @@
import { CB } from 'utilityTypes';
import type { CB } from 'vest-utils';
import { optionalFunctionValue } from 'vest-utils';

import { IsolateTypes } from 'IsolateTypes';
Expand Down
4 changes: 2 additions & 2 deletions packages/vest/src/core/state/createStateRef.ts
@@ -1,5 +1,5 @@
import type { NestedArray } from 'nestedArray';
import type { State, UseState } from 'vast';
import { nestedArray } from 'vest-utils';

import VestTest from 'VestTest';
import { OptionalFieldDeclaration } from 'optionalFields';
Expand Down Expand Up @@ -54,4 +54,4 @@ type TestObjects = {
current: VestTests;
};

export type VestTests = NestedArray<VestTest>;
export type VestTests = nestedArray.NestedArray<VestTest>;
2 changes: 1 addition & 1 deletion packages/vest/src/core/state/stateHooks.ts
@@ -1,5 +1,5 @@
import { ValueOf } from 'utilityTypes';
import { cache as createCache, nestedArray, asArray, assign } from 'vest-utils';
import type { ValueOf } from 'vest-utils';

import VestTest from 'VestTest';
import type { StateKey, StateRef, StateValue, VestTests } from 'createStateRef';
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/core/suite/create.ts
@@ -1,5 +1,5 @@
import { CB } from 'utilityTypes';
import { createState } from 'vast';
import type { CB } from 'vest-utils';
import { assign, seq, invariant, isFunction } from 'vest-utils';

import { IsolateTypes } from 'IsolateTypes';
Expand Down
25 changes: 12 additions & 13 deletions packages/vest/src/core/test/key.ts
Expand Up @@ -7,21 +7,20 @@ import { useTestObjects } from 'stateHooks';
export function usePrevKeys(): Record<string, VestTest> {
const [{ prev }] = useTestObjects();

return asArray(nestedArray.getCurrent(prev, useCurrentPath())).reduce(
(prevKeys, testObject) => {
if (!(testObject instanceof VestTest)) {
return prevKeys;
}

if (isNullish(testObject.key)) {
return prevKeys;
}
return asArray<nestedArray.NestedArray<VestTest>>(
nestedArray.getCurrent(prev, useCurrentPath())
).reduce((prevKeys, testObject) => {
if (!(testObject instanceof VestTest)) {
return prevKeys;
}

prevKeys[testObject.key] = testObject;
if (isNullish(testObject.key)) {
return prevKeys;
},
{} as Record<string, VestTest>
);
}

prevKeys[testObject.key] = testObject;
return prevKeys;
}, {} as Record<string, VestTest>);
}

export function usePrevTestByKey(key: string): VestTest | undefined {
Expand Down
2 changes: 1 addition & 1 deletion packages/vest/src/exports/parser.ts
@@ -1,7 +1,7 @@
import { suiteSelectors } from 'vest';
import { hasOwnProperty, invariant, isPositive } from 'vest-utils';

import { SuiteSummary } from 'SuiteSummaryTypes';
import { suiteSelectors } from 'vest';

// eslint-disable-next-line max-statements
export function parse(summary: SuiteSummary): ParsedVestObject {
Expand Down
3 changes: 1 addition & 2 deletions packages/vest/src/hooks/mode/mode.ts
@@ -1,5 +1,4 @@
import { Modes } from './Modes';

import { Modes } from 'Modes';
import VestTest from 'VestTest';
import ctx from 'ctx';
import { hasErrorsByTestObjects } from 'hasFailuresByTestObjects';
Expand Down

1 comment on commit 4c9f3b8

@vercel
Copy link

@vercel vercel bot commented on 4c9f3b8 Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest-next – ./website

vest-next-ealush.vercel.app
vest-website.vercel.app
vest-next.vercel.app
vest-next-git-latest-ealush.vercel.app

Please sign in to comment.