Skip to content

Commit

Permalink
fix: issues with imports not working fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Code-Monkey committed May 2, 2022
1 parent 9c00675 commit 490bcef
Show file tree
Hide file tree
Showing 37 changed files with 412 additions and 245 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
node_modules
.idea/*
.idea/workspace.xml
.idea/workspace.xml
dist
27 changes: 27 additions & 0 deletions .idea/workspace.xml

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

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"scripts": {
"clean": "git clean -xdf && rm -rf yarn.lock && yarn",
"postinstall": "yarn build",
"test": "lerna run test",
"test:fix": "lerna run test -- -u",
"lint": "lerna run lint",
"lint:fix": "lerna run lint -- --fix",
"test": "lerna run test --stream",
"test:fix": "lerna run test --stream -- -u",
"lint": "lerna run lint --stream",
"lint:fix": "lerna run lint --stream -- --fix",
"lint:cms": "cd platforms/react-cms && yarn lint",
"size": "lerna run size",
"size": "lerna run size --stream",
"install:cms": "cd platforms/react-cms && yarn",
"build:cms": "cd platforms/react-cms && yarn build",
"build:tcm": "cd packages/tcm-cli && yarn build",
Expand Down
4 changes: 2 additions & 2 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
},
"dependencies": {
"@aw-web-design/react-feather": "3.1.45",
"@aw-web-design/styled-system": "3.2.1",
"@aw-web-design/tcm-cli": "3.2.3",
"@aw-web-design/styled-system": "3.2.2",
"@aw-web-design/tcm-cli": "3.2.5",
"@aw-web-design/theme": "3.1.43",
"classnames": "2.3.1",
"csstype": "3.0.11",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import toJson from 'enzyme-to-json';
import { fireEvent, screen } from '@testing-library/react';
import React from 'react';

import { mountWithTheme } from '../../../test-tools';
Expand All @@ -23,9 +23,11 @@ describe('<Checkbox />', () => {
it('calls onClick function', () => {
const handleClick = jest.fn();

const { asFragment } = mountWithTheme(<Checkbox onClick={handleClick} />);
const { getByTitle } = mountWithTheme(<Checkbox onClick={handleClick} />);

wrapper.find('div').simulate('click');
expect(async () => await getByTitle('minus-icon'));

fireEvent.click(screen.getByTitle('minus-icon'));

expect(handleClick).toHaveBeenCalled();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import toJson from 'enzyme-to-json';
import React from 'react';

import { mountWithTheme } from '../../../test-tools';
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/atoms/grid/__test__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import toJson from 'enzyme-to-json';
import React from 'react';

import { mountWithTheme } from '../../../test-tools';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import toJson from 'enzyme-to-json';
import React from 'react';

import { mountWithTheme } from '../../../test-tools';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import toJson from 'enzyme-to-json';
import React from 'react';

import { mountWithTheme } from '../../../test-tools';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import toJson from 'enzyme-to-json';
import React from 'react';

import { mountWithTheme } from '../../../test-tools';
Expand Down
14 changes: 0 additions & 14 deletions packages/memoize/.github/dependabot.yml

This file was deleted.

22 changes: 0 additions & 22 deletions packages/memoize/.github/workflows/bundle-size-check.yml

This file was deleted.

34 changes: 0 additions & 34 deletions packages/memoize/.github/workflows/test.yml

This file was deleted.

34 changes: 0 additions & 34 deletions packages/memoize/.github/workflows/validate.yml

This file was deleted.

6 changes: 3 additions & 3 deletions packages/memoize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ memoizedAdd(NaN);
You can also pass in a custom function for checking the equality of two sets of arguments

```js
const memoized = memoizeOne(fn, isEqual);
const memoized = index(fn, isEqual);
```

An equality function should return `true` if the arguments are equal. If `true` is returned then the wrapped function will not be called.
Expand Down Expand Up @@ -385,10 +385,10 @@ const canThrow = (name: string) => {
if (name === 'throw') {
throw new Error(name);
}
return { name };
return {name};
};

const memoized = memoizeOne(canThrow);
const memoized = index(canThrow);

const value1 = memoized('Alex');
// result function called: console.log => 'called'
Expand Down
10 changes: 6 additions & 4 deletions packages/memoize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
"version": "1.0.1",
"description": "A memoization library which only remembers the latest invocation",
"type": "module",
"module": "./dist/memoize.esm.js",
"main": "./dist/memoize.esm.js",
"exports": {
"require": "./dist/memoize.cjs.js",
"import": "./dist/memoize.esm.js"
},
"typings": "dist/index.d.ts",
"scripts": {
"test": "tcm test",
"lint": "tcm lint",
"build": "tcm build --format esm"
"build": "tcm build"
},
"files": [
"dist",
Expand All @@ -29,7 +31,7 @@
"url": "https://github.com/alexreardon/memoize-one/issues"
},
"dependencies": {
"@aw-web-design/tcm-cli": "3.2.3"
"@aw-web-design/tcm-cli": "3.2.5"
},
"devDependencies": {
"lodash": "4.17.21",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
import areInputsEqual from './are-inputs-equal';
import type { EqualityFn, MemoizedFn, Cache } from './types';

export type EqualityFn<TFunc extends (...args: any[]) => any> = (
newArgs: Parameters<TFunc>,
lastArgs: Parameters<TFunc>
) => boolean;

export type MemoizedFn<TFunc extends (this: any, ...args: any[]) => any> = {
clear: () => void;
(
this: ThisParameterType<TFunc>,
...args: Parameters<TFunc>
): ReturnType<TFunc>;
};

// internal type
type Cache<TFunc extends (this: any, ...args: any[]) => any> = {
lastThis: ThisParameterType<TFunc>;
lastArgs: Parameters<TFunc>;
lastResult: ReturnType<TFunc>;
};

function memoizeOne<TFunc extends (this: any, ...newArgs: any[]) => any>(
function index<TFunc extends (this: any, ...newArgs: any[]) => any>(
resultFn: TFunc,
isEqual: EqualityFn<TFunc> = areInputsEqual
): MemoizedFn<TFunc> {
Expand Down Expand Up @@ -56,4 +37,5 @@ function memoizeOne<TFunc extends (this: any, ...newArgs: any[]) => any>(
return memoized;
}

export default memoizeOne;
export { EqualityFn, MemoizedFn };
export default index;
19 changes: 19 additions & 0 deletions packages/memoize/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export type EqualityFn<TFunc extends (...args: any[]) => any> = (
newArgs: Parameters<TFunc>,
lastArgs: Parameters<TFunc>
) => boolean;

export type MemoizedFn<TFunc extends (this: any, ...args: any[]) => any> = {
clear: () => void;
(
this: ThisParameterType<TFunc>,
...args: Parameters<TFunc>
): ReturnType<TFunc>;
};

// internal type
export type Cache<TFunc extends (this: any, ...args: any[]) => any> = {
lastThis: ThisParameterType<TFunc>;
lastArgs: Parameters<TFunc>;
lastResult: ReturnType<TFunc>;
};
2 changes: 1 addition & 1 deletion packages/memoize/test/cache-clearing.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import memoize from '../src/memoize-one';
import memoize from '../src';

it('should enable cache clearing', () => {
const underlyingFn = jest.fn(function add(a: number, b: number) {
Expand Down
2 changes: 1 addition & 1 deletion packages/memoize/test/memoize-one.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { isEqual } from 'lodash';

import memoize, { EqualityFn } from '../src/memoize-one';
import memoize, { EqualityFn } from '../src';
/* eslint-disable @typescript-eslint/no-explicit-any */

type HasA = {
Expand Down
5 changes: 2 additions & 3 deletions packages/memoize/test/types-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import { expectTypeOf } from 'expect-type';
import { isEqual } from 'lodash';

import memoize from '../src/memoize-one';

import type { EqualityFn, MemoizedFn } from './../src/memoize-one';
import memoize from '../src';
import type { EqualityFn, MemoizedFn } from '../src';

it('should maintain the types of the original function', () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
8 changes: 5 additions & 3 deletions packages/react-feather/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"version": "3.1.46",
"description": "React component for Feather icons",
"type": "module",
"module": "./dist/react-feather.esm.js",
"main": "./dist/react-feather.esm.js",
"exports": {
"require": "./dist/react-feather.cjs.js",
"import": "./dist/react-feather.esm.js"
},
"typings": "dist/index.d.ts",
"files": [
"dist",
Expand Down Expand Up @@ -38,7 +40,7 @@
"homepage": "https://github.com/The-Code-Monkey/TechStack#readme",
"devDependencies": {
"cross-env": "7.0.3",
"@aw-web-design/tcm-cli": "3.2.3"
"@aw-web-design/tcm-cli": "3.2.5"
},
"dependencies": {
"@aw-web-design/react-lazy-named": "1.0.5"
Expand Down
Loading

0 comments on commit 490bcef

Please sign in to comment.