Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
Use a flag around local flow versions
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Dec 2, 2016
1 parent e84acc8 commit 66bd3a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
14 changes: 9 additions & 5 deletions lib/pkg/flow-base/lib/FlowHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,18 @@ async function canFindFlow(flowPath: string): Promise<boolean> {
* preferences in Atom, in which case the return value will be stale.
*/
async function getPathToFlow(): Promise<string> {
const config = global.vscode.workspace.getConfiguration('flow').get('pathToFlow')
if (await canFindFlow(config)) {
return config
const config = global.vscode.workspace.getConfiguration('flow')
const userPath = config.get('pathToFlow')

if (await canFindFlow(userPath)) {
return userPath
}
if (await canFindFlow(fallbackNodeModuleFlowLocation())){

const shouldUseNodeModule = config.get('useNPMPackagedFlow')
if (shouldUseNodeModule && await canFindFlow(fallbackNodeModuleFlowLocation())){
return fallbackNodeModuleFlowLocation()
}
return config
return userPath
}

/**
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
"type": "boolean",
"default": true,
"description": "Stop Flow on Exit"
},
"flow.useNPMPackagedFlow": {
"type": "boolean",
"default": false,
"description": "Support using flow through your node_modules folder, WARNING: Checking this box is a security risk. When you open a project we will immediately run code contained within it."
}
}
}
Expand Down Expand Up @@ -77,4 +82,4 @@
"bugs": {
"url": "https://github.com/flowtype/flow-for-vscode/issues"
}
}
}

0 comments on commit 66bd3a5

Please sign in to comment.