Skip to content

Commit

Permalink
Merge pull request #1221 from pact-foundation/chore/update_imports_to…
Browse files Browse the repository at this point in the history
…_pact-cli

chore: update pact cli invocation usage to @pact-foundation/pact-cli
  • Loading branch information
YOU54F authored Jun 17, 2024
2 parents 54087fa + bfc05dc commit 00ade0d
Show file tree
Hide file tree
Showing 31 changed files with 8,358 additions and 1,612 deletions.
1 change: 0 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"bail": true,
"require": [
"ts-node/register",
"./test/helper.ts",
"source-map-support/register"
],
"fullTrace": true,
Expand Down
22 changes: 22 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -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/[email protected] -c pact-broker`

# 11.x.x -> 12.x.x

- Node versions less than 16 are no longer supported
Expand Down
37 changes: 37 additions & 0 deletions docs/consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <YOUR_PACT_FILES_OR_DIR> --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`.
34 changes: 0 additions & 34 deletions docs/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <YOUR_PACT_FILES_OR_DIR> --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
Expand Down
Loading

0 comments on commit 00ade0d

Please sign in to comment.