Skip to content

Clarify how devDependencies should be used for NPM packages (OEP-67: Standard Tools and Technologies) #615

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 2 commits into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions oeps/best-practices/oep-0067-bp-tools-and-technology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ Frontend Technology Selection
don't unintentionally increase the size of our JavaScript bundles, we utilize BundleWatch
for automated bundle size monitoring.

#. **Development dependencies should be separated into devDependencies**

**Rationale**: To keep installation and deployment of our MFEs as fast as
possible, the "dependencies" field in ``package.json`` should reference only
the packages needed to build the bundle of the MFE (this includes webpack via
frontend-build, as well as any dependencies used in the actual MFE/React
code). Any dependencies used only for testing, linting, formatting, or other
development tasks should be put into "devDependencies" (e.g. Jest, eslint,
TypeScript, ``@types/`` packages, etc.).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how typescript is configured here, but I've had it throw errors at build time if types aren't available. Would that be a problem here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, and I'll have to check how we're doing the build. But normally to keep builds fast, the type checking is done using tsc during the same time when we run the test suite / linter / code formatter / etc., and the build process uses a much faster process to merely strip out the TypeScript annotations without actually parsing them. After all, you don't need to run the linter nor the test suite during the build so neither do you need to type check.


Backend Technology Selection
============================

Expand Down Expand Up @@ -330,6 +340,8 @@ Change History
2024-07-25
==========

* Added "Development dependencies should be separated into devDependencies"
* `Pull request #615 <https://github.com/openedx/open-edx-proposals/pull/615>`_
* Changed guidance on React state/data loading to recommend React Query instead of Redux
* Updated JavaScript/TypeScript guidance
* `Pull request #616 <https://github.com/openedx/open-edx-proposals/pull/616>`_
Expand Down
Loading