-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(console.log): add custom chrome formatters (#85)
- Loading branch information
1 parent
04be26b
commit e74f757
Showing
27 changed files
with
2,712 additions
and
1,631 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,12 @@ jobs: | |
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
- uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: 1.10.1.693 | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn test | ||
- run: yarn semantic-release | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,14 @@ jobs: | |
with: | ||
node-version: '12' | ||
|
||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: 1.10.1.693 | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
name: Publish Examples | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
on: push | ||
|
||
jobs: | ||
publish-examples: | ||
|
@@ -14,6 +12,14 @@ jobs: | |
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- uses: DeLaGuardo/[email protected] | ||
with: | ||
cli: 1.10.1.693 | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
|
@@ -46,9 +52,25 @@ jobs: | |
|
||
- run: yarn shadow-cljs release dev | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
id: extract_branch | ||
|
||
- name: Publish to GitHub Pages 🚀 | ||
uses: JamesIves/github-pages-deploy-action@releases/v3 | ||
uses: JamesIves/github-pages-deploy-action@4.1.0 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: gh-pages # The branch the action should deploy to. | ||
FOLDER: public # The folder the action should deploy. | ||
branch: gh-pages | ||
folder: public | ||
target-folder: branches/${{ steps.extract_branch.outputs.branch }} | ||
|
||
- name: Slack Notification | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_CHANNEL: proj-dev-homebase-react | ||
SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' | ||
SLACK_ICON: https://github.com/homebaseio.png?size=200 | ||
SLACK_MESSAGE: "- :github: Branch: <https://github.com/homebaseio/homebase-react/tree/${{ steps.extract_branch.outputs.branch }}|${{ steps.extract_branch.outputs.branch }}>\n- :card_file_box: devcards: https://homebaseio.github.io/homebase-react/branches/${{ steps.extract_branch.outputs.branch }}/index.html" | ||
SLACK_TITLE: "Published ${{ steps.extract_branch.outputs.branch }} to GitHub Pages :rocket:" | ||
SLACK_USERNAME: Homebase | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ pom.xml.asc | |
.hgignore | ||
.hg/ | ||
.vscode | ||
.cpcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{:paths ["src"] | ||
:deps {thheller/shadow-cljs {:mvn/version "2.11.25"} | ||
devcards/devcards {:mvn/version "0.2.7"} | ||
datascript/datascript {:mvn/version "1.0.7"} | ||
reagent/reagent {:mvn/version "1.0.0-alpha2"} | ||
inflections/inflections {:mvn/version "0.13.2"} | ||
binaryage/devtools {:mvn/version "1.0.2"} | ||
homebaseio/datalog-console {:git/url "https://github.com/homebaseio/datalog-console" :sha "91d5b6009d66807ceec9807a1f8ed099a0a6f219"} | ||
;; homebaseio/datalog-console {:local/root "../datalog-console"} | ||
camel-snake-kebab/camel-snake-kebab {:mvn/version "0.4.2"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Homebase React uses ClojureScript and its corresponding data format EDN internally. We then compile all of that to Javascript using the Google Closure Compiler (closure not clojure) to get as small a bundle as possible. Then we provide APIs (react hooks) that accept JSON and do all the conversion to EDN and back again behind the scenes. | ||
|
||
EDN and Clojure provide far more safety and extensibility than JSON and Javascript; Clojure being immutable by default and EDN being extensible. This lets us build and support features that would be unwieldy in JSON and JS. | ||
|
||
However, the tradeoffs are: | ||
|
||
1. A larger bundle size. Some of the Clojure runtime cannot be compiled away even though the closure compiler is really aggressive. | ||
2. Clojure error messages sometimes leak into JS land. We try to annotate the ones we know about so they make sense to JS devs, but it's far from perfect and if you see something weird please create an issue. | ||
3. Our code is released already minified. We do this because most people do not develop with the google closure compiler and other build tools are not nearly as effective at optimizing this code. This makes debugging homebase-react while developing a bit harder since the code is not very readable, but we think the tradeoff is worth it to provide a smaller bundle size. And to compensate we try to build enough supporting dev tooling so you never need to read the compiled source. | ||
4. Confusing console logs. EDN data looks different from JSON and to add to that, homebase-react mostly outputs entities, which are lazy data types and not very helpful when logged out with the default console formatting. See custom chrome formatters below for a vastly improved logging experience. | ||
|
||
### Custom chrome formatters | ||
If you develop with [Chrome](https://www.google.com/chrome/) or a Chromium browser like Brave or Edge you'll get significantly more meaningful logs for entities `console.log(anEntity)` due to our use of custom chrome :formatters. These custom formatters allow us to perform lazy database queries to fetch all of an entity's attributes, including references to other entities and all reverse references to the current entity. They let you access your entire data graph from the console, with any logged out entity as an entry point. | ||
|
||
**To enable custom chrome formatters** | ||
|
||
**1.** Open the preferences panel in chrome devtools by clicking the cog. | ||
|
||
 | ||
|
||
**2.** Toggle `Enabled custom formatters` on. | ||
|
||
 | ||
|
||
**3.** Keep the chrome console open and refresh the page. Any logged out entities should now have the custom formatting. | ||
|
||
 | ||
|
||
**Live demo:** open the console while on the [todo example](https://homebaseio.github.io/homebase-react/#!/dev.example.todo) page. | ||
|
||
**Remember**: for custom formatters to work `console.log(anEntity)` must be called *after* you open the chrome console. Anything logged out before you open the console will not have custom formatting applied because chrome processes those logs in the background. | ||
|
||
### DEPRECATED `_recentlyTouchedAttributes` | ||
|
||
*Use [custom chrome formatters](#custom-chrome-formatters) instead.* | ||
|
||
If you set `debug` to `true` in your configuration, you will be able to access the `_recentlyTouchedAttributes` attribute on entities. `_recentlyTouchedAttributes` will show any cached attributes for a given entity. This is helpful for approximating that entity's schema and values. | ||
|
||
```js | ||
<HomebaseProvider config={{ debug: true }}> | ||
<App/> | ||
</HomebaseProvider> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
e74f757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
homebase-example-ts-firebase-todo – ./examples/typescript-firebase-todo
homebase-example-ts-firebase-todo-homebaseio.vercel.app
homebase-example-ts-firebase-todo.vercel.app
homebase-example-ts-firebase-todo-git-master-homebaseio.vercel.app
homebase-react-examples-typescript-firebase-todo.vercel.app
e74f757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
homebase-example-counter – ./examples/counter
homebase-example-counter-homebaseio.vercel.app
homebase-example-counter-git-master-homebaseio.vercel.app
homebase-example-counter.vercel.app
hbre-counter.vercel.app
e74f757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
homebase-example-roam – ./examples/roam
homebase-example-roam-git-master-homebaseio.vercel.app
homebase-example-roam.vercel.app
homebase-example-roam-homebaseio.vercel.app
roamdemo.homebase.io
e74f757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
homebase-example-todo – ./examples/todo
homebase-example-todo-homebaseio.vercel.app
homebase-example-todo.vercel.app
homebase-example-todo-git-master-homebaseio.vercel.app