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
Fix webpacker issues #8136
Fix webpacker issues #8136
Conversation
@leio10 Remember the packages folder is duplicated in the design app, so when you do changes in it, do the following: $ rm -rf decidim_app-design/packages
$ cp -R packages decidim_app-design/ |
dev: "https://gitpkg.now.sh/mainio/decidim/packages_dev/dev?feature/split-npm-packages", | ||
prod: "https://gitpkg.now.sh/mainio/decidim/packages_dev/all?feature/split-npm-packages" | ||
dev: "https://gitpkg.now.sh/decidim/decidim/packages_dev/dev", | ||
prod: "https://gitpkg.now.sh/decidim/decidim/packages_dev/all" |
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.
Branch is missing here, add ?develop
to the end of the URLs.
Same thing for the URLs in the package.json
files.
{ | ||
dev: "https://gitpkg.now.sh/#{github_repo}/packages_dev/dev?#{branch}", | ||
prod: "https://gitpkg.now.sh/#{github_repo}/packages_dev/all?#{branch}" | ||
if decidim_gemspec.source.is_a?(Bundler::Source::Rubygems) |
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.
@ahukkanen With this change I'm trying to simplify things as much as possible. My idea here is: if you are using a gem, it should be released and there should be a released npm package with the exactly same version, it doesn't matter the type of version.
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.
@leio10 Yes, isn't it already so? If the gem source is Rubygems (i.e. a released gem), it will refer to the matching NPM packages.
Or did I get something wrong here?
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'm referring that we are now checking for the .dev
suffix to use gitpkg
in that case. I'd like to remove that part if possible.
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.
Ah, that is because the specs that are testing building the gems and installing them locally. In those situations, the source is reported to be "Rubygems" but the NPM packages for those versions are not yet available.
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.
Ah, ok, I'm slowly understanding all the issues, thanks! ❤️
# are installed using file references outside the application root | ||
# where the `package.json` is located at. For more information, see: | ||
# https://github.com/npm/cli/issues/2339 | ||
FileUtils.cp_r("#{gem_path}/packages", rails_app_path) |
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.
If the gems doesn't come from rubygems, just copy the packages
folder from the gem's folder into the app and install it locally.
@ahukkanen What do you think about this approach?
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.
@leio10 I think we discussed this approach already at #8119 (comment).
I think copying the packages
folder is justified only when the gem source is a path. If the gems come from GitHub, we should install the NPM packages also from GitHub.
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 agree with you, but I don't find a better way to do it when having references to other packages:
- Using local references doesn't work.
- Using
gitpkg
is not trustworthy. If you install the gem using the commit123
you need to be sure that all the other packages are from the same commit. That's why I think that copying the folder is the less worst solution.
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.
In my head, I would separate the NPM packages to live their own life compared to the Decidim gems.
So you would never want to reference a single commit from the Decidim repository or Decidim fork for the NPM packages. I think if you want to customize the NPM packages, you need to make a fork of them yourself and reference that fork where you have updated all the references inside the different packages.
I would think that modifying the NPM package's in so much detail that you would have to reference a single commit shouldn't be necessary most times, at least for the time being. They don't contain any running front-end code for Decidim right now, they are mostly for the "essentials" required to manage the packages with Webpacker.
@ahukkanen I've committed some changes to make some tests using the decidim gem from this branch and see if it works properly. It's not a final proposal, just a try to see if I'm able to understand the problem and find the simplest solution. I've added some comments to explain my changes, please let me know your thoughts about them. Regarding the
Without this option, you can be sure that you are always using the right files. |
I also don't like the To solve this, I proposed something at: #8121 (comment) Here is an example implementation of that: If we want to install the packages from git, it is difficult to get all the references correct. I think a proper solution would be relying only on a single dedicated repository for the NPM builds, no matter if Decidim is installed from a git fork referring some other organization. If they want to fork the NPM packages too, they would fork the |
But with the automated package building would you have the ability to use the npm package for the exact commit that your app is pointing to? Copying the |
No, you cannot reference a specific commit that way. Or theoretically you could if we made a build for each and every commit in the Decidim repository but I think that would become ugly pretty soon. And it would come with its own restrictions such as having to wait for the build to become available up to 1-2 hours when the next scheduled run is due (GitHub by the way doesn't guarantee the cron schedule would stick and even if it runs always). As I mentioned above, I would rather think of the NPM dependencies as their own entity outside of the Decidim gems. So outside of the Decidim repository (where core development is done), you would never want to reference a specific commit for the NPM packages. It should be enough that the NPM package version matches the Decidim version.
You are right that when copying But personally I am against this idea because it would require updating the local application's I'm not seeing why I would want to reference that single commit at any point regarding the NPM packages. If some package is not up to date, I would just run I think we just have slightly different point of view regarding this topic. I think the NPM packages and the Decidim gems are detached from each other, not having to match 100% at any given time. You seem to think the opposite about this. |
Yes, I understand your point and agree with it. What concerns me is if it's possible to have issues when installing the gem from Git in your app, even when you are not doing anything weird with npm. Let me give you an example:
That's why I want to keep the commit used by If you want to detach completely the |
@leio10 I think we should change the git branch references for the actual releases. What I thought in https://github.com/mainio/decidim-npm-builds was that there would be e.g. It already does that for the dev verisons. If you check the branches in that repo, there is one version branch for the |
And what comes to the CI failing if it installs the packages with This would mean you just have to run |
Hi @ahukkanen, I feel that we are a bit stuck here. Maybe we can ask @ferblape and @mrcasals to chime in to have more eyes on this. I'll try to explain very briefly the problem we have and the options that we are considering: The problemWe added a We also have to take into account that the app can use the Decidim gem from a local path (dev and test apps), from the released gems or from a git repository ( The solutionsWe all agree that we should publish an We also agree that if we are using the gem from a local folder the best option is to copy the The discussionWe are not able to find a solution for the scenario where the gem is installed from a git repository. We developed three ideas:
|
cb26fdf
to
13cf3f0
Compare
13cf3f0
to
981b2ff
Compare
1759d61
to
924982d
Compare
@leio10 I came up with another possible way to solve this problem which is implemented here: So, what you would need to do with git installations is the following: $ npm i https://github.com/mainio/decidim-npm-local
$ npm exec decidiminstall . After this, every time you run After you've run those, it will always install the exact same versions of the NPM packages that contained in the installed Can you test this yourself and let me know what you think? |
Ok, @ahukkanen I like your idea, I'll try it as soon as possible 👍 |
3ed96b1
to
b68f206
Compare
@ahukkanen Thanks for your great work! ❤️ |
@leio10 Yes, you can fork of course, it's open source as stated in the license. Or create a new repo, as you wish. The idea was that it would be published to NPM and its version number does not have to follow the Decidim releases. FYI: Once you have run those commands above locally, you won't have to change the deployment in any way. Just commit the updated The install script of the local installer that builds the packs runs every time you run |
The only thing that has to change in Decidim is the webpacker install task to install the dependencies using the local installer for git installations. It could be also applied to the file path installations if we want to get rid of the duplicated This might also solve the need to duplicate the |
* develop: (47 commits) New Crowdin updates (#8150) Move the webpacker config override to @decidim/webpacker (#8158) Fix admin stylesheet dynamic imports (#8154) Fix session timeout conflicting with remember me (#7467) Allow to create online meetings without an URL (#8152) Fix verification route issues (#8146) Fix dont save timeout path to session (#8142) Fix access to import CSV results in accountability (#8132) Fix user report notification reported user name (#8130) Allow users to comment and delete their own comments (#8072) New Crowdin updates (#8124) Fix webpacker issues (#8136) Add comments in participatory space presentation page stats block (#8034) Split NPM dependencies to more granular packages (#8121) Metric is not shown when value is zero for blocked and reported users (#8117) Add missing templates translations (#8133) Add missing translation for authorization_modals (#8129) Polls in meetings (#8065) Fix flaky test on initiatives (#8128) Filter participants admin (#8104) ...
🎩 What? Why?
This PR fixes all git paths for npm packages and updates the docs with some recent changes.
📌 Related Issues
Link your PR to an issue
Testing
Describe the best way to test or validate your PR.
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/
.📷 Screenshots
Please add screenshots of the changes you're proposing