fix: setup to allow login to Medusa Cloud
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
const path = require(`path`)
|
||||
const resolveCwd = require(`resolve-cwd`)
|
||||
const yargs = require(`yargs`)
|
||||
const existsSync = require(`fs-exists-cached`).sync
|
||||
|
||||
const { getLocalMedusaVersion } = require(`./util/version`)
|
||||
const { didYouMean } = require(`./did-you-mean`)
|
||||
const existsSync = require(`fs-exists-cached`).sync
|
||||
|
||||
const { whoami } = require("./commands/whoami")
|
||||
const { login } = require("./commands/login")
|
||||
const { link } = require("./commands/link")
|
||||
|
||||
const handlerP = fn => (...args) => {
|
||||
Promise.resolve(fn(...args)).then(
|
||||
@@ -77,6 +82,30 @@ function buildLocalCommands(cli, isLocalProject) {
|
||||
})
|
||||
),
|
||||
})
|
||||
.command({
|
||||
command: `whoami`,
|
||||
desc: `View the details of the currently logged in user.`,
|
||||
handler: handlerP(whoami),
|
||||
})
|
||||
.command({
|
||||
command: `link`,
|
||||
desc: `Creates your Medusa Cloud user in your local database for local testing.`,
|
||||
handler: handlerP(argv => {
|
||||
if (!isLocalProject) {
|
||||
console.log("must be a local project")
|
||||
cli.showHelp()
|
||||
}
|
||||
|
||||
const args = { ...argv, ...projectInfo, useYarn }
|
||||
|
||||
return link(args)
|
||||
}),
|
||||
})
|
||||
.command({
|
||||
command: `login`,
|
||||
desc: `Logs you into Medusa Cloud.`,
|
||||
handler: handlerP(login),
|
||||
})
|
||||
.command({
|
||||
command: `develop`,
|
||||
desc: `Start development server. Watches file and rebuilds when something changes`,
|
||||
|
||||
Reference in New Issue
Block a user