@@ -15,8 +15,8 @@ import { Logger } from "../logger.js";
15
15
* Support for AWS SAM framework
16
16
*/
17
17
export class SamFramework implements IFramework {
18
- protected samConfigFile = path . resolve ( "samconfig.toml" ) ;
19
- protected samTemplateFile = path . resolve ( "template.yaml" ) ;
18
+ protected samConfigFile = "samconfig.toml" ;
19
+ protected samTemplateFile = "template.yaml" ;
20
20
21
21
/**
22
22
* Framework name
@@ -31,19 +31,19 @@ export class SamFramework implements IFramework {
31
31
*/
32
32
public async canHandle ( ) : Promise < boolean > {
33
33
try {
34
- await fs . access ( this . samConfigFile , constants . F_OK ) ;
34
+ await fs . access ( path . resolve ( this . samConfigFile ) , constants . F_OK ) ;
35
35
} catch ( error ) {
36
36
Logger . verbose (
37
- `[SAM] This is not a SAM framework project. ${ this . samConfigFile } not found.`
37
+ `[SAM] This is not a SAM framework project. ${ path . resolve ( this . samConfigFile ) } not found.`
38
38
) ;
39
39
return false ;
40
40
}
41
41
42
42
try {
43
- await fs . access ( this . samTemplateFile , constants . F_OK ) ;
43
+ await fs . access ( path . resolve ( this . samTemplateFile ) , constants . F_OK ) ;
44
44
} catch ( error ) {
45
45
Logger . verbose (
46
- `[SAM] This is not a SAM framework project. ${ this . samTemplateFile } not found.`
46
+ `[SAM] This is not a SAM framework project. ${ path . resolve ( this . samTemplateFile ) } not found.`
47
47
) ;
48
48
return false ;
49
49
}
@@ -65,16 +65,24 @@ export class SamFramework implements IFramework {
65
65
66
66
const environment = config . configEnv ?? "default" ;
67
67
68
- const samConfigContent = await fs . readFile ( this . samConfigFile , "utf-8" ) ;
68
+ const samConfigContent = await fs . readFile (
69
+ path . resolve ( this . samConfigFile ) ,
70
+ "utf-8"
71
+ ) ;
69
72
70
73
const samConfig = toml . parse ( samConfigContent ) ;
71
74
const stackName = samConfig [ environment ] ?. global ?. parameters ?. stack_name ;
72
75
73
76
if ( ! stackName ) {
74
- throw new Error ( `Stack name not found in ${ this . samConfigFile } ` ) ;
77
+ throw new Error (
78
+ `Stack name not found in ${ path . resolve ( this . samConfigFile ) } `
79
+ ) ;
75
80
}
76
81
77
- const samTemplateContent = await fs . readFile ( this . samTemplateFile , "utf-8" ) ;
82
+ const samTemplateContent = await fs . readFile (
83
+ path . resolve ( this . samTemplateFile ) ,
84
+ "utf-8"
85
+ ) ;
78
86
const template = yaml . parse ( samTemplateContent ) ;
79
87
80
88
const lambdas : any [ ] = [ ] ;
0 commit comments