From 9559572b0547a3e55bef189bd99dcc2a88075513 Mon Sep 17 00:00:00 2001 From: Luca Ban Date: Sat, 13 Jul 2019 19:28:22 +0900 Subject: [PATCH 1/5] Add info how to install locally Fixes #2720 --- docs/04-tutorial.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/04-tutorial.md b/docs/04-tutorial.md index acbe9930ddb..b15d0ee4aa1 100755 --- a/docs/04-tutorial.md +++ b/docs/04-tutorial.md @@ -127,6 +127,31 @@ rollup --config rollup.config.dev.js rollup --config rollup.config.prod.js ``` +### Using Rollup locally + +When working with multiple environments or in a team, it's often smart to add Rollup as a _local_ dependency. This way you don't have to remember (or remind team members) to install Rollup globally and you can make sure everyone is using the same version. + +To install Rollup locally you can simply do: + +```console +npm i -D rollup +// OR yarn -D add rollup +``` + +Now you can run it inside the root folder of your project like so: + +```console +./node_modules/.bin/rollup --config +``` + +In this case it's best to just add this command as a script to your `package.json`: + +```console + "scripts": { + "build": "./node_modules/.bin/rollup --config" + } +``` + ### Using plugins So far, we've created a simple bundle from an entry point and a module imported via a relative path. As you build more complex bundles, you'll often need more flexibility – importing modules installed with NPM, compiling code with Babel, working with JSON files and so on. From 182b813633ab2d9230f175cdb9b83ff72b10a0a1 Mon Sep 17 00:00:00 2001 From: Luca Ban Date: Sat, 13 Jul 2019 19:30:17 +0900 Subject: [PATCH 2/5] =?UTF-8?q?typo=20=F0=9F=A6=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/04-tutorial.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/04-tutorial.md b/docs/04-tutorial.md index b15d0ee4aa1..c8a1c79ee37 100755 --- a/docs/04-tutorial.md +++ b/docs/04-tutorial.md @@ -146,10 +146,12 @@ Now you can run it inside the root folder of your project like so: In this case it's best to just add this command as a script to your `package.json`: -```console +```json +{ "scripts": { "build": "./node_modules/.bin/rollup --config" } +} ``` ### Using plugins From 211892e7040ab1714fb242741b0008aa3cbb666c Mon Sep 17 00:00:00 2001 From: Luca Ban Date: Thu, 18 Jul 2019 20:15:32 +0900 Subject: [PATCH 3/5] =?UTF-8?q?change=20"./node=5Fmodules/.bin/rollup"=20w?= =?UTF-8?q?ith=20"rollup"=20=F0=9F=92=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/04-tutorial.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/04-tutorial.md b/docs/04-tutorial.md index c8a1c79ee37..8e3cfc55748 100755 --- a/docs/04-tutorial.md +++ b/docs/04-tutorial.md @@ -141,15 +141,16 @@ npm i -D rollup Now you can run it inside the root folder of your project like so: ```console -./node_modules/.bin/rollup --config +npm run rollup --config +// OR yarn rollup --config ``` -In this case it's best to just add this command as a script to your `package.json`: +In this case it's usually a good idea to also add a script to your `package.json`, so the whole team uses the correct build command: ```json { "scripts": { - "build": "./node_modules/.bin/rollup --config" + "build": "npm run rollup --config" } } ``` From 61ceefbfafacc0fb41aea30b3976e6488dc36094 Mon Sep 17 00:00:00 2001 From: Luca Ban Date: Fri, 19 Jul 2019 09:35:15 +0900 Subject: [PATCH 4/5] =?UTF-8?q?change=20`npm=20run`=20with=20`npx`=20?= =?UTF-8?q?=F0=9F=99=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/04-tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/04-tutorial.md b/docs/04-tutorial.md index 8e3cfc55748..4f0665da906 100755 --- a/docs/04-tutorial.md +++ b/docs/04-tutorial.md @@ -141,7 +141,7 @@ npm i -D rollup Now you can run it inside the root folder of your project like so: ```console -npm run rollup --config +npx rollup --config // OR yarn rollup --config ``` @@ -150,7 +150,7 @@ In this case it's usually a good idea to also add a script to your `package.json ```json { "scripts": { - "build": "npm run rollup --config" + "build": "npx rollup --config" } } ``` From 3ec5a3b023ff2b93376abafa8aae16984457c784 Mon Sep 17 00:00:00 2001 From: Andrew Powell Date: Sun, 11 Aug 2019 09:51:50 -0400 Subject: [PATCH 5/5] docs: update verbiage and apply suggestions --- docs/04-tutorial.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/04-tutorial.md b/docs/04-tutorial.md index 4f0665da906..73b3e811300 100755 --- a/docs/04-tutorial.md +++ b/docs/04-tutorial.md @@ -127,34 +127,46 @@ rollup --config rollup.config.dev.js rollup --config rollup.config.prod.js ``` -### Using Rollup locally +### Installing Rollup locally -When working with multiple environments or in a team, it's often smart to add Rollup as a _local_ dependency. This way you don't have to remember (or remind team members) to install Rollup globally and you can make sure everyone is using the same version. +When working within teams or distributed environments it can be wise to add Rollup as a _local_ dependency. Installing Rollup locally prevents the requirement that multiple contributors install Rollup separately as an extra step, and ensures that all contributors are using the same version of Rollup. -To install Rollup locally you can simply do: +To install Rollup locally with NPM: ```console -npm i -D rollup -// OR yarn -D add rollup +npm install rollup --save-dev ``` -Now you can run it inside the root folder of your project like so: +Or with Yarn: + +```console +yarn -D add rollup +``` + +After installing, Rollup can be run within the root directory of your project: ```console npx rollup --config -// OR yarn rollup --config ``` -In this case it's usually a good idea to also add a script to your `package.json`, so the whole team uses the correct build command: +Or with Yarn: + +```console +yarn rollup --config +``` + +Once installed, it's common practice to add a single build script to `package.json`, providing a convenient command for all contributors. e.g. ```json { "scripts": { - "build": "npx rollup --config" + "build": "rollup --config" } } ``` +_Note: Once installed locally, both NPM and Yarn will resolve the dependency's bin file and execute Rollup when called from a package script._ + ### Using plugins So far, we've created a simple bundle from an entry point and a module imported via a relative path. As you build more complex bundles, you'll often need more flexibility – importing modules installed with NPM, compiling code with Babel, working with JSON files and so on.