8000 4.0 build system by patrickarlt · Pull Request #911 · Esri/arcgis-rest-js · GitHub
[go: up one dir, main page]

Skip to content

4.0 build system #911

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 58 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1f3be28
4.0 build system WIP
patrickarlt Sep 5, 2021
a4840ff
merge
patrickarlt Sep 5, 2021
4358363
working build system
patrickarlt Sep 7, 2021
6c4a91d
wip
patrickarlt Sep 7, 2021
3f021a0
co
patrickarlt Sep 7, 2021
cd5d7b7
add fetch package
patrickarlt Sep 7, 2021
1503252
wip
patrickarlt Sep 7, 2021
3a88f72
remove typedoc
patrickarlt Sep 7, 2021
6b85c69
more cleanup
patrickarlt Sep 7, 2021
063617b
remove package locks
patrickarlt Sep 7, 2021
2050f8e
restore typedoc
patrickarlt Sep 7, 2021
c094402
continue cleanup
patrickarlt Sep 7, 2021
27cfeb9
remove old ts-helper for node tests
patrickarlt Sep 7, 2021
b666f63
remove old ts-helper for node tests
patrickarlt Sep 7, 2021
09cf5cc
update engine
patrickarlt Sep 7, 2021
f3b61dd
delete lerna.json
patrickarlt Sep 7, 2021
37cdcda
continue cleanup
patrickarlt Sep 7, 2021
c21711e
Use node-fetch 3.0, fix rollup
patrickarlt Sep 8, 2021
e7ae725
updates to webpack and rollup, add files
patrickarlt Sep 8, 2021
9e8d4cf
Update demos/node-common-js/package.json
patrickarlt Sep 8, 2021
6be7f27
Update package-lock.json
noahmulfinger Sep 9, 2021
1b8edf9
rollup support
patrickarlt Sep 9, 2021
4df1a18
more rollup fixing
patrickarlt Sep 9, 2021
02a1769
clean up
patrickarlt Sep 9, 2021
232b4c9
Merge branch '4.0-build-system' of github.com:Esri/arcgis-rest-js int…
patrickarlt Sep 9, 2021
6ea23d6
revert linting
patrickarlt Sep 9, 2021
b264a72
rollup specific builds
patrickarlt Sep 9, 2021
9cf5763
add wrapper around node-fetch
patrickarlt Sep 9, 2021
1da8715
More WIP
patrickarlt Sep 10, 2021
54f48af
chrome debugging
patrickarlt Sep 10, 2021
63fa944
cleanup skypack check, fix intermittantly failing test
patrickarlt Sep 10, 2021
4a5a64a
Merge branch 'v4.0' into 4.0-build-system
patrickarlt Sep 10, 2021
b802d80
migrate @esri/arcgis-rest-auth, fix browser auth test
patrickarlt Sep 11, 2021
60029d7
auth demo
patrickarlt Sep 11, 2021
3c1e755
migrate portal, service admin and routing
patrickarlt Sep 12, 2021
d52a305
migrate all packages
patrickarlt Sep 12, 2021
2fc29e4
cleanup package.jsons
patrickarlt Sep 13, 2021
e34fa11
attachments demo
patrickarlt Sep 13, 2021
910ae0f
more demo work
patrickarlt Sep 13, 2021
8c58d3d
fix spelling of Vernonia
patrickarlt Sep 13, 2021
d3d6ae5
wrap up demos
patrickarlt Sep 13, 2021
792fe3c
more demos
patrickarlt Sep 14, 2021
8435faa
use import/export type, ultra runner, better rollup
patrickarlt Sep 14, 2021
cd0ab49
format package.jsons
patrickarlt Sep 14, 2021
6c23e01
update actions
patrickarlt Sep 14, 2021
62c9780
fix build script
patrickarlt Sep 14, 2021
766ed16
fix tests, add file attachment node demo, remove data for file/text i…
patrickarlt Sep 14, 2021
1936f6a
use npm 7 in GitHub actions
patrickarlt Sep 14, 2021
dd0a99c
fix build
patrickarlt Sep 14, 2021
0cd5959
upgrade npm in actions
patrickarlt Sep 14, 2021
cfc76cb
fix tests
patrickarlt Sep 14, 2021
8459553
don't fail fast on tests
patrickarlt Sep 14, 2021
2594b60
don't fail fast on tests
patrickarlt Sep 14, 2021
a6f820c
sass
patrickarlt Sep 15, 2021
b194a5c
fix tests
patrickarlt Sep 15, 2021
24ba0a8
deno demo, cleanup
patrickarlt Sep 24, 2021
d1863fc
final cleanup
patrickarlt Sep 24, 2021
d2af66f
fix tests in windows, cleanup test deprecations
patrickarlt Sep 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 0 additions & 20 deletions .eslintrc.js

This file was deleted.

37 changes: 37 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"env": {
"browser": true,
"node": true,
"es2017": true
},
"plugins": ["@typescript-eslint", "import"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint",
"plugin:import/recommended",
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"import/extensions": ["error", "ignorePackages"],

// remove import/no-unresolved once https://github.com/import-js/eslint-plugin-import/issues/2111 is resolved
"import/no-unresolved": "off"
},
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
}
}
}
6 changes: 5 additions & 1 deletion .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [12, 14]
node: [12, 14, 16]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Upgrade npm
run: npm i -g npm@7

- name: Install Dependencies
run: npm install

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/pull-request-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node: [14]
node: [12, 14, 16]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Update to NPM 7 for workspace support
run: npm install -g npm@7

- name: Install Dependencies
run: npm install

Expand Down
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,13 @@ packages/**/test/mocks/**/*.js
packages/**/test/mocks/**/*.map

# Ignore built TypeDoc files
typedoc
typedoc

# Ignore srihash output
srihashes.json

# Prevent caches from ultra runner
**/.ultra.cache.json

# Prevent package locks from npm installs in demos
demos/*/package-lock.json
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
23 changes: 12 additions & 11 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
"version": "0.2.0",
"configurations": [
{
"name": "Attach to `npm run test:node:debug`",
"type": "node",
"request": "launch",
"name": "Debug Node Tests",
"program": "${workspaceRoot}/node_modules/.bin/jasmine",
"args": [
"--config=jasmine.json"
]
"request": "attach",
"port": 9229
},
{
"type": "node",
"request": "launch",
"name": "Debug Changelog Script",
"program": "${workspaceRoot}/support/changelog.js",
"args": ["--config=jasmine.json"]
"type": "pwa-msedge",
"request": "attach",
"name": "Attach to `npm run test:chrome:debug`",
"address": "localhost",
"port": 9333,
"pathMapping": {
"/": "${workspaceRoot}/",
"/base/": "${workspaceRoot}/"
}
}
]
}
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"editor.tabSize": 2
"editor.tabSize": 2,
"javascript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "js"
}
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,34 @@ The documentation is published at http://esri.github.io/arcgis-rest-js/ (source

### Instructions

You can install dependencies (and bootstrap lerna) by cloning the repository and running:
You can install dependencies by cloning the repository and running:

```bash
npm install
```

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

Some useful commands include:
For all packages

- `npm test` runs _all_ the tests and confirms the API is functioning as expected.
- There is also a `Debug Node Tests` configuration in the `.vscode/launch.json` which will run the Node tests in the VS Code debugger.
- `npm run docs:serve` will run the documentation site locally at http://localhost:3000/arcgis-rest-js/
- `npm run build` will created UMD bundles for _all_ the packages
- `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/*`
- `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.
- `npm run build:esm`, `npm run build:cjs`, `npm run build:bundled` - as as the above but only one of our target distributions.
- `npm run dev:esm`, `npm run dev:cjs`, `npm run dev:bundled` - runs the appropriate watch command in all packages.

For a specific package

- `npm run build -w @esri/arcgis-rest-request` - run all builds in a specific workspace
- `npm run dev -w @esri/arcgis-rest-request` - run all dev commands in a specific workspace
- `npm run build:esm -w @esri/arcgis-rest-request` - run the esm build in a specific workspace
- `npm run dev:esm -w @esri/arcgis-rest-request` - run the esm dev command in a specific workspace
- `npm run build:cjs -w @esri/arcgis-rest-request` - run the common js build in a specific workspace
- `npm run dev:cjs -w @esri/arcgis-rest-request` - run the common js dev command in a specific workspace
- `npm run build:bundled -w @esri/arcgis-rest-request` - run the rollup build in a specific workspace
- `npm run dev:bundled -w @esri/arcgis-rest-request` - run the rollup dev command in a specific workspace

### Packages

- [`@esri/arcgis-rest-request`](./packages/arcgis-rest-request/) - Underpins other packages and supports making low-level requests.
- [`@esri/arcgis-rest-auth`](./packages/arcgis-rest-auth) - Provides methods for authenticating named users and applications.
- [`@esri/arcgis-rest-portal`](./packages/arcgis-rest-portal) - Methods for working with ArcGIS Online/Enterprise content and users.
- [`@esri/arcgis-rest-feature-layer`](./packages/arcgis-rest-feature-layer) - Functions for querying and editing features inside of hosted feature layers.
- [`@esri/arcgis-rest-service-admin`](./packages/arcgis-rest-service-admin) - Functions for administering hosted feature services.
Expand Down
9 changes: 5 additions & 4 deletions demos/ago-node-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ This project uses the `commander` module, which streamlines the creation of node

### Installing

Like all the other demo apps, run `npm run bootstrap` from the root.
Like all the other demo apps, run `npm run build` from the root.

### Running

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.

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.
Expand All @@ -19,9 +20,9 @@ Here is a post with information on creating node command line tools: [A Guide to

### Commands

| command | description | example |
| --- | --- | --- |
| `ago search <query>` | search for items | `ago search water` |
| command | description | example |
| ------------------------ | ----------------------------- | ----------------------------------------------------- |
| `ago search <query>` | search for items | `ago search water` 10000 |
| `ago export <id> <file>` | export an item to a json file | `ago export a62cb9d894f145cc89531c096d0012b1 pa.json` |

## Building your own tooling
Expand Down
24 changes: 11 additions & 13 deletions demos/ago-node-cli/ago.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
#!/usr/bin/env node
require('cross-fetch/polyfill');
require('isomorphic-form-data');

/**
* This demo uses the commander module, which streamlines the creation of command-line-applications
*/
const program = require('commander');
const program = require("commander");

program
.version('0.0.1');
program.version("0.0.1");

/**
* Bring in the search command...
*/
const itemSearchCommand = require('./lib/item-search-command');
const itemSearchCommand = require("./lib/item-search-command");

program
.command('search <query>')
.description('Search for items')
.command("search <query>")
.description("Search for items")
.action(function (query) {
console.log(query);
itemSearchCommand.execute(query);
});

const itemExportCommand = require('./lib/item-export-command');
program
.command('export <itemId> <filename>')
.description('Export an item to a json file')
const itemExportCommand = require("./lib/item-export-command");
program
.command("export <itemId> <filename>")
.description("Export an item to a json file")
.action(function (id, filename) {
itemExportCommand.execute(id, filename);
});

program.parse(process.argv);
program.parse(process.argv);
39 changes: 18 additions & 21 deletions demos/ago-node-cli/lib/item-search-command.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/**
* Bring in searchItems fn
*/
Expand All @@ -11,25 +10,23 @@ module.exports = {
execute: function (query) {
// construct the search call..
return searchItems({
searchForm: {
q: query,
start: 1,
num: 10
}
})
.then((response) => {
// if we got results
if (Array.isArray(response.results) && response.results.length) {
console.info(`${response.total} items found for "${query}".`);
response.results.forEach((entry) => {
console.info(`${entry.id} | ${entry.title}`);
})
} else {
console.info(`No results found for "${query}".`);
}
q: query,
start: 1,
num: 10
})
.catch((err) => {
console.error(err);
});
.then((response) => {
// if we got results
if (Array.isArray(response.results) && response.results.length) {
console.info(`${response.total} items found for "${query}".`);
response.results.forEach((entry) => {
console.info(`${entry.id} | ${entry.title}`);
});
} else {
console.info(`No results found for "${query}".`);
}
})
.catch((err) => {
console.error(err);
});
}
}
};
Loading
0