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

Stop using bower #1830

Merged
merged 3 commits into from
Dec 17, 2024
Merged

Stop using bower #1830

merged 3 commits into from
Dec 17, 2024

Conversation

adamzap
Copy link
Member

@adamzap adamzap commented Dec 17, 2024

bower is maintained but not recommended for use by its developers. Our bower.json file now only includes two dependencies: jquery and jquery-flot. At this point, bower is not doing much to serve the project.

This patch makes the following primary changes:

  • Remove bower.json
  • Remove package.json, which only included bower
  • Put the minified source files for jquery and jquery-flot directly in static/js/lib/
  • Remove the project directories for jquery and jquery-flot.

The following smaller changes are also included:

  • Remove Makefile rules related to bower and jquery-flot
  • Update the "JavaScript libraries" section of the README.rst
  • Remove steps related to package.json from Dockerfile

Part of #1827

`bower` is maintained but not recommended for use by its developers. Our
`bower.json` file now only includes two dependencies: `jquery` and
`jquery-flot`. At this point, `bower` is not doing much to serve the
project.

This patch makes the following primary changes:

- Remove `bower.json`
- Remove `package.json`, which only included `bower`
- Put the minified source files for `jquery` and `jquery-flot` directly
  in `static/js/lib/`
- Remove the project directories for `jquery` and `jquery-flot`.

The following smaller changes are also included:

- Remove `Makefile` rules related to `bower` and `jquery-flot`
- Update the "JavaScript libraries" section of the `README.rst`
- Remove steps related to `package.json` from  `Dockerfile`
Copy link
Member

@pauloxnet pauloxnet left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bmispelon bmispelon left a comment

Choose a reason for hiding this comment

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

This looks great (as usual), I just found one thing that I think can be cleaned up further.

@@ -41,10 +41,6 @@ RUN apt-get update \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# install node dependencies
COPY ./package.json ./package.json
RUN npm install
Copy link
Member

Choose a reason for hiding this comment

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

This was the only usage of npm in the Dockerfile right? I think that means we can drop the npm dependency above (L19)

Copy link
Member

Choose a reason for hiding this comment

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

Good catch. 👀

I checked the code and the same is true for the README.

You can remove the npm install in the README.rst (L3)
https://github.com/django/djangoproject.com/blob/main/README.rst?plain=1#L23

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry I missed that! I pushed 4628411 for the npm references and noticed 147cd76 as well.

Copy link
Member

@bmispelon bmispelon left a comment

Choose a reason for hiding this comment

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

Excellent 👍🏻

@bmispelon bmispelon merged commit 98e20a0 into django:main Dec 17, 2024
4 checks passed
@adamzap adamzap deleted the remove-bower branch December 17, 2024 20:53
@bmispelon
Copy link
Member

Had to revert this because it failed on deploy while doing collectstatic (post-process).

The issue is the line //# sourceMappingURL=jquery.min.map inside jquery.min.js which collectstatic tries to rewrite and fails because the file doesn't exist.

Either we should delete the line, or re-add the .map file.

@adamzap
Copy link
Member Author

adamzap commented Dec 17, 2024

Oh wow, ok. Do you want me to delete the line and push to this branch or a new branch?

@bmispelon
Copy link
Member

Oh wow, ok. Do you want me to delete the line and push to this branch or a new branch?

I'm fine with either. Can a PR be reopened after it's been merged?

(Also I opened a new issue to try and prevent this type of issue from happening in the future: #1831 )

@adamzap
Copy link
Member Author

adamzap commented Dec 17, 2024

I don't think I can re-open this PR. I'll open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants