Skip to content

Add/standardize Next and Remix demos - #10

Open
merrywhether wants to merge 1 commit into
electerious:masterfrom
merrywhether:new-demos
Open

Add/standardize Next and Remix demos#10
merrywhether wants to merge 1 commit into
electerious:masterfrom
merrywhether:new-demos

Conversation

@merrywhether

@merrywhether merrywhether commented Jan 17, 2022

Copy link
Copy Markdown
Contributor

Following up on #8 (comment), I was inspired to add a Next.js demo. While I was at it, I also added a Remix demo and updated the React Router demo to CRA v5 and react-router v6.

Working across the 3 apps, I then tried to standardize the various directory structures and READMEs for better predictability/comparability:

  • page components are all identical and nav extracted (these files can now be easily copy-pasted into new demos)
  • hoisted demo .gitignore entries to minimuze clutter in the demos themselves (also deleted optional files like jsconfig.json where possible for the same reason)
  • READMEs link to relevant file showcasing usage

Also attempted to reach a uniform code style based on your lint rules and other code (function expressions over declarations, 2 import groups, etc) without adding linting. Each of these frameworks would like to do their own linting which made things a little weird (CRA could see the root package.json's eslintConfig for instance). Added a .prettierrc with the 2 major settings to align with your established patterns and make things easier for those with Prettier configured, but happy to remove it as well.

Next app running:
Screen Shot 2022-01-17 at 12 17 43 PM

Remix app running:
Screen Shot 2022-01-17 at 12 51 47 PM

Updated CRA+RR app running:
Screen Shot 2022-01-17 at 12 12 28 PM

Comment thread .prettierrc
@@ -0,0 +1,4 @@
{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made things easier when working in the demos with Prettier configured (which is now default in VSCode) without going all the way to configuring linting for each of them. Happy to remove is this is problematic though.

Comment thread demos/next/README.md
@@ -0,0 +1,23 @@
# useAckee with Next.js

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README's all have the same structure, adapted from the one made by create-next-app.

"react-router-dom": "^5.2.0",
"react-scripts": "4.0.1",
"use-ackee": "^3.0.1"
"eslintConfig": {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is necessary to prevent CRA from looking up the directory tree and finding+complaining about the package's own ESLint config. This sets it back to the default lint CRA rules.

useAckee(pathname, {
domainId: 'hd11f820-68a1-11e6-8047-79c0c2d9bce0',
server: 'https://example.com',
})

@merrywhether merrywhether Jan 17, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original demo had ignoreLocalhost: false which resulted in CORS errors (and would otherwise fail even without them). Without that setting (which you probably don't recommend for real apps anyway), you get the nice console.warn which shows that Ackee is successfully running. Happy to revert if you prefer, though.

@merrywhether
merrywhether force-pushed the new-demos branch 3 times, most recently from 30f5d82 to cbb2539 Compare January 17, 2022 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant