@@ -6,33 +6,51 @@ import { fileURLToPath, pathToFileURL } from 'url'
66import { spawnSync , SpawnSyncReturns } from 'child_process'
77import { createRequire } from 'module'
88
9- import yargs from 'yargs/yargs' ;
9+ import yargs from 'yargs/yargs'
1010
1111import { AWSAdapterProps } from '../adapter'
1212
1313const __dirname = fileURLToPath ( new URL ( '.' , import . meta. url ) )
1414
15+ interface Arguments {
16+ [ x : string ] : unknown
17+ _: ( string | number ) [ ]
18+ $0: string
19+ s: string | undefined
20+ 'default-projects' : string | undefined
21+ }
22+
1523export async function main ( args : string [ ] ) : Promise < void > {
1624 let pulumiPaths : string [ ] | undefined
1725 let stackName : string | undefined
1826
1927 var argv = yargs ( process . argv . slice ( 2 ) )
20- . usage ( 'Usage: $0 [options]' )
21- . command ( '$0' , 'Destroy the pulumi stacks for sveltekit-adapter-aws-pulumi' )
22- . example ( '$0' , 'count the lines in the given file' )
23- . alias ( 'f' , 'file' )
24- . nargs ( 'f' , 1 )
25- . describe ( 'f' , 'Load a file' )
26- . demandOption ( [ 'f' ] )
27- . help ( 'h' )
28+ . usage ( 'Usage: $0 [options] <artifactPath>' )
29+ . command ( '$0' , '' , ( yargs ) => {
30+ yargs
31+ . positional ( 'artifactPath' , {
32+ describe : 'directory containing the build artifacts' ,
33+ type : 'string' ,
34+ } )
35+ . option ( 's' , {
36+ describe : 'stack name' ,
37+ type : 'string' ,
38+ } )
39+ . option ( 'default-projects' , {
40+ describe : 'use the built-in Pulumi projects' ,
41+ type : 'boolean' ,
42+ } )
43+ } )
2844 . alias ( 'h' , 'help' )
29- . epilog ( 'copyright 2019' )
30- . argv ;
45+ . help ( )
46+ . parseSync ( ) as Arguments
47+
48+ console . log ( argv )
3149
3250 let artifactPath = 'build'
3351
3452 if ( argv . _ . length ) {
35- artifactPath = argv . _ [ 0 ]
53+ artifactPath = String ( argv . _ [ 0 ] )
3654 }
3755
3856 const absArtifactPath = path . resolve ( process . cwd ( ) , artifactPath )
0 commit comments