@Override public void executeNode() throws Exception { String digest = FileUtil.getDigest(getSourceFiles()); super.executeNode(); _writeSourceDigestFile(digest.getBytes(StandardCharsets.UTF_8)); }
@Override public void executeNode() throws Exception { String digest = FileUtil.getDigest(getSourceFiles()); super.executeNode(); _writeSourceDigestFile(digest.getBytes(StandardCharsets.UTF_8)); }
private void _npmCacheVerify() { Logger logger = getLogger(); try { _npmCacheVerify = true; super.executeNode(); } catch (Exception e) { if (logger.isWarnEnabled()) { String message = "Unable to run \"npm cache verify\""; if (Validator.isNotNull(e.getMessage())) { message = e.getMessage() + ". " + message; } logger.warn(message); } } finally { _npmCacheVerify = false; } }
@Override public void executeNode() throws Exception { super.executeNode(); File shrinkwrapJsonFile = new File( getWorkingDir(), "npm-shrinkwrap.json"); JsonSlurper jsonSlurper = new JsonSlurper(); Map<String, Object> shrinkwrap = (Map<String, Object>)jsonSlurper.parse( shrinkwrapJsonFile); List<String> excludedDependencies = getExcludedDependencies(); if (!excludedDependencies.isEmpty()) { _removeExcludedDependencies(shrinkwrap, getExcludedDependencies()); } String shrinkwrapJSON = JsonOutput.prettyPrint( JsonOutput.toJson(shrinkwrap)); shrinkwrapJSON = shrinkwrapJSON.replace(_FOUR_SPACES, "\t"); Files.write( shrinkwrapJsonFile.toPath(), shrinkwrapJSON.getBytes(StandardCharsets.UTF_8)); }
private void _npmCacheVerify() { Logger logger = getLogger(); try { _npmCacheVerify = true; super.executeNode(); } catch (Exception e) { if (logger.isWarnEnabled()) { String message = "Unable to run \"npm cache verify\""; if (Validator.isNotNull(e.getMessage())) { message = e.getMessage() + ". " + message; } logger.warn(message); } } finally { _npmCacheVerify = false; } }
@Override public void executeNode() throws Exception { super.executeNode(); File shrinkwrapJsonFile = new File( getWorkingDir(), "npm-shrinkwrap.json"); JsonSlurper jsonSlurper = new JsonSlurper(); Map<String, Object> shrinkwrap = (Map<String, Object>)jsonSlurper.parse( shrinkwrapJsonFile); List<String> excludedDependencies = getExcludedDependencies(); if (!excludedDependencies.isEmpty()) { _removeExcludedDependencies(shrinkwrap, getExcludedDependencies()); } String shrinkwrapJSON = JsonOutput.prettyPrint( JsonOutput.toJson(shrinkwrap)); shrinkwrapJSON = shrinkwrapJSON.replace(_FOUR_SPACES, "\t"); Files.write( shrinkwrapJsonFile.toPath(), shrinkwrapJSON.getBytes(StandardCharsets.UTF_8)); }
_updatePackageJsonFile(packageJsonPath); super.executeNode();
_updatePackageJsonFile(packageJsonPath); super.executeNode();
private void _npmInstall(boolean reset) throws Exception { Logger logger = getLogger(); int npmInstallRetries = getNpmInstallRetries(); Project project = getProject(); for (int i = 0; i < (npmInstallRetries + 1); i++) { if (reset || (i > 0)) { project.delete(getNodeModulesDir()); } try { super.executeNode(); break; } catch (IOException ioe) { if (i == npmInstallRetries) { throw ioe; } if (logger.isWarnEnabled()) { logger.warn( ioe.getMessage() + ". Running \"npm install\" again"); } _npmCacheVerify(); } } }
private void _npmInstall(boolean reset) throws Exception { Logger logger = getLogger(); int npmInstallRetries = getNpmInstallRetries(); Project project = getProject(); for (int i = 0; i < (npmInstallRetries + 1); i++) { if (reset || (i > 0)) { project.delete(getNodeModulesDir()); } try { super.executeNode(); break; } catch (IOException ioe) { if (i == npmInstallRetries) { throw ioe; } if (logger.isWarnEnabled()) { logger.warn( ioe.getMessage() + ". Running \"npm install\" again"); } _npmCacheVerify(); } } }