Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/*
vendor/*
project/*
babel.config.js
webpack.config.ts

# compiled js ignored since it is run on the jsx directory
modules/*/js/*
Expand Down
39 changes: 23 additions & 16 deletions .github/workflows/loristest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ jobs:
EEG_VIS_ENABLED: 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install protoc-gen-js plugin
run: npm install -g protoc-gen-js

- name: Install EEG package dependencies
# We only need to install protobuf-compiler
# Other deps were added to fix an apt dependency issue introduced by a new github Ubuntu image
# (see https://github.com/actions/runner-images/blob/releases/ubuntu22/20230305/images/linux/Ubuntu2204-Readme.md)
# that updated the list of installed apt packages/apt repositories. That issue may disappear in future Ubuntu images.
run: |
sudo apt install -y imagemagick-6-common libmagickcore-6.q16-6 libmagickwand-6.q16-6 \
libprotobuf-dev libprotobuf23 libprotoc23 protobuf-compiler
sudo apt install -y imagemagick-6-common libmagickcore-6.q16-7t64 libmagickwand-6.q16-7t64 \
libprotobuf-dev libprotobuf32t64 libprotoc32t64 protobuf-compiler
cd modules/electrophysiology_browser/jsx/react-series-data-viewer/
protoc protocol-buffers/chunk.proto --js_out=import_style=commonjs,binary:./src/

Expand All @@ -36,13 +39,13 @@ jobs:
- name: Create node_modules tarball
run: tar cfvz node_modules.tar.gz node_modules

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload node_modules artifact
with:
name: node_modules
path: node_modules.tar.gz

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload lorisjs.tar.gz artifact
with:
name: lorisjs
Expand All @@ -54,7 +57,7 @@ jobs:
matrix:
php: ['8.1', '8.2', '8.3']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -70,7 +73,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
Expand All @@ -83,7 +86,7 @@ jobs:
- name: Create vendor tarball
run: tar cfvz vendor-php${{matrix.php}}.tar.gz vendor

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
name: Upload vendor-php${{matrix.php}}.tar.gz artifact
with:
name: vendor-php${{matrix.php}}
Expand All @@ -107,21 +110,21 @@ jobs:
php: ['8.1', '8.2', '8.3']
apiversion: ['v0.0.3', 'v0.0.4-dev']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Download node_modules artifact
with:
name: node_modules
path: .

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Download compiled LORIS javascript artifact
with:
name: lorisjs
path: .

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
name: Download PHP dependencies artifact
with:
name: vendor-php${{matrix.php}}
Expand Down Expand Up @@ -230,7 +233,7 @@ jobs:
php: '8.3'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -246,7 +249,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Composer cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
Expand All @@ -255,14 +258,18 @@ jobs:
- name: Change PHP Version in Dockerfile
run: sed -i "s/8.0/${{ matrix.php }}/g" Dockerfile.test.php8


- name: Install protoc-gen-js plugin
run: npm install -g protoc-gen-js

- name: Install package dependencies
# We only need to install protobuf-compiler
# Other deps were added to fix an apt dependency issue introduced by a new github Ubuntu image
# (see https://github.com/actions/runner-images/blob/releases/ubuntu22/20230305/images/linux/Ubuntu2204-Readme.md)
# that updated the list of installed apt packages/apt repositories. That issue may disappear in future Ubuntu images.
run: |
sudo apt install -y imagemagick-6-common libmagickcore-6.q16-6 libmagickwand-6.q16-6 \
libprotobuf-dev libprotobuf23 libprotoc23 protobuf-compiler
sudo apt install -y imagemagick-6-common libmagickcore-6.q16-7t64 libmagickwand-6.q16-7t64 \
libprotobuf-dev libprotobuf32t64 libprotoc32t64 protobuf-compiler
cd modules/electrophysiology_browser/jsx/react-series-data-viewer/
protoc protocol-buffers/chunk.proto --js_out=import_style=commonjs,binary:./src/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ function testSessionsProjectPermissions()
*/
function testSessionsNavigation()
{
$this->markTestSkipped(
'rewrite later'
);
$this->safeGet($this->url . "/electrophysiology_browser/sessions/999999");
$link = self::$nextLink;
$this->safeClick(WebDriverBy::cssSelector($link));
Expand Down
48 changes: 31 additions & 17 deletions webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ const module: webpack.ModuleOptions = {
use: [
{
loader: 'ts-loader',
options:{
options: {
onlyCompileBundledFiles: true,
compilerOptions: {
strict: false,
}
}
},
},
],
},
},
],
},
],
};

Expand All @@ -209,7 +209,12 @@ plugins.push(new CopyPlugin({
globOptions: {
ignore: ['react.profiling.min.js'],
},
/** https://webpack.js.org/plugins/copy-webpack-plugin/#filter */
/**
* https://webpack.js.org/plugins/copy-webpack-plugin/#filter
*
* @param {string} path - The full path of the file being filtered.
* @returns {Promise<boolean>} Whether the file should be kept.
*/
filter: async (path) => {
const file = path.split(/\\|\//).pop() as string;
const keep = [
Expand All @@ -223,7 +228,12 @@ plugins.push(new CopyPlugin({
from: path.resolve(__dirname, 'node_modules/react-dom/umd'),
to: path.resolve(__dirname, 'htdocs/vendor/js/react'),
force: true,
/** https://webpack.js.org/plugins/copy-webpack-plugin/#filter */
/**
* https://webpack.js.org/plugins/copy-webpack-plugin/#filter
*
* @param {string} path - The full path of the file being filtered.
* @returns {Promise<boolean>} Resolves to `true` if the file should be kept, otherwise `false`.
*/
filter: async (path) => {
const file = path.split(/\\|\//).pop() as string;
const keep = [
Expand All @@ -249,26 +259,30 @@ if (EEGVisEnabled !== 'true' && EEGVisEnabled !== '1' ) {
}

/**
* Get the webpack entries of a given module, which is described by its name
* Get the webpack entries of a given module, described by its name
* and its entry points.
*
* @param {string} moduleName - The name of the module (e.g., 'login').
* @param {string[]} files - A list of entry point file names for the module (e.g., ['index', 'dashboard']).
*
* @returns A list of two-element tuples mapping each entry name (exemple
* 'login/loginIndex') to its webpack entry.
*/
function makeModuleEntries(moduleName: string, files: string[]) {
// Check if a project override exists for the module.
const basePath = fs.existsSync(`./project/modules/${moduleName}`)
? `./project/modules/${moduleName}/`
: `./modules/${moduleName}/`;

return files.map((fileName) => ([moduleName + '/' + fileName, {
import: basePath + 'jsx/' + fileName,
filename: basePath + 'js/' + fileName + '.js',
library: {
name: ['lorisjs', moduleName, fileName],
type: 'window',
return files.map((fileName) => ([
`${moduleName}/${fileName}`,
{
import: `${basePath}jsx/${fileName}`,
filename: `${basePath}js/${fileName}.js`,
library: {
name: ['lorisjs', moduleName, fileName],
type: 'window',
},
},
}]));
]));
}

// Add entries for project overrides.
Expand Down