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

Feature/issue 1116 base path configuration #1135

Merged

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Aug 5, 2023

Related Issue

resolves #1116 (and #273)

Summary of Changes

  1. Add basePath support to greenwood.config.js (covers pages, API routes, and adapter routing, <script> and <link> tags, and GraphQL queries)
  2. Persist base path setting in a <script> tag
  3. Add Base Path configuration docs
  4. Update GitHub Pages guide to call out when to use a base path

TODO

  1. Enable for greenwood build / greenwood serve
  2. Support script and style tags
  3. Check support for /graph.json
    Screenshot 2023-10-23 at 8 57 47 PM
  4. Check support for static router
    Screenshot 2023-10-23 at 8 57 38 PM
  5. Check support for 404 page
  6. Odd margin: auto and navigation issues on the docs website
    Screenshot 2023-10-25 at 4 26 13 PM
  7. Should this be baked into the graph / URLs by default?
  8. Add test cases
    • develop
    • serve
    • graphql
    • static router
  9. finish and add test cases for - resolvers and file writing assumes certain route depth #273
  10. Check support for dev proxy
  11. Check support for API routes / SSR pages
  12. Check support in adapters (for host routing)
  13. Display basePath for server logging output
  14. Add documentation
    • clarify this is only for greenwood routing (not for user content like links, forms, etc)
  15. test with a project using GitHub pages and update GitHub pages guide - upgrade to use latest version of greenwood with basePath support greenwood-demo-github-pages#1
  16. "lift" shared client side base path config to CLI output and document - chore/upgrade greenwood v0.29.0 thescientist13/greenwood-starter-presentation#66
  17. Remove demo code
  18. Refactor tests to align with chore/Issue 1016: Replace the use of request with fetch in test cases #1172

Questions

  1. Is there actually a way to do it with just <base href="..."/> (make discussion) - Enhance `basePath` configuration with `<base href="...">` support #1175
  2. should track an issue for customizing trailing forward slash - https://github.com/ProjectEvergreen/greenwood/issues/new

@thescientist13 thescientist13 added documentation Greenwood specific docs CLI feature New feature or request labels Aug 5, 2023
@thescientist13 thescientist13 self-assigned this Aug 5, 2023
@thescientist13 thescientist13 linked an issue Oct 26, 2023 that may be closed by this pull request
5 tasks
@thescientist13 thescientist13 changed the base branch from master to release/0.29.0 October 27, 2023 01:32
@thescientist13 thescientist13 force-pushed the feature/issue-1116-base-path-configuration branch from f86c248 to 6a598a3 Compare October 27, 2023 01:44
@@ -4,6 +4,7 @@
<head>
<title>Greenwood - ${globalThis.page.title}</title>
<meta charset="utf-8">
<base href="/my-subpath/"/>
Copy link
Member Author

Choose a reason for hiding this comment

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

note: this isn't actually doing anything

@@ -157,6 +157,11 @@ async function getAppTemplate(pageTemplateContents, context, customImports = [],
? appBody.replace(/<page-outlet><\/page-outlet>/, pageBody)
: appBody;

const basePathTag = basePath === ''
Copy link
Member Author

Choose a reason for hiding this comment

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

note: this isn't actually doing anything

@thescientist13 thescientist13 force-pushed the feature/issue-1116-base-path-configuration branch from 0646400 to dda51e5 Compare November 1, 2023 13:00
@thescientist13 thescientist13 merged commit d2a6103 into release/0.29.0 Nov 3, 2023
8 checks passed
@thescientist13 thescientist13 deleted the feature/issue-1116-base-path-configuration branch November 3, 2023 23:03
thescientist13 added a commit that referenced this pull request Nov 9, 2023
* base path configuration support WIP

* base path examples

* refactor base configuraton within the graph

* integrate base path into script, style and link tags

* inegrate base path into graphql plugin

* integrate base path into static router

* all test cases passing

* display base path in server URL terminal output

* add base path documentation

* handle route depths and base path in graphql resolvers

* refactor graphql route depths and base path handling

* add basic base path test cases for develop and serve commands

* fix linting

* remove describe.only

* upgrade github pages docs with base path callout and configuration

* add image tag example to manual base path prefixing in docs

* add base path config serve based test cases

* refactor test cases to use fetch

* flesh out base path test cases for proxies, API routes, and SSR pages

* refactor specs to use fetch

* add base path support to adapter plugins

* restore post rebase misses

* have CLI serialize base path into all pages

* document base path persistance

* remove demo code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking CLI Content as Data documentation Greenwood specific docs feature New feature or request Guide Plugins Greenwood Plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for configuring a base path resolvers and file writing assumes certain route depth
1 participant