? Pending

User tests: Successful: Unsuccessful:

avatar dgrammatiko
dgrammatiko
30 Jan 2019

Pull Request for no Issue .

Summary of Changes

Clean up the mess!

A bit of history here: when the production team decided to move forward with the separation of sources and deliverables in the repo quite a few things were done in a hurry. My wrong and I do apologise for all that mess that was in the repo for quite some time. I guess I should fix it now and this is exactly what this PR is doing, in sort:

  • Reduce the sources to just one directory (from media and media_src to media_source)
  • One rule to rule them all for javascript, meaning the javascript files can be either .es5.js or .es6.js or .w-c.es6.js. This way all our tools work nicely...
  • One rule to rule them all, this time for css and scss (similar to js but here only .css and .scss extensions)
  • All web components/custom elements now can live in the place that they were meant to be. So all fileds now live in media/system/js/fields etc...
  • Drop temporarily the watch function as the implementation was way to greedy, I will come with another PR sortly after this one is merged

Testing Instructions

npm i should give you the same results as before

Expected result

Nothing broken

Actual result

Documentation Changes Required

We dropped one npm command for the custom elements/webcomponents, this is done now by the same command for minifying es5 or compiling ES6

Also there is no performance penalty here (actually there is quite some gain but since we're also transpiring the es6 files instead of blindly copying this doesn't really show up)...

EDIT: I've partially restored the watch functionality for the javascript files. Won't delete the processed files once the source files gets deleted. Also it only works for the media_source folder only

avatar dgrammatiko dgrammatiko - open - 30 Jan 2019
avatar dgrammatiko dgrammatiko - change - 30 Jan 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Jan 2019
Category Administration com_categories com_config com_content com_media com_modules Templates (admin) JavaScript Repository
avatar dgrammatiko dgrammatiko - change - 30 Jan 2019
Title
Refactor the tools
[4.0] Refactor the build tools
avatar dgrammatiko dgrammatiko - edited - 30 Jan 2019
avatar dgrammatiko
dgrammatiko - comment - 30 Jan 2019

PR for the failing tests: joomla/test-javascript#12

avatar brianteeman
brianteeman - comment - 30 Jan 2019

Does it address #23671 if so then I can close that issue

avatar dgrammatiko
dgrammatiko - comment - 30 Jan 2019

yup, you can close it:
screenshot 2019-01-30 at 22 59 38

avatar dgrammatiko dgrammatiko - change - 30 Jan 2019
Labels Added: ?
094cfd0 30 Jan 2019 avatar dgrammatiko oops
avatar brianteeman
brianteeman - comment - 30 Jan 2019

@dgrammatiko thanks

avatar dgrammatiko dgrammatiko - change - 31 Jan 2019
The description was changed
avatar dgrammatiko dgrammatiko - edited - 31 Jan 2019
148e570 31 Jan 2019 avatar dgrammatiko CS
avatar N6REJ
N6REJ - comment - 4 Feb 2019

anyway to support template/extension scss to css via the same functions?

avatar dgrammatiko
dgrammatiko - comment - 4 Feb 2019

Yes, if we ever move the template assets to their natural place: that is the media folder

avatar wilsonge
wilsonge - comment - 6 Feb 2019

If you solve the conflicts I'm good to merge this

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

@wilsonge done

@N6REJ so your comment above gave me some ideas, watch the coming PRs

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

@wilsonge if you're about to merge this one make sure that you'll merge first the javascript tests, restart drone here and then merge this one. Let's make @rdeutz happy here...

avatar Hackwar
Hackwar - comment - 6 Feb 2019

@dgrammatiko Regarding your comment to move the media files of a template to /media: I understand where you are coming from, but I just wanted to bring up that the template is the final point of truth and is meant to override everything else if necessary. Putting the assets of the template into the /media folder would mean that this role would be weakened and bring up the question if overrides for something in a template should reside in the /templates folder or in the /media folder. At the same time most extensions still don't use the /media folder at all for their assets and don't get me started on receiving SCSS files to include in my template.css instead of dozens of small custom CSS. I think the idea of changing this is something that has its merits, but would have to be debated and to me seems out of scope for 4.x.

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

Putting the assets of the template into the /media folder would mean that this role would be weakened and bring up the question if overrides for something in a template should reside in the /templates folder or in the /media folder.

Sorry NOT TRUE. You can include the assets in a way that will not be overridable Joomla 101

I think the idea of changing this is something that has its merits, but would have to be debated and to me seems out of scope for 4.x.

I think you don't understand the idea, so the idea is to have all the distributable and compiled assets in the media folder NOT moving the css or js folder folder from the template. It breaks nothing apart that the position for the template.css or .js will be in the media folder. Again if this is included as non overridable there is exactly 0 change here. Apart the fact that our build tools will care only for one folder.

BUT,

Because there is always a but, I will not make an RFC or a PR for this. Instead I'll make a much bigger proposal so Joomla finally gets distributions...

avatar mbabker
mbabker - comment - 6 Feb 2019

If it's in the media folder it's intended to support overrides by way of the JHtml API. If you're writing $doc->addScript('/templates/cassiopeia/js/template.min.js'); or $doc->addScript('/media/tpl_cassiopeia/js/template.min.js'); anywhere, including the template itself, you're Doing It Wrong™.

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

@mbabker but we're still using the API ?

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

@Hackwar @Hackwar anyways I've already proposed that and it didn't fly so I won't loose my time, I have my views here which obviously not align with the old guard and that's fine...

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

sure

avatar wilsonge
wilsonge - comment - 6 Feb 2019

Didn't seem to work. I guess we need to update the package-lock or something. @rdeutz can you advise? https://github.com/joomla/joomla-cms/blob/4.0-dev/package.json#L70

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

It didn't pick up the changes:
screenshot 2019-02-07 at 00 26 32

Also weird because it's supposed to fetch directly from the GitHub repo...

avatar dgrammatiko
dgrammatiko - comment - 6 Feb 2019

@wilsonge seems like a caching issue. I guess if someone could restart the drone will be fixed. I mean the changes are there but are not fetched

avatar N6REJ
N6REJ - comment - 7 Feb 2019

@dgrammatiko cool!, if it helps/matters I'm using storm.
also ruby based scss messes with fontawesome content statements and changes it into ascii char instead of utf-8 even if utf-8 is declared. js based doesn't do that
i.e. ...
dart sass = foobar'd
node-sass = just fine.

avatar dgrammatiko
dgrammatiko - comment - 7 Feb 2019

@N6REJ PHPStorm has a great integration, check this out:

  • Right click on page.json:

screenshot 2019-02-07 at 20 51 52

  • Then Click on Show NPM Scripts:

screenshot 2019-02-07 at 20 52 01

  • You can run any command by double clicking on it

Same goes for VSCode

avatar joomla-cms-bot joomla-cms-bot - change - 7 Feb 2019
Category Administration com_categories com_config com_content com_media com_modules Templates (admin) JavaScript Repository Unit Tests Administration com_categories com_config com_content com_media com_modules Templates (admin) JavaScript Repository
avatar dgrammatiko dgrammatiko - change - 7 Feb 2019
Labels Added: ?
avatar rdeutz
rdeutz - comment - 7 Feb 2019

you need to add [CLEAR CACHE] in your commit message

avatar dgrammatiko dgrammatiko - change - 7 Feb 2019
Title
[4.0] Refactor the build tools
[4.0][CLEAR CACHE] Refactor the build tools
avatar dgrammatiko dgrammatiko - edited - 7 Feb 2019
avatar dgrammatiko dgrammatiko - change - 7 Feb 2019
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 7 Feb 2019
Category Administration com_categories com_config com_content com_media com_modules Templates (admin) JavaScript Repository Unit Tests Administration com_categories com_config com_content com_media com_modules Templates (admin) JavaScript Repository
avatar dgrammatiko
dgrammatiko - comment - 7 Feb 2019

@wilsonge javascript test passing

PS There is also this #23786 Covers the scss watch...

avatar dgrammatiko dgrammatiko - change - 7 Feb 2019
Title
[4.0][CLEAR CACHE] Refactor the build tools
[4.0][NO CACHE] Refactor the build tools
avatar dgrammatiko dgrammatiko - edited - 7 Feb 2019
avatar wilsonge wilsonge - change - 7 Feb 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-02-07 23:00:24
Closed_By wilsonge
avatar wilsonge wilsonge - close - 7 Feb 2019
avatar wilsonge wilsonge - merge - 7 Feb 2019
avatar dgrammatiko
dgrammatiko - comment - 7 Feb 2019

Woohoo ?
Thanks @wilsonge

avatar wilsonge
wilsonge - comment - 7 Feb 2019

Thankyou! I hope this is the last refactor tho ?

avatar N6REJ
N6REJ - comment - 9 Feb 2019

@dgrammatiko sweet! I'll look forward to it.

Add a Comment

Login with GitHub to post a comment