diff --git a/README.md b/README.md index 677372e..0ee2c92 100644 --- a/README.md +++ b/README.md @@ -1 +1,48 @@ # ArcGIS REST JS Samples + +This repository contains a variety of samples of different ways to use [ArcGIS REST JS](https://github.com/Esri/arcgis-rest-js). Please see the [samples folder](samples/) for the entire list. Each sample has a README file to explain how to run the sample. + +## Local ArcGIS REST JS + +If you'd like to use a local version of ArcGIS REST JS while running one of the samples, follow these steps. + +### Local ArcGIS REST JS (NPM) + +For samples that use NPM to install ArcGIS REST JS as a dependency, follow these steps. + +1. In the ArcGIS REST JS repo run any relevant build commands for the packages with which you are working. +1. In the terminal, `cd` onto the package you want to link. E.g. `cd packages/arcgis-rest-request`. +1. Run `npm link`. +1. In this repo, `cd` into the demo you want to run and run the `npm link` command for the package you want to link. `npm link @esri/arcgis-rest-request` + +Remember that you must run `npm run build` in the ArcGIS REST JS repository after making changes to see those changes when running the sample. + +To remove the link and use the package from NPM instead of the local one, run `npm install` in the sample folder again. + +### Local ArcGIS REST JS (Browser) + +For samples that use a ` + ``` + + ... to this: + + ```html + + ``` + +## Sample Repository Maintenance + +In order to not need to constantly update the packages, we are not including `package-lock.json` files within samples the use NPM to install dependencies. See [.gitignore](.gitignore). diff --git a/samples/attachments-browser/README.md b/samples/attachments-browser/README.md index 1670b1f..33f8f21 100644 --- a/samples/attachments-browser/README.md +++ b/samples/attachments-browser/README.md @@ -1,7 +1,15 @@ -# Running this demo +# Attachments Browser -1. Make sure you run `npm run build` in the root folder to setup the dependencies -1. `npm start` -1. Visit http://localhost:8080 +## Running this sample -**Note:** The server starts with a special configuration to serve URLs starting with `@esri/arcgis-rest-*` from their respective packages. In your application you will need to change these URLs to point to their respective locations. +For this sample, you do not need to install any dependencies - it uses ArcGIS REST JS from the Unpkg CDN. To run this sample, you just need to host the `index.html` file. There are a variety of ways to do that; one simple way is to use the [serve](https://www.npmjs.com/package/serve) package: + +```bash +npx serve +``` + +### Local ArcGIS REST JS + +If you'd like to use a local version of ArcGIS REST JS, follow the [steps in the parent README](../README.md#local-arcgis-rest-js-browser), updating the script tags in these files as necessary: + +- `index.html` diff --git a/samples/attachments-browser/index.html b/samples/attachments-browser/index.html index 382b833..f71f3ba 100644 --- a/samples/attachments-browser/index.html +++ b/samples/attachments-browser/index.html @@ -1,8 +1,15 @@ -