-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@contentstack/management dependency updated, code clean
- Loading branch information
1 parent
5bbe4b8
commit d03833c
Showing
4 changed files
with
47 additions
and
36 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,18 +1,28 @@ | ||
import * as contentstackSdk from '@contentstack/management' | ||
import {cli} from 'cli-ux' | ||
import processStack from './process-stack' | ||
const regexMessages = require('../../messages/index.json').validateRegex | ||
import { cli } from "cli-ux"; | ||
import * as contentstackSdk from "@contentstack/management"; | ||
|
||
export default async function connectStack(flags: any, host: string, tokenDetails: any) { | ||
import processStack from "./process-stack"; | ||
const regexMessages = require("../../messages/index.json").validateRegex; | ||
|
||
export default async function connectStack( | ||
flags: any, | ||
host: string, | ||
tokenDetails: any | ||
) { | ||
try { | ||
const startTime = Date.now() | ||
cli.action.start(regexMessages.cliAction.connectStackStart, '', {stdout: true}) | ||
const startTime = Date.now(); | ||
cli.action.start(regexMessages.cliAction.connectStackStart, "", { | ||
stdout: true, | ||
}); | ||
const client = contentstackSdk.client({ | ||
host: host, | ||
}) | ||
const stackInstance = await client.stack({api_key: tokenDetails.apiKey, management_token: tokenDetails.token}) | ||
await processStack(flags, stackInstance, startTime) | ||
}); | ||
const stackInstance = client.stack({ | ||
api_key: tokenDetails.apiKey, | ||
management_token: tokenDetails.token, | ||
}); | ||
await processStack(flags, stackInstance, startTime); | ||
} catch (error) { | ||
throw new Error(regexMessages.errors.stack.apiKey) | ||
throw new Error(regexMessages.errors.stack.apiKey); | ||
} | ||
} |