Skip to content
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

Build Milestone: frontend-build migrated into the library #5

Merged
merged 524 commits into from
Jul 24, 2024

Conversation

davidjoy
Copy link
Contributor

@davidjoy davidjoy commented Jul 2, 2024

This PR contains a fully functional version of https://github.com/openedx/frontend-build, including all its commit history.

Beyond the commit history from frontend-build, this PR contains some other changes:

  • It adjusts the github workflows so they're appropriate to this new library and don't conflict with frontend-build.
  • It contains two ADRs of note describing further changes to the repository:
    • 0004, which talks about our plan for how we will migrate other libraries into frontend-base, and
    • 0005, which talks about migrating from Babel, babel-loader, @babel/preset-env, and Browserslist to ts-loader and tsconfig.json.
  • It updates the README to describe how to modify an MFE to use this library locally instead of frontend-build (which works well).
  • It removes some historical files (like openedx.yaml) and cleans up some cruft in general.

adamstankiewicz and others added 30 commits December 21, 2022 14:30
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
chore: Remove irrelevant webpack dev server clauses in production build

fix: Test configuration for typescript

chore: Add documentation for using tsconfig.json in client repos

chore: Update tsconfig.json to use noImplicitAny=false for now

chore: Update tsconfig.json libs, and correct exclude list
…cript

feat: Enable typescript for production builds
fix: Fix and additional documentation for tsconfig
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Bumps [cookiejar](https://github.com/bmeck/node-cookiejar) from 2.1.3 to 2.1.4.
- [Release notes](https://github.com/bmeck/node-cookiejar/releases)
- [Commits](https://github.com/bmeck/node-cookiejar/commits)

---
updated-dependencies:
- dependency-name: cookiejar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
The .github/workflows/self-assign-issue.yml workflow is missing or needs an update to stay in
sync with the current standard for this workflow as defined in the
`.github` repo of the `openedx` GitHub org.
…yml`.

The .github/workflows/add-remove-label-on-comment.yml workflow is missing or needs an update to stay in
sync with the current standard for this workflow as defined in the
`.github` repo of the `openedx` GitHub org.
…d.yml`.

The .github/workflows/add-depr-ticket-to-depr-board.yml workflow is missing or needs an update to stay in
sync with the current standard for this workflow as defined in the
`.github` repo of the `openedx` GitHub org.
* feat: added CSS custom media query support
* refactor: added PostCssCustom media for dev-stage and prod webpack configs

`@edx/frontend-build` now supports custom CSS media queries in order to support media query definitions using CSS variables (not natively supported by CSS). To do so, it uses PostCSS Custom Media to let you define `@custom-media` in CSS following the Custom Media Specification: https://www.w3.org/TR/mediaqueries-5/#at-ruledef-custom-media.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.75.0...v5.76.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
davidjoy added 5 commits July 2, 2024 16:29
Webpack tree shaking depends on “sideEffects” being false in package.json so that it knows that our code has no side effects.  Tree shaking relies on imports/exports to understand what code is in use, so if a file has side effects - not just an export, which it shouldn’t do - then it may be tree shaken mistakenly.  This field indicates that no code in the repository has side effects.
The ADR is about all the libraries we’re going to migrate into frontend-base, not just frontend-build.
Added steps to add `frontend-base` to a local MFE checkout instead of `frontend-build`.  This is very similar to what developers will ultimately do to cut over to `frontend-base` from `frontend-build` in the future.
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 2, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Jul 2, 2024

Thanks for the pull request, @davidjoy!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently unmaintained.

To get help with finding a technical reviewer, tag the community contributions project manager for this PR in a comment and let them know that your changes are ready for review:

  1. On the right-hand side of the PR, find the Contributions project, click the caret in the top right corner to expand it, and check the "Primary PM" field for the name of your PM.
  2. Find their GitHub handle here.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

davidjoy added 6 commits July 3, 2024 09:46
Currently just a list of notes about required/breaking changes in the repo that MFEs will need to address when migrating.
A prior commit removed a peerDependency on react in the top-level package.json.  This meant that react was no longer installed in the node_modules directory.  When eslint runs, that means it encountered this error:

<local path>/frontend-base/cli/test-app/src/Image.tsx
  1:38  error  Unable to resolve path to module 'react'  import/no-unresolved

The test-app (example back in frontend-build) relied on react being installed, since it’s own dependencies weren’t installed.

This commit actually runs npm ci on the test-app, as we should have been doing.  The fact that it wasn’t breaking in the past was a lucky side effect of how peer dependencies work with npm.
Straightening out the library’s ESLint configuration files.  Pulled @edx/eslint-config into the repository as part of this, so we can iterate on it and simplify it for a typescript world independent of how it’s being used in apps today.
The previous commit removes our usage of the @edx/eslint-config, this removes the dependency.
@davidjoy
Copy link
Contributor Author

davidjoy commented Jul 4, 2024

Working on the CI failure. Having some issues getting Jest configured correctly.

davidjoy added 12 commits July 5, 2024 10:18
VSCode was having issues finding the tsconfig.json because frontend-base existed in a larger workspace, and so it was looking for it in the root of the workspace.  This makes it look relative to the actual file trying to use it, which should work regardless of anyone’s workspace structure.
- Now extends from the installed frontend-base, not from its parent.  This makes it act more like a real app.
- Adding jest.config.js to the included files.
The test-app is in this repository, but should otherwise act like an independent app.  This helps keep ESLint from getting confused about whether it should be linting it.  It can lint itself.
The jest config for the plugins directory needs to have a “node” test environment, rather than the “jsdom” test environment used by most test suites.
- The top-level tsconfig should exclude the test-app.
- It should also include the jest config and index.js file.
- It should include the ‘cli’ directory.
- It should exclude the ‘cli/test-app’ directory completely.
This commit changes how we manage jest configs to some extent, and puts a bit more responsibility on the apps consuming our common jest config here in frontend-base.  See the README for more details, but there was no good way to provide mock JS files for SVG and files in the repo here now that we’re using ts-jest instead of babel.
These type definitions are used by consuming apps.  In particular, this includes a type definition for an SVG file so consuming app test suites can understand their own SVG files.

This commit also updates the README to record additional migration steps.
- tsconfig include directories need globs (**/*)
- bumping version of react in test-app to be 17.
- Removing unnecessary parameters to package.json lint script
- using CLI for linting in test-app
@svgr/webpack is not compatible with anything but babel.  It provides a little-used feature that lets developers import SVG files as react components instead of paths.  We’re losing very little by removing it, and are gaining a simpler (and functional) webpack config.
@davidjoy
Copy link
Contributor Author

We've decided to merge this PR, since it's effectively a point-in-time check-in and work has progressed beyond it significantly.

@davidjoy davidjoy merged commit e9e4285 into openedx:main Jul 24, 2024
5 checks passed
@openedx-webhooks
Copy link

@davidjoy 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

davidjoy pushed a commit to davidjoy/frontend-base that referenced this pull request Jul 31, 2024
* docs: plugin hooks

---------

Co-authored-by: Maxwell Frank <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.