If you'd like to participate in the development and maintenance of this plugin, please open a PR or an issue. Help is welcome.Thanks to all who have contributed so far!
NOTE: This branch refers to version 4.0.0 and above. See the 3.0.0 branch for the previous version.
This vue-cli plugin aims to make it easier to deploy a built Vue.js app to an S3 bucket.
Supports:
Cache-Control
metadata for use with PWAs and Service WorkersYou must have a set of valid AWS credentials set up on your system.
yarn add vue-cli-plugin-s3-deploy@next
After installation, invoke the plugin with vue invoke s3-deploy
.
Answer the configuration prompts. This will inject a deploy
script command into your package.json
file.
Deploy your app with yarn deploy
.
Options are set in vue.config.js
and overridden on a per-environment basis by .env
, .env.staging
, .env.production
, etc.
module.exports = {
pluginOptions: {
s3Deploy: {
awsProfile: "Specifies the credentials profile to use. For env vars, omit or set to 'default'. (default: default)",
endpoint: "Override the default AWS endpoint with another e.g. DigitalOcean.",
region: "AWS region for the specified bucket (default: us-east-1)",
bucket: "The S3 bucket name (required)",
createBucket: "Create the bucket if it doesn't exist (default: false)",
staticHosting: "Enable S3 static site hosting (default: false)",
staticIndexPage: "Sets the default index file (default: index.html)",
staticErrorPage: "Sets the default error file (default: error.html)",
assetPath: "The path to the built assets (default: dist)",
assetMatch: "Regex matcher for asset to deploy (default: **)",
deployPath: "Path to deploy the app in the bucket (default: /)",
acl: "Access control list permissions to apply in S3 (default: public-read)",
pwa: "Sets max-age=0 for the PWA-related files specified (default: false)",
pwaFiles: "Comma-separated list of files to treat as PWA files",
enableCloudfront: "Enables support for Cloudfront distribution invalidation (default: false)",
cloudfrontId: "The ID of the distribution to invalidate",
cloudfrontMatchers: "A comma-separated list of paths to invalidate (default: /*)",
uploadConcurrency: "Number of concurrent uploads (default: 5)",
cacheControl: "Sets cache-control metadata for all uploads, overridden for individual files by pwa settings",
gzip: "Enables GZIP compression",
gzipFilePattern: "Pattern for matching files to be gzipped. (By default: '**/*.{js,css,json,ico,map,xml,txt,svg,eot,ttf,woff,woff2}')"
}
}
}
The pwa
option is meant to help make deploying progressive web apps a little easier. Due to the way service workers interact with caching, this option alone will tell the browser to not cache the service-worker.js
file by default. This ensures that changes made to the service worker are reflected as quickly as possible.
You can specify which files aren't cached by setting a value for the pwaFiles
option:
{
pwaFiles: "index.html,dont-cache.css,not-this.js"
}
The cacheControl
option is intended for deployments with lots of static files and relying on browser or CDN caching.
For example, you may want to have files default to being cached for 1 day:
{
cacheControl: "max-age=86400"
}
Deployment options can be overridden with .env files to support development, staging, and production deployment environments.
The .env file options are, with examples:
VUE_APP_S3D_AWS_PROFILE=stagingadmin
VUE_APP_S3D_REGION=staging-aws-east-1
VUE_APP_S3D_BUCKET=staging-bucket
VUE_APP_S3D_CREATE_BUCKET=true
VUE_APP_S3D_UPLOAD_CONCURRENCY=5
VUE_APP_S3D_STATIC_HOSTING=true
VUE_APP_S3D_STATIC_INDEX_PAGE=index.html
VUE_APP_S3D_STATIC_ERROR_PAGE=error.html
VUE_APP_S3D_ASSET_PATH=dist/staging
VUE_APP_S3D_ASSET_MATCH=**
VUE_APP_S3D_DEPLOY_PATH=/app-staging
VUE_APP_S3D_ACL=public-read
VUE_APP_S3D_PWA=true
VUE_APP_S3D_PWA_FILES=service-worker-stage.js,index.html
VUE_APP_S3D_CACHE_CONTROL="max-age=3600"
VUE_APP_S3D_GZIP=true
VUE_APP_S3D_GZIP_FILE_PATTERN="**/*.{js,css,json,ico,map,xml,txt,svg,eot,ttf,woff,woff2}"
VUE_APP_S3D_ENABLE_CLOUDFRONT=true
VUE_APP_S3D_CLOUDFRONT_ID=AIXXXXXXXX
VUE_APP_S3D_CLOUDFRONT_MATCHERS=/index.html,/styles/*.css,/*.png
These options OVERRIDE the config options set in vue.config.js and should be used to customize a default set of options. A common use case is only overriding VUE_APP_S3D_BUCKET
for production deployment.
The AWS SDK will pick up the specified credentials from your ~/.aws/credentials
file and from the environment variables AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
, and AWS_SESSION_TOKEN
.
To specify credentials other than default
in ~/.aws/credentials
, re-run vue invoke s3-deploy
and select a different profile.
If your build process appends hashes to the files it generates, you may find that files with old hashes build up in your S3 bucket. Consider using this plugin to tag these old files so that S3 can expire them after a set number of days: https://github.com/euan-forrester/vue-cli-plugin-s3-deploy-cleanup
@jackdcasey has written a GitHub action to deploy with vue-cli-plugin-s3-deploy! https://github.com/jackdcasey/vue-cli-plugin-s3-deploy-action (In Development)
4.0.0-rc4
deployPath
failures. (Thanks @tarasbilohan)4.0.0-rc3
3.0.0
vue invoke
.2.1.1
awsProfile
. The SDK supports this via the AWS_PROFILE
environment variable.2.1
deployPath
option. Allows you to deploy to folder in the bucket, not always to the root. Fixes #15.awsProfile
for using AWS credentials other than default
. Fixes #19.v2.0.2
v2.0.0
v1.3
v1.2
v1.1
Clone the repo and install dependencies with yarn install
.Run yarn watch-test
to start a test runner.Build the dist directory with yarn build
.
Contributions welcome.Just open a pull request.
通用指南 如果你用 Vue CLI 处理静态资源并和后端框架一起作为部署的一部分,那么你需要的仅仅是确保 Vue CLI 生成的构建文件在正确的位置,并遵循后端框架的发布方式即可。 如果你独立于后端部署前端应用——也就是说后端暴露一个前端可访问的 API,然后前端实际上是纯静态应用。那么你可以将 dist 目录里构建的内容部署到任何静态文件服务器中,但要确保正确的 publicPath。 本地预览
Vue CLI 官方文档(三)模式和环境变量(–mode,.env)、构建目标(–target)、部署 1. 模式和环境变量 模式 模式是 Vue CLI 项目中一个重要的概念。默认情况下,一个 Vue CLI 项目有三个模式: development 模式用于 vue-cli-service serve test 模式用于 vue-cli-service test:unit production
vue-cli-plugin-apicloud 是基于vue cli 的apicloud插件,方便添加apicloud模板,最快使用vue开发apicloud。 支持wifi调试、同步 使用 假设你有一个vue项目(如果没有,使用vue create xxx) 进入项目,执行vue add apicloud yarn wifi-start yarn wifi-sync
Vue CLI Plugin Electron Builder Easily Build Your Vue.js App For Desktop With Electron Build status: Top Supporters Glenn Frank Quick Start: Open a terminal in the directory of your app created with V
S3-plugin 是一个高性能 PyTorch 数据集库,用于高效访问存储在 S3 存储桶中的数据集。它提供对任何大小数据集的流式数据访问,因此无需提供本地存储容量。该库旨在利用 S3 提供的高吞吐量以最小延迟访问对象。 用户可以根据需要灵活地使用地图样式或可迭代样式的数据集接口。该库本身与文件格式无关,并将 S3 中的对象呈现为二进制缓冲区(blob)。用户可以自由地对从 S3 接收到的数据应
S3 Captcha Plugin 是高级的验证码脚本,它通过选择正确的图像来进行验证,而不是写出那些难以辨识的数字和字母。
Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统,提供: 通过 @vue/cli 搭建交互式的项目脚手架。 通过 @vue/cli + @vue/cli-service-global 快速开始零配置原型开发。 一个运行时依赖 (@vue/cli-service),该依赖: 可升级; 基于 webpack 构建,并带有合理的默认配置; 可以通过项目内的配置文件进行配置; 可以通过插件
San CLI webpack 编译时的进度条插件,是一个 Service 插件 使用文档 请移步San-CLI 文档