Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export from index.js #344

Merged
merged 7 commits into from
Oct 30, 2020
Merged

Export from index.js #344

merged 7 commits into from
Oct 30, 2020

Conversation

bakerkretzmar
Copy link
Collaborator

This PR changes the filename of Ziggy's main 'entrypoint' from route.js to index.js.

This has one major benefit, which is that it makes exporting more things easier—particularly from the NPM package. For example, after this PR we could add and export a React Hook and using it would be as simple as import route, { useRoute } from 'ziggy-js'.

Two additional upsides to this change are that the complete import filepath gets shorter for anyone using it, since import route from './vendor/tightenco/ziggy/dist' now works, and it's clearer where Ziggy's exports are and might make a tad more sense to newcomers since there's now an index.js file, which is pretty standard for Javascript.

The diff looks gnarly but the Javascript source didn't actually change at all, it just moved around.


Unrelated:

@bakerkretzmar bakerkretzmar added this to the v1.0 milestone Oct 28, 2020
@bakerkretzmar bakerkretzmar merged commit 5213c4d into develop Oct 30, 2020
@bakerkretzmar bakerkretzmar deleted the jbk/export-index-js branch October 30, 2020 15:11
bakerkretzmar added a commit that referenced this pull request Oct 30, 2020
bakerkretzmar added a commit that referenced this pull request Nov 6, 2020
* Add upgrade guide

* Wip

* Wip

* Update GitHub actions to not run on Markdown files

* Wip

* Formatting

* Add changes in #337

* Add anchor links

* Add changes in #338

* Add changes in #341, formatting

* Wip

* Update usage examples in Readme

* Move CSP section down

* LICENSE.md → LICENSE

* Wip

* Wip

* Formatting

* Add new features section to Upgrading

* Prep Changelog headers and tags for v1

* Move current() with query fix to Fixed section

* Add entries for #334 and #344 to Upgrading

* Add Upgrading entry for check() being deprecated

* Add #345 to Upgrading

* Wip on Readme

* JavaScript → Javascript

* Wording/formatting

* Update Readme:
- Move Usage above Setup
- Remove 'basic setup' section about @routes directive, it's covered in Installation
- Wording fixes
- Add note about boolean encoding (see #345)
- Remove old 'Artisan Command' section

* Formatting

* Formatting and wording

* Javascript → JavaScript

* Remove unused heading link

* Add section under 'Other' for setting up an API endpoint to return routes, link to that from SPA and JS sections

* Fix wording re: watching files

* :)
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