-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add postinstall script for apps under cfgov-refresh #3831
Conversation
|
@@ -101,7 +101,8 @@ | |||
"wcag": "0.3.0" | |||
}, | |||
"scripts": { | |||
"test": "snyk test" | |||
"test": "snyk test", |
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.
Unrelated to this, PR, but this should probably be changed to run our actual test suites.
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.
Also not directly related to this PR: Is there a way to bubble the |
// eslint-disable-next-line no-sync | ||
let apps = fs.readdirSync( `${ paths.unprocessed }/apps/` ); | ||
|
||
// Filter out .DS_STORE directory. |
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.
Trivial: This could be more broadly stated "Filter out hidden directories"
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.
Fixed in #3834
// Filter out .DS_STORE directory. | ||
apps = apps.filter( dir => dir.charAt( 0 ) !== '.' ); | ||
|
||
// Run each application's JS through webpack and store the gulp streams. |
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.
Is this actually happening? Looks like all it's doing is running npm install
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.
Fixed in #3834
@@ -0,0 +1,3 @@ | |||
{ | |||
"lockfileVersion": 1 | |||
} |
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.
The creation of this file appears to be a mistake.
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.
No, it should be created. I'm not sure why it's empty though.
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.
Look at the path; it's in the wrong location.
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.
Fixed in #3834
exec( `npm --prefix ${ appsPath } install ${ appsPath }`, | ||
( error, stdout, stderr ) => { | ||
// eslint-disable-next-line no-console | ||
console.log( 'App\'s npm output: ' + stdout ); |
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.
Is it possible to use app
in these logs to have it say what app it's actually referring to, here? Could get hard to figure things out if this is ever installing multiple apps' stuff.
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.
Great idea!
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.
Fixed in #3834
// eslint-disable-next-line no-console | ||
console.log( 'App\'s npm output: ' + stdout ); | ||
// eslint-disable-next-line no-console | ||
console.log( 'App\'s npm errors: ' + stderr ); |
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.
Are there always errors/warnings? Should this get a condition check like error
below?
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.
Fixed in #3834
// Run each application's JS through webpack and store the gulp streams. | ||
apps.forEach( app => { | ||
/* Check if node_modules directory exists in a particular app's folder. | ||
If it doesn't log the command to add it and don't process the scripts. */ |
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.
Trivial: Could use a comma after "doesn't" for clarity.
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.
Fixed in #3834
Additions
scripts/npm/apps-install/index.js
script for runningnpm install
on./cfgov/unprocessed/apps/[app namespace]/package.json
.Testing
./cfgov/unprocessed/apps/[app namespace]/node_modules
gulp build
, getApp dependencies not installed…
message. (Do not follow message.)npm install
from the project root.gulp build
and check that./cfgov/unprocessed/apps/[app namespace]/node_modules
exists.