乐趣区

关于前端:腾讯云-Serverless-使用及部署-Docusaurus

  • 代码:https://github.com/ikuokuo/st…

前提筹备

npm install -g serverless
npm update -g serverless
❯ serverless -v
Framework Core: 2.8.0
Plugin: 4.1.1
SDK: 2.3.2
Components: 3.2.7

疾速部署

❯ serverless
Serverless: 以后未检测到 Serverless 我的项目,是否心愿新建一个我的项目?Yes
Serverless: 请抉择你心愿创立的 Serverless 利用 vue-starter - 疾速部署一个 Vue.js 根底利用
Serverless: 请输出项目名称 demo
Serverless: 正在装置 vue-starter 利用...

vue-starter › Created

demo 我的项目已胜利创立!Serverless: 是否心愿立刻将该我的项目部署到云端?Yes

Please scan QR code login from wechat.
Wait login...
Login successful for TencentCloud.

serverless ⚡framework
Action: "deploy" - Stage: "dev" - App: "demo" - Instance: "vue-starter"

region:  ap-guangzhou
website: https://my-vue-starter-1255876835.cos-website.ap-guangzhou.myqcloud.com

Full details: https://serverless.cloud.tencent.com/apps/demo/vue-starter/dev

Serverless 利用曾经胜利部署,您将享有 30 天收费额度。计费详情:https://url.cn/T1uSQD5C

88s › vue-starter › Success

拜访 https://my-vue-starter-125587… 查看利用。

查看信息

❯ cd demo
❯ sls info

serverless ⚡framework

Last Action:  deploy (8 minutes ago)
Deployments:  1
Status:       active
More Info:    Full details: https://serverless.cloud.tencent.com/apps/demo/vue-starter/dev

region:                ap-guangzhou
website:               https://my-vue-starter-1255876835.cos-website.ap-guangzhou.myqcloud.com
sourceCodeDownloadUrl: https://sp-ins-prod-1300963013.cos.ap-guangzhou.myqcloud.com/**

vue-starter › Info successfully loaded

开发调试

sls dev

移除我的项目

sls remove

部署 Docusaurus

创立利用

npx @docusaurus/init@next init my-site classic

运行:

cd my-site
yarn start

部署利用

cd my-site
touch serverless.yml

serverless.yml:

component: website
name: doc-starter
app: demo
inputs:
  src:
    src: ./src
    hook: yarn build
    dist: ./build
  bucketName: my-doc-starter
  protocol: https

部署:

serverless

Serverless 控制台

拜访 https://serverless.cloud.tenc… 查看利用:

结语

欢送关注 GoCoding 公众号,分享日常 Coding 中实用的小技巧、小常识!

退出移动版