grunt-vtex-deploy
v0.20.3
Published
VTEX deploy for front end projects
Downloads
83
Readme
grunt-vtex-deploy
VTEX Deploy for front end projects
Release History
0.11.0: Watch out! Breaking changes. For the old API, use v0.8.1.
The "vtex_deploy" task
IMPORTANT: Required Environment Variables
- S3 access key:
S3_KEY
- S3 secret key:
S3_SECRET
- S3 bucket:
S3_BUCKET
Interesting options
options.tempDirectory:
Default value: "./tmp-deploy/"
options.requireEnvironmentType:
Default value: process.env["ENVIRONMENT_TYPE"] If you need a target to only run in a given environment type (e.g., stable).
options.bucket:
Default value: "vtex-io" The bucket to which your files will be uploaded.
options.cwd:
Default value: empty string. A root directory regarding every file referenced in this target. This will not be appended to the target destination, on upload. This is the point of this property.
options.publish:
Default value: false
Whether your package should automatically update the corresponding "tag" to your version in the index.json file.
When you have a version
component to your upload, your version will be added to your package in the index.json file.
If publish is true
, the tag corresponding to the version will be updated to the uploaded version.
E.g. if you just published version 1.2.3-beta, the "beta" tag will be updated with version "1.2.3-beta".
options.upload.version:
Default value: false
A target: source
map. If target
is a directory, source
may be a glob.
If you wish to upload some files at the version directory of your app's folder (e.g. v01-00-00-stable-28
).
See the usage example.
options.upload.root:
Default value: false
A target: source
map. If target
is a directory, source
may be a glob.
If you wish to upload some files at the root of your app's folder.
See the usage example.
options.transform:
Conveniently replace special parts of every file in the files
array.
Pass a replace
map with regex as keys and your desired replacements as values.
The special {{version}}
value gets translated to a version name, e.g. v01-00-00-stable-28
Usage Example
(More usage examples in JS on Gruntfile.js)
vtex_deploy:
main:
cwd: "build"
upload:
version:
"/": "**"
root:
"index.html": "index.html"
transform:
replace:
"/vtex_deploy/": "//io.vtex.com.br/vtex_deploy/{{version}}/"
VERSION_DIRECTORY: "{{version}}"
files: ["index.html", "test1"]
Result:
Running "vtex_deploy:main" (vtex_deploy) task
Using temp directory: ./tmp-deploy/
Cleaning temp directory...
Copying upload files to temp directory...
Copied 5 files
Starting preprocessing
Files: [ 'build/index.html', 'build/test1' ]
Processed tmp-deploy/build/index.html
Processed tmp-deploy/build/test1
Using bucket: vtex-io
Root upload path: vtex_deploy
Version upload path: vtex_deploy/0.11.0
Starting upload...
Uploaded all files successfully!
List of uploaded files:
https://vtex-io.s3.amazonaws.com/vtex_deploy/0.11.0/index.debug.html
https://vtex-io.s3.amazonaws.com/vtex_deploy/0.11.0/index.html
https://vtex-io.s3.amazonaws.com/vtex_deploy/0.11.0/recursive/test1
https://vtex-io.s3.amazonaws.com/vtex_deploy/0.11.0/test1
https://vtex-io.s3.amazonaws.com/vtex_deploy/0.11.0/test2
https://vtex-io.s3.amazonaws.com/vtex_deploy/index.html
Updating registry index...
Version updated at https://vtex-io.s3.amazonaws.com/index.json