Skip to content

Commit 434e4bf

Browse files
authored
Merge pull request #10 from webKrafters/pdeps
Pdeps
2 parents 31aa29c + 0f1a79f commit 434e4bf

23 files changed

+191
-379
lines changed

docs-dev

package-lock.json

Lines changed: 49 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"steveswork <[email protected]> (https://github.com/steveswork)"
1212
],
1313
"dependencies": {
14-
"@webkrafters/get-property": "^1.1.2",
15-
"lodash": "^4.17.21"
14+
"@webkrafters/clone-total": "^1.0.1",
15+
"@webkrafters/get-property": "^1.1.2"
1616
},
1717
"description": "Auto Immutable - self enforcing immutable data structure",
1818
"devDependencies": {
@@ -24,9 +24,12 @@
2424
"@babel/preset-env": "^7.20.2",
2525
"@types/jest": "^29.5.12",
2626
"@types/lodash": "^4.17.0",
27-
"@types/node": "^20.11.28",
27+
"@types/node": "^20.13.0",
2828
"babel-loader": "^8.2.5",
2929
"jest": "^29.7.0",
30+
"lodash.isempty": "^4.4.0",
31+
"lodash.isequal": "^4.5.0",
32+
"lodash.isplainobject": "^4.0.6",
3033
"ts-jest": "^29.1.2",
3134
"ts-node": "^10.9.2",
3235
"typescript": "^5.4.2"
@@ -44,6 +47,11 @@
4447
"license": "MIT",
4548
"main": "dist/index.js",
4649
"name": "@webkrafters/auto-immutable",
50+
"peerDependencies": {
51+
"lodash.isempty": ">= 0.1.0",
52+
"lodash.isequal": ">= 0.1.0",
53+
"lodash.isplainobject": ">= 0.8.0"
54+
},
4755
"publishConfig": {
4856
"access": "public"
4957
},
@@ -60,5 +68,5 @@
6068
"test:watch": "jest --updateSnapshot --watchAll"
6169
},
6270
"types": "dist/index.d.ts",
63-
"version": "1.0.0"
71+
"version": "1.0.1-rc.0"
6472
}

post-build.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,28 @@ var fs = require( 'fs' );
22
var path = require( 'path' );
33
const { promisify } = require( 'util' );
44

5+
const copyFile = promisify( fs.copyFile );
56
const read = promisify( fs.readFile );
67
const write = promisify( fs.writeFile );
78

9+
const LOGO_FILENAME = 'logo.svg';
10+
11+
const LOGO_SOURCEPATH = path.join( 'docs-dev', 'src', 'images', LOGO_FILENAME );
12+
813
const fOpts = { encoding: 'utf8' };
914

1015
Promise
1116
.allSettled([
12-
read(
13-
path.join( 'docs-dev', 'src', 'images', 'logo.svg' ),
14-
fOpts
15-
),
16-
read( 'logo.svg', fOpts )
17+
read( LOGO_SOURCEPATH, fOpts ),
18+
read( LOGO_FILENAME, fOpts )
1719
])
1820
.then(([ officialLogo, appLogo ]) => {
1921
if( officialLogo.reason ) {
2022
throw new Error( officialLogo.reason );
2123
}
2224
if( appLogo.reason ) { appLogo.value = '' }
2325
if( appLogo.value === officialLogo.value ) { return }
24-
write( 'logo.svg', officialLogo.value, fOpts );
26+
return copyFile( LOGO_SOURCEPATH, LOGO_FILENAME );
2527
})
2628
.catch( e => {
2729
console.log( 'FAILED TO PROCESS LOGO TRANSFER\n', e );

src/connection.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import {
2+
beforeAll,
3+
describe,
4+
expect,
5+
jest,
6+
test
7+
} from '@jest/globals';
8+
19
import AccessorCache from './model/accessor-cache';
210
import { Immutable } from './main';
311
import { deps, Connection } from './connection';
@@ -100,7 +108,7 @@ describe( 'Connection class', () => {
100108
.spyOn( deps, 'setValue' )
101109
.mockReturnValue( undefined );
102110

103-
connection.get( expect.any( Array ) );
111+
connection.get( expect.any( Array ) as unknown as string );
104112
expect( cacheGetSpy ).toHaveBeenCalledTimes( 1 );
105113
connection.set( {} );
106114
expect( setSpy ).toHaveBeenCalledTimes( 1 );
@@ -111,7 +119,7 @@ describe( 'Connection class', () => {
111119
connection.disconnect();
112120

113121
expect( connection.disconnected ).toBe( true );
114-
connection.get( expect.any( Array ) );
122+
connection.get( expect.any( Array ) as unknown as string );
115123
expect( cacheGetSpy ).not.toHaveBeenCalled();
116124
connection.set( {} );
117125
expect( setSpy ).not.toHaveBeenCalled();

src/main.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
import {
2+
beforeAll,
3+
describe,
4+
expect,
5+
jest,
6+
test
7+
} from '@jest/globals';
8+
19
import { Connection } from './connection';
210
import { Closable, Immutable } from './main';
311

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { Value } from '.';
99

1010
import * as _constants from './constants';
1111

12-
import { clonedeep } from './utils';
12+
import clonedeep from '@webkrafters/clone-total';
1313

1414
import AccessorCache from './model/accessor-cache';
1515

src/model/accessor-cache/index.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
1+
import {
2+
afterAll,
3+
beforeAll,
4+
describe,
5+
expect,
6+
jest,
7+
test
8+
} from '@jest/globals';
9+
110
import type { SourceData } from '../../test-artifacts/data/create-data-obj';
211

312
type Value = Partial<SourceData>;
413

14+
import clonedeep from '@webkrafters/clone-total';
15+
516
import * as constants from '../../constants';
6-
import { clonedeep } from '../../utils';
17+
718
import AccessorCache from '.';
819

920
import _createSourceData from '../../test-artifacts/data/create-data-obj';
@@ -177,7 +188,10 @@ describe( 'AccessorCache class', () => {
177188
},
178189
'tags[4]': 'ullamco'
179190
};
180-
const retVal = cache.get( expect.any( String ), ...accessorPaths[ 0 ] );
191+
const retVal = cache.get(
192+
expect.any( String ) as unknown as string,
193+
...accessorPaths[ 0 ]
194+
);
181195
test( 'is a compiled slice of value object as referenced in the propertyPaths', () => {
182196
expect( retVal ).toEqual( retValExpected );
183197
} );

src/model/accessor-cache/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ interface PropertyOriginInfo {
1616
value: any
1717
};
1818

19-
import { isEmpty, isEqual } from 'lodash';
19+
import isEmpty from 'lodash.isempty';
20+
import isEqual from 'lodash.isequal';
2021

21-
import { GLOBAL_SELECTOR } from '../../constants';
22+
import getProperty from '@webkrafters/get-property';
2223

23-
import { getProperty } from '../../utils';
24+
import { GLOBAL_SELECTOR } from '../../constants';
2425

2526
import Atom from '../atom';
2627
import Accessor from '../accessor';

src/model/accessor/test/index.test.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { getProperty } from '../../../utils';
1+
import {
2+
beforeAll,
3+
describe,
4+
expect,
5+
test
6+
} from '@jest/globals';
7+
8+
import getProperty from '@webkrafters/get-property';
9+
210
import Atom from '../../atom';
311

412
import Accessor from '..';
@@ -66,13 +74,13 @@ describe( 'Accessor class', () => {
6674
describe( 'addClient(...)', () => {
6775
test( 'adds new client id to `clients`', () => {
6876
const numClients = accessor.numClients;
69-
const id = expect.any( String );
77+
const id = expect.any( String ) as unknown as string;
7078
accessor.addClient( id );
7179
expect( accessor.numClients ).toBe( numClients + 1 );
7280
accessor.removeClient( id );
7381
} );
7482
test( 'ignores requests to add existing clients', () => {
75-
const id = expect.any( String );
83+
const id = expect.any( String ) as unknown as string;
7684
accessor.addClient( id );
7785
const numClients = accessor.numClients;
7886
accessor.addClient( id );
@@ -83,27 +91,27 @@ describe( 'Accessor class', () => {
8391
} );
8492
describe( 'hasClient(...)', () => {
8593
test( 'returns `false` if client not found in `clients`', () => {
86-
const id = expect.any( String );
94+
const id = expect.any( String ) as unknown as string;
8795
accessor.removeClient( id );
8896
expect( accessor.hasClient( id ) ).toBe( false );
8997
} );
9098
test( 'returns `true` if client found in `clients`', () => {
91-
const id = expect.any( String );
99+
const id = expect.any( String ) as unknown as string;
92100
accessor.addClient( id );
93101
expect( accessor.hasClient( id ) ).toBe( true );
94102
accessor.removeClient( id );
95103
} );
96104
} );
97105
describe( 'removeClient(...)', () => {
98106
test( 'removes client id from `clients`', () => {
99-
const id = expect.any( String );
107+
const id = expect.any( String ) as unknown as string;
100108
accessor.addClient( id );
101109
const numClients = accessor.numClients;
102110
accessor.removeClient( id );
103111
expect( accessor.numClients ).toBe( numClients - 1 );
104112
} );
105113
test( 'ignores requests to remove non-existing clients', () => {
106-
const id = expect.any( String );
114+
const id = expect.any( String ) as unknown as string;
107115
accessor.addClient( id );
108116
accessor.removeClient( id );
109117
const numClients = accessor.numClients;

0 commit comments

Comments
 (0)