This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +23
-13
lines changed Expand file tree Collapse file tree 4 files changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,10 @@ class ServerlessNextJsPlugin {
56
56
return userConfig === undefined ? defaults [ param ] : userConfig ;
57
57
}
58
58
59
+ getPluginConfigValues ( ...params ) {
60
+ return params . map ( p => this . getPluginConfigValue ( p ) ) ;
61
+ }
62
+
59
63
printStackOutput ( ) {
60
64
const awsInfo = this . serverless . pluginManager . getPlugins ( ) . find ( plugin => {
61
65
return plugin . constructor . name === "AwsInfo" ;
Original file line number Diff line number Diff line change @@ -24,8 +24,7 @@ const normaliseSrc = (staticDir, src) =>
24
24
. join ( "" ) ;
25
25
26
26
const getStaticRouteProxyResources = async function ( bucketName ) {
27
- const staticDir = this . getPluginConfigValue ( "staticDir" ) ;
28
- const routes = this . getPluginConfigValue ( "routes" ) ;
27
+ const [ staticDir , routes ] = this . getPluginConfigValues ( "staticDir" , "routes" ) ;
29
28
30
29
if ( ! staticDir ) {
31
30
return { } ;
@@ -34,6 +33,7 @@ const getStaticRouteProxyResources = async function(bucketName) {
34
33
const baseResource = await loadYml (
35
34
path . join ( __dirname , "../resources/api-gw-proxy.yml" )
36
35
) ;
36
+
37
37
const result = {
38
38
Resources : { }
39
39
} ;
Original file line number Diff line number Diff line change @@ -21,9 +21,12 @@ const overrideTargetIfNotServerless = nextConfiguration => {
21
21
module . exports = async function ( ) {
22
22
const pluginBuildDir = this . pluginBuildDir ;
23
23
const nextConfigDir = pluginBuildDir . nextConfigDir ;
24
- const pageConfig = this . getPluginConfigValue ( "pageConfig" ) ;
25
- const customHandler = this . getPluginConfigValue ( "customHandler" ) ;
26
- const routes = this . getPluginConfigValue ( "routes" ) ;
24
+
25
+ const [ pageConfig , customHandler , routes ] = this . getPluginConfigValues (
26
+ "pageConfig" ,
27
+ "customHandler" ,
28
+ "routes"
29
+ ) ;
27
30
28
31
logger . log ( "Started building next app ..." ) ;
29
32
@@ -61,13 +64,10 @@ module.exports = async function() {
61
64
62
65
await rewritePageHandlers ( nextPages , customHandler ) ;
63
66
64
- const service = this . serverless . service ;
65
-
66
- this . nextPages = nextPages ;
67
-
68
67
nextPages . forEach ( page => {
69
68
const functionName = page . functionName ;
70
- service . functions [ functionName ] = page . serverlessFunction [ functionName ] ;
69
+ this . serverless . service . functions [ functionName ] =
70
+ page . serverlessFunction [ functionName ] ;
71
71
} ) ;
72
72
73
73
this . serverless . service . setFunctionNames ( ) ;
Original file line number Diff line number Diff line change @@ -6,9 +6,15 @@ module.exports = function() {
6
6
7
7
let { nextConfiguration, staticAssetsBucket } = this . configuration ;
8
8
9
- const bucketNameFromConfig = this . getPluginConfigValue ( "assetsBucketName" ) ;
10
- const staticDir = this . getPluginConfigValue ( "staticDir" ) ;
11
- const uploadBuildAssets = this . getPluginConfigValue ( "uploadBuildAssets" ) ;
9
+ const [
10
+ bucketNameFromConfig ,
11
+ staticDir ,
12
+ uploadBuildAssets
13
+ ] = this . getPluginConfigValues (
14
+ "assetsBucketName" ,
15
+ "staticDir" ,
16
+ "uploadBuildAssets"
17
+ ) ;
12
18
13
19
if ( bucketNameFromConfig ) {
14
20
staticAssetsBucket = bucketNameFromConfig ;
You can’t perform that action at this time.
0 commit comments