29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-27 07:33:41 +00:00
cms/build
2021-05-02 20:05:39 +02:00
..
build-modules-js s/packgage/package (#33160) 2021-04-16 09:38:58 +02:00
media_source JS codestyle (#33484) 2021-05-02 20:05:39 +02:00
test-stuff [4.0] Testing gmp.dll added to appveyor (#28099) 2020-02-28 12:19:29 +01:00
warning_page Improvements to fatal error page generation (#31743) 2021-02-25 16:32:37 +00:00
.eslintrc [4.0] Media manager compiled using rollup (#32459) 2021-02-20 21:30:44 +00:00
.gitignore Ignore js coverage (#19631) 2018-02-09 06:57:37 -08:00
.stylelintrc.json [4.0] scss stylint (#31407) 2020-11-17 23:07:04 +00:00
build.js [4.0] Proper cache invalidation of the static assets [.js/.css] (#32485) 2021-03-22 20:23:27 +01:00
build.php [4.0] Automate build versioning (#32828) 2021-03-24 17:38:00 +01:00
bump.php [4.0] Converted copyright statement to standard format (#31504) 2020-11-28 01:33:45 +00:00
deleted_file_check.php [4.0] Converted copyright statement to standard format (#31504) 2020-11-28 01:33:45 +00:00
helpTOC.php [4.0] Converted copyright statement to standard format (#31504) 2020-11-28 01:33:45 +00:00
phpmd.xml Add build rules for pdepend and phpmd. 2012-08-30 01:36:08 +02:00
README.md [4.0] Some more commands for the build tools (#32928) 2021-03-31 18:15:20 +02:00
stubGenerator.php Correct docblock (#33184) 2021-04-20 19:38:31 +01:00

Joomla build tools

Joomla provides a set of tools for managing the static assets dependencies based on popular NodeJS tools and also a couple of PHP scripts that automate the release process.

Node based tools

The responsibilities of these tools are:

  • to copy files from the node-modules folder to the media folder
  • do any transformations on the copied files
  • Update the version numbers on the xml files of the editors tinyMCE and Codemirror
  • Copy files from the build/media_source folder to the media folder
  • Transform any modern JS to both ES2017 and transpile it to ES5
  • Transform any SCSS file to the respective CSS file

For some of these operations some conventions were established, to simplify and speed up the process.

Javascript

There are three options here:

  • Modern Javascript files should have an extension .es6.js. This allows the ESLint to check the style code, Joomla is using the AirBnB preset https://github.com/airbnb/javascript Also it instructs Rollup to do the transforms for ES2017 and then transpile to ES5. This step creates normal and minified files. Production code WILL NOT have the .es6 part part for ES2017+ files but WILL HAVE a -es5.js for the ES5 ones

  • Web Component Javascript files should have an extension .w-c.es6.js. This allows the ESLint to check the code and it instructs Rollup to do the transforms for ES2017 and then transpile to ES5. This step creates normal and minified files. The difference with the .es6 files is that the tools will automate the minification of the css (assuming that the appropriate scss file exists) and injected into the js file into a placeholder {{CSS_CONTENTS_PLACEHOLDER}} (ie: build/media_source/system/js/joomla-core-loader.w-c.es6.js) Production code WILL NOT have the .w-c.es6 part for ES2017+ files but WILL HAVE a -es5.js for the ES5 ones

  • Legacy Javascript files should have an extension .es5.js. This instructs ESLint to skip checking this file Also it instructs the tools to create a minified version (production code WILL NOT have the .es5 part)

SCSS

  • SCSS files starting with _ will not become entry points for SCSS. SCSS files will be transformed to CSS both normal and minified versions

CSS

  • CSS files will only get minified

NPM commands

  • npm run build:js: compiles ALL the JS (excluding Bootstrap and Media Manager)
  • npm run build:js -- build/media_source/com_actionlogs: compiles ALL the JS ONLY in the folder build/media_source/com_actionlogs
  • npm run build:css: compiles ALL the SCSS
  • npm run build:css -- templates/cassiopeia: compiles ALL the SCSS ONLY in the folder templates/cassiopeia
  • npm run build:bs5: Builds the Bootstrap Javascript components
  • npm run build:com_media: Builds the Media Manager Vue Application
  • npm run lint:js: Check the code style for all the Javascript/vue files
  • npm run lint:js -- --fix: Check and fix the code style for all the Javascript/vue files (might not fix everything)
  • npm run lint:css: Check the code style for all the SCSS files
  • npm run lint:css -- --fix: Check and fix the code style for all the SCSS files (might not fix everything)
  • npm run gzip: Creates .gz files for all the .min.js and .min.css
  • npm run versioning: Creates the correct version hash for all the assets inside the joomla.asset.json files (excluding templates)