From bfc05dcf52f81f0d41f7342a9c5b2b47372bdb1f Mon Sep 17 00:00:00 2001 From: Yousaf Nabi Date: Mon, 17 Jun 2024 21:19:40 +0100 Subject: [PATCH] docs: update migration guide and move publishing pacts to consumer side docs --- MIGRATION.md | 22 ++++++++++++++++++++++ docs/consumer.md | 37 +++++++++++++++++++++++++++++++++++++ docs/provider.md | 34 ---------------------------------- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index b3b6b80ea..e016acb38 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,27 @@ # Pact-js migration guide +# 12.x.x -> 13.x.x + +## Breaking Changes + + All CLI/API functionality provided by the Pact CLI tools (ruby based) now migrated to + + * Repo + + * https://github.com/pact-foundation/pact-js-cli/ + + * NPM Package + + * https://www.npmjs.com/package/@pact-foundation/pact-cli + + * imports + + * `@pact-foundation/pact-core` imports will now become `@pact-foundation/pact-cli` for programatic usage of the CLI tools + + * npx usage + + * `npx --package=@pact-foundation/pact-cli@15.0.0 -c pact-broker` + # 11.x.x -> 12.x.x - Node versions less than 16 are no longer supported diff --git a/docs/consumer.md b/docs/consumer.md index a6c23fc36..18d42cb35 100644 --- a/docs/consumer.md +++ b/docs/consumer.md @@ -153,3 +153,40 @@ describe('GET /dogs', () => { ``` Read on about [matching](/docs/matching.md) + +## Publishing Pacts to a Broker + +Sharing is caring - to simplify sharing Pacts between Consumers and Providers, we have created the [Pact Broker](https://docs.pact.io/pact_broker). + +The Broker: + +- versions your contracts +- tells you which versions of your applications can be deployed safely together +- allows you to deploy your services independently +- provides API documentation of your applications that is guaranteed to be up-to date +- visualises the relationships between your services +- integrates with other systems, such as Slack or your CI server, via webhooks +- ...and much much [more](https://docs.pact.io/getting_started/sharing_pacts). + +[Host your own using the open source docker image](https://docs.pact.io/pact_broker/docker_images), or sign-up for a [free hosted Pact Broker](https://pactflow.io) with our friends at PactFlow. + +### Publish in npm scripts + +The easiest way to publish pacts to the broker is via an npm script in your package.json: + +``` + + "test:publish": "./node_modules/.bin/pact-broker publish --consumer-app-version=\"$(npx absolute-version)\" --auto-detect-version-properties --broker-base-url=https://your-broker-url.example.com" +``` + +You'll need to install [`@pact-foundation/pact-cli`](https://github.com/pact-foundation/pact-js-cli) package to use the `pact-broker` command. This is a standalone package that can be installed via npm. + +For a full list of the options, see the [CLI usage instructions](https://github.com/pact-foundation/pact-ruby-standalone/releases). + +All CLI binaries are available in npm scripts when using pact-js-cli `@pact-foundation/pact-cli`. + +If you want to pass your username and password to the broker without including +them in scripts, you can provide it via the environment variables +`PACT_BROKER_USERNAME` and `PACT_BROKER_PASSWORD`. If your broker supports an +access token instead of a password, use the environment variable +`PACT_BROKER_TOKEN`. \ No newline at end of file diff --git a/docs/provider.md b/docs/provider.md index d60597cb7..0489feb25 100644 --- a/docs/provider.md +++ b/docs/provider.md @@ -274,40 +274,6 @@ For each _interaction_ in a pact file, the order of execution is as follows: If any of the middleware or hooks fail, the tests will also fail. -### Publishing Pacts to a Broker - -Sharing is caring - to simplify sharing Pacts between Consumers and Providers, we have created the [Pact Broker](https://docs.pact.io/pact_broker). - -The Broker: - -- versions your contracts -- tells you which versions of your applications can be deployed safely together -- allows you to deploy your services independently -- provides API documentation of your applications that is guaranteed to be up-to date -- visualises the relationships between your services -- integrates with other systems, such as Slack or your CI server, via webhooks -- ...and much much [more](https://docs.pact.io/getting_started/sharing_pacts). - -[Host your own using the open source docker image](https://docs.pact.io/pact_broker/docker_images), or sign-up for a [free hosted Pact Broker](https://pactflow.io) with our friends at PactFlow. - -#### Publish in npm scripts - -The easiest way to publish pacts to the broker is via an npm script in your package.json: - -``` - - "test:publish": "./node_modules/.bin/pact-broker publish --consumer-app-version=\"$(npx absolute-version)\" --auto-detect-version-properties --broker-base-url=https://your-broker-url.example.com" -``` - -For a full list of the options, see the [CLI usage instructions](https://github.com/pact-foundation/pact-ruby-standalone/releases). -All CLI binaries are available in npm scripts when using pact-js. - -If you want to pass your username and password to the broker without including -them in scripts, you can provide it via the environment variables -`PACT_BROKER_USERNAME` and `PACT_BROKER_PASSWORD`. If your broker supports an -access token instead of a password, use the environment variable -`PACT_BROKER_TOKEN`. - #### Publishing Verification Results to a Pact Broker If you're using a [Pact Broker](https://docs.pact.io/pact_broker), (e.g. a hosted one with our friends at [PactFlow](https://pactflow.io)), you can