diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000..3eb4cd4 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,28 @@ +name: Bump version + +on: + push: + branches: + - main + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + bump: + permissions: + contents: write + name: Bump version + runs-on: ubuntu-latest + steps: + - uses: ./.github/workflows/test.yml + + - name: Generate tag + run: | + git config user.name Automated release + git config user.email websdk-react-hooks@miro.com + yarn release + + - name: Publish tag + id: publish_tag + run: git push --follow-tags \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30c9019..29c881e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,9 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + # Allows other workflows to invoke this + workflow_call: + jobs: deploy: name: Build and Test diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index afa1104..f02148a 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ Make sure you have a [Miro application](https://developers.miro.com/docs/build-y - [useInfo](./src/useInfo/useInfo.md) - Get [Miro board info](https://developers.miro.com/docs/websdk-reference-board#getinfo). - [useOnlineUsers](./src/useOnlineUsers/useOnlineUsers.md) - Get [online users](https://developers.miro.com/docs/websdk-reference-board#getonlineusers) in a Miro board. - [useSelectedItems](./src/useSelectedItems/useSelectedItems.md) - List [selected items](https://developers.miro.com/docs/websdk-reference-board#getselection) with possible predicate filter. +- [useSession](./src/useSession/useSession.md) - Interact with [Miro session](https://developers.miro.com/docs/websdk-reference-session). - [useStorage](./src/useStorage/useStorage.md) - Interact with [Miro storage](https://developers.miro.com/docs/websdk-reference-storage). - [useViewport](./src/useViewport/useViewport.md) - Interact with [Miro viewport](https://developers.miro.com/docs/websdk-reference-viewport). diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 7fb5348..0000000 --- a/TODO.md +++ /dev/null @@ -1,10 +0,0 @@ -# TODO - -- [x] Create build task -- [ ] Configure local environment -- [x] Configure testing pipeline -- [ ] Configure GH action to publish package to npmjs -- [ ] Configure standard release to bump package and create change log -- [x] Write README.md -- [ ] Write CONTRIBUTING.md -- [x] Identify best license to use \ No newline at end of file diff --git a/package.json b/package.json index 50a4b7d..d641e83 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "build:es": "tsc -m esNext --outDir esm", "build": "yarn clean && concurrently yarn:build:cjs yarn:build:es", "clean": "rimraf lib esm", - "release": "standard-version --no-verify" + "release": "commit-and-tag-version --no-verify" }, "husky": { "hooks": { @@ -37,12 +37,12 @@ "author": "Miro Platform WebSDK", "repository": { "type": "git", - "url": "https://github.com/miroapp-dev/miro-react-hooks" + "url": "https://github.com/miroapp/miro-react-hooks" }, "bugs": { - "url": "https://github.com/miroapp-dev/miro-react-hooks/issues" + "url": "https://github.com/miroapp/miro-react-hooks/issues" }, - "homepage": "https://github.com/miroapp-dev/miro-react-hooks#readme", + "homepage": "https://github.com/miroapp/miro-react-hooks#readme", "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" @@ -57,6 +57,7 @@ "@testing-library/react-hooks": "^8.0.1", "@types/jest": "^29.5.10", "@typescript-eslint/eslint-plugin": "^6.4.0", + "commit-and-tag-version": "^12.0.0", "commitizen": "^4.3.0", "concurrently": "^8.2.2", "eslint": "^8.0.1", @@ -77,7 +78,6 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "rimraf": "^5.0.5", - "standard-version": "^9.5.0", "ts-jest": "^29.1.1", "ts-node": "^10.9.1", "typescript": "*" diff --git a/src/context.tsx b/src/context.tsx index 0ab6d97..45beee6 100644 --- a/src/context.tsx +++ b/src/context.tsx @@ -8,5 +8,6 @@ export type MiroContextType = { export const MiroContext = createContext({}); export const MiroProvider: FC> = ({ children, miro }) => { - return {children}; + const miroInstance = miro ?? globalThis.miro; + return {children}; }; diff --git a/yarn.lock b/yarn.lock index a9ec8b2..3219a88 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2767,6 +2767,25 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +commit-and-tag-version@^12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/commit-and-tag-version/-/commit-and-tag-version-12.0.0.tgz#f2f695fef032661954189859dce8eefdd159bed2" + integrity sha512-ynzs3Zojw3Z0hyBuA4prkDUvfODRUoqbsk7RFpFc28I12vXxhrAv+N5/9W4O0htdi9sxL6xvzxozXUapBeGXTQ== + dependencies: + chalk "^2.4.2" + conventional-changelog "3.1.25" + conventional-changelog-config-spec "2.1.0" + conventional-changelog-conventionalcommits "6.1.0" + conventional-recommended-bump "7.0.1" + detect-indent "^6.0.0" + detect-newline "^3.1.0" + dotgitignore "^2.1.0" + figures "^3.1.0" + find-up "^5.0.0" + git-semver-tags "^5.0.0" + semver "^7.5.4" + yargs "^17.7.2" + commitizen@^4.0.3, commitizen@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/commitizen/-/commitizen-4.3.0.tgz#0d056c542a2d2b1f9b9aba981aa32575b2849924" @@ -2864,7 +2883,14 @@ conventional-changelog-config-spec@2.1.0: resolved "https://registry.yarnpkg.com/conventional-changelog-config-spec/-/conventional-changelog-config-spec-2.1.0.tgz#874a635287ef8b581fd8558532bf655d4fb59f2d" integrity sha512-IpVePh16EbbB02V+UA+HQnnPIohgXvJRxHcS5+Uwk4AT5LjzCZJm5sp/yqs5C6KZJ1jMsV4paEV13BN1pvDuxQ== -conventional-changelog-conventionalcommits@4.6.3, conventional-changelog-conventionalcommits@^4.5.0: +conventional-changelog-conventionalcommits@6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-6.1.0.tgz#3bad05f4eea64e423d3d90fc50c17d2c8cf17652" + integrity sha512-3cS3GEtR78zTfMzk0AizXKKIdN4OvSh7ibNz6/DPbhWWQu7LqE/8+/GqSodV+sywUR2gpJAdP/1JFf4XtN7Zpw== + dependencies: + compare-func "^2.0.0" + +conventional-changelog-conventionalcommits@^4.5.0: version "4.6.3" resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.3.tgz#0765490f56424b46f6cb4db9135902d6e5a36dc2" integrity sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g== @@ -2941,6 +2967,11 @@ conventional-changelog-preset-loader@^2.3.4: resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.4.tgz#14a855abbffd59027fd602581f1f34d9862ea44c" integrity sha512-GEKRWkrSAZeTq5+YjUZOYxdHq+ci4dNwHvpaBC3+ENalzFWuCWa9EZXSuZBpkr72sMdKB+1fyDV4takK1Lf58g== +conventional-changelog-preset-loader@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-3.0.0.tgz#14975ef759d22515d6eabae6396c2ae721d4c105" + integrity sha512-qy9XbdSLmVnwnvzEisjxdDiLA4OmV3o8db+Zdg4WiFw14fP3B6XNz98X0swPPpkTd/pc1K7+adKgEDM1JCUMiA== + conventional-changelog-writer@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-5.0.1.tgz#e0757072f045fe03d91da6343c843029e702f359" @@ -2986,6 +3017,14 @@ conventional-commits-filter@^2.0.7: lodash.ismatch "^4.4.0" modify-values "^1.0.0" +conventional-commits-filter@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/conventional-commits-filter/-/conventional-commits-filter-3.0.0.tgz#bf1113266151dd64c49cd269e3eb7d71d7015ee2" + integrity sha512-1ymej8b5LouPx9Ox0Dw/qAO2dVdfpRFq28e5Y0jJEU8ZrLdy0vOSkkIInwmxErFGhg6SALro60ZrwYFVTUDo4Q== + dependencies: + lodash.ismatch "^4.4.0" + modify-values "^1.0.1" + conventional-commits-parser@^3.2.0: version "3.2.4" resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz#a7d3b77758a202a9b2293d2112a8d8052c740972" @@ -2998,6 +3037,16 @@ conventional-commits-parser@^3.2.0: split2 "^3.0.0" through2 "^4.0.0" +conventional-commits-parser@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-4.0.0.tgz#02ae1178a381304839bce7cea9da5f1b549ae505" + integrity sha512-WRv5j1FsVM5FISJkoYMR6tPk07fkKT0UodruX4je86V4owk451yjXAKzKAPOs9l7y59E2viHUS9eQ+dfUA9NSg== + dependencies: + JSONStream "^1.3.5" + is-text-path "^1.0.1" + meow "^8.1.2" + split2 "^3.2.2" + conventional-commits-parser@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-5.0.0.tgz#57f3594b81ad54d40c1b4280f04554df28627d9a" @@ -3008,19 +3057,18 @@ conventional-commits-parser@^5.0.0: meow "^12.0.1" split2 "^4.0.0" -conventional-recommended-bump@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-6.1.0.tgz#cfa623285d1de554012f2ffde70d9c8a22231f55" - integrity sha512-uiApbSiNGM/kkdL9GTOLAqC4hbptObFo4wW2QRyHsKciGAfQuLU1ShZ1BIVI/+K2BE/W1AWYQMCXAsv4dyKPaw== +conventional-recommended-bump@7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-7.0.1.tgz#ec01f6c7f5d0e2491c2d89488b0d757393392424" + integrity sha512-Ft79FF4SlOFvX4PkwFDRnaNiIVX7YbmqGU0RwccUaiGvgp3S0a8ipR2/Qxk31vclDNM+GSdJOVs2KrsUCjblVA== dependencies: concat-stream "^2.0.0" - conventional-changelog-preset-loader "^2.3.4" - conventional-commits-filter "^2.0.7" - conventional-commits-parser "^3.2.0" - git-raw-commits "^2.0.8" - git-semver-tags "^4.1.1" - meow "^8.0.0" - q "^1.5.1" + conventional-changelog-preset-loader "^3.0.0" + conventional-commits-filter "^3.0.0" + conventional-commits-parser "^4.0.0" + git-raw-commits "^3.0.0" + git-semver-tags "^5.0.0" + meow "^8.1.2" convert-source-map@^2.0.0: version "2.0.0" @@ -4140,6 +4188,15 @@ git-raw-commits@^2.0.11, git-raw-commits@^2.0.8: split2 "^3.0.0" through2 "^4.0.0" +git-raw-commits@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-3.0.0.tgz#5432f053a9744f67e8db03dbc48add81252cfdeb" + integrity sha512-b5OHmZ3vAgGrDn/X0kS+9qCfNKWe4K/jFnhwzVWWg0/k5eLa3060tZShrRg8Dja5kPc+YjS0Gc6y7cRr44Lpjw== + dependencies: + dargs "^7.0.0" + meow "^8.1.2" + split2 "^3.2.2" + git-remote-origin-url@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz#5282659dae2107145a11126112ad3216ec5fa65f" @@ -4148,7 +4205,7 @@ git-remote-origin-url@^2.0.0: gitconfiglocal "^1.0.0" pify "^2.3.0" -git-semver-tags@^4.0.0, git-semver-tags@^4.1.1: +git-semver-tags@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-4.1.1.tgz#63191bcd809b0ec3e151ba4751c16c444e5b5780" integrity sha512-OWyMt5zBe7xFs8vglMmhM9lRQzCWL3WjHtxNNfJTMngGym7pC1kh8sP6jevfydJ6LP3ZvGxfb6ABYgPUM0mtsA== @@ -4156,6 +4213,14 @@ git-semver-tags@^4.0.0, git-semver-tags@^4.1.1: meow "^8.0.0" semver "^6.0.0" +git-semver-tags@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/git-semver-tags/-/git-semver-tags-5.0.1.tgz#db748aa0e43d313bf38dcd68624d8443234e1c15" + integrity sha512-hIvOeZwRbQ+7YEUmCkHqo8FOLQZCEn18yevLHADlFPZY02KJGsu5FZt9YW/lybfK2uhWFI7Qg/07LekJiTv7iA== + dependencies: + meow "^8.1.2" + semver "^7.0.0" + gitconfiglocal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz#41d045f3851a5ea88f03f24ca1c6178114464b9b" @@ -5601,7 +5666,7 @@ meow@^12.0.1: resolved "https://registry.yarnpkg.com/meow/-/meow-12.1.1.tgz#e558dddbab12477b69b2e9a2728c327f191bace6" integrity sha512-BhXM0Au22RwUneMPwSCnyhTOizdWoIEPU9sp0Aqa1PnDMR5Wv2FGXYDjuzJEIX+Eo2Rb8xuYe5jrnm5QowQFkw== -meow@^8.0.0: +meow@^8.0.0, meow@^8.1.2: version "8.1.2" resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.2.tgz#bcbe45bda0ee1729d350c03cffc8395a36c4e897" integrity sha512-r85E3NdZ+mpYk1C6RjPFEMSE+s1iZMuHtsHAqY0DT3jZczl0diWUZ8g6oU7h0M9cD2EL+PzaYghhCLzR0ZNn5Q== @@ -5706,7 +5771,7 @@ minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== -modify-values@^1.0.0: +modify-values@^1.0.0, modify-values@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== @@ -6532,7 +6597,7 @@ scheduler@^0.23.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@7.5.4, semver@^7.0.0, semver@^7.1.1, semver@^7.3.4, semver@^7.3.7, semver@^7.5.3, semver@^7.5.4: +semver@7.5.4, semver@^7.0.0, semver@^7.3.4, semver@^7.3.7, semver@^7.5.3, semver@^7.5.4: version "7.5.4" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== @@ -6653,7 +6718,7 @@ spdx-license-ids@^3.0.0: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.16.tgz#a14f64e0954f6e25cc6587bd4f392522db0d998f" integrity sha512-eWN+LnM3GR6gPu35WxNgbGl8rmY1AEmoMDvL/QD6zYmPWgywxWqJWNdLGT+ke8dKNWrcYgYjPpG5gbTfghP8rw== -split2@^3.0.0: +split2@^3.0.0, split2@^3.2.2: version "3.2.2" resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== @@ -6684,26 +6749,6 @@ stack-utils@^2.0.3: dependencies: escape-string-regexp "^2.0.0" -standard-version@^9.5.0: - version "9.5.0" - resolved "https://registry.yarnpkg.com/standard-version/-/standard-version-9.5.0.tgz#851d6dcddf5320d5079601832aeb185dbf497949" - integrity sha512-3zWJ/mmZQsOaO+fOlsa0+QK90pwhNd042qEcw6hKFNoLFs7peGyvPffpEBbK/DSGPbyOvli0mUIFv5A4qTjh2Q== - dependencies: - chalk "^2.4.2" - conventional-changelog "3.1.25" - conventional-changelog-config-spec "2.1.0" - conventional-changelog-conventionalcommits "4.6.3" - conventional-recommended-bump "6.1.0" - detect-indent "^6.0.0" - detect-newline "^3.1.0" - dotgitignore "^2.1.0" - figures "^3.1.0" - find-up "^5.0.0" - git-semver-tags "^4.0.0" - semver "^7.1.1" - stringify-package "^1.0.1" - yargs "^16.0.0" - string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -6791,11 +6836,6 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -stringify-package@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" - integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== - "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -7441,7 +7481,7 @@ yargs-parser@^21.0.1, yargs-parser@^21.1.1: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs@^16.0.0, yargs@^16.2.0: +yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==