mirror of
https://github.com/serverless/serverless.git
synced 2025-12-08 19:46:03 +00:00
Fix #5242 Do this by first supplying the `servicePath` in `~/lib/plugins/lib/validate.js` and `~/lib/plugins/print.js` in a consistent manner with the code in `~/lib/classes/PluginManager.js`. Then, provide a default of `process.cwd()` for `servicePath` in `getCacheFilePath` and `getServerlessConfigFile`.
14 lines
436 B
JavaScript
14 lines
436 B
JavaScript
'use strict';
|
|
|
|
const homedir = require('os').homedir();
|
|
const path = require('path');
|
|
const crypto = require('crypto');
|
|
|
|
const getCacheFilePath = function (srvcPath) {
|
|
const servicePath = srvcPath || process.cwd();
|
|
const servicePathHash = crypto.createHash('sha256').update(servicePath).digest('hex');
|
|
return path.join(homedir, '.serverless', 'cache', servicePathHash, 'autocomplete.json');
|
|
};
|
|
|
|
module.exports = getCacheFilePath;
|