feat(proxy-server): use tsc
to build dist folder
#5856
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Before this change,
netlify-cms-proxy-server
was built using webpack - which is OK, but not really necessary. This has a few benefits, mentioned originally in #5852:dist/middlewares/whatever
, at their own riskglobals.d.ts
anymoreTest plan
Run existing tests - there's no new code, other than some slightly-modified imports.
Implementation
I had to add a
"types": "src/index.ts"
to netlify-cms-lib-util so that netlify-cms-proxy-server can import from its main module - this seems better to me than importing fromnetlify-cms-lib-util/src/API
anyway. Setting the types to point atsrc
andmain
to point atdist
means that types match up with runtime behaviour. But it could also be worth generating type declaration for lib-util too, down the line. I didn't want to change lib-util much since I'm assuming it has lots of dependencies.I also had to add the
@types/semaphore
dev dependency to lib-util, since it relies onsemaphore
types.I upgraded
netlify-cms-lib-util
to a prod dependency innetlify-cms-proxy-server
since it's no longer bundled with it.Checklist
Please add a
x
inside each checkbox:yarn format
.yarn test
.