@extrahorizon/exh-cli 1.5.1 → 1.6.0-dev-38-562ae51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/build/commands/localizations/sync.d.ts +29 -0
- package/build/commands/localizations/sync.js +59 -0
- package/build/commands/localizations/utils/assertValidKey.d.ts +1 -0
- package/build/commands/localizations/utils/assertValidKey.js +10 -0
- package/build/commands/localizations/utils/assertValidLanguageCode.d.ts +2 -0
- package/build/commands/localizations/utils/assertValidLanguageCode.js +21 -0
- package/build/commands/localizations/utils/fetchLocalizations.d.ts +2 -0
- package/build/commands/localizations/utils/fetchLocalizations.js +20 -0
- package/build/commands/localizations/utils/readLocalizationFiles.d.ts +6 -0
- package/build/commands/localizations/utils/readLocalizationFiles.js +39 -0
- package/build/commands/localizations/utils/syncLocalizations.d.ts +2 -0
- package/build/commands/localizations/utils/syncLocalizations.js +46 -0
- package/build/commands/localizations.d.ts +5 -0
- package/build/commands/localizations.js +10 -0
- package/build/commands/whoami.d.ts +8 -0
- package/build/commands/whoami.js +20 -0
- package/build/helpers/util.d.ts +1 -0
- package/build/helpers/util.js +7 -1
- package/build/index.js +0 -7
- package/build/repositories/auth.d.ts +3 -0
- package/build/repositories/auth.js +11 -0
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Extra Horizon CLI changelog
|
|
2
2
|
|
|
3
|
+
### v1.6.0
|
|
4
|
+
* Removed the update notifier. The version of the package we used had security vulnerabilities and we're unable to migrate to the latest version right now. We'll look into this again in the future.
|
|
5
|
+
* Added the `exh whoami` command, showing the currently logged in user
|
|
6
|
+
|
|
3
7
|
### v1.5.1
|
|
4
8
|
* Now also publishing to the NPM registry, no longer needing to authenticate with GitHub Packages to install the CLI
|
|
5
9
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Extra Horizon CLI
|
|
2
2
|
|
|
3
|
-
This is the command-line interface to the Extra Horizon platform. It allows you to manage
|
|
3
|
+
This is the command-line interface to the Extra Horizon platform. It allows you to manage just some parts of your Extra Horizon configuration for now, but
|
|
4
4
|
will be extended with additional functionality.
|
|
5
5
|
|
|
6
6
|
See [changelog](CHANGELOG.md) for the latest changes.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
import { OAuth1Client } from '@extrahorizon/javascript-sdk';
|
|
3
|
+
export declare const command = "sync";
|
|
4
|
+
export declare const desc = "Sync all localizations in a directory with the ExH cloud";
|
|
5
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "keys" | "path" | "languages"> & import("yargs").InferredOptionTypes<{
|
|
6
|
+
path: {
|
|
7
|
+
demandOption: false;
|
|
8
|
+
describe: string;
|
|
9
|
+
type: "string";
|
|
10
|
+
};
|
|
11
|
+
keys: {
|
|
12
|
+
demandOption: false;
|
|
13
|
+
describe: string;
|
|
14
|
+
type: "string";
|
|
15
|
+
};
|
|
16
|
+
languages: {
|
|
17
|
+
demandOption: false;
|
|
18
|
+
describe: string;
|
|
19
|
+
type: "string";
|
|
20
|
+
};
|
|
21
|
+
}>>;
|
|
22
|
+
interface HandlerInput {
|
|
23
|
+
sdk: OAuth1Client;
|
|
24
|
+
path?: string;
|
|
25
|
+
languages?: string;
|
|
26
|
+
keys?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const handler: ({ keys: rawKeys, languages: rawLanguages, path, sdk }: HandlerInput) => Promise<void>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const ospath = require("path");
|
|
6
|
+
const util_1 = require("../../helpers/util");
|
|
7
|
+
const assertValidKey_1 = require("./utils/assertValidKey");
|
|
8
|
+
const assertValidLanguageCode_1 = require("./utils/assertValidLanguageCode");
|
|
9
|
+
const fetchLocalizations_1 = require("./utils/fetchLocalizations");
|
|
10
|
+
const readLocalizationFiles_1 = require("./utils/readLocalizationFiles");
|
|
11
|
+
const syncLocalizations_1 = require("./utils/syncLocalizations");
|
|
12
|
+
exports.command = 'sync';
|
|
13
|
+
exports.desc = 'Sync all localizations in a directory with the ExH cloud';
|
|
14
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({
|
|
15
|
+
path: {
|
|
16
|
+
demandOption: false,
|
|
17
|
+
describe: 'Directory containing the localizations which need to be synced in a JSON format. By Default: /locales',
|
|
18
|
+
type: 'string',
|
|
19
|
+
},
|
|
20
|
+
keys: {
|
|
21
|
+
demandOption: false,
|
|
22
|
+
describe: 'The keys separated by a "," to sync',
|
|
23
|
+
type: 'string',
|
|
24
|
+
},
|
|
25
|
+
languages: {
|
|
26
|
+
demandOption: false,
|
|
27
|
+
describe: 'The languages separated by a "," to sync',
|
|
28
|
+
type: 'string',
|
|
29
|
+
},
|
|
30
|
+
}).check(({ path, keys: rawKeys, languages: rawLanguages }) => {
|
|
31
|
+
if (path && !fs.existsSync(ospath.join(process.cwd(), path))) {
|
|
32
|
+
throw new Error('please provide a valid file path for your localizations');
|
|
33
|
+
}
|
|
34
|
+
if (rawLanguages) {
|
|
35
|
+
const languageCodes = rawLanguages.toLocaleUpperCase().split(',');
|
|
36
|
+
for (const languageCode of languageCodes) {
|
|
37
|
+
(0, assertValidLanguageCode_1.assertValidLanguageCode)(languageCode);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (rawKeys) {
|
|
41
|
+
const keys = rawKeys.split(',');
|
|
42
|
+
for (const key of keys) {
|
|
43
|
+
(0, assertValidKey_1.assertValidKey)(key);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
exports.builder = builder;
|
|
49
|
+
const handler = async ({ keys: rawKeys, languages: rawLanguages, path, sdk }) => {
|
|
50
|
+
const keys = rawKeys?.split(',');
|
|
51
|
+
const selectedLanguageCodes = rawLanguages?.toUpperCase().split(',');
|
|
52
|
+
const fullPath = ospath.join(process.cwd(), path ?? 'locales');
|
|
53
|
+
console.log(`- Reading the localization configuration from ${fullPath}`);
|
|
54
|
+
const { localizations, languageCodes } = (0, readLocalizationFiles_1.readLocalizationFiles)(fullPath, keys, selectedLanguageCodes);
|
|
55
|
+
console.log('- Fetching the localization configuration from the localizations service');
|
|
56
|
+
const savedLocalizations = await (0, fetchLocalizations_1.fetchLocalizations)(sdk, localizations.map(localization => localization.key), languageCodes);
|
|
57
|
+
await (0, syncLocalizations_1.syncLocalizations)(sdk, localizations, savedLocalizations);
|
|
58
|
+
};
|
|
59
|
+
exports.handler = handler;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const assertValidKey: (key: string) => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertValidKey = void 0;
|
|
4
|
+
const assertValidKey = (key) => {
|
|
5
|
+
const validKeyRegex = /^[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
6
|
+
if (!validKeyRegex.test(key)) {
|
|
7
|
+
throw new Error(`The key ${key} is not valid! Must follow the pattern ${validKeyRegex}!`);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
exports.assertValidKey = assertValidKey;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertValidLanguageCode = exports.availableLanguagesCodes = void 0;
|
|
4
|
+
exports.availableLanguagesCodes = [
|
|
5
|
+
'EN', 'AA', 'AB', 'AE', 'AF', 'AK', 'AM', 'AN', 'AR', 'AS', 'AV', 'AY', 'AZ', 'BA', 'BE', 'BG', 'BH', 'BI', 'BM', 'BN', 'BO',
|
|
6
|
+
'BR', 'BS', 'CA', 'CE', 'CH', 'CO', 'CR', 'CS', 'CU', 'CV', 'CY', 'DA', 'DE', 'DV', 'DZ', 'EE', 'EL', 'EO', 'ES', 'ET', 'EU',
|
|
7
|
+
'FA', 'FF', 'FI', 'FJ', 'FO', 'FR', 'FY', 'GA', 'GD', 'GL', 'GN', 'GU', 'GV', 'HA', 'HE', 'HI', 'HO', 'HR', 'HT', 'HU', 'HY',
|
|
8
|
+
'HZ', 'IA', 'ID', 'IE', 'IG', 'II', 'IK', 'IN', 'IO', 'IS', 'IT', 'IW', 'IU', 'JA', 'JI', 'JW', 'JV', 'KA', 'KG', 'KI', 'KJ',
|
|
9
|
+
'KK', 'KL', 'KM', 'KN', 'KO', 'KR', 'KS', 'KU', 'KV', 'KW', 'KY', 'LA', 'LB', 'LG', 'LI', 'LN', 'LO', 'LT', 'LU', 'LV', 'MG',
|
|
10
|
+
'MH', 'MI', 'MK', 'ML', 'MN', 'MO', 'MR', 'MS', 'MT', 'MY', 'NA', 'NB', 'ND', 'NE', 'NG', 'NL', 'NN', 'NO', 'NR', 'NV', 'NY',
|
|
11
|
+
'OC', 'OJ', 'OM', 'OR', 'OS', 'PA', 'PI', 'PL', 'PS', 'PT', 'QU', 'RM', 'RN', 'RO', 'RU', 'RW', 'SA', 'SC', 'SD', 'SE', 'SG',
|
|
12
|
+
'SH', 'SI', 'SK', 'SL', 'SM', 'SN', 'SO', 'SQ', 'SR', 'SS', 'ST', 'SU', 'SV', 'SW', 'TA', 'TE', 'TG', 'TH', 'TI', 'TK', 'TL',
|
|
13
|
+
'TN', 'TO', 'TR', 'TS', 'TT', 'TW', 'TY', 'UG', 'UK', 'UR', 'UZ', 'VE', 'VI', 'VO', 'WA', 'WO', 'XH', 'YI', 'YO', 'ZA', 'ZH',
|
|
14
|
+
'ZU',
|
|
15
|
+
];
|
|
16
|
+
const assertValidLanguageCode = (languageCode) => {
|
|
17
|
+
if (!exports.availableLanguagesCodes.includes(languageCode)) {
|
|
18
|
+
throw new Error(`The language code ${languageCode} is not available! The available language codes are [${exports.availableLanguagesCodes.join(', ')}]`);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.assertValidLanguageCode = assertValidLanguageCode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchLocalizations = void 0;
|
|
4
|
+
const javascript_sdk_1 = require("@extrahorizon/javascript-sdk");
|
|
5
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
const fetchLocalizations = async (sdk, keys, languageCodes) => {
|
|
7
|
+
const localizations = [];
|
|
8
|
+
const keyChunks = (0, lodash_1.chunk)(keys, 5);
|
|
9
|
+
for (const keyChunk of keyChunks) {
|
|
10
|
+
const result = await sdk.localizations.find({
|
|
11
|
+
rql: (0, javascript_sdk_1.rqlBuilder)()
|
|
12
|
+
.in('key', keyChunk)
|
|
13
|
+
.select(['key'].concat(languageCodes.map(languageCode => `text.${languageCode}`)))
|
|
14
|
+
.build(),
|
|
15
|
+
});
|
|
16
|
+
localizations.push(...result.data);
|
|
17
|
+
}
|
|
18
|
+
return localizations;
|
|
19
|
+
};
|
|
20
|
+
exports.fetchLocalizations = fetchLocalizations;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Localization } from '@extrahorizon/javascript-sdk';
|
|
2
|
+
export interface LocalizationFilesOutput {
|
|
3
|
+
localizations: Pick<Localization, 'key' | 'text'>[];
|
|
4
|
+
languageCodes: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const readLocalizationFiles: (path: string, keys?: string[], languageCodes?: string[]) => LocalizationFilesOutput;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readLocalizationFiles = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const ospath = require("path");
|
|
6
|
+
const util_1 = require("../../../helpers/util");
|
|
7
|
+
const assertValidLanguageCode_1 = require("./assertValidLanguageCode");
|
|
8
|
+
const readLocalizationFiles = (path, keys, languageCodes) => {
|
|
9
|
+
const uniqueLanguageCodes = new Set();
|
|
10
|
+
const localizationMap = {};
|
|
11
|
+
const fileNames = (0, fs_1.readdirSync)(path);
|
|
12
|
+
for (const fileName of fileNames) {
|
|
13
|
+
const parsedFileName = ospath.parse(fileName);
|
|
14
|
+
const languageCode = parsedFileName.name.toUpperCase();
|
|
15
|
+
(0, assertValidLanguageCode_1.assertValidLanguageCode)(languageCode);
|
|
16
|
+
if (parsedFileName.ext !== '.json') {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (languageCodes && !languageCodes.includes(languageCode)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
uniqueLanguageCodes.add(languageCode);
|
|
23
|
+
const localizationJson = (0, util_1.readJsonFileSync)(ospath.join(path, fileName));
|
|
24
|
+
for (const [key, text] of Object.entries(localizationJson)) {
|
|
25
|
+
if (keys && !keys.includes(key)) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (!(key in localizationMap)) {
|
|
29
|
+
localizationMap[key] = { key, text: {} };
|
|
30
|
+
}
|
|
31
|
+
localizationMap[key].text[languageCode] = text;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
localizations: Object.values(localizationMap),
|
|
36
|
+
languageCodes: [...uniqueLanguageCodes.values()],
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
exports.readLocalizationFiles = readLocalizationFiles;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.syncLocalizations = void 0;
|
|
4
|
+
const chalk = require("chalk");
|
|
5
|
+
const getMissingLocalizations = (configLocalizations, fetchedLocalizations) => configLocalizations.filter(configLocalization => fetchedLocalizations.find(fetchedLocalization => fetchedLocalization.key === configLocalization.key) === undefined);
|
|
6
|
+
const getChangedLocalizations = (configLocalizations, fetchedLocalizations) => {
|
|
7
|
+
const changedLocalizations = [];
|
|
8
|
+
for (const configLocalization of configLocalizations) {
|
|
9
|
+
const knownLocalization = fetchedLocalizations.find(fetchedLocalization => fetchedLocalization.key === configLocalization.key);
|
|
10
|
+
if (knownLocalization) {
|
|
11
|
+
const localizationUpdateData = {
|
|
12
|
+
key: configLocalization.key,
|
|
13
|
+
text: {},
|
|
14
|
+
};
|
|
15
|
+
for (const [newLanguage, newText] of Object.entries(configLocalization.text)) {
|
|
16
|
+
const knownText = knownLocalization.text[newLanguage];
|
|
17
|
+
if (!knownText || knownText !== newText) {
|
|
18
|
+
localizationUpdateData.text[newLanguage] = newText;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (Object.keys(localizationUpdateData.text).length > 0) {
|
|
22
|
+
changedLocalizations.push(localizationUpdateData);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return changedLocalizations;
|
|
27
|
+
};
|
|
28
|
+
const syncLocalizations = async (sdk, configLocalizations, fetchedLocalizations) => {
|
|
29
|
+
const localizationsToCreate = getMissingLocalizations(configLocalizations, fetchedLocalizations);
|
|
30
|
+
const localizationsToUpdate = getChangedLocalizations(configLocalizations, fetchedLocalizations);
|
|
31
|
+
console.log(`- Creating of ${localizationsToCreate.length} new localization key(s).`);
|
|
32
|
+
if (localizationsToCreate.length > 0) {
|
|
33
|
+
await sdk.localizations.create({
|
|
34
|
+
localizations: localizationsToCreate,
|
|
35
|
+
});
|
|
36
|
+
console.log(chalk.green('Successful!'));
|
|
37
|
+
}
|
|
38
|
+
console.log(`- Updating of ${localizationsToUpdate.length} new localization key(s).`);
|
|
39
|
+
if (localizationsToUpdate.length > 0) {
|
|
40
|
+
await sdk.localizations.update({
|
|
41
|
+
localizations: localizationsToUpdate,
|
|
42
|
+
});
|
|
43
|
+
console.log(chalk.green('Successful!'));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.syncLocalizations = syncLocalizations;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
exports.command = 'localizations <command>';
|
|
6
|
+
exports.desc = 'Manage localizations';
|
|
7
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('localizations');
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const handler = () => { };
|
|
10
|
+
exports.handler = handler;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
import type { OAuth1Client } from '@extrahorizon/javascript-sdk';
|
|
3
|
+
export declare const command = "whoami";
|
|
4
|
+
export declare const desc = "Shows the currently logged in user";
|
|
5
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<{}>;
|
|
6
|
+
export declare const handler: ({ sdk }: {
|
|
7
|
+
sdk: OAuth1Client;
|
|
8
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
const authRepository = require("../repositories/auth");
|
|
6
|
+
exports.command = 'whoami';
|
|
7
|
+
exports.desc = 'Shows the currently logged in user';
|
|
8
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs);
|
|
9
|
+
exports.builder = builder;
|
|
10
|
+
const handler = async function list({ sdk }) {
|
|
11
|
+
const host = authRepository.getHost(sdk);
|
|
12
|
+
if (!host) {
|
|
13
|
+
console.log('No ExH cluster host was found in the configuration.');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
console.log('You are targeting:', host);
|
|
17
|
+
const currentUser = await authRepository.fetchMe(sdk);
|
|
18
|
+
console.log('You are logged in as:', currentUser.email);
|
|
19
|
+
};
|
|
20
|
+
exports.handler = handler;
|
package/build/helpers/util.d.ts
CHANGED
package/build/helpers/util.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.asyncExec = exports.epilogue = void 0;
|
|
3
|
+
exports.readJsonFileSync = exports.asyncExec = exports.epilogue = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
|
+
const fs_1 = require("fs");
|
|
5
6
|
const chalk = require("chalk");
|
|
6
7
|
const error_1 = require("./error");
|
|
7
8
|
function epilogue(y) {
|
|
@@ -34,3 +35,8 @@ async function asyncExec(cmd) {
|
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
exports.asyncExec = asyncExec;
|
|
38
|
+
function readJsonFileSync(path) {
|
|
39
|
+
const fileContent = (0, fs_1.readFileSync)(path, { encoding: 'utf-8' });
|
|
40
|
+
return JSON.parse(fileContent);
|
|
41
|
+
}
|
|
42
|
+
exports.readJsonFileSync = readJsonFileSync;
|
package/build/index.js
CHANGED
|
@@ -6,13 +6,6 @@ const lodash_1 = require("lodash");
|
|
|
6
6
|
const yargs = require("yargs");
|
|
7
7
|
const helpers_1 = require("yargs/helpers");
|
|
8
8
|
const exh_1 = require("./exh");
|
|
9
|
-
function checkVersion() {
|
|
10
|
-
const pkg = require('../package.json');
|
|
11
|
-
const updateNotifier = require('update-notifier');
|
|
12
|
-
const notifier = updateNotifier({ pkg, updateCheckInterval: 0 });
|
|
13
|
-
notifier.notify();
|
|
14
|
-
}
|
|
15
|
-
checkVersion();
|
|
16
9
|
yargs((0, helpers_1.hideBin)(process.argv))
|
|
17
10
|
.middleware(async (argv) => {
|
|
18
11
|
const isTTY = tty.isatty(process.stdout.fd);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchMe = exports.getHost = void 0;
|
|
4
|
+
function getHost(sdk) {
|
|
5
|
+
return sdk?.raw?.defaults?.baseURL;
|
|
6
|
+
}
|
|
7
|
+
exports.getHost = getHost;
|
|
8
|
+
async function fetchMe(sdk) {
|
|
9
|
+
return await sdk?.users.me();
|
|
10
|
+
}
|
|
11
|
+
exports.fetchMe = fetchMe;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@extrahorizon/exh-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0-dev-38-562ae51",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"exports": "./build/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://github.com/ExtraHorizon/exh-cli.git"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"start": "yarn
|
|
14
|
+
"start": "yarn build && node ./build/index.js",
|
|
15
15
|
"clean": "rimraf build",
|
|
16
16
|
"build": "yarn clean && tsc",
|
|
17
17
|
"test": "jest",
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"chalk": "^4.0.0",
|
|
47
47
|
"joi": "^17.6.0",
|
|
48
48
|
"lodash": "^4.17.21",
|
|
49
|
-
"update-notifier": "^5.1.0",
|
|
50
49
|
"uuid": "^8.3.2",
|
|
51
50
|
"yargs": "^17.5.1"
|
|
52
51
|
}
|