bids-validator
bids-validator copied to clipboard
Migrate web site from Next to Vite
Help match the openneuro build environment more closely.
I didn't need to use any of the workarounds in https://github.com/OpenNeuroOrg/openneuro/blob/master/packages/openneuro-app/vite.config.js to allow vite build to go off. Mosttly stayed with defaults from vite.
Codecov Report
Merging #1430 (f2db304) into master (da94aa9) will decrease coverage by
0.43%. The diff coverage is42.46%.
@@ Coverage Diff @@
## master #1430 +/- ##
==========================================
- Coverage 84.03% 83.60% -0.44%
==========================================
Files 90 90
Lines 3652 3806 +154
Branches 1108 1233 +125
==========================================
+ Hits 3069 3182 +113
- Misses 489 532 +43
+ Partials 94 92 -2
| Impacted Files | Coverage Δ | |
|---|---|---|
| bids-validator/utils/json.js | 77.77% <0.00%> (+50.50%) |
:arrow_up: |
| bids-validator/validators/nifti/nii.js | 69.72% <28.57%> (+0.15%) |
:arrow_up: |
| bids-validator/utils/files/readNiftiHeader.js | 52.99% <32.69%> (-12.64%) |
:arrow_down: |
| bids-validator/validators/headerFields.js | 71.52% <91.66%> (+0.20%) |
:arrow_up: |
| bids-validator/validators/events/events.js | 100.00% <100.00%> (ø) |
|
| ...tor/validators/microscopy/validateTiffSignature.js | 81.81% <0.00%> (-8.19%) |
:arrow_down: |
| bids-validator/validators/bids/quickTestError.js | 88.23% <0.00%> (-5.10%) |
:arrow_down: |
| bids-validator/src/schemaTypes.js | 83.87% <0.00%> (-4.07%) |
:arrow_down: |
| bids-validator/utils/files/readBuffer.js | 36.36% <0.00%> (-3.64%) |
:arrow_down: |
| bids-validator/utils/options.js | 67.92% <0.00%> (-2.91%) |
:arrow_down: |
| ... and 32 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update da94aa9...f2db304. Read the comment docs.
I didn't need to use any of the workarounds in https://github.com/OpenNeuroOrg/openneuro/blob/master/packages/openneuro-app/vite.config.js to allow vite build to go off. Mosttly stayed with defaults from vite.
I wonder if that's fixes in Vite or because they are dependencies of dependencies when used in OpenNeuro?
vite 2.8 vs vite 2.3.1 in openneuro, could be. The tsconfigs between ON and validator are slightly different so not sure if that affects it.
Still breaking esbuild in Docker with the same errors...
I'm replicating those locally outside of docker, not sure whats up.
Right now the two packages throwing esbuild errors for me are nifti-js and jshint. nifti-js is from an unused require('assert') and jshint has the same import, but assert is being used.
nifti-js hasn't been updated since 2016 :(
To get the esbuild to work I cloned nifti-js and removed the unused blocking import. Keeping it at my rwblair account is no good, should I push a copy to bids-standard, or should we be trying something like monkey patching? Project is effectively abandoned.
I also removed jshint from the config json parser. I have it return the json.parse error message instead, so this is considerably less verbose, not sure how much we care about this feature.
Maybe try opening a PR against nifti-js before we fork?
Could we bundle it into our source tree (maybe as a submodule?) until it's merged and released upstream or we decide to officially fork?
scijs/nifti-js/pull/4
We'll see if it gets a response.
nifti-reader-js may be a good alternative, it's used by NiiVue so at least on the OpenNeuro side it could slightly reduce dependency weight.
nifti-header-js uses different names for header fields than the spec and nifti-js so that caused a bit of silliness (pixDims vs pixdim and dims vs dim). I should of just normalized the field names to match the spec in the parseHeader function, instead I changed them to match the libraries usage. Fun fact nifti-js was overwriting the dim array length property to match dim[0].
Unfortunately something like this won't work since it doesn't kill the old dev instance: https://www.npmjs.com/package/npm-watch
Vites watch can't obviously kick off the validator rebuild as far as I can tell. Not sure about npm script interactions in that config: https://vitejs.dev/config/#server-watch
~~@nellh I couldn't figure out how to get it to go without using the openneuro shims, only needed two of them.~~
~~As best I can figure in the bids-validator esbuild was taking queues from the browser field in the package.json field, and there is no way to pass that information outside of packge.json to esbuild.~~
I forgot to test the validator edits caused hot reloading..
rwblair/bids-validator#3 An alternative idea that goes back to using dist/esm/index.js, and enabling esbuild's built in watch functionality on run web-dev, and then having the esbuild and vite dev run simultaneously using a package called concurrently.