diff --git a/docs/content/add-plugins/algolia.md b/docs/content/add-plugins/algolia.md index 251703067f..a5d13f5c62 100644 --- a/docs/content/add-plugins/algolia.md +++ b/docs/content/add-plugins/algolia.md @@ -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 ``` diff --git a/docs/content/add-plugins/contentful.md b/docs/content/add-plugins/contentful.md index 5903945b0b..b5be5c4869 100644 --- a/docs/content/add-plugins/contentful.md +++ b/docs/content/add-plugins/contentful.md @@ -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. diff --git a/docs/content/add-plugins/meilisearch.md b/docs/content/add-plugins/meilisearch.md index 0b0b658e28..c9b93b2588 100644 --- a/docs/content/add-plugins/meilisearch.md +++ b/docs/content/add-plugins/meilisearch.md @@ -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: diff --git a/docs/content/add-plugins/minio.md b/docs/content/add-plugins/minio.md index 48bf826508..551149ae6d 100644 --- a/docs/content/add-plugins/minio.md +++ b/docs/content/add-plugins/minio.md @@ -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: diff --git a/docs/content/add-plugins/s3.md b/docs/content/add-plugins/s3.md index c448c55afe..d3059732c0 100644 --- a/docs/content/add-plugins/s3.md +++ b/docs/content/add-plugins/s3.md @@ -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: diff --git a/docs/content/add-plugins/segment.md b/docs/content/add-plugins/segment.md index 37f1766a48..eccf0c414f 100644 --- a/docs/content/add-plugins/segment.md +++ b/docs/content/add-plugins/segment.md @@ -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. diff --git a/docs/content/add-plugins/sendgrid.mdx b/docs/content/add-plugins/sendgrid.mdx index f9cf0a8216..6ff828cb3c 100644 --- a/docs/content/add-plugins/sendgrid.mdx +++ b/docs/content/add-plugins/sendgrid.mdx @@ -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. diff --git a/docs/content/add-plugins/slack.md b/docs/content/add-plugins/slack.md index 3b789b7fb7..de9de6d45a 100644 --- a/docs/content/add-plugins/slack.md +++ b/docs/content/add-plugins/slack.md @@ -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 ``` diff --git a/docs/content/add-plugins/spaces.md b/docs/content/add-plugins/spaces.md index c9952830aa..27d856e030 100644 --- a/docs/content/add-plugins/spaces.md +++ b/docs/content/add-plugins/spaces.md @@ -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: diff --git a/docs/content/add-plugins/strapi.md b/docs/content/add-plugins/strapi.md index 637595a45d..a9d34cd002 100644 --- a/docs/content/add-plugins/strapi.md +++ b/docs/content/add-plugins/strapi.md @@ -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. diff --git a/docs/content/add-plugins/stripe.md b/docs/content/add-plugins/stripe.md index f89003a3f9..4ca268ad95 100644 --- a/docs/content/add-plugins/stripe.md +++ b/docs/content/add-plugins/stripe.md @@ -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 diff --git a/docs/content/admin/quickstart.md b/docs/content/admin/quickstart.md index 4fb4929845..a8fe6c2d28 100644 --- a/docs/content/admin/quickstart.md +++ b/docs/content/admin/quickstart.md @@ -20,16 +20,16 @@ If you’re not very familiar with Medusa’s architecture, you can learn more a ## Install the Admin -Start by cloning the [Admin GitHub repository](https://github.com/medusajs/admin): +Start by cloning the [Admin GitHub repository](https://github.com/medusajs/admin) and changing to the cloned directory: ```bash git clone https://github.com/medusajs/admin medusa-admin +cd medusa-admin ``` -Then, change to the cloned directory and install the dependencies: +Then, install the dependencies: -```bash -cd medusa-admin +```bash npm2yarn npm install ``` @@ -39,14 +39,18 @@ Before running your Medusa admin, make sure that your Medusa server is running. :::tip -To run your Medusa server, go to the directory holding the server and run `npm start`. +To run your Medusa server, go to the directory holding the server and run: + +```bash npm2yarn +npm run start +``` ::: Then, in the directory holding your Medusa admin, run the following to start the development server: -```bash -npm start +```bash npm2yarn +npm run start ``` By default, the admin runs on port 7000. So, in your browser, go to `localhost:7000` to view your admin. @@ -57,7 +61,13 @@ Use your Medusa admin’s user credentials to log in. :::tip -If you installed the demo data when you installed the Medusa server by using the `--seed` option or running `npm run seed`, you can use the email `admin@medusa-test.com` and password `supersecret` to log in. +If you installed the demo data when you installed the Medusa server by using the `--seed` option or running: + +```bash npm2yarn +npm run seed +``` + +You can use the email `admin@medusa-test.com` and password `supersecret` to log in. ::: diff --git a/docs/content/advanced/backend/endpoints/add-admin.md b/docs/content/advanced/backend/endpoints/add-admin.md index 9f14d7b475..cc57d4c72a 100644 --- a/docs/content/advanced/backend/endpoints/add-admin.md +++ b/docs/content/advanced/backend/endpoints/add-admin.md @@ -38,7 +38,11 @@ Now, if you run your server and send a request to `/admin/hello`, you will recei :::note -Custom endpoints are compiled into the `dist` directory of your Backend when you run your server using `medusa develop`, while it’s running, and when you run `npm run build`. +Custom endpoints are compiled into the `dist` directory of your Backend when you run your server using `medusa develop`, while it’s running, and when you run: + +```bash npm2yarn +npm run build +``` ::: diff --git a/docs/content/advanced/backend/endpoints/add-storefront.md b/docs/content/advanced/backend/endpoints/add-storefront.md index 025933be6c..251e8b6584 100644 --- a/docs/content/advanced/backend/endpoints/add-storefront.md +++ b/docs/content/advanced/backend/endpoints/add-storefront.md @@ -38,7 +38,11 @@ Now, if you run your server and send a request to `/store/hello`, you will recei :::note -Custom endpoints are compiled into the `dist` directory of your Backend when you run your server using `medusa develop`, while it’s running, and when you run `npm run build`. +Custom endpoints are compiled into the `dist` directory of your Backend when you run your server using `medusa develop`, while it’s running, and when you run: + +```bash npm2yarn +npm run build +``` ::: diff --git a/docs/content/guides/checkouts.md b/docs/content/guides/checkouts.md index 64c6386b88..b735dd0d31 100644 --- a/docs/content/guides/checkouts.md +++ b/docs/content/guides/checkouts.md @@ -6,7 +6,11 @@ title: Checkouts ## Introduction The purpose of this guide is to describe a checkout flow in Medusa. It is assumed that you've completed our [Quickstart](https://docs.medusajs.com/quickstart/quick-start) or [Tutorial](https://docs.medusajs.com/tutorial/set-up-your-development-environment) and are familiar with the technologies we use in our stack. Additionally, having an understanding of the [core API](https://docs.medusajs.com/api/store/auth) would serve as a great foundation for this walkthrough. -> All code snippets in the following guide, use the JS SDK distributed through **npm**. To install it, run `yarn add @medusajs/medusa-js` or `npm install @medusajs/medusa-js`. +> All code snippets in the following guide, use the JS SDK distributed through **npm**. To install it, run: + +```bash npm2yarn +npm install @medusajs/medusa-js +``` ## Glossary - **Cart**: The Cart contains all the information needed for customers to complete an Order. In the Cart customers gather the items they wish to purchase, they add shipping and billing details and complete payment information. diff --git a/docs/content/guides/file-plugin.md b/docs/content/guides/file-plugin.md index 1f9addeace..0112bdd8ed 100644 --- a/docs/content/guides/file-plugin.md +++ b/docs/content/guides/file-plugin.md @@ -62,7 +62,7 @@ api_secret: "xx" The first step in creating a plugin is to initialize the Node.js project: -```bash +```bash npm2yarn npm init ``` @@ -70,7 +70,7 @@ This command will ask you to fill out your project's metadata, which will eventu Next up, we need to install cloudinary's Node.js SDK. -```bash +```bash npm2yarn npm install cloudinary ``` diff --git a/docs/content/guides/plugins.md b/docs/content/guides/plugins.md index 15d486ff92..2516702c5c 100644 --- a/docs/content/guides/plugins.md +++ b/docs/content/guides/plugins.md @@ -22,7 +22,7 @@ A plugin is essentially a Node.js project of their own. They contain a file in r The first step in creating a plugin is to initialize the Node.js project: -```bash +```bash npm2yarn npm init ``` @@ -88,7 +88,11 @@ Official Medusa plugins can be found within the [mono repo](https://github.com/m Note: For plugins to become a part of the mono repo, we require you to submit a PR request. If approved, we will publish it under the Medusa organisation on Github. -Plugins are distributed as NPM packages making it possible for developers to simply install and use a plugin via `yarn add` or `npm install`. +Plugins are distributed as NPM packages making it possible for developers to simply install and use a plugin via: + +```bash npm2yarn +npm install +``` After installing a plugin using your preferred package manager, it should be added to `medusa-config.js`. We allow you to provide options for plugins. These options can be used for anything ranging from provider requirements such as API keys or custom configuration used in the plugin's logic. These options are injected into the services, subscribers, and APIs of the plugin. @@ -98,8 +102,8 @@ The following steps will install the official Contentful plugin for your Medusa First, we add the plugin as a dependency to your project: -```bash -yarn add medusa-plugin-contentful +```bash npm2yarn +npm install medusa-plugin-contentful ``` ### Step 2: Configuration diff --git a/docs/content/how-to/create-medusa-app.md b/docs/content/how-to/create-medusa-app.md index 9752d7ae02..ef514a8678 100644 --- a/docs/content/how-to/create-medusa-app.md +++ b/docs/content/how-to/create-medusa-app.md @@ -8,12 +8,16 @@ Starting a new e-commerce project just got easier, now with one command. ## Getting started with `create-medusa-app` -Use `create-medusa-app` with your preferred package manager: +Use `create-medusa-app` with npx: + +```bash +npx create-medusa-app +``` + +Or Yarn: ```bash yarn create medusa-app - -npx create-medusa-app ``` Behind the scenes, `create-medusa-app` is populating your database with some initial set of mock data, which helps to interact with Medusa setup intuitively straight away. diff --git a/docs/content/how-to/deploying-admin-on-netlify.md b/docs/content/how-to/deploying-admin-on-netlify.md index c41ae32829..018b99422b 100644 --- a/docs/content/how-to/deploying-admin-on-netlify.md +++ b/docs/content/how-to/deploying-admin-on-netlify.md @@ -12,7 +12,7 @@ This is a guide for deploying Medusa Admin on Netlify. Netlify is a platform tha Install Netlify CLI on your machine using npm: -```shell= +```bash npm2yarn npm install netlify-cli -g ``` @@ -20,7 +20,7 @@ npm install netlify-cli -g Connect to your Netlify account from your terminal: -```shell= +```bash netlify login ``` @@ -34,7 +34,7 @@ The Netlify CLI is used to achieve this. #### Create a new site -```shell= +```bash netlify init ``` @@ -44,7 +44,7 @@ The default build and deploy settings fit the needs of a Gatsby application, so #### Add an environment variable -```shell= +```bash netlify env:set GATSBY_MEDUSA_BACKEND_URL "https://your-medusa-server.com" ``` @@ -54,7 +54,7 @@ The above environment variable should point to your Medusa server. Finally to deploy the admin, commit and push your changes to the repository connected in step 3. -```shell= +```bash git add . git commit -m "Deploy Medusa Admin on Netlify" git push origin main diff --git a/docs/content/how-to/deploying-gatsby-on-netlify.md b/docs/content/how-to/deploying-gatsby-on-netlify.md index 1d2ea7d623..fbc8cbac86 100644 --- a/docs/content/how-to/deploying-gatsby-on-netlify.md +++ b/docs/content/how-to/deploying-gatsby-on-netlify.md @@ -12,7 +12,7 @@ This is a guide for deploying our [Gatsby storefront starter](https://github.com Install Netlify CLI on your machine using npm: -```shell= +```bash npm2yarn npm install netlify-cli -g ``` @@ -20,7 +20,7 @@ npm install netlify-cli -g Connect to your Netlify account from your terminal: -```shell= +```bash netlify login ``` @@ -34,7 +34,7 @@ The Netlify CLI is used to achieve this. #### Create a new site -```shell= +```bash netlify init ``` @@ -44,7 +44,7 @@ The default build and deploy settings fit the needs of a Gatsby application, so #### Add an environment variable -```shell= +```bash netlify env:set GATSBY_MEDUSA_BACKEND_URL "https://your-medusa-server.com" ``` @@ -54,7 +54,7 @@ The above environment variable should point to your Medusa server. Finally to deploy the storefront, commit and push your changes to the repository connected in step 3. -```shell= +```bash git add . git commit -m "Deploy Medusa Admin on Netlify" git push origin main diff --git a/docs/content/how-to/deploying-on-heroku.md b/docs/content/how-to/deploying-on-heroku.md index 4f2dde1191..2d9013ae1d 100644 --- a/docs/content/how-to/deploying-on-heroku.md +++ b/docs/content/how-to/deploying-on-heroku.md @@ -20,13 +20,13 @@ Install Heroku on your machine: **Ubuntu** -```shell= +```bash sudo snap install --classic heroku ``` **MacOS** -```shell= +```bash brew tap heroku/brew && brew install heroku ``` @@ -41,7 +41,7 @@ Download the appropriate installer for your Windows installation: Connect to your Heroku account from your terminal: -```shell= +```bash heroku login ``` @@ -51,7 +51,7 @@ heroku login In your **Medusa project directory** run the following commands to create an app on Heroku and add it as a remote origin. -```shell= +```bash heroku create medusa-test-app heroku git:remote -a medusa-test-app ``` @@ -66,7 +66,7 @@ Medusa requires a Postgres database and a Redis instance to work. These are adde Add a Postgres addon to your Heroku app -```shell= +```bash heroku addons:create heroku-postgresql:hobby-dev ``` @@ -78,7 +78,7 @@ Add a Redis instance to your Heroku app > The addon `redistogo:nano` is free, but Heroku requires you to add a payment method to proceed. -```shell= +```bash heroku addons:create redistogo:nano ``` @@ -88,7 +88,7 @@ You can find more informations, plans and pricing about Redis To Go [here](https Medusa requires a set of environment variables. From you project repository run the following commands:. -```shell= +```bash heroku config:set NODE_ENV=production heroku config:set JWT_SECRET=your-super-secret heroku config:set COOKIE_SECRET=your-super-secret-pt2 @@ -99,7 +99,7 @@ heroku config:set NPM_CONFIG_PRODUCTION=false Additionally, we need to set the buildpack to Node.js -```shell= +```bash heroku buildpacks:set heroku/nodejs ``` @@ -108,25 +108,25 @@ heroku buildpacks:set heroku/nodejs The library we use for connecting to Redis, does not allow usernames in the connection string. Therefore, we need to perform the following commands to remove it. Get the current Redis URL: -```shell= +```bash heroku config:get REDISTOGO_URL ``` You should get something like: -```shell= +```bash redis://redistogo:some_password_123@some.redistogo.com:9660/ ``` Remove the username from the Redis URL: -```shell= +```bash redis://r̶e̶d̶i̶s̶t̶o̶g̶o̶:some_password_123@sole.redistogo.com:9660/ ``` Set the new environment variable `REDIS_URL` -```shell= +```bash heroku config:set REDIS_URL=redis://:some_password_123@sole.redistogo.com:9660/ ``` @@ -138,7 +138,7 @@ Before jumping into the deployment, we need to configure Medusa. Update `module.exports` to include the following: -```javascript= +```js module.exports = { projectConfig: { redis_url: REDIS_URL, @@ -159,7 +159,7 @@ module.exports = { Update `scripts` to include the following: -```json= +```json ... "scripts": { "serve": "medusa start", @@ -175,7 +175,7 @@ Update `scripts` to include the following: Finally, we need to commit and push our changes to Heroku: -```shell= +```bash git add . git commit -m "Deploy Medusa App on Heroku" git push heroku HEAD:master @@ -185,7 +185,7 @@ git push heroku HEAD:master You can explore your Heroku app build logs using the following command in your project directory. -```shell= +```bash heroku logs -n 500000 --remote heroku --tail ``` @@ -193,7 +193,7 @@ heroku logs -n 500000 --remote heroku --tail As an optional extra step, we can create a user for you to use when your admin system is up and running. -```shell= +```bash heroku run -a medusa-test-app -- medusa user -e "some-user@test.com" -p "SuperSecret1234" ``` diff --git a/docs/content/how-to/deploying-on-qovery.md b/docs/content/how-to/deploying-on-qovery.md index ab6312c8e2..23c221384d 100644 --- a/docs/content/how-to/deploying-on-qovery.md +++ b/docs/content/how-to/deploying-on-qovery.md @@ -33,21 +33,21 @@ Our Medusa project needs a bit of configuration to fit the needs of Qovery. First, add the Postgres and Redis database url to your `medusa-config.js`. In Qovery, click on your Medusa app in the environment overview. Navigate to environment variables in the sidebar on the left. Among the secret variables you should find your database urls. They should look something like this: -```javascript= +```bash QOVERY_REDIS_123456789_DATABASE_URL QOVERY_POSTGRESQL_123456789_DATABASE_URL ``` Add these to your `medusa-config.js`. -```javascript= +```js const DATABASE_URL = process.env.QOVERY_POSTGRESQL_123456789_DATABASE_URL const REDIS_URL= process.env.QOVERY_REDIS_123456789_DATABASE_URL ``` Furthermore, update `module.exports` to include the following: -```javascript= +```js module.exports = { projectConfig: { redis_url: REDIS_URL, @@ -70,7 +70,7 @@ module.exports = { We need to add a couple of more environment variables in Qovery. Add the following variables in your Console with an application scope: -```javascript= +```bash JTW_SECRET=something_secret_jwt COOKIE_SECRET=something_secret_cookie ``` @@ -81,7 +81,7 @@ COOKIE_SECRET=something_secret_cookie Update `scripts` to the following: -```json= +```json "scripts": { "serve": "medusa start", "start": "medusa migrations run && medusa start", @@ -102,7 +102,7 @@ In your environment overview in Qovery, deploy your databases one after the othe To initialise your first build Qovery, simply commit and push your changes. -```shell= +```bash git add . git commit -m "chore: Qovery setup" git push origin main diff --git a/docs/content/how-to/headless-ecommerce-store-with-gatsby-contentful-medusa.md b/docs/content/how-to/headless-ecommerce-store-with-gatsby-contentful-medusa.md index 008af173ce..adfddc1311 100644 --- a/docs/content/how-to/headless-ecommerce-store-with-gatsby-contentful-medusa.md +++ b/docs/content/how-to/headless-ecommerce-store-with-gatsby-contentful-medusa.md @@ -38,17 +38,20 @@ If you want to jump straight to the code for this series you can checkout: 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) + ``` brew install redis brew services start redis @@ -60,7 +63,7 @@ Medusa has support for SQLite and PostgreSQL and uses Redis for caching and queu We will make use of `medusa new` to setup your local Medusa server. -```sh +```bash medusa new medusa-contentful-store https://github.com/medusajs/medusa-starter-contentful ``` @@ -146,7 +149,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. @@ -229,8 +239,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. @@ -239,8 +249,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: @@ -251,9 +261,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. @@ -289,7 +299,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. diff --git a/docs/content/how-to/making-your-store-more-powerful-with-contentful.md b/docs/content/how-to/making-your-store-more-powerful-with-contentful.md index 9eced2a235..dbe0f65eb9 100644 --- a/docs/content/how-to/making-your-store-more-powerful-with-contentful.md +++ b/docs/content/how-to/making-your-store-more-powerful-with-contentful.md @@ -39,8 +39,8 @@ module.exports = function (migration, context) { This small snippet will create a content model in your Contentful space with two fields: a title which will be used to name entries in a meaningful manner (i.e. it won't be displayed to customers) and a body which contains the rich text to display. To apply your migration run: -```shell -yarn migrate:contentful --file contentful-migrations/rich-text.js +```bash npm2yarn +npm run migrate:contentful --file contentful-migrations/rich-text.js ``` If you go to your Contentful space and click Content Model you will see that the Rich Text model has been added to your space: @@ -68,8 +68,8 @@ module.exports = function (migration, context) { After migrating your space you are ready create your new contact page: -```shell -yarn migrate:contentful --file contentful-migrations/update-page-module-validation.js +```bash npm2yarn +npm run migrate:contentful --file contentful-migrations/update-page-module-validation.js ``` ## Adding Rich Text to About @@ -197,8 +197,8 @@ module.exports = function (migration, context) { Run the migration: -``` -yarn migrate:contentful --file contentful-migrations/product-add-modules.js +```bash npm2yarn +npm run migrate:contentful --file contentful-migrations/product-add-modules.js ``` ### Adding "Related Products" Tile Section diff --git a/docs/content/how-to/uploading-images-to-minio.md b/docs/content/how-to/uploading-images-to-minio.md index 0bbb77a687..df96e1b730 100644 --- a/docs/content/how-to/uploading-images-to-minio.md +++ b/docs/content/how-to/uploading-images-to-minio.md @@ -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: diff --git a/docs/content/how-to/uploading-images-to-s3.md b/docs/content/how-to/uploading-images-to-s3.md index 418abe016b..12c8a36ff5 100644 --- a/docs/content/how-to/uploading-images-to-s3.md +++ b/docs/content/how-to/uploading-images-to-s3.md @@ -51,8 +51,8 @@ Upon successful 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: diff --git a/docs/content/how-to/uploading-images-to-spaces.md b/docs/content/how-to/uploading-images-to-spaces.md index 71f217a06c..4ad47a48d6 100644 --- a/docs/content/how-to/uploading-images-to-spaces.md +++ b/docs/content/how-to/uploading-images-to-spaces.md @@ -20,8 +20,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: diff --git a/docs/content/quickstart/quick-start.md b/docs/content/quickstart/quick-start.md index 5a466cd195..c41b518a41 100644 --- a/docs/content/quickstart/quick-start.md +++ b/docs/content/quickstart/quick-start.md @@ -15,18 +15,25 @@ You can install Node from the [official website](https://nodejs.org/en/). ## Getting started 1. **Install Medusa CLI** - ```bash + + ```bash npm2yarn npm install -g @medusajs/medusa-cli ``` + 2. **Create a new Medusa project** - ``` + + ```bash medusa new my-medusa-store --seed ``` + 3. **Start your Medusa engine** + ```bash medusa develop ``` + 4. **Use the API** + ```bash curl localhost:9000/store/products | python -m json.tool ``` diff --git a/docs/content/starters/gatsby-medusa-starter.md b/docs/content/starters/gatsby-medusa-starter.md index c60b29d3d4..bd8153c092 100644 --- a/docs/content/starters/gatsby-medusa-starter.md +++ b/docs/content/starters/gatsby-medusa-starter.md @@ -16,17 +16,15 @@ mv .env.template .env.development **Install dependencies** Use your favourite package manager to install dependencies: -```shell -yarn -# or +```bash npm2yarn npm install ``` **Start developing.** Start up the local server: -```shell -yarn start +```bash npm2yarn +npm run start ``` Your site is now running at http://localhost:8000! diff --git a/docs/content/starters/nextjs-medusa-starter.md b/docs/content/starters/nextjs-medusa-starter.md index 9b5d9704f2..ca682547ce 100644 --- a/docs/content/starters/nextjs-medusa-starter.md +++ b/docs/content/starters/nextjs-medusa-starter.md @@ -16,17 +16,15 @@ mv .env.template .env.local **Install dependencies** Use your favourite package manager to install dependencies: -```shell -yarn -# or +```bash npm2yarn npm install ``` **Start developing.** Start up the local server: -```shell -yarn dev +```bash npm2yarn +npm run dev ``` Your site is now running at http://localhost:8000! diff --git a/docs/content/troubleshooting/missing-payment-providers.md b/docs/content/troubleshooting/missing-payment-providers.md index bf06cd9d41..e0ab0ae5c8 100644 --- a/docs/content/troubleshooting/missing-payment-providers.md +++ b/docs/content/troubleshooting/missing-payment-providers.md @@ -19,9 +19,7 @@ const plugins = [ And installing them through your favourite package manager: -```bash -yarn add medusa-payment-stripe -# or +```bash npm2yarn npm install medusa-payment-stripe ``` diff --git a/docs/content/troubleshooting/transaction-error-in-checkout.md b/docs/content/troubleshooting/transaction-error-in-checkout.md index ab1b7f3a8c..2711cf684a 100644 --- a/docs/content/troubleshooting/transaction-error-in-checkout.md +++ b/docs/content/troubleshooting/transaction-error-in-checkout.md @@ -34,4 +34,8 @@ module.exports = { } ``` -> When changing from SQLite to Postgres, you should seed the database again using: `yarn seed` +> When changing from SQLite to Postgres, you should seed the database again using: + +```bash npm2yarn +npm run seed +``` diff --git a/docs/content/tutorial/0-set-up-your-development-environment.md b/docs/content/tutorial/0-set-up-your-development-environment.md index ba0328af8a..5e509faaff 100644 --- a/docs/content/tutorial/0-set-up-your-development-environment.md +++ b/docs/content/tutorial/0-set-up-your-development-environment.md @@ -97,14 +97,8 @@ brew services start redis The final installation to do to get started with Medusa is the Medusa CLI, which is an npm package you can install globally on your computer to get instant access to commands that help you manage and run your Medusa project. As the Medusa CLI is distributed as an npm package it is very easily installed by running: -``` -npm install -g @medusajs/medusa-cli -``` - -We like to use Yarn instead of npm; if you wish to do the same you can install the CLI with: - -``` -yarn global add @medusajs/medusa-cli +```bash npm2yarn +npm install @medusajs/medusa-cli -g ``` ### Text editor diff --git a/www/docs/docusaurus.config.js b/www/docs/docusaurus.config.js index c676f84b95..af865e720b 100644 --- a/www/docs/docusaurus.config.js +++ b/www/docs/docusaurus.config.js @@ -129,6 +129,9 @@ module.exports = { editUrl: "https://github.com/medusajs/medusa/edit/master/www/", path: docsPath, routeBasePath: "/", + remarkPlugins: [ + [require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}], + ], }, theme: { customCss: require.resolve("./src/css/custom.css"), diff --git a/www/docs/package.json b/www/docs/package.json index 3eaf37097f..bad3621291 100644 --- a/www/docs/package.json +++ b/www/docs/package.json @@ -19,6 +19,7 @@ "dependencies": { "@docusaurus/core": "2.0.0-beta.17", "@docusaurus/preset-classic": "2.0.0-beta.17", + "@docusaurus/remark-plugin-npm2yarn": "^2.0.0-beta.18", "@svgr/webpack": "6.2.1", "clsx": "^1.1.1", "docusaurus2-dotenv": "^1.4.0", diff --git a/www/docs/yarn.lock b/www/docs/yarn.lock index c5ce61f56e..564505c36f 100644 --- a/www/docs/yarn.lock +++ b/www/docs/yarn.lock @@ -1605,6 +1605,15 @@ "@types/react" "*" prop-types "^15.6.2" +"@docusaurus/remark-plugin-npm2yarn@^2.0.0-beta.18": + version "2.0.0-beta.18" + resolved "https://registry.yarnpkg.com/@docusaurus/remark-plugin-npm2yarn/-/remark-plugin-npm2yarn-2.0.0-beta.18.tgz#f898f186ffb4d5e7938be050c71be222c55f4d03" + integrity sha512-GmlbPzB8ImH6ey0LhOTe5NOIY30TwVNXarpm63zG1HYEUOT/H8X8w2NQPlT6RyhH9FtDi4bKMzfEP4ImpJGgCQ== + dependencies: + npm-to-yarn "^1.0.1" + tslib "^2.3.1" + unist-util-visit "^2.0.2" + "@docusaurus/theme-classic@2.0.0-beta.17": version "2.0.0-beta.17" resolved "https://registry.yarnpkg.com/@docusaurus/theme-classic/-/theme-classic-2.0.0-beta.17.tgz#1f7a1dd714993819f266ce422d06dd4533d4ab3a" @@ -5585,6 +5594,11 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" +npm-to-yarn@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/npm-to-yarn/-/npm-to-yarn-1.0.1.tgz#6cdb95114c4ff0be50a7a2381d4d16131a5f52df" + integrity sha512-bp8T8oNMfLW+N/fE0itFfSu7RReytwhqNd9skbkfHfzGYC+5CCdzS2HnaXz6JiG4AlK2eA0qlT6NJN1SoFvcWQ== + nprogress@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/nprogress/-/nprogress-0.2.0.tgz#cb8f34c53213d895723fcbab907e9422adbcafb1"