Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
grunt-nexus-artifact
Advanced tools
Download artifacts from a Nexus artifact repository. Publish artifacts to a Nexus artifact repository. Only works with Mac and Linux
Nexus does really well with binary files. The idea is a repository can build and publish artifacts and other repositories can pull down those artifacts and extract them. Built files don't need to be committed to git, which take up most of the space in git repositories.
This plugin requires Grunt >=0.4.0
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-nexus-artifact --save-dev
or add the following to your package.json file:
{
"devDependencies": {
"grunt-nexus-artifact": "0.3.5"
}
}
Once the plugin has been installed, enabled it inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-nexus-artifact');
Run this task with the grunt nexus:target:fetch
command.
nexus: {
client: {
url: 'http://nexus.google.com:8080',
repository: 'jslibraries',
fetch: [
{ id: 'com.google.js:jquery:tgz:1.8.0', path: 'public/lib/jquery' }
]
}
}
In grunt, options cascade. If all of your artifacts come from the same nexus server, you can do the following:
nexus: {
options: {
url: 'http://nexus.google.com:8080'
},
client: {
options: {
repository: 'jslibraries'
},
fetch: [
{ id: 'com.google.js:jquery:tgz:1.8.0', path: 'public/lib/jquery' }
]
},
build: {
options: {
repository: 'jstools'
},
fetch: [
{ id: 'com.google.js:closure:tgz:0.1.0', path: 'tools/closure' }
]
}
}
There are a number of options available.
Type: String
This defines the url of your nexus repository. This should be the base URL plus port. Ex: http://your-nexus-repository:8080
Type: String
This defines the name of the repository. Since this task uses the REST API, the repository is not inferred
Type: String
This is an optional parameter that will be the nexus username - may not be needed for fetches
Type: String
This is an optional parameter that will be the nexus password - may not be needed for fetches
Type: Array{Object}
This defines an array of nexus artifacts to be retrieved from nexus. Each artifact has config options:
Type: String
This defines the group_id of the artifact. Ex: com.google.js
Type: String
This defines the name of the artifact. Ex: jquery
Type: String
Available extentions are tgz
, zip
and jar
This defines the extension of the artifact. Ex: tgz
Type: String
This defines the version of the artifact. Ex: 1.8.0
Type: String
This is a shorthand for group_id
, name
, ext
and version
. This defines the id string of the artifact in the following format:
{group_id}:{name}:{ext}:{version}
Ex:
com.google.js:jquery:tgz:1.8.0
Type: String
This defines the path where the artifact will be extracted to. Ex: public/lib/jquery
The publish flag will run the publish config to push artifacts up to nexus. It uses grunt-contrib-compress so the file configuration will be the same.
Run this task with the grunt nexus:target:publish
command.
nexus: {
options: {
url: 'http://nexus.google.com:8080',
repository: 'jslibraries'
},
client: {
files: [
{ src: ['builds/**/*'] }
],
options: {
curl: false,
publish: [{
id: 'com.mycompany.js:built-artifact:tgz',
version: 'my-version',
path: 'dist/',
username: 'admin',
password: 'admin123'
}]
}
}
}
In this example the id
config is used, but the version is dropped. It can be specified in the id
config or specified in the version
config. This makes it easier to set the version dynamically.
The options listed here are new or repurposed for publish
Type String
This defines the temporary path for the compressed artifact.
Type Array
This parameter comes from grunt-contrib-compress
. You can read about it at github.com/gruntjs/grunt-contrib-compress.
There are some differences from the config on grunt-contrib-compress
. First of all, ext
is used from the artifact, so it doesn't need to be specified. mode
is currently not supported. It will auto-configure based on the extension.
Type Boolean
Default false
This parameter gives the option to use curl to upload - some people have issues with uploading using Node streams (not sure why)
Run this task with the grunt nexus:target:verify
command.
This will pull down the last built artifact published to the nexus server.
###Examples You can specify the version in the configuration. This is the preferred approach when the version is dynamic.
nexus: {
client: {
url: 'http://nexus.google.com:8080',
repository: 'jslibraries',
verify: [
{
id: 'com.google.js:jquery:tgz:',
version: '<%= buildVersion %>',
path: 'public/lib/jquery'
}
]
}
}
You can also optionally append the version to the 'id' string.
nexus: {
client: {
url: 'http://nexus.google.com:8080',
repository: 'jslibraries',
verify: [
{
id: 'com.google.js:jquery:tgz:1.8.0',
path: 'public/lib/jquery'
}
]
}
}
Type: String
This defines the url of your nexus repository. This should be the base URL plus port. Ex: http://your-nexus-repository:8080
Type: String
This defines the name of the repository. Since this task uses the REST API, the repository is not inferred
Type: String
This is an optional parameter that will be the nexus username - may not be needed for fetches
Type: String
This is an optional parameter that will be the nexus password - may not be needed for fetches
Type: Array{Object}
This defines an array of nexus artifacts to be retrieved from nexus. Each artifact has config options:
Type: String
This defines the group_id of the artifact. Ex: com.google.js
Type: String
This defines the name of the artifact. Ex: jquery
Type: String
Available extentions are tgz
, zip
and jar
This defines the extension of the artifact. Ex: tgz
Type: String
This defines the version of the artifact. Ex: 1.8.0
Type: String
This is a shorthand for group_id
, name
, ext
and version
. This defines the id string of the artifact in the following format:
{group_id}:{name}:{ext}:{version}
Ex:
com.google.js:jquery:tgz:1.8.0
Type: String
This defines the path where the artifact will be extracted to. Ex: public/lib/jquery
Contributed by Nicholas Boll of Rally Software
FAQs
A grunt plugin that helps with simple nexus artifacts
The npm package grunt-nexus-artifact receives a total of 3 weekly downloads. As such, grunt-nexus-artifact popularity was classified as not popular.
We found that grunt-nexus-artifact demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.