Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(CLI): Export resolved local installation path directly
- Loading branch information
Showing
10 changed files
with
65 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
// This module should be dependencies free (as it's used at local fallback triage) and | ||
// kept async (as telemetry payload generation depends on it) | ||
try { | ||
const path = require('path'); | ||
const { createRequire } = require('module'); | ||
|
||
module.exports = path.resolve( | ||
path.dirname( | ||
createRequire(path.resolve(process.cwd(), 'require-resolver')).resolve('serverless') | ||
), | ||
'..' | ||
); | ||
} catch { | ||
module.exports = null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
const resolveLocalServerlessPath = require('../cli/resolve-local-serverless-path'); | ||
const localServerlessPath = require('../cli/local-serverless-path'); | ||
|
||
const serverlessPath = path.resolve(__dirname, '../..'); | ||
|
||
// This method should be kept as sync. The reason for it is the fact that | ||
// telemetry generation and persistence needs to be run in sync manner | ||
// and it depends on this function, either directly or indirectly. | ||
module.exports = () => { | ||
const localServerlessPath = resolveLocalServerlessPath(); | ||
return serverlessPath === localServerlessPath; | ||
}; | ||
module.exports = () => serverlessPath === localServerlessPath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.