Skip to content

Commit 31b29c7

Browse files
yugasunYuga Sun
authored andcommitted
fix: support replace deployment
1 parent 420da8f commit 31b29c7

File tree

10 files changed

+67
-288
lines changed

10 files changed

+67
-288
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ jobs:
4141
- name: Running integration tests
4242
run: npm run test
4343
env:
44+
SERVERLESS_PLATFORM_VENDOR: tencent
45+
GLOBAL_ACCELERATOR_NA: true
4446
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }}
4547
TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }}

example/README.md

Lines changed: 0 additions & 266 deletions
This file was deleted.

example/nuxt.config.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
export default {
22
mode: 'universal',
3+
env: {
4+
STATIC_URL: process.env.STATIC_URL || ''
5+
},
6+
/*
7+
** Build configuration
8+
*/
9+
build: {
10+
extend(config, { isDev, isClient }) {
11+
if (!isDev && process.env.STATIC_URL) {
12+
config.output.publicPath = process.env.STATIC_URL
13+
}
14+
}
15+
},
316
/*
417
** Headers of the page
518
*/
@@ -14,7 +27,7 @@ export default {
1427
content: 'Serverless Nuxt.js Application Created By Serverless Framework'
1528
}
1629
],
17-
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
30+
link: [{ rel: 'icon', type: 'image/x-icon', href: `${process.env.STATIC_URL}/favicon.ico` }]
1831
},
1932
/*
2033
** Customize the progress-bar color
@@ -35,14 +48,5 @@ export default {
3548
/*
3649
** Nuxt.js modules
3750
*/
38-
modules: [],
39-
/*
40-
** Build configuration
41-
*/
42-
build: {
43-
/*
44-
** You can extend webpack config here
45-
*/
46-
extend(config, ctx) {}
47-
}
51+
modules: []
4852
}

example/pages/index.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
<div class="container">
33
<div>
44
<logo />
5-
<h1 class="title">nuxt-demo</h1>
6-
<h2 class="subtitle">Serverless Nuxt.js Application Created By Serverless Framework</h2>
7-
<div class="links">
8-
<a href="https://nuxtjs.org/" target="_blank" class="button--green">Documentation</a>
9-
<a href="https://github.com/nuxt/nuxt.js" target="_blank" class="button--grey">GitHub</a>
10-
</div>
5+
<h1 class="title">Welcome to Nuxt.js</h1>
6+
<h2 class="subtitle">
7+
The SSR app is hosted on
8+
<a href="https://cloud.tencent.com/product/ssr" target="_blank" rel="noopener noreferrer">
9+
Serverless SSR
10+
</a>
11+
</h2>
1112
</div>
1213
</div>
1314
</template>

example/serverless.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ inputs:
1717
- http
1818
- https
1919
environment: release
20+
staticConf:
21+
cosConf:
22+
replace: true
23+
bucket: nuxtjs-demo
24+
sources:
25+
- src: .nuxt/dist/client
26+
targetDir: /
27+
- src: static
28+
targetDir: /

package.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"publishConfig": {
55
"access": "public"
66
},
7+
"description": "Tencent Cloud Nuxt.js Serverless Component",
78
"scripts": {
89
"test": "jest ./tests/integration.test.js --testEnvironment node",
910
"commitlint": "commitlint -f HEAD@{15}",
@@ -57,5 +58,26 @@
5758
"lint-staged": "^10.0.8",
5859
"prettier": "^1.19.1",
5960
"semantic-release": "^17.0.4"
60-
}
61+
},
62+
"directories": {
63+
"doc": "docs",
64+
"example": "example",
65+
"test": "tests"
66+
},
67+
"repository": {
68+
"type": "git",
69+
"url": "git+https://github.com/serverless-components/tencent-nuxtjs.git"
70+
},
71+
"keywords": [
72+
"serverless-nuxtjs",
73+
"nuxtjs",
74+
"serverless",
75+
"serverless-framework",
76+
"serverless-components",
77+
"tencent-cloud"
78+
],
79+
"bugs": {
80+
"url": "https://github.com/serverless-components/tencent-nuxtjs/issues"
81+
},
82+
"homepage": "https://github.com/serverless-components/tencent-nuxtjs#readme"
6183
}

serverless.component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: nuxtjs
2-
version: 0.1.5
2+
version: 0.1.6
33
author: 'Tencent Cloud, Inc.'
44
org: 'Tencent Cloud, Inc.'
55
description: Deploy a serverless Nuxt.js application onto Tencent SCF and API Gateway.

0 commit comments

Comments
 (0)