@@ -20,6 +20,7 @@ type AppOptions = {
20
20
name : string ,
21
21
author : string ,
22
22
description : string ,
23
+ 'service-id' : string | undefined ,
23
24
} ;
24
25
25
26
type Preset = {
@@ -108,6 +109,7 @@ const defaultOptions: AppOptions = {
108
109
109
110
name : 'compute-js-static-site' ,
110
111
description : 'Compute@Edge static site' ,
112
+ 'service-id' : undefined ,
111
113
} ;
112
114
113
115
function pickKeys ( keys : string [ ] , object : Record < string , any > ) : Record < string , any > {
@@ -158,7 +160,7 @@ export function initApp(commandLineValues: CommandLineOptions) {
158
160
options = {
159
161
...options ,
160
162
...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 )
162
164
} ;
163
165
164
166
if ( typeof options [ 'not-found-page' ] === 'function' ) {
@@ -241,6 +243,7 @@ export function initApp(commandLineValues: CommandLineOptions) {
241
243
const author = options [ 'author' ] ;
242
244
const name = options [ 'name' ] ;
243
245
const description = options [ 'description' ] ;
246
+ const fastlyServiceId = options [ 'service-id' ] as string | undefined ;
244
247
245
248
let spaRel : string | null = spaFilename != null ? path . relative ( path . resolve ( ) , spaFilename ) : null ;
246
249
if ( spaRel != null && ! spaRel . startsWith ( '..' ) ) {
@@ -262,6 +265,7 @@ export function initApp(commandLineValues: CommandLineOptions) {
262
265
console . log ( 'name :' , name ) ;
263
266
console . log ( 'author :' , author ) ;
264
267
console . log ( 'description :' , description ) ;
268
+ console . log ( 'Service ID :' , fastlyServiceId ) ;
265
269
console . log ( '' ) ;
266
270
267
271
console . log ( "Initializing Compute@Edge Application in " + computeJsDir + "..." ) ;
@@ -324,7 +328,7 @@ description = "${description}"
324
328
language = "javascript"
325
329
manifest_version = 2
326
330
name = "${ name } "
327
- service_id = ""
331
+ service_id = "${ fastlyServiceId } "
328
332
` ;
329
333
330
334
const fastlyTomlPath = path . resolve ( computeJsDir , 'fastly.toml' ) ;
0 commit comments