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

Update examples to run independently #318

Merged
merged 4 commits into from
Jun 25, 2019

Conversation

mefellows
Copy link
Member

Currently, all of the examples run with the implicit parent package scope, as well as requiring a compiled build of pact-js to run (i.e. a npm run dist in the root directory).

This makes it difficult for newcomers to navigate to an example and run independently, or to use as a basic for a project because the dependencies are not made clear.

This change does the following:

  • Moves the karma examples into the examples, because it just makes sense to do so
  • Uses the exported versions of the pact packages (as one would do in real life)
  • Adds all required packages to each example to enable independently installing
  • Updates the travis build to use npm link so that all examples in the repository are still tested against the current build of Pact JS / Pact Web, to prevent bugs/regressions

- All examples are now completely standalone
(hopefully this helps with people wanting to use them
without running/building pact js)
- Examples are `npm link`ed during build, to ensure they
are still testing the current build
@coveralls
Copy link

coveralls commented Jun 21, 2019

Coverage Status

Coverage remained the same at 95.041% when pulling 5d0d349 on feat/examples-use-exported-packages into d10e4b1 on master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.041% when pulling 24101e1 on feat/examples-use-exported-packages into d10e4b1 on master.

Copy link
Contributor

@TimothyJones TimothyJones left a comment

Choose a reason for hiding this comment

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

I love this! Great improvement.

A few small things:

  1. Snyk complains about the examples. I wonder if we can/should prevent it from checking them?

  2. I hadn't realised the graphql example is written in typescript - a quick glance suggests there's a fair bit of extra config that's unrelated to the example. Should we change this in a later commit?

  3. Some of the bash changes are missing ", and for robustness, it's probably worth covering if the glob doesn't match (I'll push a commit fixing these).

@mefellows
Copy link
Member Author

mefellows commented Jun 24, 2019

Thanks.

  1. Yes, probably a good idea (or we can just let the updates come through and fix them?)
  2. There's not a lot of consistency in the examples, I'd love to see a consistent use case used throughout (where appropriate). See Examples are too contrived to be useful #179 for some ramblings on that.
  3. Thanks, that would be appreciated. I'll wait for this before merging.

@mefellows mefellows force-pushed the feat/examples-use-exported-packages branch from fc4c906 to 5d0d349 Compare June 24, 2019 23:48
@mefellows mefellows merged commit 058ab6f into master Jun 25, 2019
@mefellows mefellows deleted the feat/examples-use-exported-packages branch June 25, 2019 00:13
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.

None yet

3 participants