Merge pull request #4107 from NoelDeMartin/MOBILE-4616

MOBILE-4616: CI and documentation improvements
main
Pau Ferrer Ocaña 2024-07-04 13:42:26 +02:00 committed by GitHub
commit 2e94f835e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 27809 additions and 27728 deletions

View File

@ -153,16 +153,14 @@ jobs:
- name: Initialise moodle-plugin-ci
run: |
git clone https://github.com/NoelDeMartin/moodle-plugin-ci --branch selenium-env ci
composer install -d ./ci
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4.4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
sed -i "58i\$CFG->behat_profiles['chrome']['capabilities'] = ['extra_capabilities' => ['chromeOptions' => ['args' => ['--ignore-certificate-errors', '--allow-running-insecure-content']]]];" ci/res/template/config.php.txt
- name: Install Behat Snapshots plugin
run: moodle-plugin-ci add-plugin NoelDeMartin/moodle-local_behatsnapshots
run: moodle-plugin-ci add-plugin moodlemobile/moodle-local_behatsnapshots
- name: Install moodle-plugin-ci
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
@ -172,6 +170,7 @@ jobs:
MOODLE_REPO: ${{ github.event.inputs.moodle_repository || 'https://github.com/moodle/moodle.git' }}
MOODLE_BEHAT_IONIC_WWWROOT: https://localhost:8001
MOODLE_BEHAT_DEFAULT_BROWSER: chrome
MOODLE_BEHAT_CHROME_CAPABILITIES: "['extra_capabilities' => ['chromeOptions' => ['args' => ['--ignore-certificate-errors', '--allow-running-insecure-content']]]]"
- name: Update config
run: moodle-plugin-ci add-config 'define("TEST_MOD_BIGBLUEBUTTONBN_MOCK_SERVER", "http://localhost:8002/hash" . sha1($CFG->wwwroot));'

View File

@ -189,16 +189,14 @@ jobs:
- name: Initialise moodle-plugin-ci
run: |
git clone https://github.com/NoelDeMartin/moodle-plugin-ci --branch selenium-env ci
composer install -d ./ci
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4.4
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
sed -i "58i\$CFG->behat_profiles['chrome']['capabilities'] = ['extra_capabilities' => ['chromeOptions' => ['args' => ['--ignore-certificate-errors', '--allow-running-insecure-content']]]];" ci/res/template/config.php.txt
- name: Install Behat Snapshots plugin
run: moodle-plugin-ci add-plugin NoelDeMartin/moodle-local_behatsnapshots
run: moodle-plugin-ci add-plugin moodlemobile/moodle-local_behatsnapshots
- name: Install moodle-plugin-ci
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
@ -208,6 +206,7 @@ jobs:
MOODLE_REPO: ${{ github.event.inputs.moodle_repository || 'https://github.com/moodle/moodle.git' }}
MOODLE_BEHAT_IONIC_WWWROOT: https://localhost:8001
MOODLE_BEHAT_DEFAULT_BROWSER: chrome
MOODLE_BEHAT_CHROME_CAPABILITIES: "['extra_capabilities' => ['chromeOptions' => ['args' => ['--ignore-certificate-errors', '--allow-running-insecure-content']]]]"
- name: Update config
run: |

View File

@ -62,7 +62,15 @@ jobs:
run: |
npm run build:prod
npm run prod --prefix cordova-plugin-moodleapp
env:
MOODLE_APP_CIRCULAR_DEPENDENCIES: true
- name: Circular dependencies
run: |
cat circular-dependencies
lines=$(cat circular-dependencies | wc -l)
echo "Total circular dependencies: $lines"
test $lines -eq 204
- name: JavaScript code compatibility
run: |
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Array.prototype.flatMap,Array.prototype.flat,Array.prototype.includes,globalThis,Object.fromEntries,Object.hasOwn,Promise.prototype.finally,String.prototype.matchAll,String.prototype.trimRight" | grep "No issues found. Files are compatible with the target runtimes."
npx check-es-compat www/*.js --polyfills="\{Array,String,TypedArray\}.prototype.at,Object.hasOwn"
npx check-es-compat cordova-plugin-moodleapp/www/*.js

1
.gitignore vendored
View File

@ -62,6 +62,7 @@ yarn-error.log
/libpeerconnection.log
testem.log
/typings
circular-dependencies
# System files
.DS_Store

View File

@ -10,6 +10,6 @@
#
# More info: https://github.com/browserslist/browserslist
Android >= 5.1
Android >= 7
iOS >= 14
Chrome >= 79

55419
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -152,6 +152,7 @@
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"check-es-compat": "3.2.0",
"circular-dependency-plugin": "^5.2.2",
"concurrently": "^8.2.0",
"cordova-plugin-moodleapp": "file:cordova-plugin-moodleapp",
"cross-env": "^7.0.3",

View File

@ -73,6 +73,7 @@ const mainMenuRoutes: Routes = [
),
];
// Single Activity format navigation.
const courseContentsRoutes: Routes = conditionalRoutes(
[
{

View File

@ -219,6 +219,9 @@ export function resolveModuleRoutes(injector: Injector, token: InjectionToken<Mo
export const APP_ROUTES = new InjectionToken('APP_ROUTES');
/**
* Module used to register routes at the root of the application.
*/
@NgModule({
imports: [
RouterModule.forRoot([]),

View File

@ -28,6 +28,10 @@ export function resolveContentsRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, COURSE_CONTENTS_ROUTES);
}
/**
* Module used to register routes in the course contents page. These are routes that will only be used on
* single activity courses where the activity uses split-view navigation in tablets, such as forum or glossary.
*/
@NgModule()
export class CoreCourseContentsRoutingModule {

View File

@ -28,6 +28,16 @@ export function resolveIndexRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, COURSE_INDEX_ROUTES);
}
/**
* Module used to register routes in the main course page. These are routes that will appear as tabs in the main page of a course,
* and they must also be declared in a CoreCourseOptionsHandler or in plugins using the CoreCourseOptionsDelegate.
*
* Some examples of routes registered in this module are:
* - /main/{tab}/course/{courseId}/contents
* - /main/{tab}/course/{courseId}/participants
* - /main/{tab}/course/{courseId}/grades
* - ...
*/
@NgModule()
export class CoreCourseIndexRoutingModule {

View File

@ -28,6 +28,15 @@ export function resolveHomeRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, MAIN_MENU_HOME_ROUTES);
}
/**
* Module used to register routes in the home main menu tab. These are routes that will appear as tabs in the home page,
* and they must also be declared in a CoreMainMenuHomeHandler or in plugins using the CoreMainMenuHomeDelegate.
*
* Some examples of routes registered in this module are:
* - /main/home/dashboard
* - /main/home/site
* - ...
*/
@NgModule()
export class CoreMainMenuHomeRoutingModule {

View File

@ -28,6 +28,16 @@ export function resolveMainMenuRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, MAIN_MENU_ROUTES);
}
/**
* Module used to register routes in the main menu tab. These are routes that will appear as tabs in the main menu (or overflow
* into the more page), and they must also be declared in a CoreMainMenuHandler or in plugins using the CoreMainMenuDelegate.
*
* Some examples of routes registered in this module are:
* - /main/calendar
* - /main/messages
* - /main/notifications
* - ...
*/
@NgModule()
export class CoreMainMenuRoutingModule {

View File

@ -42,15 +42,19 @@ export function buildTabMainRoutes(injector: Injector, mainRoute: Route): Routes
return [mainRoute, ...routes.siblings];
}
/**
* Module used to register children routes for all main menu tabs. These are routes that can be navigated within any tab in the
* main menu, but will remain within the navigation stack of the tab rather than overriding the main menu or moving to another tab.
*
* Some examples of routes registered in this module are:
* - /main/{tab}/user
* - /main/{tab}/badges
* - /main/{tab}/mod_forum
* - ...
*/
@NgModule()
export class CoreMainMenuTabRoutingModule {
/**
* Use this function to declare routes that will be children of all main menu tabs root routes.
*
* @param routes Routes to be children of main menu tabs.
* @returns Calculated module.
*/
static forChild(routes: ModuleRoutesConfig): ModuleWithProviders<CoreMainMenuTabRoutingModule> {
return {
ngModule: CoreMainMenuTabRoutingModule,

View File

@ -28,6 +28,16 @@ export function resolveSiteRoutes(injector: Injector): ModuleRoutes {
return resolveModuleRoutes(injector, SITE_PREFERENCES_ROUTES);
}
/**
* Module used to register routes in the site preferences page. These are routes that must also be declared in a
* CoreSettingsHandler or in plugins using the CoreSettingsDelegate.
*
* Some examples of routes registered in this module are:
* - /main/{tab}/preferences/storage
* - /main/{tab}/preferences/messages
* - /main/{tab}/preferences/notifications
* - ...
*/
@NgModule()
export class CoreSitePreferencesRoutingModule {

View File

@ -20,16 +20,8 @@ import 'zone.js';
// Platform polyfills
import 'core-js/es/array/at';
import 'core-js/es/array/flat-map';
import 'core-js/es/array/flat';
import 'core-js/es/array/includes';
import 'core-js/es/global-this';
import 'core-js/es/object/from-entries';
import 'core-js/es/object/has-own';
import 'core-js/es/promise/finally';
import 'core-js/es/string/at';
import 'core-js/es/string/match-all';
import 'core-js/es/string/trim-right';
import 'core-js/es/typed-array/at';
polyfillEventComposedPath();

View File

@ -15,7 +15,7 @@ For more information about upgrading, read the official documentation: https://m
- Due to a breaking change in cordova-plugin-file, avoid using FileEntry.toURL(). Use CoreFileProvider.getFileEntryURL instead.
- FileTransfer service is no longer available, now we recommend use window.FileTransfer instead.
- CSS variable --font-size-normal has been deprecated in favor of --font-size-md.
- Activity modules services that does not admit plugins are not avaible for site plugins anymore.
- Activity modules services that do not admit plugins are not available for site plugins anymore.
- CoreUserDelegate type available values changed from newpage and communication to listitem and button.
=== 4.3.0 ===

View File

@ -13,6 +13,8 @@
// limitations under the License.
const TerserPlugin = require('terser-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const { appendFileSync } = require('fs');
module.exports = config => {
config.optimization.minimizer.push(
@ -46,5 +48,20 @@ module.exports = config => {
});
}
if (process.env.MOODLE_APP_CIRCULAR_DEPENDENCIES) {
config.plugins.push(
new CircularDependencyPlugin({
exclude: /node_modules/,
cwd: process.cwd(),
onDetected({ paths }) {
appendFileSync(
`${process.cwd()}/circular-dependencies`,
paths.join(' -> ') + '\n',
);
},
}),
);
}
return config;
};