Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Oct 19, 2018
2 parents 6e4e97b + fc7e47a commit c9ee969
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## How it works

webpack 4 plugin to download remote files, and save them locally.
webpack 4 plugin to download & save remote files locally

## Usage

```js
const DownloadFilePlugin = require('download-file-webpack-plugin');
const SaveRemoteFilePlugin = require('save-remote-file-webpack-plugin');
module.exports = {
plugins: [
new DownloadFilePlugin([
new SaveRemoteFilePlugin([
{
url: 'http://example.com/some/file.txt',
filepath: 'local.txt',
Expand All @@ -24,5 +24,5 @@ You can pass in either an object, or an array of objects.

## Options

* **url** remote URL of the file to download
* **filepath** filename where the file will be saved
* **url** remote URL of the remote file to save locally
* **filepath** filename where the file will be saved, relative to your webpack `output.path`
12 changes: 6 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var download = require('download-to-file');
var path = require('path');

module.exports = function () {
function DownloadFilePlugin(options) {
_classCallCheck(this, DownloadFilePlugin);
function SaveRemoteFilePlugin(options) {
_classCallCheck(this, SaveRemoteFilePlugin);

if (options instanceof Array) {
this.options = options;
Expand All @@ -18,13 +18,13 @@ module.exports = function () {
}
}

_createClass(DownloadFilePlugin, [{
_createClass(SaveRemoteFilePlugin, [{
key: 'apply',
value: function apply(compiler) {
var _this = this;

compiler.hooks.beforeRun.tapAsync({
name: 'DownloadFilePlugin',
name: 'SaveRemoteFilePlugin',
context: true
}, function (context, compilation, callback) {
var downloadFiles = function downloadFiles(option) {
Expand All @@ -35,7 +35,7 @@ module.exports = function () {
compilation.errors.push(new Error(err));
} else {
if (reportProgress) {
reportProgress(100.0, 'Download finished: ', filepath);
reportProgress(100.0, 'Remote files saved to: ', filepath);
}
}
});
Expand All @@ -46,5 +46,5 @@ module.exports = function () {
}
}]);

return DownloadFilePlugin;
return SaveRemoteFilePlugin;
}();
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "download-file-webpack-plugin",
"name": "save-remote-file-webpack-plugin",
"version": "1.0.0",
"description": "webpack 4 plugin to download remote files, and save them locally",
"description": "webpack 4 plugin to download & save remote files locally",
"main": "dist/index.js",
"dependencies": {
"download-to-file": "^2.1.0"
},
"homepage": "https://github.com/nystudio107/download-file-webpack-plugin",
"homepage": "https://github.com/nystudio107/save-remote-file-webpack-plugin",
"repository": {
"type": "git",
"url": "[email protected]:nystudio107/download-file-webpack-plugin.git"
"url": "[email protected]:nystudio107/save-remote-file-webpack-plugin.git"
},
"devDependencies": {
"babel-cli": "^6.22.2",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const download = require('download-to-file')
const path = require('path');

module.exports = class DownloadFilePlugin {
module.exports = class SaveRemoteFilePlugin {
constructor(options) {
if (options instanceof Array) {
this.options = options;
Expand All @@ -13,7 +13,7 @@ module.exports = class DownloadFilePlugin {
apply(compiler) {
compiler.hooks.beforeRun.tapAsync(
{
name: 'DownloadFilePlugin',
name: 'SaveRemoteFilePlugin',
context: true
},
(context, compilation, callback) => {
Expand All @@ -25,7 +25,7 @@ module.exports = class DownloadFilePlugin {
compilation.errors.push(new Error(err));
} else {
if (reportProgress) {
reportProgress(100.0, 'Download finished: ', filepath);
reportProgress(100.0, 'Remote files saved to: ', filepath);
}
}
});
Expand Down

0 comments on commit c9ee969

Please sign in to comment.