Skip to content

Commit

Permalink
feat(package-name): Pact-node renamed to pact-core
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyJones committed Mar 1, 2021
1 parent fa5e190 commit 700ad09
Show file tree
Hide file tree
Showing 13 changed files with 55 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug report
about: Report a bug with pact-node
about: Report a bug with pact-js-core
title: ''
labels: bug
assignees: ''
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ _This checklist is optional, but studies show that people who have followed it c

Before making a feature request, I have:

- [ ] [Searched the issues to check that this feature hasn't been requested before](https://github.com/pact-foundation/pact-node/issues?q=is%3Aissue)
- [ ] [Searched the issues to check that this feature hasn't been requested before](https://github.com/pact-foundation/pact-js-core/issues?q=is%3Aissue)
- [ ] Checked the documentation to see if it is possible to do what I want already

### Feature description

_Please describe what you would like Pact-node to do_
_Please describe what you would like Pact-js-core to do_

### Use case

_What is the use case that motivates this feature request?_

_Please describe *why* you would like Pact-node to have this feature._
_Please describe *why* you would like Pact-js-core to have this feature._
2 changes: 1 addition & 1 deletion .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ _Thank you for reporting an issue! We appreciate it very much. Issues are a big

_NOTE: If your issue is a how-to question, it is probably better asked in the pact-foundation slack channel, https://slack.pact.io/ _

_This is the template for issues that aren't feature requests or bug reports. If your issue is a feature request or bug report, please use the relevant template from https://github.com/pact-foundation/pact-node/issues/new/choose - these will cover off the most common questions we ask and speed up a fix_
_This is the template for issues that aren't feature requests or bug reports. If your issue is a feature request or bug report, please use the relevant template from https://github.com/pact-foundation/pact-js-core/issues/new/choose - these will cover off the most common questions we ask and speed up a fix_

_If you're reading this thinking "Hmmm, it is bug report/feature request, but neither of those templates work for what I want to report", then please feel free to ignore the template in whatever way you think best suits your issue. We trust you, you're awesome_

Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ _Please read and then remove this section_

Thank you for making a pull request!

Pact-node is built and maintained by developers like you, and we appreciate contributions very much. You are awesome!
Pact-js-core is built and maintained by developers like you, and we appreciate contributions very much. You are awesome!

Our changelog is automatically built from our commit history, using conventional changelog. This means we'd like to take care that:

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Please provide the following information with your issue to enable us to respond

## I want to contribute code but don't know where to start

If you're not sure where to start, look for the [help wanted](https://github.com/pact-foundation/pact-node/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
label in our issue tracker. If you have an idea that you think would be great, come and chat to us on [slack] in the `#pact-node` channel, or open a feature request issue.
If you're not sure where to start, look for the [help wanted](https://github.com/pact-foundation/pact-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
label in our issue tracker. If you have an idea that you think would be great, come and chat to us on [slack] in the `#pact-js` channel, or open a feature request issue.

## I'm ready to contribute code

Expand All @@ -26,7 +26,7 @@ Pact Node uses the [Conventional Changelog](https://github.com/bcoe/conventional
commit message conventions to simplify automation process. Please ensure you follow the guidelines.

You can take a look at the git history (`git log`) to get the gist of it.
If you have questions, feel free to reach out in `#pact-node` in our [slack
If you have questions, feel free to reach out in `#pact-js` in our [slack
community](https://pact-foundation.slack.com/).

#### Release notes
Expand Down
62 changes: 32 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
<img src="https://raw.githubusercontent.com/pact-foundation/pact-logo/master/media/logo-black.png" width="200">

![Build and test](https://github.com/pact-foundation/pact-node/workflows/Build%20and%20test/badge.svg)
[![Known Vulnerabilities](https://snyk.io/test/github/pact-foundation/pact-node/badge.svg?targetFile=package.json)](https://snyk.io/test/github/pact-foundation/pact-node?targetFile=package.json)
[![npm](https://img.shields.io/npm/v/@pact-foundation/pact-node.svg)](https://www.npmjs.com/package/@pact-foundation/pact-node)
[![license](https://img.shields.io/github/license/pact-foundation/pact-node.svg)](https://github.com/pact-foundation/pact-node/blob/master/LICENSE)
[![dependencies](https://img.shields.io/david/pact-foundation/pact-node.svg)](https://www.npmjs.com/package/@pact-foundation/pact-node)
![Build and test](https://github.com/pact-foundation/pact-js-core/workflows/Build%20and%20test/badge.svg)
[![Known Vulnerabilities](https://snyk.io/test/github/pact-foundation/pact-js-core/badge.svg?targetFile=package.json)](https://snyk.io/test/github/pact-foundation/pact-js-core?targetFile=package.json)
[![npm](https://img.shields.io/npm/v/@pact-foundation/pact-js-core.svg)](https://www.npmjs.com/package/@pact-foundation/pact-core)
[![license](https://img.shields.io/github/license/pact-foundation/pact-js-core.svg)](https://github.com/pact-foundation/pact-js-core/blob/master/LICENSE)
[![dependencies](https://img.shields.io/david/pact-foundation/pact-js-core.svg)](https://www.npmjs.com/package/@pact-foundation/pact-core)
[![slack](http://slack.pact.io/badge.svg)](http://slack.pact.io)

# Pact Node
# Pact-JS Core

An idiomatic Node wrapper for the [Pact](http://pact.io) [CLI Tools](https://github.com/pact-foundation/pact-ruby-standalone).
**This is the core of pact-js. Unless you are wanting to develop tools for the pact ecosystem, you almost certainly want to install [`@pact-foundation/pact`](https://github.com/pact-foundation/pact-js/) instead**.

***NOTE*: If you are new to Pact and are wanting to get started with contract testing, you almost certainly don't want to use this package. Head over to [Pact JS](https://github.com/pact-foundation/pact-js/) instead.**
A wrapper for the [Pact](http://pact.io) [CLI Tools](https://github.com/pact-foundation/pact-ruby-standalone).

***If you are new to Pact and are wanting to get started with contract testing, you almost certainly don't want to use this package. Head over to [Pact JS](https://github.com/pact-foundation/pact-js/) instead.**

<!-- TOC -->

- [Pact Node](#pact-node)
- [Pact Core](#pact-js-core)
- [Installation](#installation)
- [Do Not Track](#do-not-track)
- [Pact Download Location](#pact-download-location)
Expand Down Expand Up @@ -47,7 +49,7 @@ An idiomatic Node wrapper for the [Pact](http://pact.io) [CLI Tools](https://git

## Installation

`npm install @pact-foundation/pact-node --save`
`npm install @pact-foundation/pact-core --save-dev`

### Do Not Track

Expand Down Expand Up @@ -79,7 +81,7 @@ For those that are behind a corporate firewall or are seeing issues where our pa
}
```

It will accept both a local path or an http(s) url. It must point to the directory containing the binary needed as the binary name is appended to the end of the location. For the example given above, Pact will look for the binary at `/home/some-user/Downloads/pact-1.44.0-win32.zip` for a Windows system. However, by using this method, you must use the correct Pact version binary associated with this version of Pact-Node. For extra security measurements, checksum validation has been added to prevent tampering with the binaries.
It will accept both a local path or an http(s) url. It must point to the directory containing the binary needed as the binary name is appended to the end of the location. For the example given above, Pact will look for the binary at `/home/some-user/Downloads/pact-1.44.0-win32.zip` for a Windows system. However, by using this method, you must use the correct Pact version binary associated with this version of Pact-Core. For extra security measurements, checksum validation has been added to prevent tampering with the binaries.

If your environment uses self-signed certificates from an internal Certificate Authority (CA), you can configure this using the standard options in an [npmrc](https://docs.npmjs.com/configuring-npm/npmrc.html) file as per below:

Expand All @@ -95,7 +97,7 @@ You can also force Pact to skip the installation of the binary during `npm insta
setting `PACT_SKIP_BINARY_INSTALL=true`. This feature is useful if you want to speed up
builds that don't need Pact and don't want to modify your projects dependencies.

Note that pact-node will not be functional without the binary.
Note that pact-core will not be functional without the binary.

```bash
PACT_SKIP_BINARY_INSTALL=true npm install
Expand All @@ -121,7 +123,7 @@ TL;DR - you almost always want Pact JS.
Simply require the library and call the create function to start the mock service

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
var server = pact.createServer({ port: 9999 });
server.start().then(function() {
// Do your testing/development here
Expand All @@ -131,7 +133,7 @@ server.start().then(function() {
Or if you're using Typescript instead of plain old Javascript

```ts
import pact from "@pact-foundation/pact-node";
import pact from "@pact-foundation/pact-core";
const server = pact.createServer({ port: 9999 });
server.start().then(() => {
// Do your testing/development here
Expand All @@ -151,7 +153,7 @@ To see the list commands possible with the CLI, simply ask for help `$# pact --h
### Set Log Level

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
pact.logLevel("debug");
```

Expand All @@ -162,7 +164,7 @@ Mock servers are used by Pact to record interactions and create pact contracts.
#### Create Mock Server

```js
var pact = require('@pact-foundation/pact-node');
var pact = require('@pact-foundation/pact-core');
var server = pact.createServer({
...
});
Expand Down Expand Up @@ -193,7 +195,7 @@ var server = pact.createServer({
If you ever need to see which servers are currently created.

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
var servers = pact.listServers();
console.log(JSON.stringify(servers));
```
Expand All @@ -203,7 +205,7 @@ console.log(JSON.stringify(servers));
Remove all servers once you're done with them in one fell swoop.

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
pact.removeAllServers();
```

Expand All @@ -212,7 +214,7 @@ pact.removeAllServers();
Start the current server.

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
pact.createServer()
.start()
.then(function() {
Expand All @@ -225,7 +227,7 @@ pact.createServer()
Stop the current server.

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
pact.createServer()
.stop()
.then(function() {
Expand All @@ -238,7 +240,7 @@ pact.createServer()
Stop the current server and deletes it from the list.

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
pact.createServer()
.delete()
.then(function() {
Expand All @@ -249,7 +251,7 @@ pact.createServer()
#### Check if a Mock server is running

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
pact.createServer().running;
```

Expand All @@ -258,7 +260,7 @@ pact.createServer().running;
There's 3 different events available, 'start', 'stop' and 'delete'. They can be listened to the same way as an [EventEmitter](https://nodejs.org/api/events.html).

```js
var pact = require("@pact-foundation/pact-node");
var pact = require("@pact-foundation/pact-core");
var server = pact.createServer();
server.on("start", function() {
console.log("started");
Expand All @@ -276,7 +278,7 @@ server.on("delete", function() {
Read more about [Verify Pacts](https://github.com/realestate-com-au/pact/wiki/Verifying-pacts).

```js
var pact = require('@pact-foundation/pact-node');
var pact = require('@pact-foundation/pact-core');

pact.verifyPacts({
...
Expand Down Expand Up @@ -313,7 +315,7 @@ pact.verifyPacts({
### Pact Broker Publishing

```js
var pact = require('@pact-foundation/pact-node');
var pact = require('@pact-foundation/pact-core');
var opts = {
...
};
Expand All @@ -339,7 +341,7 @@ pact.publishPacts(opts).then(function () {
### Pact Broker Deployment Check

```js
var pact = require('@pact-foundation/pact-node');
var pact = require('@pact-foundation/pact-core');
var opts = {
...
};
Expand Down Expand Up @@ -386,7 +388,7 @@ The interface is comparable to the Mock Server API.
#### Create Stub Server

```js
var pact = require('@pact-foundation/pact-node');
var pact = require('@pact-foundation/pact-core');
var server = pact.createStub({
...
});
Expand All @@ -411,7 +413,7 @@ var server = pact.createStub({
#### Create Message Pacts

```js
var pact = require('@pact-foundation/pact-node');
var pact = require('@pact-foundation/pact-core');
var message = pact.createMessage({
...
});
Expand Down Expand Up @@ -454,7 +456,7 @@ This means you may call them direct from scripts in your package json, for examp
"scripts": {
"pactPublish": "pact-broker publish ./pacts --consumer-app-version=$\(git describe\) --broker-base-url=$BROKER_BASE_URL --broker-username=$BROKER_USERNAME --broker-password=BROKER_PASSWORD"`
}
These are available in circumstances where `pact-node` has not yet implemented a feature or access via JavaScript APIs is not desirable. To run the binaries is as simple as the following:
These are available in circumstances where `pact-core` has not yet implemented a feature or access via JavaScript APIs is not desirable. To run the binaries is as simple as the following:
*Example can-i-deploy check*:
```sh
Expand Down Expand Up @@ -482,7 +484,7 @@ The following are the binaries currently made available:

### Enable Long Paths

[Windows has a default path length limit of 260](https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation) causing issues with projects that are nested deep inside several directory and with how npm handles node_modules directory structures. To fix this issue, please enable Windows Long Paths in the registry by running `regedit.exe`, find the key `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled` and change the value from `0` to `1`, then reboot your computer. Pact should now work as it should, if not, please [raise an issue on github](https://github.com/pact-foundation/pact-node/issues).
[Windows has a default path length limit of 260](https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#maximum-path-length-limitation) causing issues with projects that are nested deep inside several directory and with how npm handles node_modules directory structures. To fix this issue, please enable Windows Long Paths in the registry by running `regedit.exe`, find the key `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled` and change the value from `0` to `1`, then reboot your computer. Pact should now work as it should, if not, please [raise an issue on github](https://github.com/pact-foundation/pact-js-core/issues).

## Contributing

Expand Down
4 changes: 2 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies in `scripts/ci/lib`.
## Kicking off a release

You must be able to create a github access token with `repo` scope to the
pact-node repository.
pact-js-core repository.

- Set an environment variable `GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES` to this token.
- Make sure master contains the code you want to release
Expand Down Expand Up @@ -69,7 +69,7 @@ may need to rebase them on top of the tagged release commit and force push.

## Releasing Pact Node Manually

If any changes needs to be released, let it be dependencies or code, you must have access to push directly to master on the pact-node repo, then follow these steps:
If any changes needs to be released, let it be dependencies or code, you must have access to push directly to master on the pact-js-core repo, then follow these steps:

- Run `npm ci --ignore-scripts` to confirm that the dependencies are appropriately configured.
- Run `npm test` first to make sure all tests pass. This will also build and download the appropriate checksums.
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@pact-foundation/pact-node",
"name": "@pact-foundation/pact-core",
"version": "10.11.11",
"description": "A wrapper for the Ruby version of Pact to work within Node",
"description": "Core of @pact-foundation/pact. You almost certainly don't want to depend on this directly.",
"main": "src/index.js",
"homepage": "https://github.com/pact-foundation/pact-node#readme",
"homepage": "https://github.com/pact-foundation/pact-js-core#readme",
"types": "src/index.d.ts",
"bin": {
"pact": "bin/pact.js",
Expand All @@ -27,7 +27,7 @@
},
"repository": {
"type": "git",
"url": "git://github.com/pact-foundation/pact-node.git"
"url": "git://github.com/pact-foundation/pact-js-core.git"
},
"keywords": [
"pact",
Expand All @@ -44,7 +44,7 @@
],
"license": "MIT",
"bugs": {
"url": "https://github.com/pact-foundation/pact-node/issues"
"url": "https://github.com/pact-foundation/pact-js-core/issues"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion script/ci/lib/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ echo "--> Preparing npmrc file"
echo "--> Releasing version ${VERSION}"

echo "--> Releasing artifacts"
echo " Publishing pact-node@${VERSION}..."
echo " Publishing pact-core@${VERSION}..."
npm publish --access public --tag latest
echo " done!"
2 changes: 1 addition & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const createLogger = (level: LogLevels = DEFAULT_LEVEL): Logger =>
pino({
level: level.toLowerCase(),
prettyPrint: {
messageFormat: `pact-node@${pkg.version}: {msg}`,
messageFormat: `pact-core@${pkg.version}: {msg}`,
translateTime: true,
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/pact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class Pact {
} catch {
logger.warn(
'WARNING: Windows Long Paths is not enabled and might cause Pact to crash if the path is too long. ' +
'To fix this issue, please consult https://github.com/pact-foundation/pact-node#enable-long-paths`',
'To fix this issue, please consult https://github.com/pact-foundation/pact-js-core#enable-long-paths`',
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export abstract class AbstractService extends events.EventEmitter {
// Set logger first
if (options.logLevel) {
setLogLevel(options.logLevel);
// Pact-node's logger supports fatal and trace,
// Pact-js-core's logger supports fatal and trace,
// but the ruby binary doesn't. So we map those.
if ((options.logLevel as string) === 'fatal') {
options.logLevel = 'error';
Expand Down Expand Up @@ -327,7 +327,7 @@ export interface ServiceOptions {
logLevel?: LogLevel;
}

// This is the pact binary's log level, which is a subset of the log levels for pact-node
// This is the pact binary's log level, which is a subset of the log levels for pact-core
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';

export interface HTTPConfig {
Expand Down
4 changes: 2 additions & 2 deletions standalone/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function downloadFileRetry(
request({
url,
headers: {
'User-Agent': 'https://github.com/pact-foundation/pact-node',
'User-Agent': 'https://github.com/pact-foundation/pact-js-core',
},
strictSSL: config.read()['strict-ssl'],
agentOptions: {
Expand Down Expand Up @@ -235,7 +235,7 @@ function download(data: Data): Promise<Data> {
t: 'screenview', // Screenview hit type.
an: 'pact-install', // App name.
av: require('../package.json').version, // App version.
aid: 'pact-node', // App Id.
aid: 'pact-node', // App Id - pact-node for historical reasons
aiid: `standalone-${PACT_STANDALONE_VERSION}`, // App Installer Id.
cd: `download-node-${data.platform}-${isCI ? 'ci' : 'user'}`,
aip: true, // Anonymise IP address
Expand Down

0 comments on commit 700ad09

Please sign in to comment.