Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #386 from DivanteLtd/develop
Browse files Browse the repository at this point in the history
Release v1.11
  • Loading branch information
andrzejewsky authored Dec 20, 2019
2 parents 8b7ded1 + a67f2fe commit 875ed27
Show file tree
Hide file tree
Showing 147 changed files with 12,879 additions and 6,983 deletions.
58 changes: 58 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module.exports = {
root: true,
env: { jest: true, node: true, es6: true},
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2018,
sourceType: 'module'
},
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: [
'standard',
'plugin:@typescript-eslint/recommended'
],
plugins: ['vue-storefront', '@typescript-eslint'],
// add your custom rules here
rules: {
'@typescript-eslint/no-var-requires': 1,
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/camelcase': 0,
semi: 'off',
'@typescript-eslint/semi': 0,
'@typescript-eslint/member-delimiter-style': ['error', { 'multiline': { 'delimiter': 'comma', 'requireLast': false }, 'singleline': { 'delimiter': 'comma' } }],
'@typescript-eslint/no-empty-interface': 1,
'@typescript-eslint/no-use-before-define': 1,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/class-name-casing': 1,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/no-var-requires': 0,
'handle-callback-err': 1,
'prefer-promise-reject-errors': 0,
'import/no-duplicates': ['warning'],
// allow paren-less arrow functions
'arrow-parens': 0,
'prefer-arrow-callback': 1,
// allow async-await
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'no-restricted-imports': [2, { paths: ['lodash-es'] }],
'vue-storefront/no-corecomponent-import': 'error',
'vue-storefront/no-corecomponent': 'error',
'vue-storefront/no-corepage-import': 'error',
'vue-storefront/no-corepage': 'error',
'no-console': 0,
'no-unused-vars': 1
},
overrides: [
{
// @todo check if this is closed https://github.com/typescript-eslint/typescript-eslint/issues/342
// This is an issue with interfaces so we need to wait until it fixed.
files: ['core/**/*.ts'],
rules: {
'no-undef': 1
}
}
]
};
31 changes: 31 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Node CI

on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [10.x, 12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: yarn lint
run: |
yarn
yarn lint
env:
CI: true
- name: yarn build
run: |
yarn build
env:
CI: true

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ api_test.sh
package-lock.json
src/config.json
config/local.json
config/certs/*.pem
var/magento2-sample-data/
.migrate
*.iml
/docker/elasticsearch/data/
!/docker/elasticsearch/data/.gitkeep
/docker/elasticsearch7/data/
!/docker/elasticsearch7/data/.gitkeep
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ jobs:
- yarn build
node_js: '10'

- &unit
stage: Test
script: yarn test:unit
name: "NodeJS 10 unit tests"
node_js: "10"
- <<: *build
node_js: '12'

41 changes: 40 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.11.0] - 2019.12.20

### Fixed

- Fixed some smaller issues with graphql so that it is now working again with the fronted - #350
- Replaced the old `crop` function call which has been removed from Sharp image processor - @grimasod (#381)


## [1.11.0-rc.1] - 2019.10.03

### Added
- Experimental Elastic 7 support - @pkarw (#342)
- Output cache support with tagging and cache invalidate requests forwarding - @pkarw @resubaka (https://github.com/DivanteLtd/vue-storefront/issues/3367, #333)
- Constant for Mailchimp subscription status - @KonstantinSoelch (#294)
- mage2vs import now has optional `--generate-unique-url-keys` parameter which defaults to `false` to enable/disable the url key generation with name and id for categories - @rain2o (#232)
- `extensions/elastic-stock` module added which is a drop-in replacement for `stock`; the difference is that it's getting the stock information from Elastic, not from e-Commerce backend directly; to use it - please just make sure your `config/local.json` file has `elastic-stock` in the `registeredExtensions` collection; then please make sure in the `vue-storefront` to change the `config.stock.ednpoint` from `http://<your-api-host>/api/stock` to `http://<your-api-host>/api/ext/elastic-stock`
- Added eslint config from vue-storefront so we have the same config and in both repos typescript support - @resubaka (#320)
- Added jest support - @resubaka (#321)
- Added caching factory and action factory for the image endpoint. This gives the possibility to use other services for caching or image processing - @resubaka (#317, #315)
- Added support for tax calculation where the values from customer_tax_class_ids is used - @resubaka (#307)
- The `db` context object - passed to every api endpoint now has two usefull methods: `getElasticClient` and `getRedisClient` for accesing the data stores - @pkarw (#328)
- The `lib/utils` got two new methods `getStoreCode(req: Express.Request)` and `getStoreView(code: string)` for getting the current multistore context from `vue-storefront` frontend requests - @pkarw

### Removed
- The `scripts/seo.js` tool has been removed, the legacy `migrations` scripts have been removed, the unused legacy extensions (`gls-parcelshop-dk`, `postnord-parcelshop-dk`) - @pkarw (#342)

### Fixed
- The way Elastic and Redis clients have been fixed and code duplication removed across the app - @pkarw (#327)
- The `product.price_*` fields have been normalized with the backward compatibility support (see `config.tax.deprecatedPriceFieldsSupport` which is by default true) - @pkarw (#289)
- The `product.final_price` field is now being taken into product price calcualtion. Moreover, we've added the `config.tax.finalPriceIncludesTax` - which is set to `true` by default. All the `price`, `original_price` and `special_price` fields are calculated accordingly. It was required as Magento2 uses `final_price` to set the catalog pricing rules after-prices - @pkarw (#289)
- Force ES connections to use protocol config option - @cewald (#303, #304)
- Better handling of HTTP error codes provided by API client - #3151

### Changed
- Error responses for mailchimp - @andrzejewsky (#3337)
- Replaced function arguments to object destructuring in `calculateProductTax` - @andrzejewsky (#3337)
- Refactor `taxcalc.js` similar to frontend - @gibkigonzo (#356)

## [1.10.0] - 2019.08.12

### Added
Expand All @@ -16,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Extensions have ability to modify Elasticsearch results. - @grimasod (#269)
- Refactored Travis build config - @Tjitse-E (#273)
- Multistore support for `magento1`-platform using `magento1-vsbridge` - @cewald (#276)
- Support self signed certificates - @lukeromanowicz (#287)

### Changed
- Sharp dependency has been updated. *It might require reinstalling yarn dependencies* - @lukeromanowicz
Expand Down Expand Up @@ -56,7 +95,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Support unicode characters in order requests - @lukeromanowicz (#201)
- TravisCI configured for building and linting - @lukeromanowicz (#204)
- Use Redis database from configuration in mage2vs - @Cyclonecode (#211)
- Requests with invalid body result in HTTP code 400 instead of 500 - @AndreiBelokopytov (#220)
- Requests with invalid body result in HTTP code 400 instead of 500 - @AndreiBelokopytov (#220)
- `src/models/order.schema.json` was moved to `src/models/order.schema.js` to support regex transformation - @lukeromanowicz (#201)

## [1.8.4] - 2019.04.17
Expand Down
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,68 @@ A [Kibana](https://www.elastic.co/products/kibana) service is available to explo

At first access it will ask to specify an index pattern, insert `vue_storefront*`

**Note:** Kibana is not provided with the Elastic 7 docker file. Please install it on your own when needed or check the [`es-head`](https://chrome.google.com/webstore/detail/elasticsearch-head/ffmkiejjmecolpfloofpjologoblkegm) Chrome plugin.

## Elastic 7 support

By default, Vue Storefront API docker files and config are based on Elastic 5.6. We plan to change the default Elastic version to 7 with the 1.11 stable release. As for now, the [Elastic 7 support](https://github.com/DivanteLtd/vue-storefront-api/pull/342) is marked as **experimental**.

**How to use it?**

In order to use the new Elastic 7 please make sure your `vue-storefront-api` has been checked out from the [PR#342](https://github.com/DivanteLtd/vue-storefront-api/pull/342) branch.
To start the Elastic 7 docker service please use the `docker-compose.elastic7.yml` file provided:

```bash
docker-compose -f docker-compose.elastic7.yml up
```

Then, please do change the `config/local.json` to start using the new Elastic API. Key properties in the `elasticsearch` section are: `indexTypes` and `apiVersion` (to be set to 7.1). If you're using the multistore configuration please make sure you adjusted the `storeViews.*.elasticsearch` section as well - per each separate store.

```json
"elasticsearch": {
"host": "localhost",
"port": 9200,
"protocol": "http",
"min_score": 0.01,
"indices": [
"vue_storefront_catalog",
"vue_storefront_catalog_de",
"vue_storefront_catalog_it"
],
"indexTypes": [
"product",
"category",
"cms_block",
"cms_page",
"attribute",
"taxrule",
"review"
],
"apiVersion": "7.1"
}
```

Starting from [Elasitc 6 and 7](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html) we can have **just single** document type per single index. Vue Storefront used to have `product`, `category` ... types defined in the `vue_storefront_catalog`.

From now on, we're using the separate indexes per each entity type. The convention is: `${indexName}_${entityType}`. If your' **logical index name** is `vue_storefront_catalog` then it will be mapped to the **physical indexes** of: `vue_storefront_catalog_product`, `vue_storefront_catalog_category` ...

To take the advantage of this new logical->physical index distinction we've provided new Elastic tools: `db7`, `migrate7`, `dump7`, `restore7` tools. They can be used exactly the same way [like the old tools](https://docs.vuestorefront.io/guide/data/database-tool.html) were. The only distinction is that they work on separate indexes.

**Create new index**

Before restoreing or importing data you might want to create a new Elastic index with the proper data types/schema applied. You can run just the `yarn db7 new` command in order to do that.

**Restore the data**

After you ran the docker file and have Elastic7 up and running you might want to:

a) restore the demo data by running `yarn restore7` and `yarn restore7_it; yarn restore7_de` for default multistores. The data is restored from `var/catalog_product.json`, `var/catalog_category.json` and so on...

b) import the data from Magento to proper physical indexes. To do so, currently you can do this only with [mage2vuestorefront](https://github.com/DivanteLtd/mage2vuestorefront/pull/96).

**Note:** After 1.11 stable release (around November, 2019) we'll **replace** the standard tools: `db`, `migrate`, `dump`, `restore` with the Elastic 7 equivalents and it will become the default.


## API access
Catalog API calls are compliant with ElasticSearch (it works like a filtering proxy to ES). More on ES queries: [ElasticSearch queries tutorial](http://okfnlabs.org/blog/2013/07/01/elasticsearch-query-tutorial.html)

Expand Down Expand Up @@ -94,6 +156,24 @@ NOTE: `npm` users will still have to install the dependencies individually in th

## Reviews
To use review feature you need to install custom module for Magento 2: [Divante ReviewApi](https://github.com/DivanteLtd/magento2-review-api)
By default new reviews will be added with status "Pending".
```json
"review": {
"defaultReviewStatus": 2
},
```

## Output Cache
Vue Storefront API supports output cache for catalog operations. Cache is tagged and can by dynamically invalidated. Please find the details how to configure it [in our docs](https://docs.vuestorefront.io/guide/basics/ssr-cache.html).

You can manually clear the Redis cache for specific tags by running the following command:

```bash
npm run cache clear
npm run cache clear -- --tag=product,category
npm run cache clear -- --tag=P198
npm run cache clear -- --tag=*
```

## Running initial Magento2 import

Expand Down Expand Up @@ -141,6 +221,11 @@ You can use the following command to run a delta indexer for a specific storevie
yarn mage2vs productsdelta --store-code=de
```

## Self signed certificates

Often in non production environment other services are using self signed certificates for secure connection.
You can easily setup the application to trust them by putting them in config/certs directory.

License
-------

Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
[
'@babel/preset-env', {
targets: {
node: "8"
node: "10"
}
}
]
Expand Down
Empty file added config/certs/.gitkeep
Empty file.
Loading

0 comments on commit 875ed27

Please sign in to comment.