diff --git a/bin/pact-broker.ts b/bin/pact-broker.ts deleted file mode 100644 index aa7bed46..00000000 --- a/bin/pact-broker.ts +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node - -import childProcess = require('child_process'); -import rubyStandalone from '../src/pact-standalone'; - -const { status } = childProcess.spawnSync( - rubyStandalone.brokerFullPath, - process.argv.slice(2), - { - stdio: 'inherit', - } -); -process.exit(status as number); diff --git a/bin/pact-message.ts b/bin/pact-message.ts deleted file mode 100644 index c31a54ec..00000000 --- a/bin/pact-message.ts +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node - -import childProcess = require('child_process'); -import rubyStandalone from '../src/pact-standalone'; - -const { status } = childProcess.spawnSync( - rubyStandalone.messageFullPath, - process.argv.slice(2), - { - stdio: 'inherit', - } -); -process.exit(status as number); diff --git a/bin/pact-mock-service.ts b/bin/pact-mock-service.ts deleted file mode 100644 index 15e279e0..00000000 --- a/bin/pact-mock-service.ts +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env node - -import childProcess = require('child_process'); -import rubyStandalone from '../src/pact-standalone'; - -const { status } = childProcess.spawnSync( - rubyStandalone.mockServiceFullPath, - process.argv.slice(2), - { stdio: 'inherit' } -); -process.exit(status as number); diff --git a/bin/pact-provider-verifier.ts b/bin/pact-provider-verifier.ts deleted file mode 100644 index 3d4b7dab..00000000 --- a/bin/pact-provider-verifier.ts +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node - -import childProcess = require('child_process'); -import rubyStandalone from '../src/pact-standalone'; - -const { status } = childProcess.spawnSync( - rubyStandalone.verifierFullPath, - process.argv.slice(2), - { - stdio: 'inherit', - } -); -process.exit(status as number); diff --git a/bin/pact-stub-service.ts b/bin/pact-stub-service.ts deleted file mode 100644 index c565efae..00000000 --- a/bin/pact-stub-service.ts +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node - -import childProcess = require('child_process'); -import rubyStandalone from '../src/pact-standalone'; - -const { status } = childProcess.spawnSync( - rubyStandalone.stubFullPath, - process.argv.slice(2), - { - stdio: 'inherit', - } -); -process.exit(status as number); diff --git a/bin/pact.ts b/bin/pact.ts deleted file mode 100644 index 34e5553f..00000000 --- a/bin/pact.ts +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node - -import childProcess = require('child_process'); -import rubyStandalone from '../src/pact-standalone'; - -const { status } = childProcess.spawnSync( - rubyStandalone.pactFullPath, - process.argv.slice(2), - { - stdio: 'inherit', - } -); -process.exit(status as number); diff --git a/bin/pactflow.ts b/bin/pactflow.ts deleted file mode 100644 index 707158b6..00000000 --- a/bin/pactflow.ts +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env node - -import childProcess = require('child_process'); -import rubyStandalone from '../src/pact-standalone'; - -const { status } = childProcess.spawnSync( - rubyStandalone.pactflowFullPath, - process.argv.slice(2), - { - stdio: 'inherit', - } -); -process.exit(status as number); diff --git a/package-lock.json b/package-lock.json index 77cb0ca8..4d20e361 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,6 @@ "dependencies": { "@types/needle": "2.5.2", "bindings": "^1.5.0", - "chalk": "4.1.2", "check-types": "7.3.0", "cross-spawn": "7.0.3", "mkdirp": "1.0.0", @@ -35,15 +34,6 @@ "underscore": "1.12.1", "unixify": "1.0.0" }, - "bin": { - "pact": "bin/pact.js", - "pact-broker": "bin/pact-broker.js", - "pact-message": "bin/pact-message.js", - "pact-mock-service": "bin/pact-mock-service.js", - "pact-provider-verifier": "bin/pact-provider-verifier.js", - "pact-stub-service": "bin/pact-stub-service.js", - "pactflow": "bin/pactflow.js" - }, "devDependencies": { "@grpc/grpc-js": "^1.8.0", "@grpc/proto-loader": "^0.7.3", @@ -1248,6 +1238,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -1641,6 +1632,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1717,6 +1709,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -1727,7 +1720,8 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/colorette": { "version": "2.0.19", @@ -4005,6 +3999,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -7014,6 +7009,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -8566,6 +8562,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "requires": { "color-convert": "^2.0.1" } @@ -8864,6 +8861,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -8919,6 +8917,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "requires": { "color-name": "~1.1.4" } @@ -8926,7 +8925,8 @@ "color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "colorette": { "version": "2.0.19", @@ -10663,7 +10663,8 @@ "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true }, "has-property-descriptors": { "version": "1.0.0", @@ -12908,6 +12909,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "requires": { "has-flag": "^4.0.0" } diff --git a/package.json b/package.json index ae0b99ba..b8e62007 100644 --- a/package.json +++ b/package.json @@ -5,15 +5,6 @@ "main": "src/index.js", "homepage": "https://github.com/pact-foundation/pact-js-core#readme", "types": "src/index.d.ts", - "bin": { - "pact": "bin/pact.js", - "pact-broker": "bin/pact-broker.js", - "pact-mock-service": "bin/pact-mock-service.js", - "pact-stub-service": "bin/pact-stub-service.js", - "pact-provider-verifier": "bin/pact-provider-verifier.js", - "pact-message": "bin/pact-message.js", - "pactflow": "bin/pactflow.js" - }, "os": [ "darwin", "linux", @@ -54,7 +45,6 @@ "dependencies": { "@types/needle": "2.5.2", "bindings": "^1.5.0", - "chalk": "4.1.2", "check-types": "7.3.0", "cross-spawn": "7.0.3", "mkdirp": "1.0.0", @@ -123,18 +113,18 @@ "typescript": "4.7.4" }, "scripts": { - "clean": "rimraf '{src,test,bin,standalone}/**/*.{js,map,d.ts}' 'package.zip' '.tmp' 'tmp'", + "clean": "rimraf '{src,test}/**/*.{js,map,d.ts}' 'package.zip' '.tmp' 'tmp'", "lint": "eslint . --ext .ts --config .eslintrc", "lint:fix": "npm run lint -- --fix", "prebuild": "npm run clean && bash script/download-libs.sh", "build": "tsc --project tsconfig.build.json", "prerelease": "npm run snyk-protect", "release": "standard-version", - "test": "cross-env LOGLEVEL=debug PACT_DO_NOT_TRACK=true mocha \"{src,test,bin,standalone}/**/*.spec.ts\"", + "test": "cross-env LOGLEVEL=debug PACT_DO_NOT_TRACK=true mocha \"{src,bin}/**/*.spec.ts\"", "snyk-protect": "snyk protect", "format:base": "prettier --parser typescript", - "format:check": "npm run format:base -- --list-different \"{src,standalone,bin,test}/**/*.{ts,tsx}\"", - "format:fix": "npm run format:base -- --write \"{src,standalone,bin,test}/**/*.{ts,tsx}\"", + "format:check": "npm run format:base -- --list-different \"{src,test}/**/*.{ts,tsx}\"", + "format:fix": "npm run format:base -- --write \"{src,test}/**/*.{ts,tsx}\"", "postinstall": "npm run native", "native": "node-gyp rebuild -v" }, diff --git a/script/create-pr-to-update-pact-ruby-standalone.sh b/script/create-pr-to-update-pact-ruby-standalone.sh deleted file mode 100755 index 50341b91..00000000 --- a/script/create-pr-to-update-pact-ruby-standalone.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -set -e - -: "${1?Please supply the pact-ruby-standalone version to upgrade to}" - -STANDALONE_VERSION=$1 -TYPE=${2:-fix} -DASHERISED_VERSION=$(echo "${STANDALONE_VERSION}" | sed 's/\./\-/g') -BRANCH_NAME="chore/upgrade-to-pact-ruby-standalone-${DASHERISED_VERSION}" - -git checkout master -git checkout standalone/install.ts -git pull origin master - -git checkout -b ${BRANCH_NAME} - -cat standalone/install.ts | sed "s/export const PACT_STANDALONE_VERSION.*/export const PACT_STANDALONE_VERSION = '${STANDALONE_VERSION}';/" > tmp-install -mv tmp-install standalone/install.ts - -git add standalone/install.ts -git commit -m "${TYPE}: update standalone to ${STANDALONE_VERSION}" -git push --set-upstream origin ${BRANCH_NAME} - -hub pull-request --message "${TYPE}: update standalone to ${STANDALONE_VERSION}" - -git checkout master diff --git a/script/download-libs.sh b/script/download-libs.sh index a94f09b5..d37ebd2c 100755 --- a/script/download-libs.sh +++ b/script/download-libs.sh @@ -2,5 +2,4 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running . "${SCRIPT_DIR}/lib/export-binary-versions.sh" -"${SCRIPT_DIR}/lib/download-ffi.sh" -"${SCRIPT_DIR}/lib/download-standalone.sh" \ No newline at end of file +"${SCRIPT_DIR}/lib/download-ffi.sh" \ No newline at end of file diff --git a/script/lib/download-standalone.sh b/script/lib/download-standalone.sh deleted file mode 100755 index aa81df37..00000000 --- a/script/lib/download-standalone.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -eu -LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running -. "${LIB_DIR}/robust-bash.sh" -. "${LIB_DIR}/download-file.sh" - -require_binary curl -require_binary unzip -require_env_var STANDALONE_VERSION - -BASEURL=https://github.com/pact-foundation/pact-ruby-standalone/releases/download -STANDALONE_DIR="${LIB_DIR}/../../standalone" - -function download_standalone { - if [ -z "${1:-}" ]; then - error "${FUNCNAME[0]} requires the filename to download from" - exit 1 - fi - - if [ -z "${2:-}" ]; then - error "${FUNCNAME[0]} requires the filename to save the download in" - exit 1 - fi - STANDALONE_FILENAME="$2" - - URL="${BASEURL}/v${STANDALONE_VERSION}/${1}" - DOWNLOAD_LOCATION="$STANDALONE_DIR/${STANDALONE_FILENAME}" - - - log "Downloading standalone version $STANDALONE_VERSION to $DOWNLOAD_LOCATION" - download_to "$URL" "$DOWNLOAD_LOCATION" - if [ "${STANDALONE_FILENAME%zip}" != "${STANDALONE_FILENAME}" ]; then - unzip -qo "$DOWNLOAD_LOCATION" -d "${DOWNLOAD_LOCATION%.*}" - rm "${DOWNLOAD_LOCATION}" - else - mkdir -p "${DOWNLOAD_LOCATION%.tar.gz}" - tar -xf "$DOWNLOAD_LOCATION" -C "${DOWNLOAD_LOCATION%.tar.gz}" - rm "${DOWNLOAD_LOCATION}" - fi -} - -log "Downloading Ruby standalone ${STANDALONE_VERSION}" - -if [[ $(find "${STANDALONE_DIR}" -name "*${STANDALONE_VERSION}") ]]; then - log "Skipping download of Ruby standalone, as it exists" - exit 0 -fi - -download_standalone "pact-${STANDALONE_VERSION}-win32.zip" "win32-${STANDALONE_VERSION}.zip" - -if [ -z "${ONLY_DOWNLOAD_PACT_FOR_WINDOWS:-}" ]; then - download_standalone "pact-${STANDALONE_VERSION}-osx.tar.gz" "darwin-${STANDALONE_VERSION}.tar.gz" - download_standalone "pact-${STANDALONE_VERSION}-linux-x86_64.tar.gz" "linux-x64-${STANDALONE_VERSION}.tar.gz" -fi - -# Write readme in the ffi folder -cat << EOF > "$STANDALONE_DIR/README.md" -# Standalone binaries - -This folder is automatically populated during build by /script/download-standalone.sh -EOF diff --git a/script/lib/export-binary-versions.sh b/script/lib/export-binary-versions.sh index 066d2464..9cc2b95f 100644 --- a/script/lib/export-binary-versions.sh +++ b/script/lib/export-binary-versions.sh @@ -2,5 +2,4 @@ LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running PROJECT_DIR="${LIB_DIR}"/../../ -export STANDALONE_VERSION=$(grep "PACT_STANDALONE_VERSION = '" "$PROJECT_DIR"/standalone/install.ts | grep -E -o "'(.*)'" | cut -d"'" -f2) export FFI_VERSION=v$(grep "PACT_FFI_VERSION = '" "$PROJECT_DIR"/src/ffi/index.ts | grep -E -o "'(.*)'" | cut -d"'" -f2) \ No newline at end of file diff --git a/standalone/__fixtures__/.keep b/standalone/__fixtures__/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/standalone/install.ts b/standalone/install.ts deleted file mode 100644 index 78bee06a..00000000 --- a/standalone/install.ts +++ /dev/null @@ -1,66 +0,0 @@ -import chalk = require('chalk'); - -// Get latest version from https://github.com/pact-foundation/pact-ruby-standalone/releases -export const PACT_STANDALONE_VERSION = '1.91.0'; - -function makeError(msg: string): Error { - return new Error(chalk.red(`Error while locating pact binary: ${msg}`)); -} - -export function createConfig(): Config { - const CHECKSUM_SUFFIX = '.checksum'; - - return { - binaries: [ - { - platform: 'win32', - binary: `pact-${PACT_STANDALONE_VERSION}-win32.zip`, - binaryChecksum: `pact-${PACT_STANDALONE_VERSION}-win32.zip${CHECKSUM_SUFFIX}`, - folderName: `win32-${PACT_STANDALONE_VERSION}`, - }, - { - platform: 'darwin', - binary: `pact-${PACT_STANDALONE_VERSION}-osx.tar.gz`, - binaryChecksum: `pact-${PACT_STANDALONE_VERSION}-osx.tar.gz${CHECKSUM_SUFFIX}`, - folderName: `darwin-${PACT_STANDALONE_VERSION}`, - }, - { - platform: 'linux', - arch: 'x64', - binary: `pact-${PACT_STANDALONE_VERSION}-linux-x86_64.tar.gz`, - binaryChecksum: `pact-${PACT_STANDALONE_VERSION}-linux-x86_64.tar.gz${CHECKSUM_SUFFIX}`, - folderName: `linux-x64-${PACT_STANDALONE_VERSION}`, - }, - ], - }; -} - -const CONFIG = createConfig(); - -export function getBinaryEntry( - platform: string = process.platform, - arch: string = process.arch -): BinaryEntry { - const found = CONFIG.binaries.find( - (value) => - value.platform === platform && (value.arch ? value.arch === arch : true) - ); - if (found === undefined) { - throw makeError( - `Cannot find binary for platform '${platform}' with architecture '${arch}'.` - ); - } - return found; -} - -export interface Config { - binaries: BinaryEntry[]; -} - -export interface BinaryEntry { - platform: string; - arch?: string; - binary: string; - binaryChecksum: string; - folderName: string; -}