Skip to content

Support loading files from GitHub repositories #218

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

Merged
merged 12 commits into from
May 25, 2021
Merged

Conversation

thomashoneyman
Copy link
Member

@thomashoneyman thomashoneyman commented May 25, 2021

Supersedes #194 and #181 and fixes #164. This PR:

  1. Implements a new query parameter, github, which accepts a path to a source file in a GitHub repository and loads its contents.
  2. Moves all examples from their various gists into this repository under the examples directory
  3. Fixes the generics example to be compatible with PureScript 0.14
  4. Updates the default example to link to the GitHub files in this repository instead of the gists.

I also updated the 0.14 package set we use as a few new packages have been added since the last update.

This is the last change necessary before we can release Try PureScript for PureScript 0.14, in my opinion.

@thomashoneyman
Copy link
Member Author

I've tested and confirmed that this works as expected using the production build. I haven't been able to get the local dev server working properly, however -- I'm getting "Module Not Found" compilation errors for things that ought to be found, like import Effect. I'll confirm here that everything is fine with the dev server too once I can get that working.

@thomashoneyman thomashoneyman requested a review from hdgarrood May 25, 2021 20:27
]
where
fromExample { title, source } =
link ("https://github.com/purescript/trypurescript/load-from-github/client/examples/" <> source) (text title)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this ought to use a tag from some kind of configuration rather than hardcoding the branch name, so that we can change these without breaking the currently released version. In practice we will want this to be the tag from the current version.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea — I could thread this in as an argument to main, so that it can be accessed in various places taken from outside the PureScript code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good 👍

Copy link
Member Author

@thomashoneyman thomashoneyman May 25, 2021

Choose a reason for hiding this comment

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

I could also do that with the entire dev / prod configurations in that case — thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If that makes the overall setup simpler, sure, I don't see why not.

Copy link
Member Author

Choose a reason for hiding this comment

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

On second thought, doing this would require some kind of text replacement processing pass to work. After all, this example is code loaded literally into the Try PureScript editor.

Otherwise, we'd have to do something like read the current tag from data in the index.html file or something like that, but this would be user-visible code and I'm not a huge fan of that.

Another option is to manually hard-code the tag as part of the release process and document where the tag would need to be updated -- we release so infrequently that this feels legitimately like an option.

Copy link
Collaborator

Choose a reason for hiding this comment

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

True - I think manually hardcoding the tag and documenting that it needs updating will work.

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps we should split the repository README so that the main README is for users and there's a separate development guide. It could include instructions for developing, like we already have, but could also have a release guide which includes:

  • Updating the hardcoded tag
  • Checking externs sizes
  • Running the deployment

What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

For now I've just added a note about the hardcoded tags to the README, but I think we probably do want a dedicated, separate development + release guide.

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.

Move example gists into the repo
2 participants