diff --git a/bin/pact-broker.ts b/bin/pact-broker.ts index 6c614acd..f46d0a99 100644 --- a/bin/pact-broker.ts +++ b/bin/pact-broker.ts @@ -5,8 +5,10 @@ import { standalone, standaloneUseShell, setStandaloneArgs, + showStandaloneDeprecationWarning, } from '../src/pact-standalone'; +showStandaloneDeprecationWarning(); const args = process.argv.slice(2); const opts = standaloneUseShell ? { shell: true } : {}; const { error, status } = childProcess.spawnSync( diff --git a/bin/pact-message.ts b/bin/pact-message.ts index d1d2214c..7b080500 100644 --- a/bin/pact-message.ts +++ b/bin/pact-message.ts @@ -5,8 +5,10 @@ import { standalone, standaloneUseShell, setStandaloneArgs, + showStandaloneDeprecationWarning, } from '../src/pact-standalone'; +showStandaloneDeprecationWarning(); const args = process.argv.slice(2); const opts = standaloneUseShell ? { shell: true } : {}; diff --git a/bin/pact-mock-service.ts b/bin/pact-mock-service.ts index b3542900..6e80acbc 100644 --- a/bin/pact-mock-service.ts +++ b/bin/pact-mock-service.ts @@ -5,8 +5,10 @@ import { standalone, standaloneUseShell, setStandaloneArgs, + showStandaloneDeprecationWarning, } from '../src/pact-standalone'; +showStandaloneDeprecationWarning(); const args = process.argv.slice(2); const opts = standaloneUseShell ? { shell: true } : {}; diff --git a/bin/pact-provider-verifier.ts b/bin/pact-provider-verifier.ts index 706fc925..a1fa9411 100644 --- a/bin/pact-provider-verifier.ts +++ b/bin/pact-provider-verifier.ts @@ -5,8 +5,10 @@ import { standalone, standaloneUseShell, setStandaloneArgs, + showStandaloneDeprecationWarning, } from '../src/pact-standalone'; +showStandaloneDeprecationWarning(); const args = process.argv.slice(2); const opts = standaloneUseShell ? { shell: true } : {}; diff --git a/bin/pact-stub-service.ts b/bin/pact-stub-service.ts index 3e02e29c..bca5c7fa 100644 --- a/bin/pact-stub-service.ts +++ b/bin/pact-stub-service.ts @@ -5,8 +5,10 @@ import { standalone, standaloneUseShell, setStandaloneArgs, + showStandaloneDeprecationWarning, } from '../src/pact-standalone'; +showStandaloneDeprecationWarning(); const args = process.argv.slice(2); const opts = standaloneUseShell ? { shell: true } : {}; diff --git a/bin/pact.ts b/bin/pact.ts index d4afad30..ab6412c2 100644 --- a/bin/pact.ts +++ b/bin/pact.ts @@ -5,8 +5,10 @@ import { standalone, standaloneUseShell, setStandaloneArgs, + showStandaloneDeprecationWarning, } from '../src/pact-standalone'; +showStandaloneDeprecationWarning(); const args = process.argv.slice(2); const opts = standaloneUseShell ? { shell: true } : {}; diff --git a/bin/pactflow.ts b/bin/pactflow.ts index fddc26fd..bce1f397 100644 --- a/bin/pactflow.ts +++ b/bin/pactflow.ts @@ -5,8 +5,10 @@ import { standalone, standaloneUseShell, setStandaloneArgs, + showStandaloneDeprecationWarning, } from '../src/pact-standalone'; +showStandaloneDeprecationWarning(); const args = process.argv.slice(2); const opts = standaloneUseShell ? { shell: true } : {}; diff --git a/src/pact-standalone.ts b/src/pact-standalone.ts index 3dc11632..8ef06644 100644 --- a/src/pact-standalone.ts +++ b/src/pact-standalone.ts @@ -1,6 +1,7 @@ import * as path from 'path'; import { getBinaryEntry } from '../standalone/install'; import pactEnvironment from './pact-environment'; +import logger from './logger'; export interface PactStandalone { cwd: string; @@ -110,6 +111,17 @@ export function setStandaloneArgs( return parsedArgs; } +export function showStandaloneDeprecationWarning(): void { + const silenceDeprecationWarnings = + process.env['PACT_SILENCE_DEPRECATION_WARNINGS'] === 'true'; + + if (!silenceDeprecationWarnings) { + logger.warn( + 'DEPRECATION NOTICE: \n pact standalone tools will be removed in pact-js-core 15.x. \n Please update imports to @pact-foundation/pact-cli \n https://github.com/pact-foundation/pact-js-core/issues/488' + ); + } +} + export const standaloneUseShell = isWindows; export default standalone(); diff --git a/src/service.ts b/src/service.ts index 1777d692..685e9d03 100644 --- a/src/service.ts +++ b/src/service.ts @@ -12,6 +12,7 @@ import spawn, { CliVerbOptions } from './spawn'; import { LogLevel } from './logger/types'; import logger, { setLogLevel } from './logger'; import { ServiceOptions } from './types'; +import { showStandaloneDeprecationWarning } from './pact-standalone'; // Get a reference to the global setTimeout object in case it is mocked by a testing library later const { setTimeout } = global; @@ -93,6 +94,8 @@ export abstract class AbstractService extends events.EventEmitter { 'Like a Boss, you used a port outside of the recommended range (1024 to 49151); I too like to live dangerously.' ); } + + showStandaloneDeprecationWarning(); } // ssl check