@pact-foundation/pact 10.2.1 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/package.json +5 -4
- package/scripts/ci/build-and-test.ps1 +64 -0
- package/scripts/ci/build-and-test.sh +74 -0
- package/scripts/ci/lib/create_npmrc_file.sh +16 -0
- package/scripts/ci/lib/get-version.sh +8 -0
- package/scripts/ci/lib/prepare-release.sh +19 -0
- package/scripts/ci/lib/publish-9x.sh +18 -0
- package/scripts/ci/lib/publish.sh +17 -0
- package/scripts/ci/lib/robust-bash.sh +36 -0
- package/scripts/ci/release-9x.sh +43 -0
- package/scripts/ci/release.sh +44 -0
- package/scripts/deploy.ps1 +12 -0
- package/scripts/install-plugins.sh +49 -0
- package/scripts/run-audit-fix-on-examples.sh +13 -0
- package/scripts/trigger-9x-release.sh +24 -0
- package/scripts/trigger-release.sh +24 -0
- package/src/asynchronousMessagePact.d.ts +88 -0
- package/src/asynchronousMessagePact.js +222 -0
- package/src/asynchronousMessagePact.js.map +1 -0
- package/src/{v4/http/index.spec.d.ts → asynchronousMessagePact.spec.d.ts} +0 -0
- package/src/asynchronousMessagePact.spec.js +117 -0
- package/src/asynchronousMessagePact.spec.js.map +1 -0
- package/src/common/net.js +8 -2
- package/src/common/net.js.map +1 -1
- package/src/dsl/verifier/proxy/parseBody.d.ts +1 -0
- package/src/dsl/verifier/proxy/tracer.js +3 -0
- package/src/dsl/verifier/proxy/tracer.js.map +1 -1
- package/src/dsl/verifier/verifier.js +3 -2
- package/src/dsl/verifier/verifier.js.map +1 -1
- package/src/httpPact/ffi.d.ts +1 -1
- package/src/httpPact/tracing.js +3 -0
- package/src/httpPact/tracing.js.map +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/messageProviderPact.js +3 -1
- package/src/messageProviderPact.js.map +1 -1
- package/src/v4/http/types.d.ts +1 -1
- package/src/v4/message/types.d.ts +2 -2
- package/src/v4/http/index.spec.js +0 -111
- package/src/v4/http/index.spec.js.map +0 -1
- package/src/v4/message/index.spec.d.ts +0 -1
- package/src/v4/message/index.spec.js +0 -214
- package/src/v4/message/index.spec.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [10.3.0](https://github.com/pact-foundation/pact-js/compare/v10.2.2...v10.3.0) (2022-11-29)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* expose V4 public interface ([047b61d](https://github.com/pact-foundation/pact-js/commit/047b61d79227ce19629140b90fa2e02edc201f66))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Fixes and Improvements
|
|
14
|
+
|
|
15
|
+
* add --detectOpenHandles to provider state tests ([9f14582](https://github.com/pact-foundation/pact-js/commit/9f145825829950da23af36f54e5a353d53fd3762))
|
|
16
|
+
* update to latest pact-core 13.12.2 ([e54aa7a](https://github.com/pact-foundation/pact-js/commit/e54aa7ae421e1651c982cada82a7602f7920317a))
|
|
17
|
+
|
|
18
|
+
### [10.2.2](https://github.com/pact-foundation/pact-js/compare/v10.2.1...v10.2.2) (2022-11-14)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Fixes and Improvements
|
|
22
|
+
|
|
23
|
+
* remove all remaining absolute imports ([1d16a76](https://github.com/pact-foundation/pact-js/commit/1d16a76462bb86c64ba0ffeb0120cb4037ce13a8))
|
|
24
|
+
|
|
5
25
|
### [10.2.1](https://github.com/pact-foundation/pact-js/compare/v10.2.0...v10.2.1) (2022-11-14)
|
|
6
26
|
|
|
7
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pact-foundation/pact",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"description": "Pact for all things Javascript",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"postdist": "npm test",
|
|
18
18
|
"predist": "npm run clean && npm run format:check && npm run lint",
|
|
19
19
|
"release": "standard-version",
|
|
20
|
-
"test": "nyc --check-coverage --reporter=html --reporter=text-summary mocha -t 120000"
|
|
20
|
+
"test": "nyc --check-coverage --reporter=html --reporter=text-summary mocha -t 120000",
|
|
21
|
+
"pretest": "bash scripts/install-plugins.sh"
|
|
21
22
|
},
|
|
22
23
|
"repository": {
|
|
23
24
|
"type": "git",
|
|
@@ -94,7 +95,7 @@
|
|
|
94
95
|
]
|
|
95
96
|
},
|
|
96
97
|
"dependencies": {
|
|
97
|
-
"@pact-foundation/pact-core": "^13.12.
|
|
98
|
+
"@pact-foundation/pact-core": "^13.12.2",
|
|
98
99
|
"@types/bluebird": "^3.5.20",
|
|
99
100
|
"@types/express": "^4.17.11",
|
|
100
101
|
"axios": "^0.27.2",
|
|
@@ -132,7 +133,7 @@
|
|
|
132
133
|
"@types/mocha": "^8.0.4",
|
|
133
134
|
"@types/mockery": "^1.4.29",
|
|
134
135
|
"@types/nock": "^9.1.2",
|
|
135
|
-
"@types/node": "^
|
|
136
|
+
"@types/node": "^18.11.9",
|
|
136
137
|
"@types/ramda": "^0.26.43",
|
|
137
138
|
"@types/sinon": "^7.0.6",
|
|
138
139
|
"@types/sinon-chai": "^2.7.29",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
npm ci
|
|
2
|
+
npm run dist
|
|
3
|
+
npm run build:v3
|
|
4
|
+
Copy-Item "package.json" -Destination "dist"
|
|
5
|
+
Copy-Item "package-lock.json" -Destination "dist"
|
|
6
|
+
Copy-Item -Path "native" -Destination "dist" -Recurse
|
|
7
|
+
pushd dist
|
|
8
|
+
npm link
|
|
9
|
+
popd
|
|
10
|
+
|
|
11
|
+
Push-Location dist
|
|
12
|
+
npm link
|
|
13
|
+
Pop-Location
|
|
14
|
+
|
|
15
|
+
Get-ChildItem ".\examples" -Directory | ForEach-Object {
|
|
16
|
+
if ($_.Name -ne "v3") {
|
|
17
|
+
Write-Output "Running examples in $($_.Name)"
|
|
18
|
+
pushd $_.FullName
|
|
19
|
+
npm i
|
|
20
|
+
npm link @pact-foundation/pact
|
|
21
|
+
npm t
|
|
22
|
+
if ($LastExitCode -ne 0) {
|
|
23
|
+
Write-Output "Non-zero exit code!"
|
|
24
|
+
$host.SetShouldExit($LastExitCode)
|
|
25
|
+
}
|
|
26
|
+
popd
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Write-Output "Done with V2 tests"
|
|
31
|
+
|
|
32
|
+
Get-ChildItem ".\examples\v3" -Directory | ForEach-Object {
|
|
33
|
+
Write-Output "Running V3 examples in $($_.Name)"
|
|
34
|
+
pushd $_.FullName
|
|
35
|
+
npm i
|
|
36
|
+
Remove-Item -LiteralPath "node_modules\@pact-foundation\pact" -Force -Recurse
|
|
37
|
+
|
|
38
|
+
npm link @pact-foundation/pact
|
|
39
|
+
npm t
|
|
40
|
+
if ($LastExitCode -ne 0) {
|
|
41
|
+
Write-Output "Non-zero exit code!"
|
|
42
|
+
$host.SetShouldExit($LastExitCode)
|
|
43
|
+
}
|
|
44
|
+
popd
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Write-Output "Done with V3 tests"
|
|
48
|
+
|
|
49
|
+
Get-ChildItem ".\examples\v4" -Directory | ForEach-Object {
|
|
50
|
+
Write-Output "Running V4 examples in $($_.Name)"
|
|
51
|
+
pushd $_.FullName
|
|
52
|
+
npm i
|
|
53
|
+
Remove-Item -LiteralPath "node_modules\@pact-foundation\pact" -Force -Recurse
|
|
54
|
+
|
|
55
|
+
npm link @pact-foundation/pact
|
|
56
|
+
npm t
|
|
57
|
+
if ($LastExitCode -ne 0) {
|
|
58
|
+
Write-Output "Non-zero exit code!"
|
|
59
|
+
$host.SetShouldExit($LastExitCode)
|
|
60
|
+
}
|
|
61
|
+
popd
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Write-Output "Done with V4 tests"
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
set -e
|
|
3
|
+
set -u
|
|
4
|
+
set -x
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
7
|
+
. "$SCRIPT_DIR"/lib/robust-bash.sh
|
|
8
|
+
|
|
9
|
+
require_env_var GIT_REF
|
|
10
|
+
|
|
11
|
+
npm ci
|
|
12
|
+
|
|
13
|
+
npm run dist
|
|
14
|
+
cp package.json ./dist
|
|
15
|
+
|
|
16
|
+
export GIT_BRANCH=${GITHUB_HEAD_REF:-${GIT_REF#refs/heads/}}
|
|
17
|
+
|
|
18
|
+
export PACT_BROKER_USERNAME="dXfltyFMgNOFZAxr8io9wJ37iUpY42M"
|
|
19
|
+
export PACT_BROKER_PASSWORD="O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1"
|
|
20
|
+
|
|
21
|
+
"${SCRIPT_DIR}"/lib/prepare-release.sh
|
|
22
|
+
|
|
23
|
+
cp package-lock.json dist
|
|
24
|
+
cp -r scripts dist
|
|
25
|
+
echo "This will be version '$(npx absolute-version)'"
|
|
26
|
+
|
|
27
|
+
# Link the build so that the examples are always testing the
|
|
28
|
+
# current build, in it's properly exported format
|
|
29
|
+
(cd dist && npm ci)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# echo "Running e2e examples build for node version $(node --version)"
|
|
33
|
+
# for i in examples/*; do
|
|
34
|
+
# [ -d "$i" ] || continue # prevent failure if not a directory
|
|
35
|
+
# [ -e "$i" ] || continue # prevent failure if there are no examples
|
|
36
|
+
# echo "--> running tests for: $i"
|
|
37
|
+
# pushd "$i"
|
|
38
|
+
# # replace pact dependency with locally build version
|
|
39
|
+
# contents="$(jq '.devDependencies."@pact-foundation/pact" = "file:../../dist"' package.json)" && \
|
|
40
|
+
# echo "${contents}" > package.json
|
|
41
|
+
# # npm ci does not work because we have just changed the package.json file
|
|
42
|
+
# npm install
|
|
43
|
+
# npm test
|
|
44
|
+
# popd
|
|
45
|
+
# done
|
|
46
|
+
|
|
47
|
+
# echo "--> Running coverage checks"
|
|
48
|
+
# npm run coverage
|
|
49
|
+
|
|
50
|
+
# echo "Running V3 e2e examples build"
|
|
51
|
+
|
|
52
|
+
# # Commented because:
|
|
53
|
+
# # 1. We can't run the broker on windows CI
|
|
54
|
+
# # 2. We use the live broker in the v3 examples now anyway
|
|
55
|
+
# # docker pull pactfoundation/pact-broker
|
|
56
|
+
# # BROKER_ID=$(docker run -e PACT_BROKER_DATABASE_ADAPTER=sqlite -d -p 9292:9292 pactfoundation/pact-broker)
|
|
57
|
+
|
|
58
|
+
# # trap "docker kill $BROKER_ID" EXIT
|
|
59
|
+
|
|
60
|
+
# for i in examples/v*/*; do
|
|
61
|
+
# [ -d "$i" ] || continue # prevent failure if not a directory
|
|
62
|
+
# [ -e "$i" ] || continue # prevent failure if there are no examples
|
|
63
|
+
# echo "------------------------------------------------"
|
|
64
|
+
# echo "------------> continuing to test V3/v$ example project: $i"
|
|
65
|
+
# node --version
|
|
66
|
+
# pushd "$i"
|
|
67
|
+
# # replace pact dependency with locally build version
|
|
68
|
+
# contents="$(jq '.devDependencies."@pact-foundation/pact" = "file:../../../dist"' package.json)" && \
|
|
69
|
+
# echo "${contents}" > package.json
|
|
70
|
+
# # npm ci does not work because we have just changed the package.json file
|
|
71
|
+
# npm install
|
|
72
|
+
# npm test
|
|
73
|
+
# popd
|
|
74
|
+
# done
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
3
|
+
. "$SCRIPT_DIR"/robust-bash.sh
|
|
4
|
+
|
|
5
|
+
require_env_var NODE_AUTH_TOKEN
|
|
6
|
+
|
|
7
|
+
set +x #Don't echo the NPM key
|
|
8
|
+
|
|
9
|
+
NPMRC_FILE=.npmrc
|
|
10
|
+
echo "@pact-foundation:registry=https://registry.npmjs.org/" > $NPMRC_FILE
|
|
11
|
+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> $NPMRC_FILE
|
|
12
|
+
echo "//registry.npmjs.org/:username=pact-foundation" >> $NPMRC_FILE
|
|
13
|
+
echo "//registry.npmjs.org/:email=pact-foundation@googlegroups.com" >> $NPMRC_FILE
|
|
14
|
+
echo "//registry.npmjs.org/:always-auth=true" >> $NPMRC_FILE
|
|
15
|
+
|
|
16
|
+
set -x
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
3
|
+
. "$SCRIPT_DIR"/robust-bash.sh
|
|
4
|
+
|
|
5
|
+
require_binary grep
|
|
6
|
+
|
|
7
|
+
VERSION="$(grep '\"version\"' package.json | grep -E -o "([0-9\.]+(-[a-z\.0-9]+)?)")"
|
|
8
|
+
echo "$VERSION"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
3
|
+
. "$SCRIPT_DIR"/robust-bash.sh
|
|
4
|
+
|
|
5
|
+
require_binary grep
|
|
6
|
+
require_binary sed
|
|
7
|
+
require_binary find
|
|
8
|
+
|
|
9
|
+
VERSION="$("$SCRIPT_DIR/get-version.sh")"
|
|
10
|
+
|
|
11
|
+
echo "--> Preparing release version ${VERSION}"
|
|
12
|
+
|
|
13
|
+
echo "--> Copy key artifacts into pact distribution"
|
|
14
|
+
artifacts=(LICENSE *md package.json)
|
|
15
|
+
|
|
16
|
+
for artifact in "${artifacts[@]}"; do
|
|
17
|
+
echo " Copying ${artifact} => ./dist/${artifact}"
|
|
18
|
+
cp "${artifact}" "./dist/${artifact}"
|
|
19
|
+
done
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
3
|
+
. "$SCRIPT_DIR"/robust-bash.sh
|
|
4
|
+
|
|
5
|
+
require_binary npm
|
|
6
|
+
|
|
7
|
+
"${SCRIPT_DIR}"/prepare-release.sh
|
|
8
|
+
VERSION="$("$SCRIPT_DIR/get-version.sh")"
|
|
9
|
+
|
|
10
|
+
echo "--> Preparing npmrc file"
|
|
11
|
+
"$SCRIPT_DIR"/create_npmrc_file.sh
|
|
12
|
+
|
|
13
|
+
echo "--> Releasing version ${VERSION}"
|
|
14
|
+
|
|
15
|
+
echo "--> Releasing artifacts"
|
|
16
|
+
echo " Publishing pact@${VERSION}..."
|
|
17
|
+
npm publish dist --access public
|
|
18
|
+
echo " done!"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
3
|
+
. "$SCRIPT_DIR"/robust-bash.sh
|
|
4
|
+
|
|
5
|
+
require_binary npm
|
|
6
|
+
|
|
7
|
+
"${SCRIPT_DIR}"/prepare-release.sh
|
|
8
|
+
VERSION="$("$SCRIPT_DIR/get-version.sh")"
|
|
9
|
+
|
|
10
|
+
echo "--> Preparing npmrc file"
|
|
11
|
+
"$SCRIPT_DIR"/create_npmrc_file.sh
|
|
12
|
+
|
|
13
|
+
echo "--> Releasing version ${VERSION}"
|
|
14
|
+
echo "--> Releasing artifacts"
|
|
15
|
+
echo " Publishing pact@${VERSION}..."
|
|
16
|
+
npm publish ./dist --access public --tag latest
|
|
17
|
+
echo " done!"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
if [ -z "${LIB_ROBUST_BASH_SH:-}" ]; then
|
|
3
|
+
LIB_ROBUST_BASH_SH=included
|
|
4
|
+
|
|
5
|
+
function error {
|
|
6
|
+
echo "❌ ${1:-}"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function log {
|
|
10
|
+
echo "🔵 ${1:-}"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
# Check to see that we have a required binary on the path
|
|
14
|
+
function require_binary {
|
|
15
|
+
if [ -z "${1:-}" ]; then
|
|
16
|
+
error "${FUNCNAME[0]} requires an argument"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
if ! [ -x "$(command -v "$1")" ]; then
|
|
21
|
+
error "The required executable '$1' is not on the path."
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function require_env_var {
|
|
27
|
+
var_name="${1:-}"
|
|
28
|
+
if [ -z "${!var_name:-}" ]; then
|
|
29
|
+
error "The required environment variable ${var_name} is empty"
|
|
30
|
+
if [ ! -z "${2:-}" ]; then
|
|
31
|
+
echo " - $2"
|
|
32
|
+
fi
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
}
|
|
36
|
+
fi
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
set -u
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
6
|
+
. "$SCRIPT_DIR"/lib/robust-bash.sh
|
|
7
|
+
|
|
8
|
+
require_env_var CI "This script must be run from CI. If you are running locally, note that it stamps your repo git settings."
|
|
9
|
+
require_env_var GITHUB_ACTOR
|
|
10
|
+
require_env_var NODE_AUTH_TOKEN
|
|
11
|
+
|
|
12
|
+
# Setup git for github actions
|
|
13
|
+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
14
|
+
git config user.name "${GITHUB_ACTOR}"
|
|
15
|
+
|
|
16
|
+
# It's easier to read the release notes
|
|
17
|
+
# from the standard version tool before it runs
|
|
18
|
+
RELEASE_NOTES="$(npx standard-version --dry-run | awk 'BEGIN { flag=0 } /^---$/ { if (flag == 0) { flag=1 } else { flag=2 }; next } flag == 1')"
|
|
19
|
+
# Don't release if there are no changes
|
|
20
|
+
if [ "$(echo "$RELEASE_NOTES" | wc -l)" -eq 1 ] ; then
|
|
21
|
+
echo "ERROR: This release would have no release notes. Does it include changes?"
|
|
22
|
+
echo " - You must have at least one fix / feat commit to generate release notes"
|
|
23
|
+
echo "*** STOPPING RELEASE PROCESS ***"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
# This is github actions' method for emitting multi-line values
|
|
27
|
+
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}"
|
|
28
|
+
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}"
|
|
29
|
+
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}"
|
|
30
|
+
echo "::set-output name=notes::$RELEASE_NOTES"
|
|
31
|
+
|
|
32
|
+
npm ci
|
|
33
|
+
"$SCRIPT_DIR"/build-and-test.sh
|
|
34
|
+
npm run release
|
|
35
|
+
|
|
36
|
+
# Emit version to next step
|
|
37
|
+
VERSION="$("$SCRIPT_DIR/lib/get-version.sh")"
|
|
38
|
+
echo "::set-output name=version::$VERSION"
|
|
39
|
+
|
|
40
|
+
"$SCRIPT_DIR"/lib/publish-9x.sh
|
|
41
|
+
|
|
42
|
+
# Push the new commit back to the repo.
|
|
43
|
+
git push --follow-tags
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
set -u
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running
|
|
6
|
+
. "$SCRIPT_DIR"/lib/robust-bash.sh
|
|
7
|
+
|
|
8
|
+
require_env_var CI "This script must be run from CI. If you are running locally, note that it stamps your repo git settings."
|
|
9
|
+
require_env_var GITHUB_ACTOR
|
|
10
|
+
require_env_var NODE_AUTH_TOKEN
|
|
11
|
+
|
|
12
|
+
# Setup git for github actions
|
|
13
|
+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
|
14
|
+
git config user.name "${GITHUB_ACTOR}"
|
|
15
|
+
|
|
16
|
+
# It's easier to read the release notes
|
|
17
|
+
# from the standard version tool before it runs
|
|
18
|
+
RELEASE_NOTES="$(npx standard-version --dry-run | awk 'BEGIN { flag=0 } /^---$/ { if (flag == 0) { flag=1 } else { flag=2 }; next } flag == 1')"
|
|
19
|
+
# Don't release if there are no changes
|
|
20
|
+
if [ "$(echo "$RELEASE_NOTES" | wc -l)" -eq 1 ] ; then
|
|
21
|
+
echo "ERROR: This release would have no release notes. Does it include changes?"
|
|
22
|
+
echo " - You must have at least one fix / feat commit to generate release notes"
|
|
23
|
+
echo "*** STOPPING RELEASE PROCESS ***"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
# This is github actions' method for emitting multi-line values
|
|
27
|
+
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}"
|
|
28
|
+
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}"
|
|
29
|
+
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}"
|
|
30
|
+
echo "::set-output name=notes::$RELEASE_NOTES"
|
|
31
|
+
|
|
32
|
+
npm ci
|
|
33
|
+
"$SCRIPT_DIR"/build-and-test.sh
|
|
34
|
+
|
|
35
|
+
npm run release
|
|
36
|
+
|
|
37
|
+
# Emit version to next step
|
|
38
|
+
VERSION="$("$SCRIPT_DIR/lib/get-version.sh")"
|
|
39
|
+
echo "::set-output name=version::$VERSION"
|
|
40
|
+
|
|
41
|
+
"$SCRIPT_DIR"/lib/publish.sh
|
|
42
|
+
|
|
43
|
+
# Push the new commit back to the repo.
|
|
44
|
+
git push --follow-tags
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Set-PSDebug -Trace 1
|
|
2
|
+
dir env:
|
|
3
|
+
|
|
4
|
+
if ($env:APPVEYOR_REPO_TAG -eq "true") {
|
|
5
|
+
Write-Output "Running deploy (APPVEYOR_REPO_TAG) is $env:APPVEYOR_REPO_TAG"
|
|
6
|
+
npm install node-pre-gyp node-pre-gyp-github
|
|
7
|
+
npm run build:v3
|
|
8
|
+
Remove-Item 'native\target' -Recurse -Force
|
|
9
|
+
npm run upload-binary
|
|
10
|
+
} else {
|
|
11
|
+
Write-Output "Skipping deploy (APPVEYOR_REPO_TAG) is $env:APPVEYOR_REPO_TAG"
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
#
|
|
3
|
+
# Usage:
|
|
4
|
+
# $ curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-plugins/master/install-cli.sh | bash
|
|
5
|
+
# or
|
|
6
|
+
# $ wget -q https://raw.githubusercontent.com/pact-foundation/pact-plugins/master/install-cli.sh -O- | bash
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
function detect_osarch() {
|
|
10
|
+
case $(uname -sm) in
|
|
11
|
+
'Linux x86_64')
|
|
12
|
+
os='linux'
|
|
13
|
+
arch='x86_64'
|
|
14
|
+
;;
|
|
15
|
+
'Darwin x86' | 'Darwin x86_64')
|
|
16
|
+
os='osx'
|
|
17
|
+
arch='x86_64'
|
|
18
|
+
;;
|
|
19
|
+
'Darwin arm64')
|
|
20
|
+
os='osx'
|
|
21
|
+
arch='aarch64'
|
|
22
|
+
;;
|
|
23
|
+
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
|
24
|
+
os="windows"
|
|
25
|
+
arch='x86_64'
|
|
26
|
+
ext='.exe'
|
|
27
|
+
;;
|
|
28
|
+
*)
|
|
29
|
+
echo "Sorry, you'll need to install the plugin CLI manually."
|
|
30
|
+
exit 1
|
|
31
|
+
;;
|
|
32
|
+
esac
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
VERSION=$(curl -s https://api.github.com/repos/pact-foundation/pact-plugins/releases | grep pact-plugin-cli | grep tag_name | head -n1 | egrep -o "[0-9\.]+")
|
|
36
|
+
detect_osarch
|
|
37
|
+
|
|
38
|
+
if [ ! -f ~/.pact/bin/pact-plugin-cli ]; then
|
|
39
|
+
echo "--- 🐿 Installing plugins CLI version ${VERSION}"
|
|
40
|
+
mkdir -p ~/.pact/bin
|
|
41
|
+
curl -L -o ~/.pact/bin/pact-plugin-cli-${os}-${arch}.gz https://github.com/pact-foundation/pact-plugins/releases/download/pact-plugin-cli-v${VERSION}/pact-plugin-cli-${os}-${arch}${ext}.gz
|
|
42
|
+
gunzip -N -f ~/.pact/bin/pact-plugin-cli-${os}-${arch}.gz
|
|
43
|
+
chmod +x ~/.pact/bin/pact-plugin-cli
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
if [ ! -d ~/.pact/plugins/matt-0.0.3 ]; then
|
|
47
|
+
echo "--- 🐿 Installing MATT plugin"
|
|
48
|
+
~/.pact/bin/pact-plugin-cli -y -d install https://github.com/mefellows/pact-matt-plugin/releases/tag/v0.0.4
|
|
49
|
+
fi
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash -eu
|
|
2
|
+
|
|
3
|
+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
4
|
+
|
|
5
|
+
for i in examples/*; do
|
|
6
|
+
[ -e "$i" ] || continue # prevent failure if there are no examples
|
|
7
|
+
echo "--> running npm audit fix on: $i"
|
|
8
|
+
if [ -z "${1:-}" ]; then
|
|
9
|
+
(cd "$i" && npm i && npm audit fix)
|
|
10
|
+
else
|
|
11
|
+
(cd "$i" && npm i && npm audit fix "$1")
|
|
12
|
+
fi
|
|
13
|
+
done
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Script to trigger release of the repository
|
|
4
|
+
# Requires a Github API token with repo scope stored in the
|
|
5
|
+
# environment variable GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES
|
|
6
|
+
# Borrowed from Beth Skurrie's excellent script at
|
|
7
|
+
# https://github.com/pact-foundation/pact-ruby/blob/master/script/trigger-release.sh
|
|
8
|
+
|
|
9
|
+
: "${GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES:?Please set environment variable GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES}"
|
|
10
|
+
|
|
11
|
+
repository_slug=$(git remote get-url $(git remote show) | cut -d':' -f2 | sed 's/\.git//' | sed 's://::' | sed 's:github.com/::')
|
|
12
|
+
|
|
13
|
+
output=$(curl -v -X POST https://api.github.com/repos/${repository_slug}/dispatches \
|
|
14
|
+
-H 'Accept: application/vnd.github.everest-preview+json' \
|
|
15
|
+
-H "Authorization: Bearer $GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES" \
|
|
16
|
+
-d "{\"event_type\": \"release-9x-triggered\"}" 2>&1)
|
|
17
|
+
|
|
18
|
+
if ! echo "${output}" | grep "HTTP\/2 204" > /dev/null; then
|
|
19
|
+
echo "$output" | sed "s/${GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES}/********/g"
|
|
20
|
+
echo "Failed to trigger release"
|
|
21
|
+
exit 1
|
|
22
|
+
else
|
|
23
|
+
echo "9.x.x Release workflow triggered"
|
|
24
|
+
fi
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Script to trigger release of the repository
|
|
4
|
+
# Requires a Github API token with repo scope stored in the
|
|
5
|
+
# environment variable GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES
|
|
6
|
+
# Borrowed from Beth Skurrie's excellent script at
|
|
7
|
+
# https://github.com/pact-foundation/pact-ruby/blob/master/script/trigger-release.sh
|
|
8
|
+
|
|
9
|
+
: "${GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES:?Please set environment variable GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES}"
|
|
10
|
+
|
|
11
|
+
repository_slug=$(git remote get-url $(git remote show) | cut -d':' -f2 | sed 's/\.git//' | sed 's://::' | sed 's:github.com/::')
|
|
12
|
+
|
|
13
|
+
output=$(curl -v -X POST https://api.github.com/repos/${repository_slug}/dispatches \
|
|
14
|
+
-H 'Accept: application/vnd.github.everest-preview+json' \
|
|
15
|
+
-H "Authorization: Bearer $GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES" \
|
|
16
|
+
-d "{\"event_type\": \"release-triggered\"}" 2>&1)
|
|
17
|
+
|
|
18
|
+
if ! echo "${output}" | grep "HTTP\/2 204" > /dev/null; then
|
|
19
|
+
echo "$output" | sed "s/${GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES}/********/g"
|
|
20
|
+
echo "Failed to trigger release"
|
|
21
|
+
exit 1
|
|
22
|
+
else
|
|
23
|
+
echo "10.x.x release workflow triggered"
|
|
24
|
+
fi
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Message
|
|
3
|
+
*/
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import { AnyJson } from './common/jsonTypes';
|
|
6
|
+
import { AnyTemplate } from './dsl/matchers';
|
|
7
|
+
import { Metadata, Message, MessageConsumer, ProviderState } from './dsl/message';
|
|
8
|
+
import { MessageConsumerOptions } from './dsl/options';
|
|
9
|
+
/**
|
|
10
|
+
* A Message Consumer is analagous to a Provider in the HTTP Interaction model.
|
|
11
|
+
* It is the receiver of an interaction, and needs to be able to handle whatever
|
|
12
|
+
* request was provided.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AsynchronousMessagePact {
|
|
15
|
+
private config;
|
|
16
|
+
private state;
|
|
17
|
+
private pact;
|
|
18
|
+
private message;
|
|
19
|
+
constructor(config: MessageConsumerOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Gives a state the provider should be in for this Message.
|
|
22
|
+
*
|
|
23
|
+
* @param {string} state - The state of the provider.
|
|
24
|
+
* @returns {Message} MessageConsumer
|
|
25
|
+
*/
|
|
26
|
+
given(state: string | ProviderState): MessageConsumerPact;
|
|
27
|
+
/**
|
|
28
|
+
* A free style description of the Message.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} description - A description of the Message to be received
|
|
31
|
+
* @returns {Message} MessageConsumer
|
|
32
|
+
*/
|
|
33
|
+
expectsToReceive(description: string): MessageConsumerPact;
|
|
34
|
+
/**
|
|
35
|
+
* The JSON object to be received by the message consumer.
|
|
36
|
+
*
|
|
37
|
+
* May be a JSON object or JSON primitive. The contents must be able to be properly
|
|
38
|
+
* stringified and parse (i.e. via JSON.stringify and JSON.parse).
|
|
39
|
+
*
|
|
40
|
+
* @param {string} content - A description of the Message to be received
|
|
41
|
+
* @returns {Message} MessageConsumer
|
|
42
|
+
*/
|
|
43
|
+
withContent(content: AnyTemplate): MessageConsumerPact;
|
|
44
|
+
/**
|
|
45
|
+
* The text content to be received by the message consumer.
|
|
46
|
+
*
|
|
47
|
+
* May be any text
|
|
48
|
+
*
|
|
49
|
+
* @param {string} content - A description of the Message to be received
|
|
50
|
+
* @returns {Message} MessageConsumer
|
|
51
|
+
*/
|
|
52
|
+
withTextContent(content: string, contentType: string): MessageConsumerPact;
|
|
53
|
+
/**
|
|
54
|
+
* The binary content to be received by the message consumer.
|
|
55
|
+
*
|
|
56
|
+
* Content will be stored in base64 in the resulting pact file.
|
|
57
|
+
*
|
|
58
|
+
* @param {Buffer} content - A buffer containing the binary content
|
|
59
|
+
* @param {String} contenttype - The mime type of the content to expect
|
|
60
|
+
* @returns {Message} MessageConsumer
|
|
61
|
+
*/
|
|
62
|
+
withBinaryContent(content: Buffer, contentType: string): MessageConsumerPact;
|
|
63
|
+
/**
|
|
64
|
+
* Message metadata.
|
|
65
|
+
*
|
|
66
|
+
* @param {string} metadata -
|
|
67
|
+
* @returns {Message} MessageConsumer
|
|
68
|
+
*/
|
|
69
|
+
withMetadata(metadata: Metadata): MessageConsumerPact;
|
|
70
|
+
/**
|
|
71
|
+
* Creates a new Pact _message_ interaction to build a testable interaction.
|
|
72
|
+
*
|
|
73
|
+
* @param handler A message handler, that must be able to consume the given Message
|
|
74
|
+
* @returns {Promise}
|
|
75
|
+
*/
|
|
76
|
+
verify(handler: MessageConsumer): Promise<unknown>;
|
|
77
|
+
private reifiedContent;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the Message object created.
|
|
80
|
+
*
|
|
81
|
+
* @returns {Message}
|
|
82
|
+
*/
|
|
83
|
+
json(): Message;
|
|
84
|
+
}
|
|
85
|
+
declare type MessageConsumerPact = AsynchronousMessagePact;
|
|
86
|
+
export declare function synchronousBodyHandler<R>(handler: (body: AnyJson | Buffer) => R): MessageConsumer;
|
|
87
|
+
export declare function asynchronousBodyHandler<R>(handler: (body: AnyJson | Buffer) => Promise<R>): MessageConsumer;
|
|
88
|
+
export {};
|