From 466307e03b006d894a75bbcfccd60d31578daf65 Mon Sep 17 00:00:00 2001 From: Yuri Guller Date: Fri, 23 Apr 2021 14:53:06 +0300 Subject: [PATCH] issue #77: ci refact (#78) * issue #77: ci refact * issue #77: ci refact * issue #77: ci refact * issue #77: ci refact * issue #77: prepare for release --- ...elease-prepare.yml => trigger-release.yml} | 19 ++-- docs/changelog.md | 11 ++- package-lock.json | 92 +++++++++++-------- package.json | 4 +- readme.md | 80 ++++++---------- 5 files changed, 108 insertions(+), 98 deletions(-) rename .github/workflows/{release-prepare.yml => trigger-release.yml} (72%) diff --git a/.github/workflows/release-prepare.yml b/.github/workflows/trigger-release.yml similarity index 72% rename from .github/workflows/release-prepare.yml rename to .github/workflows/trigger-release.yml index c2cd48f..951980d 100644 --- a/.github/workflows/release-prepare.yml +++ b/.github/workflows/trigger-release.yml @@ -1,12 +1,14 @@ -name: Prepare 'object-observer' release +name: Trigger 'object-observer' release on: - push: - tags: - - release + workflow_dispatch: + inputs: + version: + description: 'Version to bump to' + required: false jobs: - prepare-verify: + prepare-verify-trigger: runs-on: ubuntu-18.04 steps: @@ -15,9 +17,6 @@ jobs: with: token: ${{ secrets.OO_CI_AT }} - - name: Delete temporary trigger tag - run: git push origin --delete release - - name: Setup NodeJS 14 uses: actions/setup-node@v2 with: @@ -26,6 +25,10 @@ jobs: - name: Install NPM run: npm install + # Bump version + - name: Bump to target version, if any + if: ${{ github.event.inputs.version }} + run: npm run bump -- --version=${{ github.event.inputs.version }} - name: Bump release version run: | npm run bump -- --release diff --git a/docs/changelog.md b/docs/changelog.md index 1d8247f..1c54a38 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -7,10 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [4.2.1] - 2021-03-15 +## [4.2.2] - 2021-04-23 +### Added +- [Issue no. 77](https://github.com/gullerya/object-observer/issues/77) - manual CI trigger for release +### Changed - documentation improved and updated - dependencies updated + +## [4.2.1] - 2021-03-15 +### Added - [Issue no. 73](https://github.com/gullerya/object-observer/issues/73) - added DOM-like API of `ObjectObserver` +### Changed +- documentation improved and updated +- dependencies updated ## [4.1.3] - 2021-02-01 ### Added diff --git a/package-lock.json b/package-lock.json index 74b802d..70edea2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -72,9 +72,9 @@ } }, "@types/node": { - "version": "14.14.34", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz", - "integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA==", + "version": "14.14.41", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.41.tgz", + "integrity": "sha512-dueRKfaJL4RTtSa7bWeTK1M+VH+Gns73oCgzvYfHZywRCoPSd8EkXBL0mZ9unPTveBn+D9phZBaxuzpwjWkW0g==", "dev": true, "optional": true }, @@ -164,9 +164,9 @@ "dev": true }, "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, "base64-js": { @@ -219,9 +219,9 @@ "dev": true }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.1.tgz", + "integrity": "sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -344,9 +344,9 @@ "dev": true }, "devtools-protocol": { - "version": "0.0.854822", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.854822.tgz", - "integrity": "sha512-xd4D8kHQtB0KtWW0c9xBZD5LVtm9chkMOfs/3Yn01RhT/sFIsVtzTtypfKoFfWBaL+7xCYLxjOLkhwPXaX/Kcg==", + "version": "0.0.869402", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.869402.tgz", + "integrity": "sha512-VvlVYY+VDJe639yHs5PHISzdWTLL3Aw8rO4cvUtwvoxFd6FHbE4OpHHcde52M6096uYYazAmd4l0o5VuFRO2WA==", "dev": true }, "doctrine": { @@ -389,9 +389,9 @@ "dev": true }, "eslint": { - "version": "7.22.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.22.0.tgz", - "integrity": "sha512-3VawOtjSJUQiiqac8MQc+w457iGLfuNGLFn8JmF051tTKbh5/x/0vlcEj8OgDCaw7Ysa2Jn8paGshV7x2abKXg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.24.0.tgz", + "integrity": "sha512-k9gaHeHiFmGCDQ2rEfvULlSLruz6tgfA8DEn+rY9/oYPFFTlz55mM/Q/Rij1b2Y42jwZiK3lXvNTw6w6TXzcKQ==", "dev": true, "requires": { "@babel/code-frame": "7.12.11", @@ -674,9 +674,9 @@ } }, "globals": { - "version": "13.6.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.6.0.tgz", - "integrity": "sha512-YFKCX0SiPg7l5oKYCJ2zZGxcXprVXHcSnVuvzrT3oSENQonVLqM5pf9fN5dLGZGyCjhw8TN8Btwe/jKnZ0pjvQ==", + "version": "13.8.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.8.0.tgz", + "integrity": "sha512-rHtdA6+PDBIjeEvA91rpqzEvk/k3/i7EeNQiryiWuJH0Hw9cpyJMAt2jtbAwUaRdhD+573X4vWw6IcjKPasi9Q==", "dev": true, "requires": { "type-fest": "^0.20.2" @@ -858,6 +858,24 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4547,13 +4565,13 @@ "dev": true }, "puppeteer": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-8.0.0.tgz", - "integrity": "sha512-D0RzSWlepeWkxPPdK3xhTcefj8rjah1791GE82Pdjsri49sy11ci/JQsAO8K2NRukqvwEtcI+ImP5F4ZiMvtIQ==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-9.0.0.tgz", + "integrity": "sha512-Avu8SKWQRC1JKNMgfpH7d4KzzHOL/A65jRYrjNU46hxnOYGwqe4zZp/JW8qulaH0Pnbm5qyO3EbSKvqBUlfvkg==", "dev": true, "requires": { "debug": "^4.1.0", - "devtools-protocol": "0.0.854822", + "devtools-protocol": "0.0.869402", "extract-zip": "^2.0.0", "https-proxy-agent": "^5.0.0", "node-fetch": "^2.6.1", @@ -4617,9 +4635,9 @@ "dev": true }, "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "dev": true, "requires": { "lru-cache": "^6.0.0" @@ -4734,21 +4752,23 @@ } }, "table": { - "version": "6.0.7", - "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", - "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", + "version": "6.3.4", + "resolved": "https://registry.npmjs.org/table/-/table-6.3.4.tgz", + "integrity": "sha512-fhKcZ3+oAYG/ld3seJEZ9+fGSsy+yeoPzLQUrwbOzNYdhrU+6TzObhJ2Sp76ZfUGIrDTrxsXz5NSCZJIUOJb4Q==", "dev": true, "requires": { - "ajv": "^7.0.2", - "lodash": "^4.17.20", + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.flatten": "^4.4.0", + "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.0" }, "dependencies": { "ajv": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-7.2.1.tgz", - "integrity": "sha512-+nu0HDv7kNSOua9apAVc979qd932rrZeb3WOvoiD31A/p1mIE5/9bN2027pE2rOPYEdS3UHzsvof4hY+lM9/WQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.1.0.tgz", + "integrity": "sha512-B/Sk2Ix7A36fs/ZkuGLIR86EdjbgR6fsAcbx9lOP/QBSXujDNbVmIS/U4Itz5k8fPFDeVZl/zQ/gJW4Jrq6XjQ==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -4886,9 +4906,9 @@ "dev": true }, "ws": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz", - "integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==", + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.5.tgz", + "integrity": "sha512-xzyu3hFvomRfXKH8vOFMU3OguG6oOvhXMo3xsGy3xWExqaM2dxBbVxuD99O7m3ZUFMvvscsZDqxfgMaRr/Nr1g==", "dev": true }, "yallist": { diff --git a/package.json b/package.json index 1c91f3d..f3fcacc 100644 --- a/package.json +++ b/package.json @@ -52,10 +52,10 @@ "bump": "node ./ci/tools/version-utils.js" }, "devDependencies": { - "eslint": "^7.22.0", + "eslint": "^7.24.0", "fs-extra": "^9.1.0", "just-test": "2.3.2", - "puppeteer": "^8.0.0", + "puppeteer": "^9.0.0", "uglify-es": "^3.3.9" } } diff --git a/readme.md b/readme.md index 5118c5e..e0f5406 100644 --- a/readme.md +++ b/readme.md @@ -5,56 +5,36 @@ [![Codecov](https://img.shields.io/codecov/c/github/gullerya/object-observer/main.svg)](https://codecov.io/gh/gullerya/object-observer/branch/main) [![Codacy](https://img.shields.io/codacy/grade/a3879d7077eb4eef83a591733ad7c579.svg?logo=codacy)](https://www.codacy.com/app/gullerya/object-observer) -# Summary +# `object-observer` __`object-observer`__ provides a deep observation of a changes performed on an object/array graph. Main aspects and features: -* implemented via native __Proxy__ (revokable) - -* observation is 'deep', yielding changes from a __sub-graphs__ too - -* nested objects of the observable graph are observables too - -* changes delivered in a __synchronous__ way by default, __asynchronous__ delivery (experimental) is optionally available as per `Observable` configuration; [more details here](docs/sync-async.md) - -* observed path may optionally be filtered as per `observer` configuration; [more details here](docs/filter-paths.md) - -* original objects are __cloned__ while turned into `Observable`s - -* __array__ specifics: - * generic object-like mutations supported - * intrinsic `Array` mutation methods supported: `pop`, `push`, `shift`, `unshift`, `reverse`, `sort`, `fill`, `splice`, `copyWithin` - * massive mutations delivered in a single callback, usually having an array of an atomic changes - -* __typed array__ specifics: - * generic object-like mutations supported - * intrinsic `TypedArray` mutation methods supported: `reverse`, `sort`, `fill`, `set`, `copyWithin` - * massive mutations delivered in a single callback, usually having an array of an atomic changes - -* intrinsic mutation methods of `Map`, `WeakMap`, `Set`, `WeakSet` (`set`, `delete`) etc __are not__ observed (see this [issue](https://github.com/gullerya/object-observer/issues/1) for more details) - -* following host objects (and their extensions) are __skipped__ from cloning / turning into observables: `Date`, `Blob`, `Error` +- implemented via native __Proxy__ (revokable) +- observation is 'deep', yielding changes from a __sub-graphs__ too +- nested objects of the observable graph are observables too +- changes delivered in a __synchronous__ way by default, __asynchronous__ delivery is optionally available as per `Observable` configuration; [more details here](docs/sync-async.md) +- observed path may optionally be filtered as per `observer` configuration; [more details here](docs/filter-paths.md) +- original objects are __cloned__ while turned into `Observable`s +- __array__ specifics: + - generic object-like mutations supported + - intrinsic `Array` mutation methods supported: `pop`, `push`, `shift`, `unshift`, `reverse`, `sort`, `fill`, `splice`, `copyWithin` + - massive mutations delivered in a single callback, usually having an array of an atomic changes +- __typed array__ specifics: + - generic object-like mutations supported + - intrinsic `TypedArray` mutation methods supported: `reverse`, `sort`, `fill`, `set`, `copyWithin` + - massive mutations delivered in a single callback, usually having an array of an atomic changes +- intrinsic mutation methods of `Map`, `WeakMap`, `Set`, `WeakSet` (`set`, `delete`) etc __are not__ observed (see this [issue](https://github.com/gullerya/object-observer/issues/1) for more details) +- following host objects (and their extensions) are __skipped__ from cloning / turning into observables: `Date`, `Blob`, `Error` #### Support matrix: ![CHROME](docs/browser-icons/chrome.png)61+ | ![FIREFOX](docs/browser-icons/firefox.png)60+ | ![EDGE](docs/browser-icons/edge.png)16+ | ![NODE JS](docs/browser-icons/nodejs.png) 8.10.0+ #### Performance report can be found [here](docs/performance-report.md) -#### Last versions (full changelog is [here](docs/changelog.md)) - -- __4.2.1__ - - documentation improved and updated - - dependencies updated - - [Issue no. 73](https://github.com/gullerya/object-observer/issues/73) - added DOM-like API of `ObjectObserver` +#### Changelog is [here](docs/changelog.md) -- __4.1.3__ - - implemented [Issue no. 71](https://github.com/gullerya/object-observer/issues/71) - added CDN deployment - -- __4.1.1__ - - [Issue no. 70](https://github.com/gullerya/object-observer/issues/70) - automated version bump - - unified `Change` object structure (so that it is always the same shape) - - improved perf tests +## Preview For a preview/playground you are welcome to: - [CodePen](https://codepen.io/gullerya/pen/zYrGMNB) @@ -62,9 +42,12 @@ For a preview/playground you are welcome to: ## Install -Use regular `npm install object-observer --save-prod` to use the library from your local environment. +Use regular `npm install object-observer --save-prod` to use the library from your local environment: +```js +import { Observable } from 'node_modules/object-observer/dist/object-observer.min.js'; +``` -Additionally, a __CDN__ deployment available (AWS driven), so one can import it directly: +Alternatively, a __CDN__ deployment available (AWS driven), so one can import it directly: ```js import { Observable } from 'https://libs.gullerya.com/object-observer/x.y.z/object-observer.min.js'; ``` @@ -76,20 +59,15 @@ CDN features: - highly available (with many geo spread edges) - agressive caching setup -Import `object-observer` as __ES6 module__: -```js -import { Observable } from 'object-observer.min.js'; -``` - ## API Library implements `Observable` API as it is defined [here](docs/observable.md). -Additionally, from version 4.2.0 there is also 'DOM-like' API flavor, a one that resonating with DOM's `MutationObserver`, `ResizeObserver` etc from the syntax perspective. +Additionally, from version 4.2.0 there is also 'DOM-like' API flavor, a one that is resonating with DOM's `MutationObserver`, `ResizeObserver` etc from the syntax perspective. Under the hood it uses the same `Observable` mechanics. Read docs about this API flavor [here](docs/dom-like-api.md). -> This is __experimental__ API until specified here otherwise. +> This is __experimental__ API until specified otherwise. ## Security @@ -101,7 +79,7 @@ Security policy is described [here](https://github.com/gullerya/object-observer/ ```javascript const - order = { type: 'book', pid: 102, ammount: 5, remark: 'remove me' }, + order = { type: 'book', pid: 102, ammount: 5, remark: 'remove me' }, observableOrder = Observable.from(order); observableOrder.observe(changes => { @@ -130,8 +108,8 @@ delete observableOrder.remark; // { type: "delete", path: ['remark'], oldValue: 'remove me', object: observableOrder } Object.assign(observableOrder, { amount: 1, remark: 'less is more' }, { async: true }); -// - by default the changes below would be delivered in a separate callback -// - due to async use, they are delivered as a batch in a single callback +// - by default the changes below would be delivered in a separate callback +// - due to async use, they are delivered as a batch in a single callback // { type: 'update', path: ['ammount'], value: 1, oldValue: 7, object: observableOrder } // { type: 'insert', path: ['remark'], value: 'less is more', object: observableOrder } ```