1.0.11 • Published 5 years ago
grunt-get-repo v1.0.11
grunt-get-repo
Download npm packages from Nexus repository via grunt.
Getting Started
grunt-get-repo
can be installed via npm: npm install grunt-get-repo
Then, add and configure it in your grunt file:
module.exports = function (grunt) {
// Load in `grunt-get-repo`
grunt.loadNpmTasks('grunt-get-repo');
};
Documentation
grunt-get-repo
creates a grunt
tasks for you getRepo
.
Global configuration
getRepo: {
dependencies: {
config: {
repository: {
url: "url-to-nexus-repository/repo-name", // mandatory: url to repository included repository name
proxy: "" // optional: proxy, if not set default: ""
},
extension: "tgz" // optional: package compression, if not set default: tgz
dest: "dir-to-download-package" // mandatory: relative path to Gruntfile.js to download package
},
src {...}
}
}
Package configuration
getRepo: {
dependencies: {
config {...},
src: [
{
url: "url-to-nexus-repository/repo-name-1", // optional: url to repository included repository name. If not set use url from config
package: "my-package-1", // mandatory: package name
version: "1.0.1", // mandatory: version
copy: [ //optional : copy extracted files into another directory
{
src: "file-to-copy-11.js", // mandatory: source filename
dest: "another-dir/file-to-copy-11.js" // mandatory: destination
},
...
]
},
{...
}
]
}
}
Examples
Sipmple download and extract
Download and extract file from the repository into directory relative to Gruntfile.js
Creates download and extract files intodiirectory: my-package/dir-to-download-package
getRepo: {
dependencies: {
config: {
repository: {
url: "url-to-nexus-repository/repo-name",
proxy: ""
},
dest: "dir-to-download-package"
},
src: [
{
package: "my-package",
version: "1.0.1"
}
]
}
}
Download, extract and copy files
Download and extract file from the repository into directory relative to Gruntfile.js
Creates download and extract files fron dest directory into another directory:
getRepo: {
dependencies: {
config: {
repository: {
url: "url-to-nexus-repository/repo-name",
proxy: ""
},
dest: "dir-to-download-package"
},
src: [
{
package: "my-package",
version: "1.0.1",
copy: [
{src: "file-to-copy-1.js", dest: "another-dir/file-to-copy-1.js"},
{src: "file-to-copy-2.js", dest: "another-dir/file-to-copy-2.js"}
]
}
]
}
}
Download, extract and copy multiple packages
getRepo: {
dependencies: {
config: {
repository: {
url: "url-to-nexus-repository/repo-name",
proxy: ""
},
dest: "dir-to-download-package"
},
src: [
{
package: "my-package-1",
version: "1.0.1",
copy: [
{src: "file-to-copy-11.js", dest: "another-dir/file-to-copy-11.js"},
{src: "file-to-copy-12.js", dest: "another-dir/file-to-copy-12.js"}
]
},
{
package: "my-package-2",
version: "1.0.1",
copy: [
{src: "file-to-copy-21.js", dest: "another-dir/file-to-copy-21.js"},
{src: "file-to-copy-22.js", dest: "another-dir/file-to-copy-22.js"}
]
}
]
}
}
Download, extract and copy multiple packages from different url's
getRepo: {
dependencies: {
config: {
repository: {
proxy: ""
},
dest: "dir-to-download-package"
},
src: [
{
url: "url-to-nexus-repository/repo-name-1",
package: "my-package-1",
version: "1.0.1",
copy: [
{src: "file-to-copy-11.js", dest: "another-dir/file-to-copy-11.js"},
{src: "file-to-copy-12.js", dest: "another-dir/file-to-copy-12.js"}
]
},
{
url: "url-to-nexus-repository/repo-name",
package: "my-package-2",
version: "1.0.1",
copy: [
{src: "file-to-copy-21.js", dest: "another-dir/file-to-copy-21.js"},
{src: "file-to-copy-22.js", dest: "another-dir/file-to-copy-22.js"}
]
}
]
}
}
Note: you can also set more tasks (getRepo:dependencies1, getRepo:dependencies2) as usual for grunt tasks