-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix circular dependency loading issue
- Loading branch information
Showing
5 changed files
with
38 additions
and
33 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,31 @@ | ||
import {currentProcessIsGlobal, inferPackageManagerForGlobalCLI} from './is-global.js' | ||
import {packageManagerFromUserAgent} from './node-package-manager.js' | ||
import {outputContent, outputToken} from './output.js' | ||
|
||
/** | ||
* Utility function for generating an install command for the user to run | ||
* to install an updated version of Shopify CLI. | ||
* @returns A string with the command to run. | ||
*/ | ||
export function cliInstallCommand(): string { | ||
const isGlobal = currentProcessIsGlobal() | ||
let packageManager = packageManagerFromUserAgent() ?? inferPackageManagerForGlobalCLI() | ||
if (packageManager === 'unknown') packageManager = 'npm' | ||
|
||
if (packageManager === 'yarn') { | ||
return `yarn ${isGlobal ? 'global ' : ''}add @shopify/cli@latest` | ||
} else { | ||
return `${packageManager} i ${isGlobal ? '-g ' : ''}@shopify/cli@latest` | ||
} | ||
} | ||
|
||
/** | ||
* Generates a message to remind the user to update the CLI. | ||
* | ||
* @param version - The version to update to. | ||
* @returns The message to remind the user to update the CLI. | ||
*/ | ||
export function getOutputUpdateCLIReminder(version: string): string { | ||
return outputContent`💡 Version ${version} available! Run ${outputToken.genericShellCommand(cliInstallCommand())}` | ||
.value | ||
} |
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