@@ -11,7 +11,7 @@ const generateId = () =>
11
11
. substring ( 6 )
12
12
13
13
const getCodeZipPath = async ( instance , code ) => {
14
- console . log ( `Packaging ${ CONFIGS . frameworkFullname } application...` )
14
+ console . log ( `Packaging ${ CONFIGS . compFullname } application...` )
15
15
16
16
// unzip source zip file
17
17
let zipPath
@@ -20,7 +20,7 @@ const getCodeZipPath = async (instance, code) => {
20
20
const downloadPath = `/tmp/${ generateId ( ) } `
21
21
const filename = 'template'
22
22
23
- console . log ( `Installing Default ${ CONFIGS . frameworkFullname } App...` )
23
+ console . log ( `Installing Default ${ CONFIGS . compFullname } App...` )
24
24
await download ( CONFIGS . templateUrl , downloadPath , {
25
25
filename : `${ filename } .zip`
26
26
} )
@@ -32,6 +32,14 @@ const getCodeZipPath = async (instance, code) => {
32
32
return zipPath
33
33
}
34
34
35
+ const removeAppid = ( str , appid ) => {
36
+ const suffix = `-${ appid } `
37
+ if ( ! str || str . indexOf ( suffix ) === - 1 ) {
38
+ return str
39
+ }
40
+ return str . slice ( 0 , - suffix . length )
41
+ }
42
+
35
43
const prepareInputs = async ( instance , inputs ) => {
36
44
let code = inputs . src || ''
37
45
code =
@@ -53,6 +61,8 @@ const prepareInputs = async (instance, inputs) => {
53
61
console . log ( `Files unzipped into ${ sourceDirectory } ...` )
54
62
55
63
const region = inputs . region || CONFIGS . region
64
+ const bucketName =
65
+ removeAppid ( inputs . bucketName , appId ) || `sls-website-${ region } -${ generateId ( ) } `
56
66
57
67
return {
58
68
useDefault : ! code . src ,
@@ -63,7 +73,7 @@ const prepareInputs = async (instance, inputs) => {
63
73
envPath : path . join ( sourceDirectory , envPath )
64
74
} ,
65
75
env : inputs . env ,
66
- bucket : `${ inputs . bucketName || `sls-website- ${ region } - ${ generateId ( ) } ` } -${ appId } ` ,
76
+ bucket : `${ bucketName } -${ appId } ` ,
67
77
region : region ,
68
78
protocol : inputs . protocol || CONFIGS . protocol ,
69
79
cors : inputs . cors
0 commit comments