Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed / Improved

- use yarn in cli installer - @gibkigonzo (#4292)


### Fixed

Expand Down
2 changes: 1 addition & 1 deletion core/scripts/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Manager extends installer.Manager {
*/
initStorefront () {
return this.storefront.goToDirectory()
.then(this.storefront.npmBuild.bind(this.storefront))
.then(this.storefront.depBuild.bind(this.storefront))
.then(this.storefront.runDevEnvironment.bind(this.storefront))
}

Expand Down
46 changes: 23 additions & 23 deletions core/scripts/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,16 @@ class Backend extends Abstract {
}

/**
* Run 'npm install' in backend directory
* Run 'yarn install' in backend directory
*
* @returns {Promise}
*/
npmInstall () {
depInstall () {
return new Promise((resolve, reject) => {
Message.info('Installing backend npm...')
Message.info('Installing backend dep...')

if (shell.exec(`npm i >> ${Abstract.infoLogStream} 2>&1`).code !== 0) {
reject(new Error('Can\'t install backend npm.'))
if (shell.exec(`yarn >> ${Abstract.infoLogStream} 2>&1`).code !== 0) {
reject(new Error('Can\'t install backend dep.'))
}

resolve()
Expand Down Expand Up @@ -280,15 +280,15 @@ class Backend extends Abstract {
}

/**
* Run 'npm run restore'
* Run 'yarn restore'
*
* @returns {Promise}
*/
restoreElasticSearch () {
return new Promise((resolve, reject) => {
Message.info('Restoring data for ElasticSearch...')

if (shell.exec(`npm run restore >> ${Abstract.infoLogStream} 2>&1`).code !== 0) {
if (shell.exec(`yarn restore >> ${Abstract.infoLogStream} 2>&1`).code !== 0) {
reject(new Error('Can\'t restore data for ElasticSearch.'))
}

Expand All @@ -297,15 +297,15 @@ class Backend extends Abstract {
}

/**
* Run 'npm run migrate'
* Run 'yarn migrate'
*
* @returns {Promise}
*/
migrateElasticSearch () {
return new Promise((resolve, reject) => {
Message.info('Migrating data into ElasticSearch...')

if (shell.exec(`npm run migrate >> ${Abstract.infoLogStream} 2>&1`).code !== 0) {
if (shell.exec(`yarn migrate >> ${Abstract.infoLogStream} 2>&1`).code !== 0) {
reject(new Error('Can\'t migrate data into ElasticSearch.'))
}

Expand Down Expand Up @@ -348,7 +348,7 @@ class Backend extends Abstract {
}

/**
* Start 'npm run dev' in background
* Start 'yarn dev' in background
*
* @returns {Promise}
*/
Expand All @@ -357,11 +357,11 @@ class Backend extends Abstract {
Message.info('Starting backend server...')

if (isWindows()) {
if (shell.exec(`start /min npm run dev > ${Abstract.backendLogStream} 2>&1 &`).code !== 0) {
if (shell.exec(`start /min yarn dev > ${Abstract.backendLogStream} 2>&1 &`).code !== 0) {
reject(new Error('Can\'t start dev server.', VUE_STOREFRONT_BACKEND_LOG_FILE))
}
} else {
if (shell.exec(`nohup npm run dev > ${Abstract.backendLogStream} 2>&1 &`).code !== 0) {
if (shell.exec(`nohup yarn dev > ${Abstract.backendLogStream} 2>&1 &`).code !== 0) {
reject(new Error('Can\'t start dev server.', VUE_STOREFRONT_BACKEND_LOG_FILE))
}
}
Expand Down Expand Up @@ -472,24 +472,24 @@ class Storefront extends Abstract {
}

/**
* Run 'npm run build' on storefront
* Run 'yarn build' on storefront
*
* @returns {Promise}
*/
npmBuild () {
depBuild () {
return new Promise((resolve, reject) => {
Message.info('Build storefront npm...')
Message.info('Build storefront dep...')

if (shell.exec(`npm run build > ${Abstract.storefrontLogStream} 2>&1`).code !== 0) {
reject(new Error('Can\'t build storefront npm.', VUE_STOREFRONT_LOG_FILE))
if (shell.exec(`yarn build > ${Abstract.storefrontLogStream} 2>&1`).code !== 0) {
reject(new Error('Can\'t build storefront dep.', VUE_STOREFRONT_LOG_FILE))
}

resolve()
})
}

/**
* Start 'npm run dev' in background
* Start 'yarn dev' in background
*
* @returns {Promise}
*/
Expand All @@ -498,11 +498,11 @@ class Storefront extends Abstract {
Message.info('Starting storefront server...')

if (isWindows()) {
if (shell.exec(`start /min npm run dev >> ${Abstract.storefrontLogStream} 2>&1 &`).code !== 0) {
if (shell.exec(`start /min yarn dev >> ${Abstract.storefrontLogStream} 2>&1 &`).code !== 0) {
reject(new Error('Can\'t start storefront server.', VUE_STOREFRONT_LOG_FILE))
}
} else {
if (shell.exec(`nohup npm run dev >> ${Abstract.storefrontLogStream} 2>&1 &`).code !== 0) {
if (shell.exec(`nohup yarn dev >> ${Abstract.storefrontLogStream} 2>&1 &`).code !== 0) {
reject(new Error('Can\'t start storefront server.', VUE_STOREFRONT_LOG_FILE))
}
}
Expand Down Expand Up @@ -574,15 +574,15 @@ class Manager extends Abstract {
return this.backend.validateM2Integration()
.then(this.backend.cloneRepository.bind(this.backend))
.then(this.backend.goToDirectory.bind(this.backend))
.then(this.backend.npmInstall.bind(this.backend))
.then(this.backend.depInstall.bind(this.backend))
.then(this.backend.createConfig.bind(this.backend))
.then(this.backend.dockerComposeUp.bind(this.backend))
.then(this.backend.importElasticSearch.bind(this.backend))
.then(this.backend.runDevEnvironment.bind(this.backend))
} else {
return this.backend.cloneRepository()
.then(this.backend.goToDirectory.bind(this.backend))
.then(this.backend.npmInstall.bind(this.backend))
.then(this.backend.depInstall.bind(this.backend))
.then(this.backend.createConfig.bind(this.backend))
.then(this.backend.dockerComposeUp.bind(this.backend))
.then(this.backend.restoreElasticSearch.bind(this.backend))
Expand All @@ -603,7 +603,7 @@ class Manager extends Abstract {
initStorefront () {
return this.storefront.goToDirectory()
.then(this.storefront.createConfig.bind(this.storefront))
.then(this.storefront.npmBuild.bind(this.storefront))
.then(this.storefront.depBuild.bind(this.storefront))
.then(this.storefront.runDevEnvironment.bind(this.storefront))
}

Expand Down
13 changes: 1 addition & 12 deletions docs/guide/basics/recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,6 @@ To make it work, you need have Magento 2 OAuth keys configured in your `vue-stor

After this change, you need to restart the `yarn dev` command to take the config changes into consideration by the VS. All the cart actions (add to cart, remove from cart, modify the quantity) are now synchronized directly with Magento 2 for both guest and logged-in clients.

## How to prevent an error "Can’t build storefront npm"

The error, "Can't build storefront npm", appears because npm can't automatically install required modules. To prevent this error, you should manually install those modules before running the installer. It's easy:

```bash
git clone https://github.com/DivanteLtd/vue-storefront.git vue-storefront && cd vue-storefront
npm install
npm install vue-carousel vue-no-ssr
npm run build # check if no errors
npm run installer
```

## How to integrate 3rd party platform? Do you think it could be used with a legacy bespoke PHP eCommerce?

Expand Down Expand Up @@ -240,7 +229,7 @@ If you would like to have a Category filter working with configurable products,
There is an SEO redirects generator for NGINX -> `https://serverfault.com/a/441517` available within the [vue-storefront-api](https://github.com/DivanteLtd/vue-storefront-api/commit/2c7e10b4c4294f222f7a1aae96627d6a0e23f30e). Now you can generate an SEO map redirecting users from the original Magento URLs to Vue Storefront URLs by running:

```bash
npm run seo redirects — —oldFormat=true | false
yarn seo redirects — —oldFormat=true | false
```

Please make sure that `vue-storefront/config/local.json` setting of `useMagentoUrlKeys` is set to `true` and you have ElasticSearch synchronized with the Magento2 instance using the current version of [mage2vuestorefront](https://github.com/DivanteLtd/mage2vuestorefront).
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/basics/ssr-cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ We strongly recommend you DO NOT USE output cache in development mode. By using
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=*
yarn cache clear
yarn cache clear -- --tag=product,category
yarn cache clear -- --tag=P198
yarn cache clear -- --tag=*
```

**Note:** The commands presented above works exactly the same way in the `vue-storefront-api`.
Expand Down
12 changes: 6 additions & 6 deletions docs/guide/cookbook/data-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Vue Storefront uses a data-migration mechanism based on [node-migrate](https://g
### 2. Recipe
1. Run a node script from **Vue Storefront API root path** which is configured out of the box.
```bash
npm run migrate
yarn migrate
```
which runs the migrations in `migrations` folder.

Expand Down Expand Up @@ -370,7 +370,7 @@ We worked in the red rectangle part of the architecture as a preparation for dat

What we did in a simple term, we taught Elasticsearch types and sorts of data(mapping, also known as schema) we will use for Vue Storefront API later on.

Upon running `npm run migrate`, it runs the pre-configured [migration scripts](https://github.com/DivanteLtd/vue-storefront-api/tree/master/migrations) using [node-migrate](https://github.com/tj/node-migrate). If you take a closer look into the migration scripts, you will notice the ultimate js file which is located at [`./src/lib/elastic.js`](https://github.com/DivanteLtd/vue-storefront-api/blob/master/src/lib/elastic.js) that does the actual labor for migration.
Upon running `yarn migrate`, it runs the pre-configured [migration scripts](https://github.com/DivanteLtd/vue-storefront-api/tree/master/migrations) using [node-migrate](https://github.com/tj/node-migrate). If you take a closer look into the migration scripts, you will notice the ultimate js file which is located at [`./src/lib/elastic.js`](https://github.com/DivanteLtd/vue-storefront-api/blob/master/src/lib/elastic.js) that does the actual labor for migration.
If you take one more closer look in the `elastic.js` file, you will also find all the schema files are located under [`./config`](https://github.com/DivanteLtd/vue-storefront-api/tree/master/config) folder.
What those scripts do can be divided into steps as per the file name.
It first creates index from index schema, then import schema from `elastic.schema.[types].json` files. It will then reindex them, and delete temporary index. Finally it will work a few workarounds to deal with deprecated process.
Expand All @@ -386,14 +386,14 @@ If you encountered with the exception as follows during the migration script :
It means you don't have the temporary index `vue_storefront_catalog_temp` which is required.
Solution is :
```bash
npm run restore
yarn restore
```
This will create the necessary temporary index, then the necessary temp index will be deleted by the steps mentioned [above](#_3-peep-into-the-kitchen-what-happens-internally) when the migration is finished

#### Secret 2. Add a new migration script
You might need to write your own migration script. In that case, you can do so by adding a file under the `./migrations` directory though this is not a recommended way. `node-migrate` provides you with the cli command for the purpose as follows :
```bash
npm run migrate create name-of-migration
yarn migrate create name-of-migration
```
This wil create a migration script template under `./migration` folder with the standard naming convention.
[more info](https://github.com/tj/node-migrate#creating-migrations)
Expand Down Expand Up @@ -438,7 +438,7 @@ module.exports.down = function(next) {
```

#### Secret 3. Execute migration multiple times
If you run a migration multiple times using `npm run migrate`, it will only run the migration once and subsequent execution will be ignored and only repeat the result as follows :
If you run a migration multiple times using `yarn migrate`, it will only run the migration once and subsequent execution will be ignored and only repeat the result as follows :

![migration complete](../images/npm-run-migrate-result.png)

Expand Down Expand Up @@ -725,7 +725,7 @@ node --harmony cli.js pages

7. Finally, reindex the Elasticsearch making sure up-to-date with data source in **Vue Storefront API** root path.
```bash
npm run db rebuild
yarn db rebuild
```

### 3. Peep into the kitchen (what happens internally)
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/cookbook/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Ever wonder what happens when you enter into **Vue Storefront** shop? From gatew

1. Go to **Vue Storefront** root path and run the following :
```bash
npm run dev
yarn dev
```

2. Open your browser and go to your development **Vue Storefront** store, for example, [_http://localhost:3000_](http://localhost:3000) if you run it by default.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/cookbook/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ Upon the release of 1.10, we also present a new way of setup and all its sorts f
We will continuously add new features to [`CLI`](https://www.npmjs.com/package/@vue-storefront/cli) as the version goes up.

### 1. Preparation
- You need to have installed [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) on your machine. (or [`yarn`](https://yarnpkg.com/lang/en/docs/install/#debian-stable) if you chose it)
- You need to have installed [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) on your machine and [`yarn`](https://yarnpkg.com/lang/en/docs/install/#debian-stable).

### 2. Recipe
1. Install _Vue Storefront CLI_ package on your machine with `-g` flag as follows :
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/data/data-migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Vue Storefront uses a data-migration mechanism based on [node-migrate](https://g
We use node-migrate, which is pre-configured with npm, so we're using the following alias:

```bash
npm run migrate
yarn migrate
```

which runs the migrations against `migrations` folder.
Expand All @@ -21,7 +21,7 @@ which runs the migrations against `migrations` folder.
You can add a new migration by simply adding a file to the `migrations` directory (not recommended) or using the command line tool:

```bash
npm run migrate create name-of-my-migration
yarn migrate create name-of-my-migration
```

The tool automatically generates the file under the `migrations` folder.
Expand Down
10 changes: 5 additions & 5 deletions docs/guide/installation/production-setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Production setup

If you’d like to start developing sites using Vue Storefront, you should start with the [Installation guide](linux-mac.md). For development purposes, you'll likely use the `yarn install` / `npm run installer` sequence, which will set up Vue Storefront locally using the automated installer and prepared Docker images for having Elasticsearch and Redis support.
If you’d like to start developing sites using Vue Storefront, you should start with the [Installation guide](linux-mac.md). For development purposes, you'll likely use the `yarn install` sequence, which will set up Vue Storefront locally using the automated installer and prepared Docker images for having Elasticsearch and Redis support.

Development mode means you're using a node.js-based server as HTTP service and running the app on the `3000` TCP port. As it's great for local testing, it's not recommended to use the installer and direct-user access to node.js in production configurations.

Expand Down Expand Up @@ -412,7 +412,7 @@ You can easily dump your current VS index using the following command (your loca
```bash
cd vue-storefront-api
rm var/catalog.json
npm run dump
yarn dump
```

Now in the `var/catalog.json` you have your current database dump. Please transfer this file to the server—for example, using the following ssh command:
Expand All @@ -426,9 +426,9 @@ Then, after logging in to your `prod.vuestorefront.io` server as a `vuestorefron

```bash
cd vue-storefront-api
npm run db new
npm run restore2main
npm run db rebuild
yarn db new
yarn restore2main
yarn db rebuild
```

#### Running the Vue Storefront and Vue Storefront API
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/integrations/direct-prices-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ To use this feature, you should also modify `config/local.json` within your `vue
},
```

_Important note_: To use the dynamic Magento 2 prices sync, you should restore the database using `npm run restore` within the `vue-storefront-api` or re-run the `mage2vuestorefront` product sync, because an "ID" field has been added to the `configurable_children` products and it's required for the prices sync.
_Important note_: To use the dynamic Magento 2 prices sync, you should restore the database using `yarn restore` within the `vue-storefront-api` or re-run the `mage2vuestorefront` product sync, because an "ID" field has been added to the `configurable_children` products and it's required for the prices sync.
10 changes: 5 additions & 5 deletions docs/guide/integrations/multistore.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ In the result, you should get:
Then, to use these indexes in Vue Storefront, you should index the database schema using the `vue-storefront-api` db tool:

```bash
npm run db rebuild -- --indexName=vue_storefront_catalog_it
npm run db rebuild -- --indexName=vue_storefront_catalog_de
npm run db rebuild -- --indexName=vue_storefront_catalog
yarn db rebuild -- --indexName=vue_storefront_catalog_it
yarn db rebuild -- --indexName=vue_storefront_catalog_de
yarn db rebuild -- --indexName=vue_storefront_catalog
```

## Vue Storefront and Vue Storefront API configuration
Expand Down Expand Up @@ -154,9 +154,9 @@ By default, the language / store is switched by the URL prefix:
General URL format is:
`http://localhost:3000/{storeCode}`

The storeCode may be switched by ENV variable set before running `npm run dev` / `npm start`:
The storeCode may be switched by ENV variable set before running `yarn dev` / `yarn start`:

- `export STORE_CODE=de && npm run dev` will run the shop with the `de` shop loaded
- `export STORE_CODE=de && yarn dev` will run the shop with the `de` shop loaded

Another option, useful when using multistore mode with the NGINX/varnish mode, is to set the shop code by the `x-vs-store-code` http reqeuest header.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/integrations/totals-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ This process doesn't require much additional configuration:

1. You must have the Magento2 API access configures in the `config/local.json` file of `vue-storefront-api`
2. You must have the "Orders" section marked On within the "Permissions" section of Magento Integration ([see the previous tutorial for the reference on how to set it up](../installation/magento.md)).
3. After the configuration step You just run `npm run o2m` inside your `vue-storefront-api` directory.
3. After the configuration step You just run `yarn o2m` inside your `vue-storefront-api` directory.

![This is the output of o2m after successfull setup](../images/o2m-output.png)
2 changes: 1 addition & 1 deletion docs/guide/upgrade-notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ Now it mirrors `core/` folder structure, which is desired behaviour.

We added the possibility to run the `vue-storefront-api` fully in Docker (previously, just the Elastic and Redis images were present in the `docker-compose.yml`. Please read the [README.md](https://github.com/DivanteLtd/vue-storefront-api) for more details.

**PLEASE NOTE:** We changed the structure of the `elasticsearch` section of the config files, moving `esIndexes` to `elasticsearch.indices` etc. There is an automatic migration that will update your config files automatically by running: `npm run migrate` in the `vue-storefront-api` folder.
**PLEASE NOTE:** We changed the structure of the `elasticsearch` section of the config files, moving `esIndexes` to `elasticsearch.indices` etc. There is an automatic migration that will update your config files automatically by running: `yarn migrate` in the `vue-storefront-api` folder.

### Default storage of the shopping carts and user data moved to localStorage

Expand Down