Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 6092e88

Browse files
authored
Merge pull request #84 from andygup/master
Fix master branch
2 parents 4e0aab5 + 6916a5c commit 6092e88

11 files changed

+3790
-3523
lines changed

README.md

Lines changed: 13 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
# angular-cli-esri-map
22

3-
This branch contains a simple but complete application that uses the ArcGIS API for JavaScript 4.x, which is an enterprise geospatial API, along with webpack and Angular CLI. It uses arcgis-webpack-plugin to help load ArcGIS JavaScript API modules.
4-
5-
If you would like to create your own Angular CLI project from scratch and incorporate these components, [create a new Angular CLI project](https://cli.angular.io/) and copy the `src/app/` directory of this repo to your new project. You will need to install `arcgis-webpack-plugin`, `@angular-builders/custom-webpack` and `@types/arcgis-js-api` manually, and then you'll need to configure the css in `angular.json` (see the file in this branch for an example).
3+
This branch contains a simple but complete application that uses the ArcGIS API for JavaScript, an enterprise geospatial API, and Angular CLI. It uses esri-loader, a small library that helps load ArcGIS JavaScript API modules (v3.x or v4.x) in non-Dojo applications.
64

75
To use arcgis-webpack-plugin instead of esri-loader to load the ArcGIS API for JavaScript modules, check out the [`@arcgis-webpack-angular`](https://github.com/Esri/angular-cli-esri-map/tree/arcgis-webpack-angular) branch of this repo.
86

9-
If you don't want to use webpack then use `esri-loader` instead by checking out the [`master`](https://github.com/Esri/angular-cli-esri-map) branch of this repo. `esri-loader` lets you lazy load ArcGIS JavaScript API modules without webpack.
7+
If you would like to create your own Angular CLI project from scratch and incorporate these components, [create a new Angular CLI project](https://cli.angular.io/) and copy the `src/app/` directory of this repo to your new project. You will need to install `esri-loader` and `@types/arcgis-js-api` manually.
108

119
## Dependencies
1210

1311
**Note: This repo is only tested to work with the most current version of the following dependencies.**
1412

15-
- Requires Angular and Angular CLI 10 (latest) [Angular CLI 10](https://github.com/angular/angular-cli)
16-
- [ArcGIS API for JavaScript 4.x](https://developers.arcgis.com/javascript/)
17-
- [arcgis-webpack-plugin](https://github.com/Esri/arcgis-webpack-plugin)
18-
- [angular-builders/custom-webpack](https://www.npmjs.com/package/@angular-builders/custom-webpack)
13+
- [Angular CLI](https://github.com/angular/angular-cli)
14+
- [ArcGIS API for JavaScript](https://developers.arcgis.com/javascript/)
15+
- [esri-loader](https://github.com/Esri/esri-loader)
1916
- [ArcGIS API for JavaScript type definitions](https://github.com/Esri/jsapi-resources/tree/master/4.x/typescript) (@types/arcgis-js-api)
2017

2118
## Build your project
2219

2320
### Clone or download this repo
2421

2522
```bash
26-
git clone https://github.com/Esri/angular-cli-esri-map.git
23+
git clone https://github.com/andygup/angular-cli-esri-map.git
2724
```
2825

2926
### Install dependencies
@@ -38,44 +35,10 @@ If you don't want to use webpack then use `esri-loader` instead by checking out
3835
### Run the application locally
3936

4037
```bash
41-
git checkout arcgis-webpack-angular
42-
ng serve --open
43-
```
44-
45-
The app will automatically reload if you change any of the source files. You can shut down the development server with a `Control C` in the terminal any time you wish.
46-
47-
### Working with the View's CSS
48-
49-
For best performance, we recommend using the local copy of the css for the ArcGIS API for JavaScript. You can configure this in `angular.json` and choose from any of the [themes](https://developers.arcgis.com/javascript/latest/guide/styling/):
50-
51-
```json
52-
"styles": [
53-
"src/styles.scss",
54-
"node_modules/arcgis-js-api/themes/light/main.css"
55-
],
56-
```
57-
58-
### Working with secure ArcGIS services
59-
60-
When working with secure ArcGIS services there is additional code that you'll need to get it to work with webpack. If you encounter an error similar to this: `DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope'`, then you'll need to follow the instructions outlined here: https://github.com/Esri/arcgis-webpack-plugin#usage. Add that code to your component and it should resolve the problem. This branch of the repo includes an example that uses workers.
61-
62-
IMPORTANT: be sure to configure the `DEFAULT_WORKER_URL` property to use the same `Major.minor` version used by the `arcgis-webpack-plugin`. You can confirm that version by looking in the header of `node_modules/@arcgis/webpack-plugin/extras/dojo/dojo.js` and you'll see information similar to this:
63-
64-
```js
65-
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
66-
// See https://js.arcgis.com/4.16/esri/copyright.txt for details.
67-
//>>built
68-
```
69-
70-
And, you need to match this version using this pattern within your component:
71-
72-
```js
73-
// Refer to esri-map.component.ts file for a complete version of this code
74-
const DEFAULT_WORKER_URL = "https://js.arcgis.com/4.16/";
75-
const DEFAULT_LOADER_URL = `${DEFAULT_WORKER_URL}dojo/dojo-lite.js`;
38+
ng serve
7639
```
7740

78-
If you are still having problems then open an issue in this repo.
41+
Navigate to http://localhost:4200 to see the app running. The app will automatically reload if you change any of the source files. You can shut down the development server with a `Control C` any time you wish.
7942

8043
### Code scaffolding
8144

@@ -85,13 +48,17 @@ Run `ng generate component component-name` to generate a new component. You can
8548

8649
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
8750

51+
### Running unit tests
52+
53+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
54+
8855
## Contributing
8956

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

9259
## Licensing
9360

94-
Copyright 2020 Esri
61+
Copyright 2019 Esri
9562

9663
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
9764

angular.json

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,20 @@
1515
"prefix": "app",
1616
"architect": {
1717
"build": {
18-
"builder": "@angular-builders/custom-webpack:browser",
18+
"builder": "@angular-devkit/build-angular:browser",
1919
"options": {
20-
"customWebpackConfig": {
21-
"path": "./extra-webpack.config.js"
22-
},
2320
"outputPath": "dist/angular-cli-esri-map",
2421
"index": "src/index.html",
2522
"main": "src/main.ts",
2623
"polyfills": "src/polyfills.ts",
2724
"tsConfig": "tsconfig.app.json",
28-
"optimization": true,
29-
"aot": false,
30-
"vendorChunk": false,
3125
"aot": true,
3226
"assets": [
3327
"src/favicon.ico",
3428
"src/assets"
3529
],
3630
"styles": [
37-
"src/styles.scss",
38-
"node_modules/arcgis-js-api/themes/light/main.css"
31+
"src/styles.scss"
3932
],
4033
"scripts": []
4134
},
@@ -71,7 +64,7 @@
7164
}
7265
},
7366
"serve": {
74-
"builder": "@angular-builders/custom-webpack:dev-server",
67+
"builder": "@angular-devkit/build-angular:dev-server",
7568
"options": {
7669
"browserTarget": "angular-cli-esri-map:build"
7770
},
@@ -88,11 +81,8 @@
8881
}
8982
},
9083
"test": {
91-
"builder": "@angular-builders/custom-webpack:karma",
84+
"builder": "@angular-devkit/build-angular:karma",
9285
"options": {
93-
"customWebpackConfig": {
94-
"path": "./extra-webpack.config.js"
95-
},
9686
"main": "src/test.ts",
9787
"polyfills": "src/polyfills.ts",
9888
"tsConfig": "tsconfig.spec.json",

0 commit comments

Comments
 (0)