Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

399 es6 webpack #1331

Merged
merged 113 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
1369604
Initial webpack config
ivmartel Mar 16, 2023
829e79a
Move utils to using classes
ivmartel Mar 16, 2023
f864c84
Move math to use classes
ivmartel Mar 16, 2023
c55f681
Add library
ivmartel Mar 17, 2023
e3d66c9
Make dicom use classes
ivmartel Mar 17, 2023
8c0e752
Fix missing
ivmartel Mar 17, 2023
2975f0f
Restore self var
ivmartel Mar 20, 2023
2f7804e
Use arrow function
ivmartel Mar 20, 2023
662c52b
More image code converted to class
ivmartel Mar 20, 2023
5695587
Fix event methods
ivmartel Mar 21, 2023
55cdadf
Update to use class
ivmartel Mar 21, 2023
1d39b04
Update io code to use class
ivmartel Mar 21, 2023
aa0f496
Update state to use class
ivmartel Mar 21, 2023
09a1cef
Simpler import
ivmartel Mar 21, 2023
81162cb
Update gui files to using class
ivmartel Mar 21, 2023
aa24d75
Remove empty constructor
ivmartel Mar 21, 2023
1bcce0a
Fix imports
ivmartel Mar 21, 2023
e9a7fac
Export default presets
ivmartel Mar 21, 2023
8708bba
Export colour maps
ivmartel Mar 21, 2023
8b6d3ae
Convert images files to using class
ivmartel Mar 21, 2023
c424b7a
Simple doc
ivmartel Mar 22, 2023
ca5ef06
Update tools to use class
ivmartel Mar 22, 2023
3f946a6
Update app files to use class
ivmartel Mar 22, 2023
4e21a75
Webpack config for library
ivmartel Mar 22, 2023
f7cd4f2
Update decoder to use class
ivmartel Mar 22, 2023
0a844cd
Fix to use logger class
ivmartel Mar 22, 2023
e43c32f
Add missing arrow functions
ivmartel Mar 22, 2023
8fc567f
Add logger, revise public/private
ivmartel Mar 22, 2023
1c1cbcb
Use logger object
ivmartel Mar 22, 2023
1209877
Fix private started, remove dwv namespace function
ivmartel Mar 22, 2023
67d55f7
Update doc
ivmartel Mar 23, 2023
0c31936
Add missing imports
ivmartel Mar 23, 2023
ef983da
Revise formating
ivmartel Mar 23, 2023
0b8d3e4
Update files to use class
ivmartel Mar 23, 2023
86e4851
Replace self by this
ivmartel Mar 23, 2023
38e0135
Add missing arrow functions
ivmartel Mar 23, 2023
31f4767
Fix constructor
ivmartel Mar 23, 2023
4aa0ac2
Fix draw
ivmartel Mar 23, 2023
ec72128
Remove outdated comment
ivmartel Mar 23, 2023
0c05ab2
Move externals to production
ivmartel Mar 23, 2023
ef3372c
Add tools, add missing arrow functions
ivmartel Mar 23, 2023
964b453
Add missing arrow function
ivmartel Mar 23, 2023
2b16daf
Revise binders
ivmartel Mar 23, 2023
14d1dcd
Use local image and not the DOM one
ivmartel Mar 23, 2023
e321259
Finish class migration
ivmartel Mar 24, 2023
6032fca
Fix method call, add arrow function
ivmartel Mar 24, 2023
afe835c
Revert to previous worker init
ivmartel Mar 24, 2023
15186e4
Move list exports
ivmartel Mar 24, 2023
be65b42
Use name and specify entry
ivmartel Mar 24, 2023
cbeed82
Use webpack html to cenerate test pages
ivmartel Mar 24, 2023
b3adfd0
Revise exports, keep groups
ivmartel Mar 24, 2023
3a96441
Update test pages, avoid using dwv namespace
ivmartel Mar 24, 2023
31cd3eb
Set decoders in client
ivmartel Mar 27, 2023
317c528
Export const
ivmartel Mar 27, 2023
6b4528d
Fix synchronous decoding
ivmartel Mar 27, 2023
c815ccd
Change decoder namespace to avoid name colision
ivmartel Mar 27, 2023
613dce8
Update namespace
ivmartel Mar 27, 2023
06de70d
Load decoders from client
ivmartel Mar 27, 2023
6f1647c
Add arrow function
ivmartel Mar 27, 2023
bdffdae
Make load methods arrow functions
ivmartel Mar 27, 2023
9f44d45
Add arrow function
ivmartel Mar 27, 2023
8e00883
Use event prop and not this
ivmartel Mar 27, 2023
65ad153
Fix namespace
ivmartel Mar 27, 2023
9b571f0
Change error into warning and escape
ivmartel Mar 27, 2023
e3a1917
Remove console log
ivmartel Mar 27, 2023
db87982
Add dicom pages
ivmartel Mar 27, 2023
f720c51
Move dom content load func in js
ivmartel Mar 27, 2023
5f8bdda
Update exports
ivmartel Mar 28, 2023
9201848
Revert demo code to use old js
ivmartel Mar 28, 2023
d91d058
Add a test webpack config
ivmartel Mar 28, 2023
99bfb21
Update colour map demo
ivmartel Mar 28, 2023
ed91078
Update bench demo
ivmartel Mar 28, 2023
15c17bb
Remove unused
ivmartel Mar 28, 2023
33a153d
Fix semi colons
ivmartel Mar 28, 2023
1c9b2eb
Add missing import
ivmartel Mar 28, 2023
51b7fba
Remove modernizr and env, update uri
ivmartel Mar 28, 2023
2299741
Fix doc
ivmartel Mar 28, 2023
8f62d82
Update test after function remove
ivmartel Mar 28, 2023
c352d01
Add custom UI object
ivmartel Mar 28, 2023
59df218
Remove jsdoc undefined type error
ivmartel Mar 28, 2023
3d896d8
Remove global dwv from main config, add it to demo
ivmartel Mar 28, 2023
65f55d9
Revert to old dictionary name
ivmartel Mar 28, 2023
89cd976
Revert to lut instead of Colourmaps
ivmartel Mar 28, 2023
d11dce1
Use lower case first for export const
ivmartel Mar 28, 2023
c00af4f
Remove grunt configuration
ivmartel Mar 29, 2023
90c2203
Remove unused sauce script
ivmartel Mar 29, 2023
db7f22c
Use let/const instead of var
ivmartel Mar 29, 2023
dcb341b
Add eslint prefer-const
ivmartel Mar 29, 2023
22970dd
Remove blank lines
ivmartel Mar 29, 2023
85c834c
Remove analyser
ivmartel Mar 29, 2023
a003767
Fix test
ivmartel Mar 29, 2023
b2242b4
Update karma coverage thresholds
ivmartel Mar 29, 2023
1887436
Add doc
ivmartel Mar 29, 2023
3e9fca1
Remove old js intro and outro files
ivmartel Mar 30, 2023
45f8fea
Change build output path
ivmartel Mar 30, 2023
c57e598
Possible deprecated libraryTarget in the future
ivmartel Mar 30, 2023
63fa43f
Fix externals case
ivmartel Mar 30, 2023
3a43eb6
Update to new build dir
ivmartel Mar 30, 2023
9f40c4a
Update deploy and viewer for deploy
ivmartel Mar 30, 2023
979067b
useUnVrFor...: remove from data writer, add setter
ivmartel Mar 31, 2023
0f6db00
Remove space
ivmartel Mar 31, 2023
8b116ab
Make rules private, add setter
ivmartel Mar 31, 2023
d47c941
Update doc
ivmartel Mar 31, 2023
d25c701
Make internal list private
ivmartel Apr 3, 2023
0ff0fc4
Massive doc update
ivmartel Apr 3, 2023
44b226e
Fix Konva warning
ivmartel Apr 3, 2023
b451e8c
Fix bad import
ivmartel Apr 3, 2023
e124eb2
Add arrow function
ivmartel Apr 3, 2023
73ba54b
Add missing imports
ivmartel Apr 3, 2023
a808557
Add magic wand as external
ivmartel Apr 3, 2023
61081c0
Update doc
ivmartel Apr 3, 2023
bca3195
Merge branch 'develop' into 399-es6-webpack
ivmartel Apr 3, 2023
d255972
Regenerate lock
ivmartel Apr 3, 2023
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
7 changes: 6 additions & 1 deletion .eslint-full.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@ module.exports = {
extends: [
'.eslintrc.js',
'plugin:jsdoc/recommended',
]
],
rules: {
// no undefined type
// https://github.com/gajus/eslint-plugin-jsdoc#user-content-eslint-plugin-jsdoc-rules-no-undefined-types
'jsdoc/no-undefined-types': 'off'
}
};
16 changes: 10 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,28 @@ module.exports = {
env: {
browser: true,
node: true,
jquery: true,
es6: true,
es2020: true
},
globals: {
dwv: 'readonly'
es2022: true
},
extends: [
'eslint:recommended',
],
parserOptions: {
sourceType: 'module'
},
rules: {
// require triple equal
// https://eslint.org/docs/rules/eqeqeq
eqeqeq: 'error',
// force semi colon
// https://eslint.org/docs/rules/semi
semi: ['error'],

// no var
// https://eslint.org/docs/rules/no-var
'no-var': 'error',
// prefer const
// https://eslint.org/docs/rules/prefer-const
'prefer-const': 'error',
// allow for some unused args
// https://eslint.org/docs/rules/no-unused-vars
'no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
Expand Down
70 changes: 0 additions & 70 deletions Gruntfile.js

This file was deleted.

3 changes: 2 additions & 1 deletion decoders/dwv/decode-rle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ importScripts('rle.js');
self.addEventListener('message', function (event) {

// decode DICOM buffer
var decoder = new dwv.decoder.RleDecoder();
// eslint-disable-next-line no-undef
var decoder = new dwvdecoder.RleDecoder();
// post decoded data
self.postMessage([decoder.decode(
event.data.buffer,
Expand Down
8 changes: 4 additions & 4 deletions decoders/dwv/rle.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// namespaces
var dwv = dwv || {};
dwv.decoder = dwv.decoder || {};
// (do not use dwv since it is the exported module name)
var dwvdecoder = dwvdecoder || {};

/**
* RLE (Run-length encoding) decoder class.
* @constructor
*/
dwv.decoder.RleDecoder = function () {};
dwvdecoder.RleDecoder = function () {};

/**
* Decode a RLE buffer.
Expand All @@ -20,7 +20,7 @@ dwv.decoder.RleDecoder = function () {};
* @returns The decoded buffer.
* @see http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_G.3.html
*/
dwv.decoder.RleDecoder.prototype.decode = function (buffer,
dwvdecoder.RleDecoder.prototype.decode = function (buffer,
bitsAllocated, isSigned, sliceSize, samplesPerPixel, planarConfiguration) {

// bytes per element
Expand Down
81 changes: 24 additions & 57 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,10 @@
module.exports = function (config) {
config.set({
basePath: '.',
frameworks: ['qunit'],
frameworks: ['qunit', 'webpack'],
files: [
// dependencies
{pattern: 'node_modules/konva/konva.min.js', watched: false},
{pattern: 'node_modules/jszip/dist/jszip.min.js', watched: false},
// benchmark
{pattern: 'node_modules/lodash/lodash.min.js', watched: false},
{pattern: 'node_modules/benchmark/benchmark.js', watched: false},
// decoders
{pattern: 'decoders/**/*.js', included: false},
// test data
{pattern: 'tests/data/**/*.dcm', included: false},
{pattern: 'tests/data/DICOMDIR', included: false},
{pattern: 'tests/data/*.dcmdir', included: false},
{pattern: 'tests/data/*.zip', included: false},
{pattern: 'tests/dicom/*.json', included: false},
{pattern: 'tests/state/**/*.json', included: false},
// extra served content
{pattern: 'tests/**/*.html', included: false},
{pattern: 'tests/visual/appgui.js', included: false},
{pattern: 'tests/visual/style.css', included: false},
{pattern: 'tests/dicom/pages/*.js', included: false},
{pattern: 'tests/image/pages/*.js', included: false},
{pattern: 'tests/pacs/*.js', included: false},
{pattern: 'tests/bench/*.js', included: false},
{pattern: 'tests/utils/worker.js', included: false},
{pattern: 'tests/visual/images/*.jpg', included: false},
{pattern: 'tests/pacs/images/*.png', included: false},
{pattern: 'dist/*.js', included: false},
{pattern: 'build/dist/*.js', included: false},
// src
'src/**/*.js',
// test
'tests/**/*.test.js',
'tests/dicom/*.js'
{pattern: 'tests/**/*.test.js', watched: false}
],
proxies: {
'/tests/data/': '/base/tests/data/',
'/tests/dicom/': '/base/tests/dicom/',
'/tests/state/': '/base/tests/state/',
'/tests/utils/': '/base/tests/utils/'
},
client: {
clearContext: false,
qunit: {
Expand All @@ -54,35 +16,40 @@ module.exports = function (config) {
}
},
preprocessors: {
'src/**/*.js': ['coverage']
'src/**/*.js': ['webpack', 'sourcemap'],
'tests/**/*.test.js': ['webpack']
},
coverageReporter: {
dir: require('path').join(__dirname, './build/coverage/dwv'),
dir: require('path').join(__dirname, './build/coverage/'),
reporters: [
{type: 'html', subdir: 'report-html'},
{type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt'},
{type: 'text-summary'}
],
check: {
global: {
statements: 40,
branches: 39,
functions: 30,
lines: 40
statements: 45,
branches: 45,
functions: 45,
lines: 45
}
}
},
reporters: ['progress'],
logLevel: config.LOG_INFO,
customLaunchers: {
ChromeWithTestsPage: {
base: 'Chrome',
flags: [
'http://localhost:9876/base/tests/index.html'
]
}
},
browsers: ['ChromeWithTestsPage'],
restartOnFileChange: true
browsers: ['Chrome'],
restartOnFileChange: true,
webpack: webpackConfig()
});
};

/**
* Get the webpack config to pass to Karma.
*
* @returns {object} The config.
*/
function webpackConfig() {
const config = require('./webpack.test.js');
delete config.entry;
delete config.output;
return config;
}
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,36 @@
"magic-wand-tool": "~1.1.7"
},
"devDependencies": {
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"babel-loader": "^9.1.2",
"babel-plugin-istanbul": "^6.1.1",
"benchmark": "~2.1.4",
"clean-jsdoc-theme": "^4.2.6",
"eslint": "~8.36.0",
"eslint-plugin-jsdoc": "~40.1.0",
"github-release-notes": "0.17.2",
"grunt": "^1.6.1",
"grunt-cli": "^1.4.3",
"grunt-contrib-concat": "^2.1.0",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-uglify": "^5.2.2",
"grunt-contrib-watch": "^1.1.0",
"html-webpack-plugin": "^5.5.0",
"jsdoc": "^4.0.2",
"karma": "^6.4.1",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage": "^2.2.0",
"karma-qunit": "^4.1.2",
"qunit": "^2.19.4"
"karma-sourcemap-loader": "^0.4.0",
"karma-webpack": "^5.0.0",
"qunit": "^2.19.4",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0"
},
"scripts": {
"start": "webpack serve --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"lint": "eslint -c '.eslint-full.js' 'src/**/*.js' 'tests/**/*.js' '*.js'",
"test": "karma start ./karma.conf.js",
"test-ci": "karma start ./karma.conf.js --browsers ChromeHeadless --reporters progress,coverage --single-run",
"build": "grunt build",
"doc": "jsdoc -c resources/doc/jsdoc.conf.json",
"dev": "grunt dev",
"gren": "gren"
}
}
5 changes: 1 addition & 4 deletions resources/doc/tutorials/standards.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ These are the standards that should be used when coding for this project.
* Versioning: [Semantic Versioning](http://semver.org/)
* Branch: try to follow some kind of [branching model](http://nvie.com/posts/a-successful-git-branching-model/)

These standards are enforced using Continuous Integration with [github-actions](https://github.com/features/actions): builds using [node](http://nodejs.org/) (see `.github/workflows/nodejs-ci.yml`) and [yarn](https://classic.yarnpkg.com). The CI basically executes `yarn install` that reads the `package.json` file and then runs `yarn run test`. This test target is configured to run a task runner called [Grunt](http://gruntjs.com/) which is configured with the `Gruntfile.js` file. The `package.json` file contains shortcuts to grunt scripts:
* `yarn run test` -> [grunt-karma](https://www.npmjs.org/package/grunt-karma) that allows to run qunit tests using a headless browser such a Google Chrome
* `yarn run lint` -> [grunt-eslint](https://www.npmjs.org/package/grunt-eslint) that lints the code
* `yarn run build` -> [grunt-contrib-concat](https://www.npmjs.org/package/grunt-contrib-concat) that concatenates a list of files together and [grunt-contrib-uglify](https://www.npmjs.org/package/grunt-contrib-uglify) that minifies the code
These standards are enforced using Continuous Integration with [github-actions](https://github.com/features/actions): builds using [node](http://nodejs.org/) (see `.github/workflows/nodejs-ci.yml`) and [yarn](https://classic.yarnpkg.com). The CI executes the lint and test scripts.

Others
* Icons: firefox-os [styleguide](http://www.mozilla.org/en-US/styleguide/products/firefox-os/icons/)
Expand Down
50 changes: 0 additions & 50 deletions resources/module/intro.js

This file was deleted.

2 changes: 0 additions & 2 deletions resources/module/outro.js

This file was deleted.

Loading