gulp-deploy-http-push
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -0,1 +1,9 @@ | ||
# [0.2.0](https://github.com/searchfe/gulp-deploy-http-push/compare/v0.1.2...v0.2.0) (2019-10-24) | ||
### Features | ||
* add cache ([f8cf685](https://github.com/searchfe/gulp-deploy-http-push/commit/f8cf685e22aa579fa71153d6df847747bc501c76)) | ||
* add cache ([3b979f8](https://github.com/searchfe/gulp-deploy-http-push/commit/3b979f89e1e95d20b2bff9fc9f19c46c6165b86e)) | ||
## [0.1.2](https://github.com/searchfe/gulp-deploy-http-push/compare/v0.1.1...v0.1.2) (2019-10-24) | ||
@@ -2,0 +10,0 @@ |
@@ -13,2 +13,4 @@ import { IFile } from './file'; | ||
retry: number; | ||
cachePath: string; | ||
cache: boolean; | ||
} |
@@ -11,2 +11,4 @@ "use strict"; | ||
var to = option.to; | ||
var cachePath = option.cachePath; | ||
var cache = option.cache; | ||
var receiver = option.receiver; | ||
@@ -26,3 +28,3 @@ var authApi = option.authApi; | ||
steps.push(function reduce(next) { | ||
upload_1.upload(receiver, to, file.getHashRelease ? file.getHashRelease() : file.relative, file.contents, file, function (error) { return error ? errorHandler(file, error, function () { return reduce(next); }) : next(); }); | ||
upload_1.upload(receiver, to, cache, cachePath, file.getHashRelease ? file.getHashRelease() : file.relative, file.contents, file, function (error) { return error ? errorHandler(file, error, function () { return reduce(next); }) : next(); }); | ||
}); | ||
@@ -29,0 +31,0 @@ function errorHandler(f, error, next) { |
@@ -12,3 +12,5 @@ /// <reference types="node" /> | ||
relative?: string; | ||
stat?: any; | ||
path?: string; | ||
} | ||
export {}; |
@@ -9,3 +9,7 @@ export declare function httpPush(options: IDeployOption[]): any; | ||
to: string; | ||
/** 缓存存放目录 */ | ||
cachePath?: string; | ||
/** 是否缓存 */ | ||
cache?: boolean; | ||
} | ||
export {}; |
@@ -9,2 +9,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var cache_1 = require("./cache"); | ||
var filter_1 = require("./filter"); | ||
@@ -17,2 +18,4 @@ var restrictor_1 = require("./restrictor"); | ||
var restrictor = new restrictor_1.Restrictor(); | ||
var cachePath = options[0].cachePath ? options[0].cachePath : cache_1.defaultCachePath; | ||
cache_1.mkdirsSync(cachePath); | ||
return new Transform({ | ||
@@ -23,6 +26,9 @@ objectMode: true, | ||
options.forEach(function (option) { | ||
if (!option.match || (option.match && filter_1.include(file.path, option.match, { | ||
root: file.base | ||
}))) { | ||
if (!cache_1.hasCache(cachePath, file) && (!option.match || | ||
(option.match && filter_1.include(file.path, option.match, { | ||
root: file.base | ||
})))) { | ||
restrictor.add({ | ||
cache: !!option.cache, | ||
cachePath: cachePath, | ||
host: option.host, | ||
@@ -33,3 +39,5 @@ retry: 2, | ||
contents: file.contents, | ||
relative: '/' + file.relative | ||
path: file.path, | ||
relative: '/' + file.relative, | ||
stat: file.stat | ||
}); | ||
@@ -36,0 +44,0 @@ // 在match名单中 |
export { Deploy } from './deploy'; | ||
export { httpPush } from './http-push'; | ||
export { push } from './push'; | ||
export { deleteCache } from './cache'; |
@@ -15,1 +15,3 @@ "use strict"; | ||
exports.push = push_1.push; | ||
var cache_1 = require("./cache"); | ||
exports.deleteCache = cache_1.deleteCache; |
@@ -7,3 +7,7 @@ export declare function push(options: PushOptions): any; | ||
to: string; | ||
/** 缓存存放目录 */ | ||
cachePath?: string; | ||
/** 是否缓存 */ | ||
cache?: boolean; | ||
} | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var readable_stream_1 = require("readable-stream"); | ||
var cache_1 = require("./cache"); | ||
var restrictor_1 = require("./restrictor"); | ||
function push(options) { | ||
var restrictor = new restrictor_1.Restrictor(); | ||
var cachePath = options.cachePath ? options.cachePath : cache_1.defaultCachePath; | ||
cache_1.mkdirsSync(cachePath); | ||
return new readable_stream_1.Transform({ | ||
objectMode: true, | ||
transform: function (file, enc, callback) { | ||
if (!file.isDirectory()) { | ||
if (!file.isDirectory() && !cache_1.hasCache(cachePath, file)) { | ||
restrictor.add({ | ||
cache: !!options.cache, | ||
cachePath: cachePath, | ||
host: options.host, | ||
@@ -17,3 +22,5 @@ retry: 2, | ||
contents: file.contents, | ||
relative: '/' + file.relative | ||
path: file.path, | ||
relative: '/' + file.relative, | ||
stat: file.stat | ||
}); | ||
@@ -20,0 +27,0 @@ } |
import { IFile } from './file'; | ||
export declare function upload(receiver: any, to: any, release: any, content: any, file: IFile, callback: any): void; | ||
export declare function upload(receiver: any, to: any, cache: any, cachePath: any, release: any, content: any, file: IFile, callback: any): void; |
@@ -20,6 +20,7 @@ "use strict"; | ||
*/ | ||
var cache_1 = require("./cache"); | ||
var fetch_1 = require("./fetch"); | ||
var token_1 = require("./token"); | ||
var util_1 = require("./util"); | ||
function upload(receiver, to, release, content, file, callback) { | ||
function upload(receiver, to, cache, cachePath, release, content, file, callback) { | ||
var subpath = file.subpath || file.relative; | ||
@@ -55,2 +56,5 @@ if (!subpath) { | ||
to + release); | ||
if (cache) { | ||
cache_1.saveCache(file, cachePath); | ||
} | ||
callback(); | ||
@@ -57,0 +61,0 @@ } |
{ | ||
"name": "gulp-deploy-http-push", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"discription": "gulp-deploy-http-push", | ||
@@ -87,2 +87,3 @@ "scripts": { | ||
"dependencies": { | ||
"fs-extra": "^8.1.0", | ||
"prompt": "^1.0.0", | ||
@@ -89,0 +90,0 @@ "readable-stream": "^3.4.0" |
@@ -39,2 +39,3 @@ # gulp-deploy-http-push | ||
to: '/home/work/xxx/template/', // 注意这个是指的是测试机器的路径,而非本地机器 | ||
cache: true // 是否使用缓存,默认缓存路径 ./node_modules/gulp-depoly-http-push/http-cache | ||
}, | ||
@@ -45,2 +46,3 @@ { | ||
to: '/home/work/xxx/webroot/', // 注意这个是指的是测试机器的路径,而非本地机器 | ||
cache: true // 是否使用缓存,默认缓存路径 ./node_modules/gulp-depoly-http-push/http-cache | ||
}, | ||
@@ -47,0 +49,0 @@ ])); |
Sorry, the diff of this file is too big to display
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
648079
33
18808
58
3
2
+ Addedfs-extra@^8.1.0
+ Addedfs-extra@8.1.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@4.0.0(transitive)
+ Addeduniversalify@0.1.2(transitive)