From 7f0fc2a8218839e41bf8265225688827d1decfcb Mon Sep 17 00:00:00 2001 From: Joseph Samela Date: Fri, 11 Jan 2019 13:43:22 -0500 Subject: [PATCH 1/3] Make package.json valid json object --- doc/tutorials/bundle.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/doc/tutorials/bundle.md b/doc/tutorials/bundle.md index 71bdf080ac..4137514033 100644 --- a/doc/tutorials/bundle.md +++ b/doc/tutorials/bundle.md @@ -72,10 +72,12 @@ You will also need an `index.html` file that will use your bundle. Here is a sim With simple scripts you can introduce the commands `npm run build` and `npm start` to manually build your bundle and watch for changes, respectively. Add the following to the script section in `package.json`: ```json -"scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "parcel index.html", - "build": "parcel build --public-url . index.html" +{ + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "parcel index.html", + "build": "parcel build --public-url . index.html" + } } ``` That's it. Now to run your application, enter From af74a476dca9e8317e19a92d0d0f217a6af73c03 Mon Sep 17 00:00:00 2001 From: Joseph Samela Date: Mon, 14 Jan 2019 10:24:32 -0500 Subject: [PATCH 2/3] show full package.json + emphasize npm init --- doc/tutorials/bundle.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/tutorials/bundle.md b/doc/tutorials/bundle.md index 4137514033..17c6659478 100644 --- a/doc/tutorials/bundle.md +++ b/doc/tutorials/bundle.md @@ -11,7 +11,9 @@ In this tutorial, we will be using [Parcel](https://parceljs.org) to bundle our ## Initial steps -Create a new empty directory for your project and navigate to it by running `mkdir new-project && cd new-project`. Initialize your project using `npm init` and answer the questions asked. +Create a new empty directory for your project and navigate to it by running `mkdir new-project && cd new-project`. Initialize your project with + + npm init Add OpenLayers as dependency to your application with @@ -73,11 +75,17 @@ With simple scripts you can introduce the commands `npm run build` and `npm star ```json { + "name": "test", + "version": "1.0.0", + "description": "", + "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "parcel index.html", "build": "parcel build --public-url . index.html" - } + }, + "author": "", + "license": "ISC" } ``` That's it. Now to run your application, enter From 62288139d6fffc0e1c6c344359c4da8fbeb2d962 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Mon, 14 Jan 2019 18:00:22 +0100 Subject: [PATCH 3/3] Clarify where package.json is created and how start and build are added --- doc/tutorials/bundle.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/tutorials/bundle.md b/doc/tutorials/bundle.md index 17c6659478..c689489534 100644 --- a/doc/tutorials/bundle.md +++ b/doc/tutorials/bundle.md @@ -15,7 +15,7 @@ Create a new empty directory for your project and navigate to it by running `mkd npm init -Add OpenLayers as dependency to your application with +This will create a `package.json` file in your working directory. Add OpenLayers as dependency to your application with npm install ol @@ -71,7 +71,7 @@ You will also need an `index.html` file that will use your bundle. Here is a sim ## Creating a bundle -With simple scripts you can introduce the commands `npm run build` and `npm start` to manually build your bundle and watch for changes, respectively. Add the following to the script section in `package.json`: +With two additional lines in `package.json` you can introduce the commands `npm run build` and `npm start` to manually build your bundle and watch for changes, respectively. The final `package.json` with the two additional commands `"start"` and `"build"` should look like this: ```json {