Skip to content

Commit

Permalink
Merge pull request #4721 from reactioncommerce/release-2.0.0-rc.5
Browse files Browse the repository at this point in the history
Release 2.0.0 rc.5
  • Loading branch information
spencern authored Oct 18, 2018
2 parents feddf8d + b4c386e commit f9fd923
Show file tree
Hide file tree
Showing 128 changed files with 2,614 additions and 1,287 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.11.3
42 changes: 33 additions & 9 deletions .reaction/waitForReplica.js → .reaction/waitForMongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ function defaultOut(message) {
}

/**
* Print a message to the console (no trailing newline)
* Run a check/wait/retry loop until a provided function returns a
* promise that resolves.
* @param {Object} options - Named options object
* @param {function()} options.out Function to show progress
* @param {number} options.max Number of retries attempted before full failure
Expand All @@ -34,8 +35,8 @@ async function checkWaitRetry({
*
* @param {string} message to be printed
* @param {number} count retry number for progress dots
* @returns {undefined}
*/
* @returns {undefined}
*/
function showOnce(message, count) {
if (!messages.has(message)) {
messages.add(message);
Expand Down Expand Up @@ -87,6 +88,29 @@ async function connect(mongoUrl) {
return client.db(dbName);
}

/**
* Runs the mongo command replSetInitiate,
* which we need for the oplog for meteor real-time
*
* @param {objecct} db connected mongo db instance
* @returns {Promise} indication of success/failure
*/
async function initReplicaSet(db) {
try {
await db.admin().command({
replSetInitiate: {
_id: "rs0",
members: [{ _id: 0, host: "localhost:27017" }]
}
});
} catch (error) {
// AlreadyInitialized is OK to treat as success
if (error.codeName !== "AlreadyInitialized") {
throw error;
}
}
}

/**
* Check if replication is ready
*
Expand All @@ -109,7 +133,11 @@ async function main() {
if (!MONGO_URL) {
throw new Error("You must set MONGO_URL environment variable.");
}
const db = await connect(MONGO_URL);
const db = await checkWaitRetry({
timeoutMessage: "ERROR: MongoDB not reachable in time.",
check: connect.bind(null, MONGO_URL)
});
await initReplicaSet(db);
await checkWaitRetry({
timeoutMessage: "ERROR: MongoDB replica set not ready in time.",
check: checkReplicaSetStatus.bind(null, db)
Expand All @@ -132,11 +160,7 @@ function exit(error) {
// Allow this module to be run directly as a node program or imported as lib
if (require.main === module) {
process.on("unhandledRejection", exit);
try {
main();
} catch (error) {
exit(error);
}
main().catch(exit);
}

module.exports = {
Expand Down
86 changes: 86 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,89 @@
# v2.0.0-rc.5
This is our fifth **release candidate** for v2.0.0 of Reaction. Please check it out and let us know what works and what doesn't for you.

## Mongo replica set issue
Many people were having issues with the Mongo replica-set image starting before the Mongo database was ready. This could cause the replica-set to fail and the application to hang during startup in a development environment. This is fixed in #4748 by waiting for mongo to be reachable within the reaction container before connecting to it, and creating the DB if needed, initiating the replica set if needed, and waiting for the replica set to be OK. This fix should solve the docker-compose startup race conditions we've been seeing. (#4748)

## GraphQL
We've added two new GraphQL queries for payment methods. A query `paymentMethods` which will list all registered payment methods and is restricted to operators and `availablePaymentMethods` which will list all payment methods which have been enabled. These new queries were added in #4709. We've also added a GraphQL mutation that permits an operator to enable or disable a payment method for a shop in #4739

We've updated the CartItems and OrderItems GraphQL queries to include a `productTags` resolver which will return the tags for the CartItem or OrderItem. The new resolvers and updated schemas were added in #4715 and #4732

There is a new GraphQL mutation for generating sitemaps `generateSitemaps` this replaces the `sitemaps/generate` meteor method. method. (#4708)

## Classic Storefront UI Updates
We've replaced the customer facing Product Grid in the Classic Storefront UI with our [CatalogGrid](https://designsystem.reactioncommerce.com/#!/CatalogGrid) component from the Reaction Design System. This was accomplished in #4649

There's a new "Include in sitemap?" checkbox in the Product Settings when using the operator interface to edit product information. This was added to make it possible to exclude published products from the sitemap. (#4708)

## Additional Plugin Capabilities
A plugin can now include a `catalog` object in `registerPackage`, with `customPublishedProductFields` and `customPublishedProductVariantFields` that are set to arrays of property names. These will be appended to the core list of fields for which published status should be tracked. This is used to build the hashes that are used to display an indicator when changes need to be published. (#4738)

A plugin can now use the `functionsByType` pattern to register one or more functions of type "publishProductToCatalog", which are called with `(catalogProduct, { context, product, shop, variants })` and expected to mutate `catalogProduct` if necessary. (#4738)


## nvmrc
Even though most of the development work happens in Docker, getting the right version of node available directly in the host OS is convenient for setting up eslint integration with your editor. We've added an `.nvmrc` file for this as [we've recommended](https://docs.reactioncommerce.com/docs/recommended-tools#general) `nvm` for installing and managing NodeJS in our docs for some time now.


## Public API Changes
We've changed the GraphQL schema for `PaymentMethod@name` from `PaymentMethodName` to `String`. `PaymentMethodName` was a subset of string and this should not cause any issues.

## Breaking Changes
WE've replaced the `generateSitemaps` Meteor method with a GraphQL mutation. See #4708 for details.

Because we've replaced the customer facing Product Grid UI in the Classic Storefront UI, if you had any plugins which relied on specific selectors or the structure of the existing UI, those may need to be updated.


## Features
- feat: payment methods (#4709) .. Resolves #4574
- feat: enable payment method for shop (#4739) .. Resolves #4718
- feat: use component library's CatalogGrid - 2.0 (#4649)
- feat: add product tags to cart items (#4715)
- feat: Add product tags to order item (#4732)
- feat: option to choose whether a product should appear in the sitemap (#4708)
- feat: add a way to extend catalog product publication (#4738)


## Fixes
- fix: Auth Consent scopes issue (#4733)
- fix: 4722 compareAtPrice - convert from Float to Money (#4731)
- fix(startup): init mongo replica set after waiting for connection (#4748)

## Chores
- chore: add .nvmrc configuration file (#4744)

## Docs
- docs: Link readers to Reaction Platform install instructions (#4724)
- docs: fix jsdoc copypasta on waitForReplica checkWaitRetry (#4723)


# v2.0.0-rc.4
This is our fourth **release candidate** for v2.0.0 of Reaction. Please check it out and let us know what works and what doesn't for you.

## Improving Jest test performance in CI
We started seeing unit tests timing out in CI in the morning on Friday October 5. It doesn't appear that this was caused by a change in our `jest` version as we were able to reproduce the issues on older branches which were previously passing.
This is resolved in #4176 by changing our `test:unit` script in `package.json` to run jest with the `--maxWorkers=4` flag. This resolved our issue with tests timing out, and improves test performance in CI overall. This is suggested in the troubleshooting jest here: https://jestjs.io/docs/en/troubleshooting.html#tests-are-extremely-slow-on-docker-and-or-continuous-integration-ci-server

## Checkout Totals
There were some cases in the Classic Storefront UI where there would be a discrepancy between the total calculated on the server and the price calculated by the client.
This is not an issue in the [Next.js Storefront](https://github.com/reactioncommerce/reaction-next-starterkit) as all price values are calculated on the server. This is resolved in #4701

## Bugfixes
fix: round total when verifying it on order create (#4701) .. Resolves #4684

## Chores
fix: limit jest maxWorkers to 4 to improve CI perf (#4716)

# v2.0.0-rc.3
This is our third **release candidate** for v2.0.0 of Reaction. Please check it out and let us know what works and what doesn't for you.

A few files snuck into our last release that had incorrect jsdoc syntax in the form of `@return <Promise>Type`
The jsdoc parser is unable to parse any return type starting with a `<` and throws an error. This error is thrown during the Deploy Docs CI step and causes that step of the CI to fail. This is resolved in #4704 by fixing the jsdoc to use the correct Promise syntax `@return Promise<Type>`

## Bugfixes
- fix: resolve errors in jsdoc Promise returns (#4704)

# v2.0.0-rc.2
This is our second **release candidate** for v2.0.0 of Reaction. Please check it out and let us know what works and what doesn't for you.

Expand Down
52 changes: 9 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Circle CI](https://circleci.com/gh/reactioncommerce/reaction.svg?style=svg)](https://circleci.com/gh/reactioncommerce/reaction) [![Gitter](https://badges.gitter.im/JoinChat.svg)](https://gitter.im/reactioncommerce/reaction?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Open Source Helpers](https://www.codetriage.com/reactioncommerce/reaction/badges/users.svg)](https://www.codetriage.com/reactioncommerce/reaction)


[Reaction](http://reactioncommerce.com) is an event-driven, real-time reactive commerce platform built with JavaScript (ES6). It plays nicely with npm, Docker, and React.

![Reaction v.1.x](https://raw.githubusercontent.com/reactioncommerce/reaction-docs/v1.7.0/assets/Reaction-Commerce-Illustration-BG-800px.png)
Expand All @@ -12,7 +11,7 @@

Reaction’s out-of-the-box core features include:

- One step cart and checkout
- One-step cart and checkout
- Order processing
- Payments with Stripe
- Shipping
Expand All @@ -26,52 +25,16 @@ Since anything in our codebase can be extended, overwritten, or installed as a p

# Getting started

### Requirements

Reaction requires Meteor, Git, Mongo DB, OS-specific build tools. For step-by-step instructions, follow the documentation for [OS X](https://docs.reactioncommerce.com/docs/next/installation-osx), [Windows](https://docs.reactioncommerce.com/docs/next/installation-windows) or [Linux](https://docs.reactioncommerce.com/docs/next/installation-linux).

### Install and run with CLI

Install the [Reaction CLI](https://github.com/reactioncommerce/reaction-cli) to get started with Reaction:

```sh
npm install -g reaction-cli
```

Create your store:

```sh
reaction init
cd reaction
reaction
```

Open `localhost:3000`

Learn more on how to [configure your project](https://docs.reactioncommerce.com/reaction-docs/master/configuration).

Having installation issues? Check out our [troubleshooting docs](https://docs.reactioncommerce.com/docs/next/troubleshooting-development).

### Install and run with Docker

You can also run the app locally using [`docker-compose`](https://docs.docker.com/compose/) by running:

```sh
docker network create api.reaction.localhost
docker-compose up
```

Open `localhost:3000`

This will use the `docker-compose.yml` file.
Follow the documentation to install Reaction with [Reaction Platform](https://docs.reactioncommerce.com/docs/installation-reaction-platform) for all operating systems.

To learn more on how to develop on Docker, read our documentation on [developing Reaction on Docker](https://docs.reactioncommerce.com/docs/next/installation-docker-development) and [troubleshooting Docker](https://docs.reactioncommerce.com/docs/next/troubleshooting-development#docker-issues).
> Installing an older version of Reaction? Follow the documentation for installing pre-2.0 Reaction on [OS X](https://docs.reactioncommerce.com/docs/1.16.0/installation-osx), [Windows](https://docs.reactioncommerce.com/docs/1.16.0/installation-windows) or [Linux](https://docs.reactioncommerce.com/docs/1.16.0/installation-linux).
# Get involved

## Read documentation & tutorials

- [Reaction Commerce: Developer documentation](https://docs.reactioncommerce.com)
- [Reaction Design System](http://designsystem.reactioncommerce.com/)
- [Reaction Commerce: API documentation](http://api.docs.reactioncommerce.com)
- [Reaction Commerce engineering blog posts](https://blog.reactioncommerce.com/tag/engineering/)
- [Reaction Commerce YouTube videos](https://www.youtube.com/user/reactioncommerce/videos)
Expand All @@ -86,13 +49,16 @@ To learn more on how to develop on Docker, read our documentation on [developing

:star: Star us on GitHub — it helps!

Want to request a feature? Use our Reaction Feature Requests repository to file a request.
Want to request a feature? Use our [Reaction Feature Requests repository](https://github.com/reactioncommerce/reaction-feature-requests) to file a request.

We love your pull requests! Check our our [`Good First Issue`](https://github.com/reactioncommerce/reaction/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) and [`Help Wanted`](https://github.com/reactioncommerce/reaction/issues?q=label%3A%22help+wanted%22) tags for good issues to tackle.

Pull requests should:

- Pass all pull request Cirlce CI checks: Run `npm run lint` and `reaction test` to make sure you're following the [Reaction Code Style Guide](https://docs.reactioncommerce.com/reaction-docs/master/styleguide) and passing [acceptance tests and unit tests](https://docs.reactioncommerce.com/reaction-docs/master/testing-reaction).
- Pass all Circle CI checks:
- Run `docker-compose run --rm reaction npm run lint` to make sure your code follows [Reaction's ESLint rules](https://github.com/reactioncommerce/reaction-eslint-config).
- Run `docker-compose run --rm reaction reaction test` to run [acceptance tests and unit tests](https://docs.reactioncommerce.com/reaction-docs/master/testing-reaction).
- Make sure you're following the [Reaction Code Style Guide](https://docs.reactioncommerce.com/reaction-docs/master/styleguide) and
- Follow the pull request template.

Get more details in our [Contributing Guide](https://docs.reactioncommerce.com/reaction-docs/master/contributing-to-reaction).
Expand Down
11 changes: 2 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ services:
build:
context: .
target: meteor-dev
command: bash -c "npm install && node ./.reaction/waitForReplica.js && reaction" #TODO; Revert to Meteor NPM. See comment in Dockerfile about Meteor1.7 NPM version issue.
command: bash -c "npm install && node ./.reaction/waitForMongo.js && reaction" #TODO; Revert to Meteor NPM. See comment in Dockerfile about Meteor1.7 NPM version issue.
depends_on:
- mongo-init-replica
- mongo
environment:
MONGO_URL: "mongodb://mongo:27017/reaction"
MONGO_OPLOG_URL: "mongodb://mongo:27017/local"
Expand All @@ -45,13 +45,6 @@ services:
volumes:
- mongo-db:/data/db

# This container's job is just to run the command to initialize the replica set. It will stop after doing that.
mongo-init-replica:
image: mongo:3.6.3
command: 'mongo mongo/reaction --eval "rs.initiate({ _id: ''rs0'', members: [ { _id: 0, host: ''localhost:27017'' } ]})"'
depends_on:
- mongo

volumes:
mongo-db:
reaction_node_modules:
6 changes: 6 additions & 0 deletions imports/collections/schemas/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ export const CartItem = new SimpleSchema({
type: String,
optional: true
},
"productTagIds": {
label: "Product Tags",
type: Array,
optional: true
},
"productTagIds.$": String,
"productVendor": {
label: "Product Vendor",
type: String,
Expand Down
2 changes: 1 addition & 1 deletion imports/collections/schemas/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export const VariantBaseSchema = new SimpleSchema({
* @extends VariantBaseSchema
* @property {VariantBaseSchema[]} options optional
*/
const CatalogVariantSchema = VariantBaseSchema.clone().extend({
export const CatalogVariantSchema = VariantBaseSchema.clone().extend({
"options": {
type: Array,
label: "Variant Options",
Expand Down
6 changes: 6 additions & 0 deletions imports/collections/schemas/orders.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ export const OrderItem = new SimpleSchema({
type: String,
optional: true
},
"productTagIds": {
label: "Product Tags",
type: Array,
optional: true
},
"productTagIds.$": String,
"productVendor": {
label: "Product Vendor",
type: String,
Expand Down
Loading

0 comments on commit f9fd923

Please sign in to comment.