forked from bestander/deploy-azure-cdn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
94 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,62 @@ | ||
gulp-deploy-azure-cdn | ||
===================== | ||
# deploy-azure-cdn | ||
|
||
Gulp task to deploy assets to azure CDN | ||
A node package for copying a directory to Azure CDN storage. | ||
Also it provides a gulp plugin interface for easy deploy with (gulp)[http://gulpjs.com/] | ||
|
||
Azure SDK uses by default the environment variables AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY. | ||
Custom connection arguments can be set in options. | ||
|
||
## Installing | ||
|
||
``` | ||
npm install deploy-azure-cdn | ||
``` | ||
|
||
## Exported interface | ||
|
||
- gulpPlugin: function(deployOptions) - to use with gulp | ||
- vanilla: function(deployOptions, files, logger, cb) - to use directly in node.js | ||
|
||
parameters: | ||
- deployOptions - azure cdn and upload configs | ||
- serviceOptions: [] - custom arguments to azure.createBlobService | ||
- containerName: null - container name, required | ||
- containerOptions: {publicAccessLevel: "blob"} - container options | ||
- folder: '', // path within container. Default is root directory of container | ||
- deleteExistingBlobs: true, // set it to false to skip recursive deleting blobs in folder | ||
- concurrentUploadThreads : 10, // number of concurrent uploads, choose best for your network condition | ||
- gzip: false, // true if want to gzip the files before uploading. File will be zipped only if compressed file is smaller than original | ||
- metadata: {cacheControl: 'public, max-age=31556926'} // metadata for each uploaded file | ||
- testRun: false, // set to true if you just want to check connectivity and see deployment logs. No blobs will be removed or uplaoded. | ||
- files: [] - array of files objects to be deployed | ||
- cwd - current working directory path | ||
- path - absolute path of file | ||
- logger - logger compatible with gutil.log(param1, param2...) | ||
- cb - node callback | ||
|
||
|
||
## Using in Gulp example | ||
```javascript | ||
var deployCdn = require('gulp-deploy-azure-cdn'); | ||
|
||
gulp.task('upload-app-to-azure', function () { | ||
return gulp.src(['build/**/*'], { | ||
cwd: 'build' | ||
}).pipe(deployCdn.gulpPlugin({ | ||
containerName: 'test', | ||
serviceOptions: ['<my azure cdn name>', '<my azure cdn secret>'], | ||
folder: 'build-0.0.1/', | ||
zip: true, | ||
deleteExistingBlobs: true, | ||
metadata: { | ||
cacheControl: 'public, max-age=31530000', // cache in browser | ||
cacheControlHeader: 'public, max-age=31530000' // cache in azure CDN. As this data does not change, we set it to 1 year | ||
} | ||
})) | ||
}); | ||
|
||
``` | ||
|
||
## Grunt plugin | ||
See my other repository: https://github.com/bestander/grunt-azure-cdn-deploy. | ||
Code is very similar but less structured. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
{ | ||
"name": "gulp-deploy-azure-cdn", | ||
"version": "0.1.0", | ||
"description": "A gulp task to deploy assets to Windows Azure CDN", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/bestander/gulp-deploy-azure-cdn.git" | ||
}, | ||
"keywords": [ | ||
"gulpplugin", | ||
"azure", | ||
"deployment", | ||
"cdn", | ||
"upload" | ||
], | ||
"author": "Konstantin Raev", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/bestander/gulp-deploy-azure-cdn/issues" | ||
}, | ||
"homepage": "https://github.com/bestander/gulp-deploy-azure-cdn", | ||
"dependencies": { | ||
"azure": "^0.8.1", | ||
"mime": "^1.2.11", | ||
"gulp-util": "^2.2.14", | ||
"through2": "^0.4.1", | ||
"q": "^1.0.1", | ||
"node.extend": "^1.0.10", | ||
"async": "^0.6.1" | ||
} | ||
"name": "deploy-azure-cdn", | ||
"version": "0.1.1", | ||
"description": "A package that deploys a groupt of files to Azure CDN. Can be used with gulp.", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/bestander/deploy-azure-cdn.git" | ||
}, | ||
"keywords": [ | ||
"gulp", | ||
"gulpfriendly", | ||
"gulpplugin", | ||
"azure", | ||
"deployment", | ||
"cdn", | ||
"upload" | ||
|
||
], | ||
"author": "Konstantin Raev", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/bestander/deploy-azure-cdn/issues" | ||
}, | ||
"homepage": "https://github.com/bestander/deploy-azure-cdn", | ||
"dependencies": { | ||
"azure": "^0.8.1", | ||
"mime": "^1.2.11", | ||
"gulp-util": "^2.2.14", | ||
"through2": "^0.4.1", | ||
"q": "^1.0.1", | ||
"node.extend": "^1.0.10", | ||
"async": "^0.6.1" | ||
} | ||
} |