-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
New Assets Build Tool (Assets Manager) #17262
Conversation
# Conflicts: # src/OrchardCore.Modules/OrchardCore.AdminDashboard/Assets.json # src/OrchardCore.Modules/OrchardCore.AdminMenu/Assets.json # src/OrchardCore.Modules/OrchardCore.AdminMenu/wwwroot/Scripts/admin-menu-icon-picker.js # src/OrchardCore.Modules/OrchardCore.Media/ResourceManifestOptionsConfiguration.cs # src/OrchardCore.Modules/OrchardCore.Resources/package.json
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.
src/OrchardCore.Modules/OrchardCore.AdminDashboard/Assets2.json
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AdminDashboard/Assets2.json
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.AdminMenu/package-lock.json
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Flows/wwwroot/Scripts/flows.edit.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Zoltán Lehóczky <zoltan.lehoczky@lombiq.com>
…MS/OrchardCore into skrypt/asset-build-tool
@Skrypt is there a need to remove the old |
Yes, you do a gît clean -xdf to clean everything |
I expect that, thanks |
@Skrypt When I do
Is that expected, e.g. if corepack is enabled? |
I think the issue is that You will need to uninstall it before and let Corepack install it per "project folder". |
On that machine I only installed Visual Studio and Node. As corepack seems to be available automatically, I was thinking |
Yes, you need to execute But the strange part is that it is failing on pnpm which is only used by OrchardCore.Commerce. We use Yarn with OC. Unless you are trying to make this asset manager work with OC.Commerce I don't see why it is failing on pnpm. |
Also, you need to stop using NPM with OC. You need to start using Yarn equivalent commands else it will add unwanted package-lock.json files everywhere. And from an interesting stackoverflow page they seems to suggest to do also:
To fix the issue. |
I forgot that I've used |
That doesn't fix the error for me. Note that |
I don't really understand how all this Node stuff is working, but I can run |
Have you tried using a terminal with administrator privilege's? Corepack has been introduced to allow to manage package managers for those who uses multiple versions of them for different projects. It becomes pretty much unmanageable over time if you have projects that uses Yarn and pnpm and that these projects only compiles with a specific version of them. Here, by not using Corepack and the proper version of Yarn it will install ; we can't predict if it will compile exactly the same as the CI does. Which will eventually leads into issues when submitting PR's. But not only that, but you want to have reproducible builds to avoid having issues from having a different compilation outcome. |
Thank you for your detailed help. The file 'C:\Program Files\nodejs\pnpm' didn't exist on my machine, it's in '%appdata%\npm'. If I run the command with admin permissions, it will create the same batch files in the program files folder, but I don't see anything related to the working folder (the OC root folder in our case). Looks the same for me as when I was using corepack in the npm folder, as both directories are in the path environment variable. Anyway, it's working as described. Maybe we should add a note about admin permissions on Windows. |
@Skrypt this PR introduced a problem. By default it is not generating the How to generate these file using the new setup? |
I created issue #17522 for tracking |
|
I'm looking at your path there and it is:
Which is 2 distinct paths: c:\Users\georg\source\repos\OrchardCMS\OrchardCore\src\OrchardCore.Themes\TheBlogTheme\wwwroot\assets\ C:\Users\georg\source\repos\OrchardCMS\OrchardCore\src\OrchardCore.Themes\TheBlogTheme\Assets\TheBlogTheme\dist\assets Not sure why yet but its returning 2 distinct paths there. |
Ok, I think I found the issue. |
Thank you 🤗 |
Can you try something on your side?
Replace the copy.mjs with this code. And let me know if that fixes the issue. |
There are no more errors on 'copy', but the themes are still failing:
I don't know why, I only find lots of 'sass' errors in the output. E.g.
But I don't know if that's the issue now. |
Here is the full log, if that helps... |
Oh, sorry. I was playing around and I deleted those, but I forget about it. My fault, it is working now with your fixes to the copy script. Thanks again for your massive work and for helping me out here too! |
If you are staging these changes does it still shows these files with changes? |
@agriffard had the same issue which I did not find anything about yet. I need to understand why Webpack moves that licence into a different spot in that file. My PC and the CI consistently outputs the same for me so far. How can I repro this one is the question. |
Some extra work for me on Christmas holidays.🎅🏼
Assets Manager
Created by @jptissot
Based on Concurrently and Parcel but can also run Vite and Webpack too. This is a non-opiniated build tool which allows to be extended for any asset compiler/bundler that someone may require.
This build tool essentially uses
Concurrently
instead ofGulp
.Concurrently
, is a concurrent shell runner which allows to trigger any possible shell command. It allows to triggerParcel
,Vite
,Gulp
or any other command that we need for building assets. Everything is written as ES6 modules (.mjs files).Kind of needed for Vue 3 migration because it needs to use either
Vite
orParcel
to build as ES6 modules.Old assets are not compiled as ES6 modules so they don't need these bundlers. For that matter I kept the old gulpfile.js which will be now triggered by
Concurrently
.What needs to be done over time is to migrate these javascript files to ES6 modules (.mjs files or .ts files) so that we can compile them as modules. But that's a migration that will happen over time.
Features
yarn build
yarn build -n module-name
yarn watch -n module-name
.yarn build -g
yarn build -gr
yarn host -n module-name
.yarn clean
. Will also clean parcel-cache folder.yarn build -t tagname
Update
Finally, I'm keeping the old gulp pipeline because there is nothing wrong with it. Also, for backward compatibility with older modules that requires it. I'm using
GulpAssets.json
for the Gulp build tool and usingAssets.json
for the new one. This way, no need to migrate to the new build tool. I'm simply triggeringgulp rebuild
withConcurrently
in the new asset build tool. Because that's what it is essentially, a concurrent shell runner. This way, it is going to be a softer migration for those who already have modules that are built with the old gulp pipeline.Of course, this PR needs to be accepted by community first.
TODO
Modules to migrate:
@jptissot @deanmarcussen @aderderian
Fixes #14169. Related to #15740.