Skip to content

Commit

Permalink
fix(peer-deps): support pact v13.x & pact-cli for publisher interface (
Browse files Browse the repository at this point in the history
  • Loading branch information
YOU54F authored Nov 12, 2024
1 parent 9d42e5c commit 7ca2136
Show file tree
Hide file tree
Showing 8 changed files with 1,120 additions and 711 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js 16.x
uses: actions/setup-node@v3
- name: Setup Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x
cache: 'yarn'

- run: corepack enable
Expand Down Expand Up @@ -47,10 +47,10 @@ jobs:
run: yarn test

- name: Release
uses: cycjimmy/semantic-release-action@v3
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: false
semantic_version: 16
semantic_version: 18
branches: |
[
'master',
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Now let's look how we can publish the pacts created from the test file to a Pact
```typescript
import { NestFactory } from '@nestjs/core';
import { Logger, LoggerService } from '@nestjs/common';
import { Publisher } from '@pact-foundation/pact';
import { Publisher } from '@pact-foundation/pact-cli';
import { PactModuleProviders } from 'nestjs-pact';
import { PactModule } from '@test/pact/pact.module';

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"@nestjs/common": "^9.2.1",
"@nestjs/core": "^9.2.1",
"@nestjs/testing": "^9.2.1",
"@pact-foundation/pact": "^10.4.0",
"@pact-foundation/pact": "^13.1.4",
"@pact-foundation/pact-cli": "^16.0.4",
"@semantic-release/changelog": "^6.0.2",
"@semantic-release/git": "^10.0.1",
"@types/get-port": "^4.2.0",
Expand All @@ -74,13 +75,13 @@
"ts-loader": "^9.4.2",
"ts-node": "10.9.1",
"tsconfig-paths": "^4.1.1",
"tslint-config-airbnb": "^5.11.2",
"typescript": "^4.9.4"
},
"peerDependencies": {
"@nestjs/common": "7.x || 8.x || 9.x || 10.x",
"@nestjs/core": "7.x || 8.x || 9.x || 10.x",
"@pact-foundation/pact": "10.x || 11.x"
"@pact-foundation/pact": "10.x || 11.x || 12.x || 13.x",
"@pact-foundation/pact-cli": "15.x || 16.x"
},
"dependencies": {
"get-port": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/pact-consumer-module-options.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ModuleMetadata, Type } from '@nestjs/common/interfaces';

import { PactOptions } from '@pact-foundation/pact';
import { PublisherOptions } from '@pact-foundation/pact-core';
import { PublisherOptions } from '@pact-foundation/pact-cli';

export type PactConsumerOptions = Omit<PactOptions, 'consumer' | 'provider'>;
export type PactPublicationOptions = PublisherOptions;
Expand Down
4 changes: 2 additions & 2 deletions src/providers/pact-publisher-provider.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Test } from '@nestjs/testing';

import { Publisher } from '@pact-foundation/pact-core';
import { Publisher } from '@pact-foundation/pact-cli';

import { PactModuleProviders } from '../common/pact-module-providers.enum';
import { PactPublicationOptions } from '../interfaces/pact-consumer-module-options.interface';

import { PactPublisherProvider } from './pact-publisher.provider';

jest.mock('@pact-foundation/pact-core', () => ({
jest.mock('@pact-foundation/pact-cli', () => ({
Publisher: jest.fn().mockImplementation(() => {
publish: jest.fn();
}),
Expand Down
2 changes: 1 addition & 1 deletion src/providers/pact-publisher.provider.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FactoryProvider } from '@nestjs/common';

import { Publisher } from '@pact-foundation/pact-core';
import { Publisher } from '@pact-foundation/pact-cli';

import { PactPublicationOptions } from '../interfaces/pact-consumer-module-options.interface';
import { PactModuleProviders } from '../common/pact-module-providers.enum';
Expand Down
Loading

0 comments on commit 7ca2136

Please sign in to comment.