public class NpmProjectType extends Object
Constructor and Description |
---|
NpmProjectType() |
Modifier and Type | Method and Description |
---|---|
boolean |
check(File directory)
Check if the project is a NPM project (i.e a package.json is found).
|
boolean |
createNewUpdateFile(String buildPath,
String buildTempPath,
com.github.zafarkhaja.semver.Version nextVersion,
boolean isIndented,
String[] matchingWords)
Write an updated temporary file with next version
then replace the project config file with it.
|
com.github.zafarkhaja.semver.Version |
getCurrentVersion(File directory,
ProcessHelper processHelper)
Return the next version of the version attribute.
|
void |
writeVersion(File directory,
com.github.zafarkhaja.semver.Version nextVersion,
ProcessHelper processHelper)
Write back to the
package.json file the next version.Use the npm command version , see : https://docs.npmjs.com/cli/v6/commands/npm-version. |
public boolean check(File directory)
directory
- The directory of the project.public com.github.zafarkhaja.semver.Version getCurrentVersion(File directory, ProcessHelper processHelper) throws IOException
directory
- The project's directory.processHelper
- Not used.IOException
- If an error occur reading files.public void writeVersion(File directory, com.github.zafarkhaja.semver.Version nextVersion, ProcessHelper processHelper) throws IOException, InterruptedException
package.json
file the next version.version
, see : https://docs.npmjs.com/cli/v6/commands/npm-version.directory
- The directory where write the file.nextVersion
- The next version to use.processHelper
- The helper to run the command.IOException
- If errors occurs when write the fileInterruptedException
- It errors occurs with the npm command.public boolean createNewUpdateFile(String buildPath, String buildTempPath, com.github.zafarkhaja.semver.Version nextVersion, boolean isIndented, String[] matchingWords) throws IOException
buildPath
- Path of the file updatedbuildTempPath
- Path of a temporary file to replace buildPathnextVersion
- Version to update config fileisIndented
- Can the config file have indentationmatchingWords
- Tab of word to match the versionIOException
- If errors occurs when write the fileCopyright © 2016–2022. All rights reserved.