2.1.2 • Published 6 years ago

noxys-deps v2.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

Noxys Dependencies

Build Status Build Status npm Dependency Status

Description

Noxys Depdendencies is a library that provide a way to parse dependency files and allow to check updates for dependencies on official repositories OR your repositories.

Features

  • Parse dependency file
  • Check updates on official or private repositories
  • Get libraries list that need to be updated

Supported Platforms

  • NodeJS :
    • NPM (package.json)
  • Java :
    • Maven (pom.xml)
    • Gradle (build.gradle)
  • Python :
    • Requirements (requirements.txt)
  • Docker :
    • Docker (Dockerfile)
  • Ruby :
    • rubygems (Gemfile)

How to use

Install

npm install --save noxys-deps

or

yarn add noxys-deps

Example Usage

const NoxysDependencies = require('noxys-deps');
const noxysDepInstance = new NoxysDependencies();
const requirementsTxtString = fs.readFileSync(path.resolve('dev/files/requirements.txt')).toString();

noxysDepInstance.parseManifestString('requirements.txt', requirementsTxtString).then((dependencies) => {
    console.log(noxysDepInstance.dependencies);
    console.log(dependencies);
    noxysDepInstance.checkUpdates().then((results) => {
        console.log(results);
    }).catch(console.error);
}).catch(console.error);

API

NoxysDependencies

Class that have all methods for parsing, check dependencies, ...

getUpdatedManifestString

This static function is here to generate updated manifest from one put in parameter.

Parameters: | Key | Description | Type | Required | Default | |:--------:|:---------------------------:|:------------:|:--------:|:--------:| | fileName | File Name (example: 'build.gradle', 'package.json') | String | True | None | | manifestString | Manifest in string | String | True | None | | dependenciesToUpdate | Dependencies list to update (given by NoxysDependencies and from checkUpdates) in the manifest (Update from "version" to "latest") | Array | True | None |

Return: Promise => Manifest updated in string

getUpdatedManifestFile

This static function is here to generate updated manifest from one put in parameter.

Parameters: | Key | Description | Type | Required | Default | |:--------:|:---------------------------:|:------------:|:--------:|:--------:| | fileName | File Name (example: 'build.gradle', 'package.json') | String | True | None | | manifestFilePath | Manifest file path | String | True | None | | dependenciesToUpdate | Dependencies list to update (given by NoxysDependencies and from checkUpdates) in the manifest (Update from "version" to "latest") | Array | True | None |

Return: Promise => Manifest updated in string

isManifestSupported

This static function is here to check if manifest is supported for parsing, ...

Parameters:

KeyDescriptionTypeRequiredDefault
fileNameFile Name (example: 'build.gradle', 'package.json')StringTrueNone

Return: Boolean

getPlatformName

This static function is here to get the platform name from manifest file name.

Parameters:

KeyDescriptionTypeRequiredDefault
fileNameFile Name (example: 'build.gradle', 'package.json')StringTrueNone

Return: String

getPlatformConfigurationKeyRelation

This static function is here to get the relation between configuration key and platform.

Return: Array

getDefaultConfiguration

This static method is here to get default configuration.

Return: Object

getUpdateTypes

This static method is here to get update types. Example of keys: NONE, UNKNOWN,...

Return: Object

Constructor

Parameters :

  • Configuration :
const configuration = {
    npm: {
        registryUrl: 'http://localhost:8081/repository/npm',
        auth: {
            username: 'admin',
            password: 'admin123',
        },
    },
    maven: {
        registryUrl: 'http://localhost:8081/repository/maven-public',
        auth: {
            username: 'admin',
            password: 'admin123',
        },
    },
    docker: {
        registryUrl: 'http://localhost:5001',
        auth: {
            username: 'admin',
            password: 'admin123',
        },
        concurrency: 15,
    },
    rubygems: {
        registryUrl: 'http://localhost:8081/repository/rubygems-proxy/',
        auth: {
            username: undefined,
            password: undefined,
        },
        concurrency: 5,
    },
    pypi: {
        registryUrl: 'http://localhost:8081/repository/pypi/',
        concurrency: 5,
    },
};

(You can give only the one you don't want to use a private repository or to change a configuration like concurrency).

parseManifestString

This function will parse the manifest and will return dependencies found in.

Parameters :

KeyDescriptionTypeRequiredDefault
fileNameFile Name (example: 'build.gradle', 'package.json')StringTrueNone
manifestStringManifest StringStringTrueNone

Return: Promise with dependencies

#### parseManifestFile This function will parse the manifest and will return dependencies found in.

Parameters :

KeyDescriptionTypeRequiredDefault
fileNameFile Name (example: 'build.gradle', 'package.json')StringTrueNone
manifestFilePathManifest File PathStringTrueNone

Return: Promise with dependencies

checkUpdates

This function will check if there is updates for parsed dependencies on registry (specified in configuration).

Return: Promise with dependencies (with latest version and update type)

getUpdatedManifest

This function is here to generate updated manifest.

Parameters: | Key | Description | Type | Required | Default | |:--------:|:---------------------------:|:------------:|:--------:|:--------:| | dependenciesToUpdate | Dependencies list to update (given by NoxysDependencies and from checkUpdates) in the manifest (Update from "version" to "latest") | Array | True | None |

Return: Promise => Manifest updated in string

Model

Dependency model :

const dependency = {
  "name": "org.glassfish.jersey.core:jersey-server",
  "type": "runtime", // "test", "development", "peer", "optional", "provided (only during compilation)", "unknown"
  "version": "2.26-b02",
  "latest": "2.27", // Will be added with checkUpdates
  "updateType": "major" // Will be added with checkUpdates
}

Thanks

  • My wife BH to support me doing this

Author

  • Oxyno-zeta (Havrileck Alexandre)

License

MIT (See in License.md)