File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ planned for 2025-07-01
3232- [ workflow] Replace Node.js version v23 with v24 (#3770 )
3333- [ refactor] Replace deprecated constants ` fs.F_OK ` and ` fs.R_OK ` (#3789 )
3434- [ refactor] Replace ` ansis ` with built-in function ` util.styleText `
35+ - [ core] Integrate stuff from ` vendor ` and ` fonts ` folders into main ` package.json ` , simplifies install and maintaining dependencies
3536
3637### Fixed
3738
Original file line number Diff line number Diff line change 1313 < link rel ="icon " href ="data:;base64,iVBORw0KGgo= " />
1414 < link rel ="stylesheet " type ="text/css " href ="css/main.css " />
1515 < link rel ="stylesheet " type ="text/css " href ="css/roboto.css " />
16- < link rel ="stylesheet " type ="text/css " href ="css/font-awesome.css " />
1716 < link rel ="stylesheet " type ="text/css " href ="node_modules/animate.css/animate.min.css " />
18- < link rel ="stylesheet " type ="text/css " href ="node_modules/weathericons/css/weather-icons.css " />
19- < link rel ="stylesheet " type ="text/css " href ="node_modules/weathericons/css/weather-icons-wind.css " />
2017 <!-- custom.css is loaded by the loader.js to make sure it's loaded after the module css files. -->
2118
2219 < script type ="text/javascript ">
4845 < script type ="text/javascript " src ="node_modules/nunjucks/browser/nunjucks.min.js "> </ script >
4946 < script type ="text/javascript " src ="js/defaults.js "> </ script >
5047 < script type ="text/javascript " src ="#CONFIG_FILE# "> </ script >
51- < script type ="text/javascript " src ="node_modules/moment/min/moment-with-locales.js "> </ script >
52- < script type ="text/javascript " src ="node_modules/moment-timezone/builds/moment-timezone-with-data.js "> </ script >
53- < script type ="text/javascript " src ="node_modules/suncalc/suncalc.js "> </ script >
54- < script type ="text/javascript " src ="node_modules/croner/dist/croner.umd.js "> </ script >
48+ < script type ="text/javascript " src ="js/vendor.js "> </ script >
5549 < script type ="text/javascript " src ="modules/default/defaultmodules.js "> </ script >
5650 < script type ="text/javascript " src ="modules/default/utils.js "> </ script >
5751 < script type ="text/javascript " src ="js/logger.js "> </ script >
Original file line number Diff line number Diff line change 1- /* global defaultModules */
1+ /* global defaultModules, vendor */
22
33const Loader = ( function ( ) {
44
@@ -238,7 +238,7 @@ const Loader = (function () {
238238
239239 /**
240240 * Load a file (script or stylesheet).
241- * Prevent double loading.
241+ * Prevent double loading and search for files in the vendor folder .
242242 * @param {string } fileName Path of the file we want to load.
243243 * @param {Module } module The module that calls the loadFile function.
244244 * @returns {Promise } resolved when the file is loaded
@@ -256,6 +256,13 @@ const Loader = (function () {
256256 return loadFile ( fileName ) ;
257257 }
258258
259+ if ( vendor [ fileName ] !== undefined ) {
260+ // This file is available in the vendor folder.
261+ // Load it from this vendor folder.
262+ loadedFiles . push ( fileName . toLowerCase ( ) ) ;
263+ return loadFile ( `${ vendor [ fileName ] } ` ) ;
264+ }
265+
259266 // File not loaded yet.
260267 // Load it based on the module path.
261268 loadedFiles . push ( fileName . toLowerCase ( ) ) ;
Original file line number Diff line number Diff line change 1+ const vendor = {
2+ "moment.js" : "node_modules/moment/min/moment-with-locales.js" ,
3+ "moment-timezone.js" : "node_modules/moment-timezone/builds/moment-timezone-with-data.js" ,
4+ "weather-icons.css" : "node_modules/weathericons/css/weather-icons.css" ,
5+ "weather-icons-wind.css" : "node_modules/weathericons/css/weather-icons-wind.css" ,
6+ "font-awesome.css" : "css/font-awesome.css" ,
7+ "suncalc.js" : "node_modules/suncalc/suncalc.js" ,
8+ "croner.js" : "node_modules/croner/dist/croner.umd.js"
9+ } ;
10+
11+ if ( typeof module !== "undefined" ) {
12+ module . exports = vendor ;
13+ }
Original file line number Diff line number Diff line change 3131 "lint:js" : " eslint --fix" ,
3232 "lint:markdown" : " markdownlint-cli2 . --fix" ,
3333 "lint:prettier" : " prettier . --write" ,
34- "postinstall" : " echo \" MagicMirror² installation finished successfully! \n\" " ,
3534 "prepare" : " [ -f node_modules/.bin/husky ] && husky || echo no husky installed." ,
3635 "server" : " node ./serveronly" ,
3736 "start" : " node --run start:x11" ,
6059 "*.css" : " stylelint --fix"
6160 },
6261 "dependencies" : {
63- "@fortawesome/fontawesome-free" : " ^6.7.2" ,
6462 "@fontsource/roboto" : " ^5.2.5" ,
6563 "@fontsource/roboto-condensed" : " ^5.2.5" ,
64+ "@fortawesome/fontawesome-free" : " ^6.7.2" ,
6665 "ajv" : " ^8.17.1" ,
6766 "animate.css" : " ^4.1.1" ,
6867 "console-stamp" : " ^3.1.2" ,
Original file line number Diff line number Diff line change 1+ const helpers = require ( "./helpers/global-setup" ) ;
2+
3+ describe ( "Vendors" , ( ) => {
4+ beforeAll ( async ( ) => {
5+ await helpers . startApplication ( "tests/configs/default.js" ) ;
6+ } ) ;
7+ afterAll ( async ( ) => {
8+ await helpers . stopApplication ( ) ;
9+ } ) ;
10+
11+ describe ( "Get list vendors" , ( ) => {
12+ const vendors = require ( `${ __dirname } /../../js/vendor.js` ) ;
13+
14+ Object . keys ( vendors ) . forEach ( ( vendor ) => {
15+ it ( `should return 200 HTTP code for vendor "${ vendor } "` , async ( ) => {
16+ const urlVendor = `http://localhost:8080/${ vendors [ vendor ] } ` ;
17+ const res = await fetch ( urlVendor ) ;
18+ expect ( res . status ) . toBe ( 200 ) ;
19+ } ) ;
20+ } ) ;
21+
22+ Object . keys ( vendors ) . forEach ( ( vendor ) => {
23+ it ( `should return 404 HTTP code for vendor https://localhost/xx/"${ vendor } "` , async ( ) => {
24+ const urlVendor = `http://localhost:8080/xx/${ vendors [ vendor ] } ` ;
25+ const res = await fetch ( urlVendor ) ;
26+ expect ( res . status ) . toBe ( 404 ) ;
27+ } ) ;
28+ } ) ;
29+ } ) ;
30+ } ) ;
You can’t perform that action at this time.
0 commit comments