在项目中本地添加的npm/yarn无服务器包如何知道serverless.yml文件的位置?我试图在无服务器框架( https://github.com/serverless/serverless)的源代码中找到确切的代码片段,这就是发生这种情况的地方,但到目前为止还没有任何运气。我需要知道这一点因为我的
yarn sls offline start命令似乎没有看到我在serverless.yml文件中所做的新更改。它一直在选择旧的那个。
发布于 2019-04-23 22:52:53
这是Serverless用来加载配置的代码:
https://github.com/serverless/serverless/blob/master/lib/utils/getServerlessConfigFile.js#L9
相关摘录:
const servicePath = srvcPath || process.cwd();
const jsonPath = path.join(servicePath, 'serverless.json');
const ymlPath = path.join(servicePath, 'serverless.yml');
const yamlPath = path.join(servicePath, 'serverless.yaml');
const jsPath = path.join(servicePath, 'serverless.js');
return BbPromise.props({
json: fileExists(jsonPath),
yml: fileExists(ymlPath),
yaml: fileExists(yamlPath),
js: fileExists(jsPath),
}).then(exists => {请注意,在命令行界面中,servicePath设置为当前工作目录。
看一下代码,我猜你可能有一个优先于serverless.yaml的serverless.json?命令serverless print将显示已解析的配置。(https://serverless.com/framework/docs/providers/aws/cli-reference/print/#print)
https://stackoverflow.com/questions/55813231
复制相似问题