Fix undefined orgInstance
This commit is contained in:
Родитель
28df1c01d6
Коммит
d36f1bbfa0
18
lib/force.js
18
lib/force.js
|
@ -54,6 +54,20 @@ let orgInstance;
|
|||
|
||||
// F U N C T I O N S
|
||||
|
||||
const getOrgInstance = function getOrgInstance(url=SALESFORCE_URL) {
|
||||
if (!orgInstance) {
|
||||
const match = SALESFORCE_URL_REGEX.exec(url);
|
||||
if (match === null) {
|
||||
throw new Error(`Invalid SALESFORCE_URL: '${url}'`);
|
||||
}
|
||||
SALESFORCE_URL_REGEX.lastIndex = 0; // reset
|
||||
orgInstance = `${match[4]}`;
|
||||
}
|
||||
|
||||
return orgInstance;
|
||||
}
|
||||
|
||||
|
||||
// Generate config object from given SALESFORCE_URL
|
||||
const parseOrgConfigFromUrl = function parseOrgConfigFromUrl(url, type, username) {
|
||||
const match = SALESFORCE_URL_REGEX.exec(url);
|
||||
|
@ -162,7 +176,7 @@ const pushSource = function pushSource(targetOrg) {
|
|||
utils.info(`[DEBUG] Push options: ${JSON.stringify(PUSH_SOURCE_OPTIONS)}`);
|
||||
}
|
||||
|
||||
utils.info(`Pushing workspace source to Organization '${orgInstance}'...`);
|
||||
utils.info(`Pushing workspace source to Organization '${getOrgInstance()}'...`);
|
||||
const start = (new Date()).getTime();
|
||||
return pushApi.doPush(PUSH_SOURCE_OPTIONS)
|
||||
.then((result) => {
|
||||
|
@ -202,7 +216,7 @@ const setupEnv = function setupEnv() {
|
|||
.then(config.setWorkspaceOrg(SALESFORCE_ORG))
|
||||
.then(() => {
|
||||
if (DEBUG) {
|
||||
utils.info(`[DEBUG] Set workspace Organization to ${SALESFORCE_ORG}`);
|
||||
utils.info(`[DEBUG] Set workspace Organization to '${SALESFORCE_ORG}'`);
|
||||
}
|
||||
})
|
||||
.then(writeHubConfig)
|
||||
|
|
Загрузка…
Ссылка в новой задаче