Skip to content

Commit e8d1be1

Browse files
4.0 build system (#911)
* 4.0 build system WIP * working build system * wip * co * add fetch package * wip * remove typedoc * more cleanup * remove package locks * restore typedoc * continue cleanup * remove old ts-helper for node tests * remove old ts-helper for node tests * update engine * delete lerna.json * continue cleanup * Use node-fetch 3.0, fix rollup * updates to webpack and rollup, add files * Update demos/node-common-js/package.json Co-authored-by: Noah Mulfinger <[email protected]> * Update package-lock.json * rollup support * more rollup fixing * clean up * revert linting * rollup specific builds * add wrapper around node-fetch * More WIP * chrome debugging * cleanup skypack check, fix intermittantly failing test * migrate @esri/arcgis-rest-auth, fix browser auth test * auth demo * migrate portal, service admin and routing * migrate all packages * cleanup package.jsons * attachments demo * more demo work * fix spelling of Vernonia * wrap up demos * more demos * use import/export type, ultra runner, better rollup * format package.jsons * update actions * fix build script * fix tests, add file attachment node demo, remove data for file/text in tests * use npm 7 in GitHub actions * fix build * upgrade npm in actions * fix tests * don't fail fast on tests * don't fail fast on tests * sass * fix tests * deno demo, cleanup * final cleanup * fix tests in windows, cleanup test deprecations Co-authored-by: Noah Mulfinger <[email protected]>
1 parent 2a6e355 commit e8d1be1

File tree

385 files changed

+58089
-80116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+58089
-80116
lines changed

.eslintrc.js

-20
This file was deleted.

.eslintrc.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 2018,
6+
"sourceType": "module"
7+
},
8+
"env": {
9+
"browser": true,
10+
"node": true,
11+
"es2017": true
12+
},
13+
"plugins": ["@typescript-eslint", "import"],
14+
"extends": [
15+
"eslint:recommended",
16+
"plugin:@typescript-eslint/recommended",
17+
"prettier",
18+
"prettier/@typescript-eslint",
19+
"plugin:import/recommended",
20+
"plugin:import/typescript"
21+
],
22+
"rules": {
23+
"@typescript-eslint/no-explicit-any": "off",
24+
"@typescript-eslint/no-unused-vars": "off",
25+
"@typescript-eslint/ban-types": "off",
26+
"@typescript-eslint/explicit-module-boundary-types": "off",
27+
"import/extensions": ["error", "ignorePackages"],
28+
29+
// remove import/no-unresolved once https://github.com/import-js/eslint-plugin-import/issues/2111 is resolved
30+
"import/no-unresolved": "off"
31+
},
32+
"settings": {
33+
"import/parsers": {
34+
"@typescript-eslint/parser": [".ts", ".tsx"]
35+
}
36+
}
37+
}

.github/workflows/pre-release-tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616

1717
strategy:
18+
fail-fast: false
1819
matrix:
1920
os: [ubuntu-latest, macos-latest, windows-latest]
20-
node: [12, 14]
21+
node: [12, 14, 16]
2122

2223
steps:
2324
- uses: actions/checkout@v2
2425
- uses: actions/setup-node@v2
2526
with:
2627
node-version: ${{ matrix.node }}
2728

29+
- name: Upgrade npm
30+
run: npm i -g npm@7
31+
2832
- name: Install Dependencies
2933
run: npm install
3034

.github/workflows/pull-request-tests.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616

1717
strategy:
18+
fail-fast: false
1819
matrix:
1920
os: [ubuntu-latest]
20-
node: [14]
21+
node: [12, 14, 16]
2122

2223
steps:
2324
- uses: actions/checkout@v2
2425
- uses: actions/setup-node@v2
2526
with:
2627
node-version: ${{ matrix.node }}
2728

29+
- name: Update to NPM 7 for workspace support
30+
run: npm install -g npm@7
31+
2832
- name: Install Dependencies
2933
run: npm install
3034

.gitignore

+10-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,13 @@ packages/**/test/mocks/**/*.js
9898
packages/**/test/mocks/**/*.map
9999

100100
# Ignore built TypeDoc files
101-
typedoc
101+
typedoc
102+
103+
# Ignore srihash output
104+
srihashes.json
105+
106+
# Prevent caches from ultra runner
107+
**/.ultra.cache.json
108+
109+
# Prevent package locks from npm installs in demos
110+
demos/*/package-lock.json

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"semi": true,
1414
"singleQuote": false,
1515
"tabWidth": 2,
16-
"trailingComma": "es5",
16+
"trailingComma": "none",
1717
"useTabs": false,
1818
"vueIndentScriptAndStyle": false
1919
}

.vscode/launch.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8+
"name": "Attach to `npm run test:node:debug`",
89
"type": "node",
9-
"request": "launch",
10-
"name": "Debug Node Tests",
11-
"program": "${workspaceRoot}/node_modules/.bin/jasmine",
12-
"args": [
13-
"--config=jasmine.json"
14-
]
10+
"request": "attach",
11+
"port": 9229
1512
},
1613
{
17-
"type": "node",
18-
"request": "launch",
19-
"name": "Debug Changelog Script",
20-
"program": "${workspaceRoot}/support/changelog.js",
21-
"args": ["--config=jasmine.json"]
14+
"type": "pwa-msedge",
15+
"request": "attach",
16+
"name": "Attach to `npm run test:chrome:debug`",
17+
"address": "localhost",
18+
"port": 9333,
19+
"pathMapping": {
20+
"/": "${workspaceRoot}/",
21+
"/base/": "${workspaceRoot}/"
22+
}
2223
}
2324
]
2425
}

.vscode/settings.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
{
2-
"editor.tabSize": 2
2+
"editor.tabSize": 2,
3+
"javascript.preferences.importModuleSpecifierEnding": "js",
4+
"typescript.preferences.importModuleSpecifierEnding": "js"
35
}

README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,34 @@ The documentation is published at http://esri.github.io/arcgis-rest-js/ (source
4848

4949
### Instructions
5050

51-
You can install dependencies (and bootstrap lerna) by cloning the repository and running:
51+
You can install dependencies by cloning the repository and running:
5252

5353
```bash
5454
npm install
5555
```
5656

5757
Afterward, for a list of all available commands run `npm run`.
5858

59-
Some useful commands include:
59+
For all packages
6060

61-
- `npm test` runs _all_ the tests and confirms the API is functioning as expected.
62-
- There is also a `Debug Node Tests` configuration in the `.vscode/launch.json` which will run the Node tests in the VS Code debugger.
63-
- `npm run docs:serve` will run the documentation site locally at http://localhost:3000/arcgis-rest-js/
64-
- `npm run build` will created UMD bundles for _all_ the packages
65-
- `npm run dev -- <esm|node|umd> <glob>` will re-run the specified build type anytime the source code changes. Example: `npm run dev -- umd @esri/*`
61+
- `npm run build` - builds all distributions of every package with `ultra`, inside each package builds are done in parallel with `npm-run-all`. Output is errors only.
62+
- `npm run build:esm`, `npm run build:cjs`, `npm run build:bundled` - as as the above but only one of our target distributions.
63+
- `npm run dev:esm`, `npm run dev:cjs`, `npm run dev:bundled` - runs the appropriate watch command in all packages.
64+
65+
For a specific package
66+
67+
- `npm run build -w @esri/arcgis-rest-request` - run all builds in a specific workspace
68+
- `npm run dev -w @esri/arcgis-rest-request` - run all dev commands in a specific workspace
69+
- `npm run build:esm -w @esri/arcgis-rest-request` - run the esm build in a specific workspace
70+
- `npm run dev:esm -w @esri/arcgis-rest-request` - run the esm dev command in a specific workspace
71+
- `npm run build:cjs -w @esri/arcgis-rest-request` - run the common js build in a specific workspace
72+
- `npm run dev:cjs -w @esri/arcgis-rest-request` - run the common js dev command in a specific workspace
73+
- `npm run build:bundled -w @esri/arcgis-rest-request` - run the rollup build in a specific workspace
74+
- `npm run dev:bundled -w @esri/arcgis-rest-request` - run the rollup dev command in a specific workspace
6675

6776
### Packages
6877

6978
- [`@esri/arcgis-rest-request`](./packages/arcgis-rest-request/) - Underpins other packages and supports making low-level requests.
70-
- [`@esri/arcgis-rest-auth`](./packages/arcgis-rest-auth) - Provides methods for authenticating named users and applications.
7179
- [`@esri/arcgis-rest-portal`](./packages/arcgis-rest-portal) - Methods for working with ArcGIS Online/Enterprise content and users.
7280
- [`@esri/arcgis-rest-feature-layer`](./packages/arcgis-rest-feature-layer) - Functions for querying and editing features inside of hosted feature layers.
7381
- [`@esri/arcgis-rest-service-admin`](./packages/arcgis-rest-service-admin) - Functions for administering hosted feature services.

demos/ago-node-cli/README.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ This project uses the `commander` module, which streamlines the creation of node
88

99
### Installing
1010

11-
Like all the other demo apps, run `npm run bootstrap` from the root.
11+
Like all the other demo apps, run `npm run build` from the root.
1212

1313
### Running
14+
1415
If you use this demo as a starting point for your own command line package, you would publish it to npm, then on the target systems run `npm install <your-cli-package>`, and it would be available as a command.
1516

1617
But, this is demo code, and thus the package is not "installed" via `npm install ...`, before we can call it as `ago <command> <query>` we need to run `npm link` in the `/demos/ago-node-cli` folder. After you do that, the command should work.
@@ -19,9 +20,9 @@ Here is a post with information on creating node command line tools: [A Guide to
1920

2021
### Commands
2122

22-
| command | description | example |
23-
| --- | --- | --- |
24-
| `ago search <query>` | search for items | `ago search water` |
23+
| command | description | example |
24+
| ------------------------ | ----------------------------- | ----------------------------------------------------- |
25+
| `ago search <query>` | search for items | `ago search water` |
2526
| `ago export <id> <file>` | export an item to a json file | `ago export a62cb9d894f145cc89531c096d0012b1 pa.json` |
2627

2728
## Building your own tooling

demos/ago-node-cli/ago.js

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
#!/usr/bin/env node
2-
require('cross-fetch/polyfill');
3-
require('isomorphic-form-data');
42

53
/**
64
* This demo uses the commander module, which streamlines the creation of command-line-applications
75
*/
8-
const program = require('commander');
6+
const program = require("commander");
97

10-
program
11-
.version('0.0.1');
8+
program.version("0.0.1");
129

1310
/**
1411
* Bring in the search command...
1512
*/
16-
const itemSearchCommand = require('./lib/item-search-command');
13+
const itemSearchCommand = require("./lib/item-search-command");
1714

1815
program
19-
.command('search <query>')
20-
.description('Search for items')
16+
.command("search <query>")
17+
.description("Search for items")
2118
.action(function (query) {
19+
console.log(query);
2220
itemSearchCommand.execute(query);
2321
});
2422

25-
const itemExportCommand = require('./lib/item-export-command');
26-
program
27-
.command('export <itemId> <filename>')
28-
.description('Export an item to a json file')
23+
const itemExportCommand = require("./lib/item-export-command");
24+
program
25+
.command("export <itemId> <filename>")
26+
.description("Export an item to a json file")
2927
.action(function (id, filename) {
3028
itemExportCommand.execute(id, filename);
3129
});
3230

33-
program.parse(process.argv);
31+
program.parse(process.argv);
+18-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Bring in searchItems fn
43
*/
@@ -11,25 +10,23 @@ module.exports = {
1110
execute: function (query) {
1211
// construct the search call..
1312
return searchItems({
14-
searchForm: {
15-
q: query,
16-
start: 1,
17-
num: 10
18-
}
19-
})
20-
.then((response) => {
21-
// if we got results
22-
if (Array.isArray(response.results) && response.results.length) {
23-
console.info(`${response.total} items found for "${query}".`);
24-
response.results.forEach((entry) => {
25-
console.info(`${entry.id} | ${entry.title}`);
26-
})
27-
} else {
28-
console.info(`No results found for "${query}".`);
29-
}
13+
q: query,
14+
start: 1,
15+
num: 10
3016
})
31-
.catch((err) => {
32-
console.error(err);
33-
});
17+
.then((response) => {
18+
// if we got results
19+
if (Array.isArray(response.results) && response.results.length) {
20+
console.info(`${response.total} items found for "${query}".`);
21+
response.results.forEach((entry) => {
22+
console.info(`${entry.id} | ${entry.title}`);
23+
});
24+
} else {
25+
console.info(`No results found for "${query}".`);
26+
}
27+
})
28+
.catch((err) => {
29+
console.error(err);
30+
});
3431
}
35-
}
32+
};

0 commit comments

Comments
 (0)