feat: added npm2yarn package (#1347)
This commit is contained in:
@@ -14,11 +14,7 @@ Create an account on Algolia and grab your Application ID and Admin API Key from
|
||||
|
||||
In your Medusa project, install the plugin using your favourite package manager:
|
||||
|
||||
```jsx
|
||||
yarn add medusa-plugin-algolia@canary
|
||||
|
||||
// or
|
||||
|
||||
```bash npm2yarn
|
||||
npm install medusa-plugin-algolia@canary
|
||||
```
|
||||
|
||||
|
||||
@@ -36,18 +36,21 @@ For a full guide to how to set up your development environment for Medusa please
|
||||
In order to get you started with your Gatsby, Contentful, Medusa store you must complete a couple of installations:
|
||||
|
||||
- Install the Medusa CLI
|
||||
|
||||
```bash npm2yarn
|
||||
npm install @medusajs/medusa-cli -g
|
||||
```
|
||||
yarn global add @medusajs/medusa-cli
|
||||
npm install -g @medusajs/medusa-cli
|
||||
```
|
||||
|
||||
- Install the Gatsby CLI
|
||||
|
||||
```bash npm2yarn
|
||||
npm install gatsby-cli -g
|
||||
```
|
||||
yarn global add gatsby-cli
|
||||
npm install -g gatsby-cli
|
||||
```
|
||||
|
||||
- [Create a Contentful account](https://www.contentful.com/sign-up/)
|
||||
- [Install Redis](https://redis.io/topics/quickstart)
|
||||
```
|
||||
|
||||
```bash
|
||||
brew install redis
|
||||
brew services start redis
|
||||
```
|
||||
@@ -144,7 +147,14 @@ In the `/src` directory there are 4 special subdirectories that are added for yo
|
||||
|
||||
#### `/data`
|
||||
|
||||
We will be using two seed scripts to kickstart your development, namely `yarn seed:contentful` and `yarn seed`. Data for these seed scripts are contained in the `/data` directory.
|
||||
We will be using two seed scripts to kickstart your development, namely:
|
||||
|
||||
```bash npm2yarn
|
||||
npm run seed:contentful
|
||||
npm run seed
|
||||
```
|
||||
|
||||
Data for these seed scripts are contained in the `/data` directory.
|
||||
|
||||
When the seed scripts have been executed you will have a Contentful space that holds all the data for your website; this includes content for Pages, Navigtion Menu, etc.
|
||||
|
||||
@@ -227,8 +237,8 @@ Now that we have collected your credentials we are ready to migrate the Contentf
|
||||
|
||||
You can now run:
|
||||
|
||||
```shell
|
||||
yarn migrate:contentful
|
||||
```bash npm2yarn
|
||||
npm run migrate:contentful
|
||||
```
|
||||
|
||||
This script will run each of the migrations in the `contentful-migrations` directory. After it has completed navigate to your Contentful space and click "Content model" in the top navigation bar. You will see that the content types will be imported into your space. Feel free to familiarize yourself with the different types by clicking them and inspecting the different fields that they hold.
|
||||
@@ -237,8 +247,8 @@ This script will run each of the migrations in the `contentful-migrations` direc
|
||||
|
||||
The next step is to seed the Contentful space with some data that can be used to display your ecommerce store's pages and navigation. To seed the database open up your command line and run:
|
||||
|
||||
```shell
|
||||
yarn seed:contentful
|
||||
```bash npm2yarn
|
||||
npm run seed:contentful
|
||||
```
|
||||
|
||||
In your Contentful space navigate to "Content" and you will be able to see the different entries in your space. You can filter the entries by type to, for example, only view Pages:
|
||||
@@ -249,9 +259,9 @@ You will notice that there are not any Products in your store yet and this is be
|
||||
|
||||
To do this open your command line and run:
|
||||
|
||||
```shell
|
||||
yarn seed
|
||||
yarn start
|
||||
```bash npm2yarn
|
||||
npm run seed
|
||||
npm run start
|
||||
```
|
||||
|
||||
This will seed your Medusa database, which will result in `medusa-plugin-contentful` synchronizing data to your Contentful space. Everytime you add or update a product the data will be copied into your Contentful space for further enrichment.
|
||||
@@ -287,7 +297,11 @@ Once `gatsby new` is complete you should rename the `.env.template` file to `.en
|
||||
|
||||
To get your token go to **Settings** > **API Keys** > **Add API key**. Now click save and copy the token specified in the field "Content Delivery API - access token".
|
||||
|
||||
After you have copied the token and your space ID to your `.env`, you can run `yarn start` which will start your Gatsby development server on port 8000.
|
||||
After you have copied the token and your space ID to your `.env`, you can start your Gatsby development server on port 8000 by running:
|
||||
|
||||
```bash npm2yarn
|
||||
npm run start
|
||||
```
|
||||
|
||||
You can now go to https://localhost:8000 to check out your new Medusa store.
|
||||
|
||||
|
||||
@@ -26,11 +26,7 @@ For other installation alternatives, you can head over to Meilisearch's [install
|
||||
|
||||
In order to add the plugin to your medusa project, you will need to first install the plugin using your favorite package manager:
|
||||
|
||||
```bash
|
||||
# yarn
|
||||
yarn add medusa-plugin-meilisearch
|
||||
|
||||
# npm
|
||||
```bash npm2yarn
|
||||
npm install medusa-plugin-meilisearch
|
||||
```
|
||||
|
||||
@@ -83,11 +79,8 @@ The Medusa + MeiliSearch integration opens up a lot of capabilities for creating
|
||||
|
||||
In order to leverage this functionality, you'll need to install the corresponding packages by running:
|
||||
|
||||
```bash
|
||||
# npm
|
||||
```bash npm2yarn
|
||||
npm install react-instantsearch-dom @meilisearch/instant-meilisearch
|
||||
# yarn
|
||||
yarn add react-instantsearch-dom @meilisearch/instant-meilisearch
|
||||
```
|
||||
|
||||
You can then use the MeiliSearch client in your react app:
|
||||
|
||||
@@ -26,8 +26,8 @@ Navigate to users and perform the following steps:
|
||||
|
||||
First, install the plugin using your preferred package manager:
|
||||
|
||||
```
|
||||
yarn add medusa-file-minio
|
||||
```bash npm2yarn
|
||||
npm install medusa-file-minio
|
||||
```
|
||||
|
||||
Then configure your `medusa-config.js` to include the plugin alongside the required options:
|
||||
|
||||
@@ -51,8 +51,8 @@ Upon successfull creation of the user, you are presented with an **Access key ID
|
||||
|
||||
First, install the plugin using your preferred package manager:
|
||||
|
||||
```
|
||||
yarn add medusa-file-s3
|
||||
```bash npm2yarn
|
||||
npm install medusa-file-s3
|
||||
```
|
||||
|
||||
Then configure your `medusa-config.js` to include the plugin alongside the required options:
|
||||
|
||||
@@ -25,8 +25,8 @@ Common integration use cases that can be implemented with Segment include:
|
||||
|
||||
Plugins in Medusa's ecosystem come as separate npm packages, that can be installed from the npm registry.
|
||||
|
||||
```bash
|
||||
yarn add medusa-plugin-segment
|
||||
```bash npm2yarn
|
||||
npm install medusa-plugin-segment
|
||||
```
|
||||
|
||||
After installation open `medusa-config.js` to configure the Segment plugin, by adding it to your project's plugin array and providing the options required by the plugin, namely the write key obtained from the Segment dashboard.
|
||||
|
||||
@@ -3895,8 +3895,8 @@ You don’t have to create a template for every type in the reference. You can s
|
||||
|
||||
In the directory of your Medusa server run the following command to install the SendGrid plugin:
|
||||
|
||||
```bash
|
||||
npm i medusa-plugin-sendgrid
|
||||
```bash npm2yarn
|
||||
npm install medusa-plugin-sendgrid
|
||||
```
|
||||
|
||||
Then, in your `.env` file add the API key you created earlier as well as the send from email:
|
||||
@@ -3945,8 +3945,8 @@ You can also optionally pass the option `localization` if you want to support di
|
||||
|
||||
Run your server now:
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```bash npm2yarn
|
||||
npm run start
|
||||
```
|
||||
|
||||
To test it out, perform an action that would trigger one of the emails being sent. For example, you can use your Medusa storefront to create an order. An email from your SendGrid account will be sent to the customer email.
|
||||
|
||||
@@ -69,7 +69,7 @@ The next step is to install Medusa’s [Slack plugin](https://github.com/medusaj
|
||||
|
||||
Open the terminal in the Medusa server’s directory and run the following command:
|
||||
|
||||
```bash
|
||||
```bash npm2yarn
|
||||
npm install medusa-plugin-slack-notification
|
||||
```
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ Navigate to API in the left sidebar. Generate a new Spaces access key. This shou
|
||||
|
||||
First, install the plugin using your preferred package manager:
|
||||
|
||||
```
|
||||
yarn add medusa-file-spaces
|
||||
```bash npm2yarn
|
||||
npm install medusa-file-spaces
|
||||
```
|
||||
|
||||
Then configure your `medusa-config.js` to include the plugin alongside the required options:
|
||||
|
||||
@@ -28,26 +28,27 @@ First, create a Medusa project using your favorite package manager. You can go a
|
||||
`npx create-medusa-app` will allow you to create a Medusa store engine, a storefront, and Medusa admin in a single command
|
||||
|
||||
```bash
|
||||
# using npx
|
||||
npx create-medusa-app
|
||||
```
|
||||
|
||||
# using yarn
|
||||
Alternatively, using Yarn:
|
||||
|
||||
```bash
|
||||
yarn create medusa-app
|
||||
```
|
||||
|
||||
> When choosing `npx` you are shown different store engine options as part of the setup. For this Strapi tutorial, you should choose `medusa-starter-default`. Optionally, pick a storefront.
|
||||
|
||||
**Use `medusa-cli`**
|
||||
`@medusajs/medusa-cli` is our Command Line Tool for creating the Medusa store engine (alongside many other powerful commands). Use it as such:
|
||||
`@medusajs/medusa-cli` is our Command Line Tool for creating the Medusa store engine (alongside many other powerful commands). First, install it:
|
||||
|
||||
```bash npm2yarn
|
||||
npm install @medusajs/medusa-cli -g
|
||||
```
|
||||
|
||||
Then, initialize a Medusa project:
|
||||
|
||||
```bash
|
||||
# using yarn
|
||||
yarn global add @medusajs/medusa-cli
|
||||
|
||||
# using npm
|
||||
npm install -g @medusajs/medusa-cli
|
||||
|
||||
# initialise a Medusa project
|
||||
medusa new my-medusa-store
|
||||
```
|
||||
|
||||
@@ -87,22 +88,14 @@ Additionally, add Strapi to your list of plugins:
|
||||
|
||||
And finally, install the plugin using your package manager:
|
||||
|
||||
```bash
|
||||
#using yarn
|
||||
yarn add medusa-plugin-strapi
|
||||
|
||||
# using npm
|
||||
```bash npm2yarn
|
||||
npm install medusa-plugin-strapi
|
||||
```
|
||||
|
||||
You've now successfully installed and configured your Medusa store engine. Seed it with data and start it up by running:
|
||||
|
||||
```bash
|
||||
# using npm
|
||||
npm run seed && npm start
|
||||
|
||||
# using yarn
|
||||
yarn seed && yarn start
|
||||
```bash npm2yarn
|
||||
npm run seed && npm run start
|
||||
```
|
||||
|
||||
We'll now turn to the Strapi side of things.
|
||||
@@ -111,15 +104,19 @@ We'll now turn to the Strapi side of things.
|
||||
|
||||
Similar to how you installed Medusa, you can install Strapi using your favorite package manager. Use the `strapi-medusa-template` to create your project. The template is a custom Strapi implementation required for the two systems to work together.
|
||||
|
||||
You can use NPX:
|
||||
|
||||
```bash
|
||||
# using npx
|
||||
npx create-strapi-app@3.6.8 strapi-medusa --template https://github.com/Deathwish98/strapi-medusa-template.git
|
||||
```
|
||||
|
||||
# using yarn
|
||||
Alternatively, using Yarn:
|
||||
|
||||
```bash
|
||||
yarn global add create-strapi-app@3.6.8
|
||||
|
||||
create-strapi-app strapi-medusa --template https://github.com/Deathwish98/strapi-medusa-template.git
|
||||
```
|
||||
|
||||
> Note: The plugin expects node version to be '>= 10.16.0 and <=14.x.x', otherwise it will throw an error.
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ If you don’t have a Medusa server installed yet, you must follow our [quicksta
|
||||
|
||||
In the root of your Medusa server, run the following command to install the stripe plugin:
|
||||
|
||||
```bash
|
||||
```bash npm2yarn
|
||||
npm install medusa-payment-stripe
|
||||
```
|
||||
|
||||
@@ -184,14 +184,14 @@ The integration with stripe must have the following workflow:
|
||||
|
||||
Before you start the implementations you need to install the necessary dependencies. You’ll be using Stripe’s React libraries to show the UI and handle the payment confirmation:
|
||||
|
||||
```bash
|
||||
```bash npm2yarn
|
||||
npm install --save @stripe/react-stripe-js @stripe/stripe-js
|
||||
```
|
||||
|
||||
You’ll also use Medusa’s JS Client to easily call Medusa’s REST APIs:
|
||||
|
||||
```bash
|
||||
npm i @medusajs/medusa-js
|
||||
```bash npm2yarn
|
||||
npm install @medusajs/medusa-js
|
||||
```
|
||||
|
||||
#### Initialize Stripe
|
||||
|
||||
Reference in New Issue
Block a user