@@ -20,6 +20,7 @@ type AppOptions = {
2020 name : string ,
2121 author : string ,
2222 description : string ,
23+ 'service-id' : string | undefined ,
2324} ;
2425
2526type Preset = {
@@ -108,6 +109,7 @@ const defaultOptions: AppOptions = {
108109 author : 'you@example.com' ,
109110 name : 'compute-js-static-site' ,
110111 description : 'Compute@Edge static site' ,
112+ 'service-id' : undefined ,
111113} ;
112114
113115function pickKeys ( keys : string [ ] , object : Record < string , any > ) : Record < string , any > {
@@ -158,7 +160,7 @@ export function initApp(commandLineValues: CommandLineOptions) {
158160 options = {
159161 ...options ,
160162 ...pickKeys ( [ 'author' , 'name' , 'description' ] , packageJson ?? { } ) ,
161- ...pickKeys ( [ 'public-dir' , 'static-dir' , 'spa' , 'not-found-page' , 'auto-index' , 'auto-ext' , 'author' , 'name' , 'description' ] , commandLineValues )
163+ ...pickKeys ( [ 'public-dir' , 'static-dir' , 'spa' , 'not-found-page' , 'auto-index' , 'auto-ext' , 'author' , 'name' , 'description' , 'service-id' ] , commandLineValues )
162164 } ;
163165
164166 if ( typeof options [ 'not-found-page' ] === 'function' ) {
@@ -241,6 +243,7 @@ export function initApp(commandLineValues: CommandLineOptions) {
241243 const author = options [ 'author' ] ;
242244 const name = options [ 'name' ] ;
243245 const description = options [ 'description' ] ;
246+ const fastlyServiceId = options [ 'service-id' ] as string | undefined ;
244247
245248 let spaRel : string | null = spaFilename != null ? path . relative ( path . resolve ( ) , spaFilename ) : null ;
246249 if ( spaRel != null && ! spaRel . startsWith ( '..' ) ) {
@@ -262,6 +265,7 @@ export function initApp(commandLineValues: CommandLineOptions) {
262265 console . log ( 'name :' , name ) ;
263266 console . log ( 'author :' , author ) ;
264267 console . log ( 'description :' , description ) ;
268+ console . log ( 'Service ID :' , fastlyServiceId ) ;
265269 console . log ( '' ) ;
266270
267271 console . log ( "Initializing Compute@Edge Application in " + computeJsDir + "..." ) ;
@@ -324,7 +328,7 @@ description = "${description}"
324328language = "javascript"
325329manifest_version = 2
326330name = "${ name } "
327- service_id = ""
331+ service_id = "${ fastlyServiceId } "
328332` ;
329333
330334 const fastlyTomlPath = path . resolve ( computeJsDir , 'fastly.toml' ) ;
0 commit comments