Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

New Release 🎉 #190

Merged
merged 98 commits into from
Sep 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
b369998
adde dev option to benchmarks
bennobuilder Jul 28, 2021
9db6211
added tree-shaking test example
bennobuilder Jul 28, 2021
3a6c84b
tried to tree shake collection
bennobuilder Jul 30, 2021
e805e05
fixed typos
bennobuilder Jul 30, 2021
98afcac
optimized treeshaking collection
bennobuilder Jul 31, 2021
0afa034
readded internal because of import order error
bennobuilder Aug 1, 2021
a1da58f
added release manual command
bennobuilder Aug 1, 2021
35d2b88
fixed tests
bennobuilder Aug 1, 2021
7b728a2
made computed state tree shakable
bennobuilder Aug 1, 2021
90bce94
removed 'type()' method
bennobuilder Aug 1, 2021
29294c1
readded cjs support (https://blog.logrocket.com/publishing-node-modu…
bennobuilder Aug 1, 2021
70e80e9
fixed typo
bennobuilder Aug 2, 2021
ff26d37
updated ts configs
bennobuilder Aug 3, 2021
32f4bdb
fixed typo
bennobuilder Aug 3, 2021
44f8415
tested tree shakability at a react project
bennobuilder Aug 3, 2021
458d665
tree shaking logger in prod
bennobuilder Aug 4, 2021
fafdfa5
created treeshaking example
bennobuilder Aug 4, 2021
fcc6b76
extract metafile from bundle (benchmark test)
bennobuilder Aug 5, 2021
123b45e
fixed typo
bennobuilder Aug 7, 2021
809efa4
implemented yargs
bennobuilder Aug 7, 2021
21a4deb
fixed typo
bennobuilder Aug 8, 2021
3a01dc2
fixed agile bench
bennobuilder Aug 8, 2021
59b4c8b
updated benchmark to esm
bennobuilder Aug 9, 2021
653f8e7
fixed tests
bennobuilder Aug 10, 2021
3c24b00
removed is dev variable because if not directly checking if the env i…
bennobuilder Aug 10, 2021
f7cfe79
fixed typos
bennobuilder Aug 11, 2021
9de3ba1
fixed typos
bennobuilder Aug 12, 2021
86cf54a
fixed typo
bennobuilder Aug 12, 2021
b4c4360
Merge pull request #187 from agile-ts/tree-shakeable-support
bennobuilder Aug 12, 2021
942ab19
manual release of @agile-ts/react and @agile-ts/core
bennobuilder Aug 12, 2021
4c4d1b5
started to outsource persist logic for better treeshaking
bennobuilder Aug 13, 2021
0cd44aa
fixed typo
bennobuilder Aug 14, 2021
88df465
added persistableState
bennobuilder Aug 15, 2021
c4ac13b
fixed typos
bennobuilder Aug 15, 2021
7f335e9
fixed typos
bennobuilder Aug 15, 2021
e9c67ca
added enhanced state with all the enhanced features like undo, ..
bennobuilder Aug 16, 2021
feefba5
fixed typo
bennobuilder Aug 16, 2021
eb88522
updated tree-shaking test
bennobuilder Aug 16, 2021
b7ec4a2
fixed typos
bennobuilder Aug 16, 2021
1363097
fixed typos
bennobuilder Aug 17, 2021
23ee44e
added webpack analyzer to example
bennobuilder Aug 17, 2021
414c033
fixed typos
bennobuilder Aug 17, 2021
d62cd89
added env config
bennobuilder Aug 18, 2021
52d995e
added warning when adding an existing storage manager
bennobuilder Aug 19, 2021
4e614ea
fixed typo
bennobuilder Aug 20, 2021
0226cab
updated registerStorageManager name
bennobuilder Aug 21, 2021
e6d1adc
fixed typos
bennobuilder Aug 22, 2021
83b369d
Merge remote-tracking branch 'origin/tree-shakeable-support' into tre…
bennobuilder Aug 22, 2021
5d2d04c
fixed typos
bennobuilder Aug 23, 2021
0c0a10a
fixed typos
bennobuilder Aug 23, 2021
c369562
fixed typos
bennobuilder Aug 24, 2021
4c322d0
fixed typos
bennobuilder Aug 25, 2021
ad1ad60
fixed persistent tests
bennobuilder Aug 25, 2021
6a8e069
fixed tests
bennobuilder Aug 25, 2021
fd0f569
fixed typos
bennobuilder Aug 25, 2021
ae48e86
fixed typos
bennobuilder Aug 25, 2021
b490410
fixed typos
bennobuilder Aug 26, 2021
51b486a
fixed typo
bennobuilder Aug 26, 2021
d8ee8bf
fixed typo
bennobuilder Aug 26, 2021
aa20d86
fixed typos
bennobuilder Aug 26, 2021
fe46dab
outsourced collection and computed shared tests
bennobuilder Aug 26, 2021
4ee1472
fixed multieditor issue
bennobuilder Aug 27, 2021
d0e6435
fixed typo
bennobuilder Aug 27, 2021
0e73f5c
split useAgile hook
bennobuilder Aug 27, 2021
dcaf6cd
fixed typos
bennobuilder Aug 27, 2021
fc9266b
fixed example
bennobuilder Aug 27, 2021
075735c
fixed typos
bennobuilder Aug 28, 2021
59bd613
updated event structure
bennobuilder Aug 28, 2021
5ea27e2
fixed typos
bennobuilder Aug 28, 2021
dcf742f
added log code manager to react package
bennobuilder Aug 29, 2021
321a8ae
fixed typo
bennobuilder Aug 29, 2021
6600cd5
fixed linter
bennobuilder Aug 29, 2021
71648dd
fixed typo
bennobuilder Aug 30, 2021
5907794
added feature to completely block the agile logcodemanager
bennobuilder Aug 31, 2021
5fb8f11
Merge pull request #188 from agile-ts/tree-shakeable-support
bennobuilder Sep 1, 2021
fe98f65
fixed typos
bennobuilder Sep 1, 2021
5c6145c
fixed esm issue
bennobuilder Sep 2, 2021
8368a00
fixed typo
bennobuilder Sep 3, 2021
22a047e
bumped version for manual release
bennobuilder Sep 3, 2021
0c2e76a
fixed typos
bennobuilder Sep 4, 2021
c894d24
added basic soft rebuild
bennobuilder Sep 6, 2021
91221f4
fixed typos
bennobuilder Sep 7, 2021
5aad737
fixed typos
bennobuilder Sep 8, 2021
1211f0b
fixed typos
bennobuilder Sep 8, 2021
1da3b28
added fields example
bennobuilder Sep 9, 2021
e0d33b4
fixed typos
bennobuilder Sep 9, 2021
4a40850
fixed typos
bennobuilder Sep 10, 2021
6156551
fixed some tests
bennobuilder Sep 10, 2021
f00c1c7
fixed tests
bennobuilder Sep 10, 2021
3e4fa1b
fixed typos
bennobuilder Sep 11, 2021
21f0df5
added precise itemKeys
bennobuilder Sep 11, 2021
a6b2140
fixed tests
bennobuilder Sep 12, 2021
af798b7
fixed typo
bennobuilder Sep 12, 2021
ad56d39
fixed typo
bennobuilder Sep 12, 2021
f68a622
Merge pull request #189 from agile-ts/optimize-collection-rebuilds
bennobuilder Sep 12, 2021
f6059c8
Merge branch 'master' into develop
bennobuilder Sep 13, 2021
256dabb
bumped version
bennobuilder Sep 13, 2021
aae6455
bumped version
bennobuilder Sep 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .changeset/calm-pets-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
'@agile-ts/api': patch
'@agile-ts/core': patch
'cra-template-agile': patch
'cra-template-agile-typescript': patch
'@agile-ts/event': patch
'@agile-ts/logger': patch
'@agile-ts/multieditor': patch
'@agile-ts/proxytree': patch
'@agile-ts/react': patch
'@agile-ts/utils': patch
'@agile-ts/vue': patch
---

#### :rocket: New Feature
* `core`, `event`, `logger`, `multieditor`, `react`, `utils`
* [#188](https://github.com/agile-ts/agile/pull/188) Tree shakeable support ([@bennodev19](https://github.com/bennodev19))

#### :nail_care: Polish
* `core`
* [#189](https://github.com/agile-ts/agile/pull/189) Optimize collection rebuilds ([@bennodev19](https://github.com/bennodev19))
* `api`, `core`, `cra-template-agile-typescript`, `cra-template-agile`, `event`, `logger`, `multieditor`, `proxytree`, `react`, `utils`, `vue`
* [#187](https://github.com/agile-ts/agile/pull/187) Tree shakeable support ([@bennodev19](https://github.com/bennodev19))

#### Committers: 1
- BennoDev ([@bennodev19](https://github.com/bennodev19))

20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ AgileTs is a global State and Logic Library implemented in Typescript.
It offers a reimagined API that focuses on **developer experience**
and allows you to **easily** and **flexible** manage your application States.
Besides [States](https://agile-ts.org/docs/core/state),
AgileTs offers some other powerful APIs that make your life easier,
AgileTs offers some other powerful and tree shakable APIs that make your life easier,
such as [Collections](https://agile-ts.org/docs/core/collection)
and [Computed States](https://agile-ts.org/docs/core/computed).
The philosophy behind AgileTs is simple:
Expand All @@ -88,19 +88,19 @@ The philosophy behind AgileTs is simple:

Write minimalistic, boilerplate-free code that captures your intent.
```ts
// Create State with inital value 'frank'
// Create State with the inital value 'frank'
const MY_STATE = createState('frank');

// Update State value from 'frank' to 'jeff'
// Update the State value from 'frank' to 'jeff'
MY_STATE.set('jeff');

// Undo latest State value change
// Undo the latest State value change
MY_STATE.undo();

// Reset State value to its initial value
// Reset the State value to its initial value
MY_STATE.reset();

// Permanently store State value in an external Storage
// Permanently store the State value in an external Storage
MY_STATE.persist("storage-key");
```

Expand Down Expand Up @@ -206,6 +206,14 @@ To find out more about contributing, check out the [CONTRIBUTING.md](https://git
<img src="https://codeclimate.com/github/agile-ts/agile/badges/gpa.svg" alt="Maintainability"/>
</a>

### ♥️ Contributors

<a href="https://github.com/agile-ts/agile/graphs/contributors">
<img src="https://contrib.rocks/image?repo=agile-ts/agile" />
</a>

[Become a contributor](https://github.com/agile-ts/agile/blob/master/CONTRIBUTING.md)


<br />

Expand Down
2 changes: 1 addition & 1 deletion benchmark/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANUAL_BENCHMARK=false
DEV=false
10 changes: 9 additions & 1 deletion benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,18 @@ Execute the benchmark located in `./benchmarks/react/counter`.
```ts
yarn run test:counter
```
If you want to test it manually, enable the `dev mode`.
```ts
yarn run test:counter --dev
```
The difference to the 'normal' mode is that:
- the executed bundle isn't `minified`
- the test has to be started manually by opening `localhost:3003`
- the test results are printed in the `browser console`

## ⭐️ Contribute

Get a part of AgileTs and start contributing. We welcome any meaningful contribution. 😀
Feel free to add more tests and State Managers to be tested. We welcome any meaningful contribution. 😀
To find out more about contributing, check out the [CONTRIBUTING.md](https://github.com/agile-ts/agile/blob/master/CONTRIBUTING.md).

<a href="https://codeclimate.com/github/agile-ts/agile/coverage.svg">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import ReactDom from 'react-dom';
import { createCollection, LogCodeManager } from '@agile-ts/core';
import { useAgile, useValue } from '@agile-ts/react';
import { createCollection, LogCodeManager, shared } from '@agile-ts/core';
import reactIntegration, { useAgile, useValue } from '@agile-ts/react';

LogCodeManager.getLogger().isActive = false;
LogCodeManager.setAllowLogging(false);
shared.integrate(reactIntegration);

export default function (target: HTMLElement, fieldsCount: number) {
const FIELDS = createCollection({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { createState, LogCodeManager, State } from '@agile-ts/core';
import { useAgile } from '@agile-ts/react';
import { createState, LogCodeManager, shared, State } from '@agile-ts/core';
import reactIntegration, { useAgile } from '@agile-ts/react';

LogCodeManager.getLogger().isActive = false;
LogCodeManager.setAllowLogging(false);
shared.integrate(reactIntegration);

export default function (target: HTMLElement, fieldsCount: number) {
const FIELDS = createState(
Expand Down
7 changes: 4 additions & 3 deletions benchmark/benchmarks/react/1000fields/bench/agilets/state.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import ReactDom from 'react-dom';
import { createState, LogCodeManager } from '@agile-ts/core';
import { useAgile } from '@agile-ts/react';
import { createState, LogCodeManager, shared } from '@agile-ts/core';
import reactIntegration, { useAgile } from '@agile-ts/react';

LogCodeManager.getLogger().isActive = false;
LogCodeManager.setAllowLogging(false);
shared.integrate(reactIntegration);

export default function (target: HTMLElement, fieldsCount: number) {
const FIELDS = createState(
Expand Down
6 changes: 3 additions & 3 deletions benchmark/benchmarks/react/1000fields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
endBenchmarkLog,
getCycleResult,
startBenchmarkLog,
} from '../../../benchmarkManager';
} from '../../benchmarkManager';

// Files to run the Benchmark on
import agileCollection from './bench/agilets/collection';
Expand Down Expand Up @@ -81,8 +81,8 @@ suite
.add('Agile State', configTest(agileState))
.add('Agile nested State', configTest(agileNestedState))
.add('Pulse Collection', configTest(pulseCollection))
// .add('Pulse State', configTest(pulseState))
// .add('Pulse nested State', configTest(pulseNestedState))
.add('Pulse State', configTest(pulseState))
.add('Pulse nested State', configTest(pulseNestedState))
.add('Hookstate', configTest(hookstate))
.add('Jotai', configTest(jotai))
.add('Mobx', configTest(mobx))
Expand Down
13 changes: 10 additions & 3 deletions benchmark/benchmarks/react/computed/bench/agilets/autoTracking.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import React from 'react';
import ReactDom from 'react-dom';
import { createComputed, createState, LogCodeManager } from '@agile-ts/core';
import { useAgile } from '@agile-ts/react';
import {
createComputed,
createState,
LogCodeManager,
shared,
} from '@agile-ts/core';
import reactIntegration, { useAgile } from '@agile-ts/react';

LogCodeManager.setAllowLogging(false);
shared.integrate(reactIntegration);

LogCodeManager.getLogger().isActive = false;
const COUNT = createState(0);
const COMPUTED_COUNT = createComputed(() => {
return COUNT.value * 5;
Expand Down
13 changes: 10 additions & 3 deletions benchmark/benchmarks/react/computed/bench/agilets/hardCoded.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import React from 'react';
import ReactDom from 'react-dom';
import { createComputed, createState, LogCodeManager } from '@agile-ts/core';
import { useAgile } from '@agile-ts/react';
import {
createComputed,
createState,
LogCodeManager,
shared,
} from '@agile-ts/core';
import reactIntegration, { useAgile } from '@agile-ts/react';

LogCodeManager.setAllowLogging(false);
shared.integrate(reactIntegration);

LogCodeManager.getLogger().isActive = false;
const COUNT = createState(0);
const COMPUTED_COUNT = createComputed(
() => {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmarks/react/computed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
endBenchmarkLog,
getCycleResult,
startBenchmarkLog,
} from '../../../benchmarkManager';
} from '../../benchmarkManager';

// Files to run the Benchmark on
import agileAutoTracking from './bench/agilets/autoTracking';
Expand Down
10 changes: 6 additions & 4 deletions benchmark/benchmarks/react/counter/bench/agilets.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from 'react';
import ReactDom from 'react-dom';
import { createState, LogCodeManager } from '@agile-ts/core';
import { useAgile } from '@agile-ts/react';
import { createState, LogCodeManager, shared } from '@agile-ts/core';
import reactIntegration, { useAgile } from '@agile-ts/react';

LogCodeManager.setAllowLogging(false);
shared.integrate(reactIntegration);

LogCodeManager.getLogger().isActive = false;
const COUNT = createState(0);

const App = () => {
const count = useAgile(COUNT, undefined);
const count = useAgile(COUNT);
return <h1 onClick={() => COUNT.set((state) => state + 1)}>{count}</h1>;
};

Expand Down
2 changes: 1 addition & 1 deletion benchmark/benchmarks/react/counter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
endBenchmarkLog,
getCycleResult,
startBenchmarkLog,
} from '../../../benchmarkManager';
} from '../../benchmarkManager';

// Files to run the Benchmark on
import agilets from './bench/agilets';
Expand Down
6 changes: 6 additions & 0 deletions benchmark/benchmarks/typescript/cloneDeep/bench/lodash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @ts-ignore
import _ from 'lodash';

export function cloneDeep<T = any>(value: T): T {
return _.cloneDeep(value);
}
19 changes: 19 additions & 0 deletions benchmark/benchmarks/typescript/cloneDeep/bench/looper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export function cloneDeep<T = any>(value: T): T {
// Extra checking 'value == null' because 'typeof null === object'
if (value == null || typeof value !== 'object') return value;

// Ignore everything that is no object or array but has the type of an object (e.g. classes)
const valConstructorName = Object.getPrototypeOf(
value
).constructor.name.toLowerCase();
if (valConstructorName !== 'object' && valConstructorName !== 'array')
return value;

let temp;
const newObject: any = Array.isArray(value) ? [] : {};
for (const property in value) {
temp = value[property];
newObject[property] = cloneDeep(temp);
}
return newObject as T;
}
3 changes: 3 additions & 0 deletions benchmark/benchmarks/typescript/cloneDeep/bench/stringify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function cloneDeep<T = any>(value: T): T {
return JSON.parse(JSON.stringify(value));
}
56 changes: 56 additions & 0 deletions benchmark/benchmarks/typescript/cloneDeep/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import Benchmark, { Suite } from 'benchmark';
import {
cycleLog,
CycleResultInterface,
endBenchmarkLog,
getCycleResult,
startBenchmarkLog,
} from '../../benchmarkManager';

// Files to run the Benchmark on
import * as lodash from './bench/lodash';
import * as looper from './bench/looper';
import * as stringify from './bench/stringify';

const toClone = { x1: true, x2: undefined };

// @ts-ignore
// Benchmark.js requires an instance of itself globally
window.Benchmark = Benchmark;

// Create new Benchmark Test Suite
const suite = new Suite('clone deep');

const results: CycleResultInterface[] = [];

// Add Tests to the Benchmark Test Suite
suite
.add('Lodash', function () {
lodash.cloneDeep(toClone);
})
.add('Looper', function () {
looper.cloneDeep(toClone);
})
.add('Stringify', function () {
stringify.cloneDeep(toClone);
})

// Add Listener
.on('start', function (this: any) {
startBenchmarkLog(this.name);
})
.on('cycle', (event: any) => {
const cycleResult = getCycleResult(event);
cycleLog(cycleResult);
results.push(cycleResult);
})
.on('complete', function (this: any) {
endBenchmarkLog(this.name, results, this.filter('fastest').map('name'));

// @ts-ignore
// Notify server that the Benchmark Test Suite has ended
window.TEST.ended = true;
})

// Run Benchmark Test Suite
.run({ async: true });
2 changes: 1 addition & 1 deletion benchmark/benchmarks/typescript/defineConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
endBenchmarkLog,
getCycleResult,
startBenchmarkLog,
} from '../../../benchmarkManager';
} from '../../benchmarkManager';

// Files to run the Benchmark on
import * as referencer from './bench/referencer';
Expand Down
10 changes: 7 additions & 3 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"homepage": "https://agile-ts.org/",
"description": "Benchmark Tests",
"scripts": {
"test": "node -r esbuild-register run.ts",
"test": "node -r esbuild-register runtime/run.ts",
"test:counter": "yarn test ./benchmarks/react/counter",
"test:1000fields": "yarn test ./benchmarks/react/1000fields",
"test:computed": "yarn test ./benchmarks/react/computed",
"test:defineConfig": "yarn test ./benchmarks/typescript/defineConfig",
"test:cloneDeep": "yarn test ./benchmarks/typescript/cloneDeep",
"install:dev:agile": "yalc add @agile-ts/core @agile-ts/react & yarn install",
"install:prod:agile": "yarn add @agile-ts/core @agile-ts/react & yarn install"
},
Expand All @@ -21,8 +22,9 @@
},
"dependencies": {
"@agile-ts/core": "file:.yalc/@agile-ts/core",
"@agile-ts/logger": "file:.yalc/@agile-ts/logger",
"@agile-ts/react": "file:.yalc/@agile-ts/react",
"@hookstate/core": "^3.0.8",
"@hookstate/core": "^3.0.11",
"@pulsejs/core": "^4.0.0-beta.3",
"@pulsejs/react": "^4.0.0-beta.3",
"@reduxjs/toolkit": "^1.6.0",
Expand All @@ -45,13 +47,15 @@
"redux": "^4.1.0",
"typescript": "^4.3.5",
"valtio": "^1.0.6",
"yargs": "^17.1.0",
"zustand": "^3.5.5"
},
"devDependencies": {
"@types/benchmark": "^2.1.0",
"@types/node": "^16.0.0",
"@types/react": "^17.0.13",
"@types/react-dom": "^17.0.8"
"@types/react-dom": "^17.0.8",
"@types/yargs": "^17.0.2"
},
"bugs": {
"url": "https://github.com/agile-ts/agile/issues"
Expand Down
Loading