-
Notifications
You must be signed in to change notification settings - Fork 126
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
4.0 build system #911
Conversation
Note that there is some risk in the dual CJS/EMS approach, mainly:
There are a few mitigating approaches to this mainly Approach #2: Isolate state
In general though I think we are OK since the entire library is stateless anyway. The only state we MIGHT use is This might be a concern though for things like |
Additional consideration is this comment in the
Since we use |
All demos have been updated and are working. However |
More additions/fixes
Commands in the In the root: For all packages
For a specific package
|
Codecov Report
@@ Coverage Diff @@
## v4.0 #911 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 139
Lines ? 2380
Branches ? 413
========================================
Hits ? 2380
Misses ? 0
Partials ? 0 Continue to review full report at Codecov.
|
PR summary for review: Breaking Changes
Additions/Changes
Notes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through some of the code and some demos and I have a few comments. This could all be work done separately on the v4 branch though if we want to just get this PR in first.
- Linting-wise, I notice there are a few files that have unused imports. Is the linter not catching that?
packages/arcgis-rest-portal/src/items/add.ts
packages/arcgis-rest-portal/src/items/helpers.ts
packages/arcgis-rest-request/src/federation-utils.ts
- Some of the demos have package-lock.json files. Should those exist since we are using an npm workspace?
- The
browser-es-modules
demo has some errors, like "request
is not defined". It also could use a little clean up because it looks like the JSON is being displayed as HTML. - The
node-es-modules
andnode-common-js
demos are missing start scripts. - The
snowpack
andvite
demo ask users to run npm install, but that creates apackage-lock.json
file that isn't gitignored.
export * from "./app-tokens"; | ||
|
||
export * from "./validate-app-access"; | ||
export { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we are re-exporting here for backwards compatibility? Do we need to do this since we are created a new release with breaking changes? Seems like we could just remove the arcgis-rest-auth
folder altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@noahmulfinger this is the major breaking change from 3.x > 4.x we are mostly doing this to that we don't have to immediately rewrite all tutorials and sections in the developer guide.
], | ||
"*.ts": [ | ||
"prettier --write --parser typescript --tab-width 2 --use-tabs false", | ||
"eslint --project tsconfig.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we switched away from tslint. Any reason? Also, it means we can probably remove all tslint:disable
comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TSLint was deprecated in 2019 https://palantir.github.io/tslint/ and merged with eslint. I there are only a few tslint:disable comments all in the tests which I think are still respected by the parser.
I ran In terms of documentation updates, I'd like to see (And am happy to try to help contribute):
|
I think this is ready to merge. I addressed #911 (comment) and #911 (review) and responded to @noahmulfinger's comments in #911 (comment) and #911 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heroic work @patrickarlt, let's get this merged!
This is a major update and modernization of the build system to resolve a whole slew of things:
fetch
(i.e.IRequestOptions.fetch
)request
andauth
modules Reduce peerDependencies #786Currently the work is only done for
arcgis-rest-request
. This is because we need to add.js
to EVERY file extension to #907 since the module spec requires it. The Node JS tests require this. Once this gets general approval I can go through and add.js
everywhere else.I'll try to summarize the changes here and with inline comments:
npm version --ws
Does not update thedependencies
orpeerDependencies
in the packages likelerna
does. We either have to make a custom script that does this OR uselerna
just for this one command or switch tostandard-version
with some custom processing to also get the changelog tools. I'm open for discussion on this.lerna
have been updated yet.prepare
lifecycle script has been removed from all packages. This should probably get re-added before this gets merged. Or a global"prepare": "npm run build -ws"
in the rootpackage.json
.fetch
inIRequestOptions
. This greatly simplifies just about everything (mostly getting TypeScript checks to pass) These tests have been commented out for now.arcgis-rest-request
now has a dependency onformdata-node
which is an isomorphicFormData
ponyfill for Node and@esri/arcigs-rest-request-fetch
which is basicallycross-fetch
without a browser ponyfill. This remove the requirement for Node users to provide their ownfetch
andFormData
polyfills.setDefaultRequestOptions
now setsDEFAULT_ARCGIS_REQUEST_OPTIONS
onglobalThis
. A newgetDefaultRequestOptions
fetches the defaults. This might avoid an edge case in whichlet DEFAULT_ARCGIS_REQUEST_OPTIONS = {}
got tree shaken out. See https://sgom.es/posts/2020-06-15-everything-you-never-wanted-to-know-about-side-effects/engine
property inpackage.json
set to>=12.16.0
, this is when conditional exports was unflagged https://nodejs.org/api/packages.html#packages_conditional_exportsdist/cjs
dist/esm
dist/umd
package.json
s indist/cjs
anddist/esm
to markt he correct module type for Node.In order to merge this:
.js
extensions to all imports underpackages/*
engines
to allpackage.json
s to match@esri/arcgis-rest-request
main
,module
,types
andexports
in allpackage.json
s to match@esri/arcgis-rest-request
AddAdded where appropriate."type": "commonjs"
or"type": "module"
to everything indemo/*
../../node-modules
"private": true
in theirpackage.jsons