-
Notifications
You must be signed in to change notification settings - Fork 174
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
[ESLint] Disable on prod instances #8229
Conversation
566f628
to
77215e6
Compare
webpack.config.js
Outdated
{ | ||
from: path.resolve(__dirname, 'node_modules/react/umd'), | ||
to: path.resolve(__dirname, 'htdocs/vendor/js/react'), | ||
flatten: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laemtl flatten: true,
shouldn't be here.
webpack.config.js
Outdated
{ | ||
from: path.resolve(__dirname, 'node_modules/react-dom/umd'), | ||
to: path.resolve(__dirname, 'htdocs/vendor/js/react'), | ||
flatten: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laemtl flatten: true,
shouldn't be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
77215e6
to
d55dc37
Compare
@laemtl conflict |
d55dc37
to
dc19906
Compare
webpack.config.js
Outdated
}), | ||
]; | ||
|
||
mode == 'development' && plugins.push(new ESLintPlugin({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right way of determining this. Your config.xml shouldn't affect your build. Whether you're running make
or make dev
should determine the build environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@laemtl @driusan one approach would be modify the Makefile to contain:
all: VERSION js
composer install --no-dev
# If anything changes, re-generate the VERSION file
VERSION: .
tools/gen-version.sh
phpdev:
composer install
js:
npm ci
mode=production npm run compile
jsdev:
npm ci
mode=development npm run compile
jslatest: clean
rm -rf package-lock.json
rm -rf modules/electrophysiology_browser/jsx/react-series-data-viewer/package-lock.json
npm install
npm run compile
dev: VERSION phpdev jsdev
...
then inside webpack.config.js use const mode = process.env.mode;
to obtain whether "development" or "production" and problem solved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maltheism @driusan Let me know if this new version works for both of you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good to me but what else is affected by the removal of lines 137-149? IIRC they predate this PR..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driusan Those lines set the mode and process.env.NODE_ENV to production/dev, which is implicitly done by passing node-env to webpack (package.json):
"compile": "webpack --node-env=development",
"build": "webpack --node-env=production",
8218fb7
to
9e4ee43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @laemtl the commands make clean && make
result in the following:
Warning: require_once(/Users/alizee/Development/GitHub/McGill/Loris/tools/../vendor/autoload.php): Failed to open stream: No such file or directory in /Users/alizee/Development/GitHub/McGill/Loris/tools/get_config.php on line 3
^
SyntaxError: Unexpected token W in JSON at position 1
at JSON.parse (<anonymous>)
at Socket.<anonymous> (/Users/alizee/Development/GitHub/McGill/Loris/npm-postinstall.js:79:30)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
npm ERR! code 1
npm ERR! path /Users/alizee/Development/GitHub/McGill/Loris
npm ERR! command failed
Unlike on main I'll get the nice warning: WARNING: Unable to fetch DB config useEEGBrowserVisualizationComponents
without it failing to build.
9e4ee43
to
df4d320
Compare
I believe those issues are fixed in #8293. I rebased the PR, let me know if this works now. |
c044a42
to
de6bd52
Compare
@driusan Rebased |
Resolves #5186 |
#8229 introduces a change which causes the npm run watch script to run in production mode. Added a specifier so that it runs in development mode and I also added the --progress flag, which is very nice to have and useful to me.
Prevent ESLint to be run when make is run (prod instances) vs make dev (dev instance).
Note
make steps order were switched to solve a bug with
make clean && make
(thanks to @maltheism amazing testing skills). The post-install node script runs a tool that requires autoload.php to be generated so composer needs to be run first.