Skip to content

"Developer quick start" in Contributing.md instructions #1203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 41 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,70 @@
# Contributing

Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing).

### Before filing an issue
## Before filing an issue

If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/arcgis-rest-js/issues) first. Have you found a new bug? Want to request a new feature? We'd [love](https://github.com/Esri/arcgis-rest-js/issues/new) to hear from you.
If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/arcgis-rest-js/issues) first. Have you found a new bug? Want to request a new feature? We'd [love](https://github.com/Esri/arcgis-rest-js/issues/new) to hear from you.

If you're looking for help you can also post issues on [GIS Stackexchange](http://gis.stackexchange.com/questions/ask?tags=esri-oss).

**Please include the following information in your issue:**

* Browser (or Node.js) version
* a snippet of code
* an explanation of
* what you saw
* what you expected to see
- Browser (or Node.js) version
- a snippet of code
- an explanation of
- what you saw
- what you expected to see

### I want to contribute, what should I work on?
## I want to contribute, what should I work on?

Any open issues are fair game. Even just telling us what you want to see would be extremely helpful!

### Getting a development environment set up
## Development environment

You don't _have to_ but we recommend installing TypeScript, Prettier and EditorConfig extensions for your editor of choice.

* https://code.visualstudio.com/
* https://github.com/Microsoft/TypeScript-Sublime-Plugin
* etc...
- <https://code.visualstudio.com/>
- <https://github.com/Microsoft/TypeScript-Sublime-Plugin>
- etc...

### Development quick start

If you are using ArcGIS REST JS, follow the "Get started" section [in the documentation](https://developers.arcgis.com/arcgis-rest-js/get-started/).

If you are making a change to the ArcGIS REST JS code, follow these steps to get started quickly:

### Running the tests
1. Clone this repository: `git clone [email protected]:Esri/arcgis-rest-js.git`
2. In a terminal, run `npm run dev:bundled`.
3. In a separate terminal, run `npm run serve`.
4. Open <https://localhost:8080/sample.html>.

See the sections below for more details on how to run the tests and other options.

## Running the tests

`@esri/arcgis-rest-js` has a comprehensive test suite built with [Karma](http://karma-runner.github.io/0.12/index.html) and [Jasmine](https://jasmine.github.io/) The tests can be found in `/packages/*/test/`.

The tests also make heavy use of [`fetch-mock`](http://www.wheresrhys.co.uk/fetch-mock/) to mock the underlying `fetch()` implementation for testing.

You can run _all_ the tests with `npm test`.

* `npm run test:chrome:debug` runs the Karma tests in Chrome and watches for changes. In the opened Chrome window you can click "Debug" and refresh the page to enter the debugger for tests.
* `npm run test:node:debug` run the node tests, automatically opening the Chrome (60+) debugger. This is great for debugging the tests while you are working.
- `npm run test:chrome:debug` runs the Karma tests in Chrome and watches for changes. In the opened Chrome window you can click "Debug" and refresh the page to enter the debugger for tests.
- `npm run test:node:debug` run the node tests, automatically opening the Chrome (60+) debugger. This is great for debugging the tests while you are working.

### Formatting commit messages
## Formatting commit messages

We require all commit messages be formatted according to [the Conventional Commits standard.](https://www.conventionalcommits.org/en/v1.0.0/). The automated build and release process uses these commits to determine changes and automatically publish changed packages and update the changelog in each package.

Please refer to [the summary of the Conventional Commits standard](https://www.conventionalcommits.org/en/v1.0.0/#summary) for how to format your commit messages. We also use [`commitlint`](https://commitlint.js.org/#/) to validate commit messages so providing a commit message in an incorrect format will result in a precommit failure.

### Documentation site
## Documentation site

The documentation is published at https://developers.arcgis.com/arcgis-rest-js/ and is maintained ina private repository and managed by the ArcGIS Developer Experience team. The [API reference](https://developers.arcgis.com/arcgis-rest-js/api-reference/) is generated automatically by [TypeDoc](https://typedoc.org/) via the `npm run typedoc` command and the [`typedoc.json` configuration file](./typedoc.json).
The documentation is published at <https://developers.arcgis.com/arcgis-rest-js/> and is maintained in a private repository and managed by the ArcGIS Developer Experience team. The [API reference](https://developers.arcgis.com/arcgis-rest-js/api-reference/) is generated automatically by [TypeDoc](https://typedoc.org/) via the `npm run typedoc` command and the [`typedoc.json` configuration file](./typedoc.json).

If you see any issue with any page on the API Reference, you can fix that by updating the inline documentation comments in this repository. If you have an issue with one of the samples or other guide pages, please [log a documentation issue](https://github.com/Esri/arcgis-rest-js/issues/new?assignees=&labels=Documentation&template=documentation.yml).

#### How to add a new package
### How to add a new package

- In `/packages`, create a new folder with your desired new package name.
- Each package will have it’s own `package.json` and `tsconfig.json`. These can be copied from other packages to maintain the correct configuration. Set the version of your new package at `1.0.0`.
Expand All @@ -65,20 +80,20 @@ If you see any issue with any page on the API Reference, you can fix that by upd
- Run `npm run start` in your sample directory.
- Add a readme describing your sample.

### Watching local source for changes
## Watching local source for changes

You can run the command below in the root of the repo to automatically recompile a package when the raw TypeScript source changes. You can use this in conjunction with [the samples](https://github.com/Esri/arcgis-rest-js-samples?tab=readme-ov-file#local-arcgis-rest-js).

```
```bash
# watch 'request' and rebuild a UMD for the browser
npm run dev -- umd @esri/arcgis-rest-request
npm run dev:bundled

# rebuild ES6 files
npm run dev -- esm @esri/arcgis-rest-request
npm run dev:esm

# rebuild CommonJS
npm run dev -- node @esri/arcgis-rest-request
npm run dev:cjs

# watch all the packages
npm run dev -- umd @esri/*
```
npm run dev
```
30 changes: 30 additions & 0 deletions sample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sample</title>
</head>

<body>
<!-- Map package imports to URLS starting with @esri/... which will get served from the local build of the modules -->
<script type="importmap">
{
"imports": {
"@esri/arcgis-rest-request": "/@esri/arcgis-rest-request/dist/bundled/request.esm.js",
"@esri/arcgis-rest-portal": "/@esri/arcgis-rest-portal/dist/bundled/portal.esm.js"
}
}
</script>

<script type="module">
import { searchItems } from "@esri/arcgis-rest-portal";

let element = document.createElement("pre");
document.body.appendChild(element);

searchItems("water").then((response) => {
element.textContent = JSON.stringify(response, null, 2); // false
});
</script>
</body>
</html>