51 Commits

Author SHA1 Message Date
Andrew Nicols
1c73373b3d MDL-75012 js: Bump stylelint and components 2023-02-28 10:19:50 +08:00
Andrew Nicols
abb6877596 MDL-75012 js: Remove grunt-contrib-uglify
We stopped using this when we updated our processes to support ESMs in
MDL-62497. Removal of the dependency was missed at the time.
2023-02-28 10:19:50 +08:00
Andrew Nicols
f70d9a3eef MDL-75012 js: Bump standard dependencies
This change bumps dependencies which have no impact upon the build
process
2023-02-28 10:19:50 +08:00
Andrew Nicols
38fff2d83f MDL-74511 core: Add phpcs config generator 2022-04-18 15:38:14 +08:00
Andrew Nicols
0a4047ab31 MDL-73915 js: Switch amd minification to terser
Unfortunately the babel minify-mangle plugin seems to be abandoned and
in certain circumstances can be very buggy. The only safe options are to
disable it, or to switch to a different minification library.

Not minifying our javascript is not ideal, so this commit updates the
javascript tasks to use a rollup, combined with babel, and terser.

Babel still converts code from ES/UMD/AMD to AMD modules with the
relevant browser support, whilst terser minifies the code.

The rollup bundler handles tracking and creation of sourcemaps, and
supports better parallelisation of the tasks.

Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core
and eslint, which change the built files anyway, this seems like the
ideal time to make this change.
2022-02-23 08:55:09 +08:00
Andrew Nicols
aa7f7957ea MDL-73915 js: Upgrade babel and eslint 2022-02-23 08:53:54 +08:00
Andrew Nicols
4ce17e604c MDL-73915 js: Upgrade packages 2022-02-23 08:51:54 +08:00
Andrew Nicols
ef74e31086 MDL-73915 js: Switch to nodejs lts/gallium 2022-02-23 08:51:54 +08:00
Andrew Nicols
1d1b3d1842 MDL-73915 js: Upgrade node-sass 2022-02-23 08:51:53 +08:00
Bas Brands
cdb651d46a MDL-71691 core_course: section styling 2021-12-08 13:14:05 +01:00
Andrew Nicols
4c1e0dcb19 MDL-72013 js: Add eslint-jsdoc plugin 2021-10-21 13:28:04 +08:00
Eloy Lafuente (stronk7)
28bdb57380 MDL-72440 js: reconcile npm installed stuff
When npm-shrinkwrap.json was regenerated few days ago by MDL-72014
running audit-fix on it, it seems that some checksums in the "lodash"
package were missing.

Now they are properly set and that's leading to npm-shrinkwrap.json
changes when people runs npm install (note npm ci is the recommended
way to install all the dev dependencies).

So, just reconcile the file to include the new checksums.
2021-08-31 11:17:07 +02:00
Eloy Lafuente (stronk7)
4162b92af9 MDL-72014 nodejs: audit fix to solve some security reports
Simply run npm audit fix that updates these main packages:

- xmldom 0.6.0
- grunt 1.4.1
- gherkin-lint 4.2.2

(and also a bunch of dependencies)
2021-08-20 13:49:46 +02:00
Andrew Nicols
b3b7b3daca MDL-61460 core: Rebuild npm-shrinkwrap for new dependencies 2021-07-08 23:30:34 +02:00
Andrew Nicols
fa073102d3 MDL-61460 Grunt: Add Component Library tasks
This new task handles building of component library documentation,
including the markdown to HTML, an index of the generated content used
for searching, and the CSS for the component library.
2021-07-08 09:51:02 +08:00
Andrew Nicols
1a62c82fef MDL-71113 js: Add jsdoc configuration and Grunt 2021-06-18 09:38:04 +08:00
Andrew Nicols
4ad0f38a82 MDL-66109 js: Upgrade to latest version of Shifter
This change bumps the version of Shifter that we use to the final
release - version 1.2.0.

I strongly doubt that there will be more releases, and this release was
over two years ago.

This version uses a newer version of Istanbul, and fixes to use that
specific version of Istanbul. As a result I have forked Shifter and
applied the Moodle Circular Dependency fixes there instead.

This version also inludes an upgrade to uglify from 1.3.x to 2.4.x. This
major upgrade includes a some changes to the built YUI module code.
2020-05-11 11:07:49 +08:00
Andrew Nicols
5b4debd2b0 MDL-66109 js: Upgrade Node dependencies
This change updates most libraries used in our Grunt build stack and
applies necessary changes to Grunt and Gherkin-lint configuration to
ensure that they continue to work.

The grunt-sass plugin has been updated to support alternative
'implementations' of sass compilers, and the chosen sass compiler must
now be specified in the grunt configuration. We continue to use the
`node-sass` package for this.

Our gherkin-lintrc included two rules which were renamed from
'no-unamed-*' to 'no-unnamed-*'. This change occurred in version 2.0.0
of Gherkin-lint and has no other effect.
2020-05-11 10:53:35 +08:00
Andrew Nicols
a508dfb43a MDL-66109 js: Fix circular dependency in Shifter dependency
Shifter is using an ancient and no-longer supported of Istanbul. That
version contains a circular dependency whereby it fetches the version
from the index that included the file in the first place.  This throws a
warning on newer versions of Node.

The fix here is simple and intended to be the bare minimum to remove
these warnings anad resolve the issue.

We have forked the istanbul project and created a v0.1.37_moodle branch
at the root version of the Istanbul version that Shifter uses (v0.1.37
tag). The circular dependency is then addressed and a new tag created.

I have then forked Shifter, pointing its package.json at the tar.gz
download of that new tag and pushed a new branch and tag for that fix.

Following this our own package.json is updated to point to the tar.gz
version of the new Shifter tag.
2020-05-11 10:53:35 +08:00
Andrew Nicols
1591dc5786 MDL-66109 js: Upgrade to latest stable version of NodeJS
Version 14.0.0 has just been released as stable, and will make its way
to an LTS release which will be supported until 30th April 2023.

At time of writing it is the "Current stable" release and will remain in
this phase until 20th October 2020, at whciih point it will transition
to LTS status.
2020-05-11 10:53:35 +08:00
Andrew Nicols
78b0a0c201 MDL-66653 javascript: Support ES6 dynamic imports 2019-09-11 14:06:32 +08:00
Andrew Nicols
ad2574f770 MDL-66265 javascript: Bump jshint version 2019-09-04 06:48:11 +08:00
Ryan Wyllie
3e5811aff2 MDL-62497 javascript: npm-shrinkwrap change 2019-07-19 14:12:49 +08:00
Ryan Wyllie
38d4f754ca MDL-62497 javascript: add watchman support to grunt watch command 2019-07-19 14:12:49 +08:00
Ryan Wyllie
c53f86d408 MDL-62497 javascript: add babel transpiling to Grunt for ES6 support 2019-07-19 14:12:48 +08:00
Mathew May
cf89ac3d1a MDL-64506 Grunt: Remove old Bootstrapbase tasks 2019-04-03 19:34:20 +08:00
Eloy Lafuente (stronk7)
ef10e7db4c MDL-63346 nodejs: Bump to created from scratch shrinkwrap file
Steps:

- remove node_modules & npm-shrinkwrap.json
- npm cache clear --force
- npm install
- npm shrinkwrap
2018-09-20 11:00:02 +02:00
Bas Brands
af9edb2e6a MDL-59261 theme_boost: compiled css fallback 2018-07-03 14:14:52 +08:00
Matteo Scaramuccia
495a5c5a73 MDL-61893 JavaScript: Bumped npm packages
Performed by removing the current 'npm-shrinkwrap.json' file:
$ rm -Rf node_modules
$ rm -f npm-shrinkwrap.json
$ npm install
$ npm shrinkwrap
2018-05-18 00:36:44 +02:00
Damyon Wiese
ecb9c82b06 MDL-60456 javascript: Rebuild npm-shrinkwrap
Build npm-shrinkwrap with the latest node version and only test the latest node version on travis.
2017-10-19 13:16:52 +08:00
Dan Poltawski
e970f8b3d3 MDL-59761 eslint: update to v4.6.1
The new versions got released while this issue was waiting for peer
review.
2017-09-12 09:24:10 +01:00
Dan Poltawski
9702503f6b MDL-59761 eslint: Upgrade to v4.4.1
Including adding some new default rules.
2017-09-06 08:53:50 +01:00
Dan Poltawski
b7e26ad2dc MDL-57945 npm: commit lockfile changes frm npm v5.3.0
Sadly npm keep altering the lockfile format see - MDL-59582
2017-07-20 11:15:37 +01:00
Dan Poltawski
0a023e5fc7 MDL-57945 stylelint: use csstree to replace some rules
Ironically we have to reverse the change from e63d89a5 because
this linter is more clever..
2017-07-19 14:29:56 +01:00
Dan Poltawski
09074c91d0 MDL-57945 stylelint: Upgrade 7.12.0
This stylelint is consolodating and focusing the project
so there are some rule deprecations without real alternatives yet.
2017-07-19 13:45:47 +01:00
Dan Poltawski
66a91ddada MDL-57139 eslint: enable eslint-plugin-promise rules
For promise best practices
2017-06-01 10:27:58 +01:00
Dan Poltawski
94e6425103 MDL-59094 npm: Update shrinkwrap file to npm 5 generated
Starting with npm version 5, npm install will generate a lockfile
(now named package-lock.json) or update the existing npm-shrinkwrap.json

To prevent changes being generated in the codebase when this happens, we
need to commit the version 5 generated shrinkwrap.

This is related to a general overhaul [1] of how npm manages things. But
for our purposes, we the lockfile should be BC to previous versions [2].

Going forward, we need to ensure we generate the lockfile on npm >=5 to
prevent differences from the previously un-versioned lockfile.

[1] http://blog.npmjs.org/post/161081169345/v500
[2] https://github.com/npm/npm/issues/16728#issuecomment-305104149
2017-05-31 10:10:03 +01:00
Dan Poltawski
8b02e2d98c
MDL-56519 behat: Lint gherkin files 2017-01-03 09:12:54 +08:00
Dan Poltawski
5c8445b5cd MDL-56423 stylelint: bump to v7.4.1
Fixes a false positive with  declaration-block-no-ignored-properties and
display: inline.
2016-10-13 10:01:30 +01:00
Dan Poltawski
00c714f05c MDL-55835 eslint: bump to v3.7.1
1) Bump eslint verson in npm
2) Enable tabs rule introduced in 3.2.0
3) With rules deprecated in 3.3.0 to their replacements
   http://eslint.org/blog/2016/08/eslint-v3.3.0-released
4) Deprecate the use of M.str (fixes MDLSITE-3646) with new
   no-restricted-properties introduced in 3.5.0
5) Fixup no-unused-vars - remove argsIgnorePattern which shouldn't have allowed
   partial matches and turns out to be uncesssary
   (detected because of https://github.com/eslint/eslint/issues/7250 in 3.6.0)
2016-10-07 10:00:26 +01:00
Dan Poltawski
d2c7175a34 MDL-55856 grunt: fail gracefully when node version too old
Unfortunately the engine requirement in packages.json is not a fatal
error, so you can get unhelpful errors with grunt if using an
unsupported version.
2016-09-15 15:32:32 +01:00
Dan Poltawski
091a1f9290 MDL-55167 npm: add stylelint-checkstyle-formatter
Useful for automations (like the Moodle prechecker)
2016-08-02 18:52:41 +01:00
Dan Poltawski
855fc5d853 MDL-55167 grunt: add stylelint css linting 2016-07-30 13:07:52 +01:00
Dan Poltawski
2ce9109088 MDL-55048 grunt/npm: Update dependencies
* We bump our minimum node version up to >=4. Although this isn't yet
  necessarily *required* it was spurred on because grunt dropped support
  for very early node versions and so it's likely some devs will have to
  upgrade their npm.

  We do it now which gives us more flexibility for tools going forward
  (especially for things like new theme/testing). And node has matured
  the ecosystem (especially supporting properly semver) so should result
  in less edge cases.

* We make the minimum node version explicit in package.json. Though it
  doesn't help much for older versions of node because npm doesn't
  have the functionality to warn about it.. ;-)

* Left async dependency as it was, because it's only on an RC: 2.0.0-rc.6
2016-07-11 15:53:10 +01:00
Dan Poltawski
037de71996 MDL-54944 eslint: Add rules from Policy decision
Also bump eslint to v2.13.1 and make the version explicit in
package.json
2016-07-07 12:10:49 +01:00
Dan Poltawski
5f4d957c21 MDL-54889 jshint: stop using for everything but shifter
Now jshint has been replaced by eslint.
2016-06-30 09:14:57 +01:00
Dan Poltawski
30db70abdc MDL-52127 grunt: be aware of third party paths
1) Parse thirdpartylibs.xml and generate an array of third party
file paths to use in grunt tasks
2) In the lint tasks, we filter third party files from being linted
3) We add a new task to generate ignore files - currently for eslint,
but will be potentially useful for other things in the future
4) Remove .eslintignore from source control

Why have the ability to generate a .eslintignore file? For tooling
integration - by having the eslintignore file people can use other
eslint tools without having to just use grunt (e.g. editor
integrations).
2016-06-14 00:37:29 +01:00
Dan Poltawski
3adb62b727 MDL-52127 js: check amd files with eslint grunt task
I have spent quite a lot of time working through the current list of
eslint options and configuring them for Moodle style and I think this is
a very good basis to start us at (as well as taking some of out jshint
options out with https://www.npmjs.com/package/polyjuice ). Thanks to
Andrew Nicols, Mark Johnson and Frédéric Massart for some refinements.

With this configuration the grunt build will fail if errors are present
in the js (though you can of course tell jshint to ignore some errors,
as I have done in admin/tool/lp/amd/src/competency_rule_points.js and
defining the Y global in lib/amd/src/yui.js ).

The grunt task will not report warnings by default, but a new
--show-lint-warnings flag will help achieve that. Editor
integrations/stanadalone eslint tool will surely be a better way of
getting eslint errors rather than using the grunt task.
2016-06-11 10:14:35 +01:00
Dan Poltawski
1aa454eda4 MDL-49817 grunt: handle multiple watched files changed at once
Includes multiple changes to the shifter task to simplify and
support this:
* Use grunt.file for shifter yui 'module' detection rather than our own
  70 line function
* Use grunt.util.spawn rather than our own exec for shifter
* Improve behaviour on various yui subdirectories

We have to add the 'async' depndency to npm because we are running
multiple async operations in the single task. We use async.eachSeries to
run each shifter job sequentally (else the output would be unreadable
when running async).

We also run shifter in non-recursive mode on the module directory so its
not building everything (thanks to Ryan for pointing this out!)
2016-01-28 08:30:04 +00:00
Dan Poltawski
8efbb7b1a1 MDL-49817 grunt: add watch task
This allows files to be watched and automatically build when changed.

Thanks to David Monllaó for the initial basis for this patch.
2016-01-28 08:27:31 +00:00