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

Cleanup for apps-install script #3834

Merged
merged 4 commits into from
Mar 1, 2018
Merged

Cleanup for apps-install script #3834

merged 4 commits into from
Mar 1, 2018

Conversation

anselmbradford
Copy link
Member

Address @Scotchester comments in #3831

Removals

  • Removes erroneous package-lock.json.

Changes

  • Corrects incorrect code comments in apps-install npm script.
  • Wrap npm standard error output in an if statement.

Testing

  1. See testing in Add postinstall script for apps under cfgov-refresh #3831

/* 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. */
/* Check if package.json exists in a particular app's folder.
If it does, run npm install on that directory. */
const appsPath = `${ paths.unprocessed }/apps/${ app }`;
// eslint-disable-next-line no-sync
if ( fs.existsSync( `${ appsPath }/package.json` ) ) {
exec( `npm --prefix ${ appsPath } install ${ appsPath }`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swap this out for execSync.. You want this to be blocking, you will need to modify the code to use try / catch. See https://github.com/cfpb/cfgov-refresh/pull/3840/files#diff-269192501d1bd2ea09c118162a0ab16aR29

// eslint-disable-next-line no-console
console.log( `npm errors/warnings from ${ appsPath }: ${stderr}` );
}

if ( error !== null ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to kill the process on error, especially since frontend.sh will complete and you won't be able to run the script again ( the checksum value gets added ).

@anselmbradford
Copy link
Member Author

@sebworks please re-pull and check pls!

@sebworks
Copy link
Contributor

sebworks commented Mar 1, 2018

💯, I'm not sure on the linting error.

@anselmbradford
Copy link
Member Author

I removed the final if statement, because if error.stderr exists, so does error. I'll merge this and you can handle any needed changes in #3840 🏓

@anselmbradford anselmbradford merged commit 9a664a9 into master Mar 1, 2018
@anselmbradford anselmbradford deleted the script_cleanup branch March 1, 2018 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants