@aneuhold/be-ts-lib 1.0.2 → 1.0.4
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/README.md +2 -0
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/services/ConfigService/ConfigDefinition.d.ts +3 -0
- package/lib/services/ConfigService/ConfigDefinition.d.ts.map +1 -1
- package/lib/services/ConfigService/ConfigService.d.ts +1 -11
- package/lib/services/ConfigService/ConfigService.d.ts.map +1 -1
- package/lib/services/ConfigService/ConfigService.js +9 -35
- package/lib/services/ConfigService/ConfigService.spec.js +1 -2
- package/lib/services/GitHubService.d.ts +15 -0
- package/lib/services/GitHubService.d.ts.map +1 -0
- package/lib/services/GitHubService.js +45 -0
- package/lib/services/TranslationService/TranslationService.d.ts +18 -0
- package/lib/services/TranslationService/TranslationService.d.ts.map +1 -0
- package/lib/services/TranslationService/TranslationService.js +34 -0
- package/lib/services/TranslationService/TranslationService.spec.d.ts +2 -0
- package/lib/services/TranslationService/TranslationService.spec.d.ts.map +1 -0
- package/lib/services/TranslationService/TranslationService.spec.js +39 -0
- package/package.json +6 -4
package/README.md
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import CurrentEnv, { OperatingSystemType, ShellType, TerminalType } from './util
|
|
|
7
7
|
import ITermService from './services/applications/ITermService';
|
|
8
8
|
import ConfigService from './services/ConfigService/ConfigService';
|
|
9
9
|
import Config from './services/ConfigService/ConfigDefinition';
|
|
10
|
-
|
|
11
|
-
export
|
|
10
|
+
import TranslationService, { TranslationProject } from './services/TranslationService/TranslationService';
|
|
11
|
+
export { CLIService, CurrentEnv, ChromeService, DockerService, OSFileSystemService, sleep, OperatingSystemType, ShellType, TerminalType, ITermService, ConfigService, TranslationService };
|
|
12
|
+
export type { Config, TranslationProject };
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,mBAAmB,MAAM,6CAA6C,CAAC;AAC9E,OAAO,UAAU,EAAE,EACjB,mBAAmB,EACnB,SAAS,EACT,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,MAAM,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAC/C,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,aAAa,MAAM,uCAAuC,CAAC;AAClE,OAAO,mBAAmB,MAAM,6CAA6C,CAAC;AAC9E,OAAO,UAAU,EAAE,EACjB,mBAAmB,EACnB,SAAS,EACT,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,YAAY,MAAM,sCAAsC,CAAC;AAChE,OAAO,aAAa,MAAM,wCAAwC,CAAC;AACnE,OAAO,MAAM,MAAM,2CAA2C,CAAC;AAC/D,OAAO,kBAAkB,EAAE,EACzB,kBAAkB,EACnB,MAAM,kDAAkD,CAAC;AAG1D,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,KAAK,EACL,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EACnB,CAAC;AAGF,YAAY,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.ConfigService = exports.ITermService = exports.TerminalType = exports.ShellType = exports.OperatingSystemType = exports.sleep = exports.OSFileSystemService = exports.DockerService = exports.ChromeService = exports.CurrentEnv = exports.CLIService = void 0;
|
|
29
|
+
exports.TranslationService = exports.ConfigService = exports.ITermService = exports.TerminalType = exports.ShellType = exports.OperatingSystemType = exports.sleep = exports.OSFileSystemService = exports.DockerService = exports.ChromeService = exports.CurrentEnv = exports.CLIService = void 0;
|
|
30
30
|
const core_ts_lib_1 = require("@aneuhold/core-ts-lib");
|
|
31
31
|
Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return core_ts_lib_1.sleep; } });
|
|
32
32
|
const CLIService_1 = __importDefault(require("./services/CLIService"));
|
|
@@ -46,3 +46,5 @@ const ITermService_1 = __importDefault(require("./services/applications/ITermSer
|
|
|
46
46
|
exports.ITermService = ITermService_1.default;
|
|
47
47
|
const ConfigService_1 = __importDefault(require("./services/ConfigService/ConfigService"));
|
|
48
48
|
exports.ConfigService = ConfigService_1.default;
|
|
49
|
+
const TranslationService_1 = __importDefault(require("./services/TranslationService/TranslationService"));
|
|
50
|
+
exports.TranslationService = TranslationService_1.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigDefinition.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigDefinition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,WAAW,MAAM;IAC7B,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfigDefinition.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigDefinition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,OAAO,WAAW,MAAM;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -8,32 +8,22 @@ export type ConfigEnv = 'local' | 'dev' | 'prod';
|
|
|
8
8
|
*/
|
|
9
9
|
export default class ConfigService {
|
|
10
10
|
static env: ConfigEnv | null;
|
|
11
|
-
private static gitHub;
|
|
12
11
|
private static configObject;
|
|
13
12
|
/**
|
|
14
13
|
* Returns the configuration object that has been loaded in for the current
|
|
15
14
|
* environment.
|
|
16
15
|
*/
|
|
17
16
|
static get config(): Config;
|
|
17
|
+
static get isInitialized(): boolean;
|
|
18
18
|
/**
|
|
19
19
|
* Loads configuration from the GitHub repository into the ConfigService.
|
|
20
20
|
*/
|
|
21
21
|
static useConfig(env: ConfigEnv): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Creates a new GitHub client using `CONFIG_GITHUB_TOKEN` from the
|
|
24
|
-
* local environment or .env file.
|
|
25
|
-
*/
|
|
26
|
-
private static getGitHubClient;
|
|
27
22
|
/**
|
|
28
23
|
* Inserts the provided configuration into the local environment.
|
|
29
24
|
*
|
|
30
25
|
* This may not actually need to happen.
|
|
31
26
|
*/
|
|
32
27
|
private static insertPropertiesIntoEnv;
|
|
33
|
-
/**
|
|
34
|
-
* Strips JSON comments from the provided JSON string. Only `//` comments
|
|
35
|
-
* are supported at the moment.
|
|
36
|
-
*/
|
|
37
|
-
private static stripJsonComments;
|
|
38
28
|
}
|
|
39
29
|
//# sourceMappingURL=ConfigService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService/ConfigService.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAGxC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,CAAQ;IAEpC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAuB;IAElD;;;OAGG;IACH,MAAM,KAAK,MAAM,IAAI,MAAM,CAO1B;IAED,MAAM,KAAK,aAAa,IAAI,OAAO,CAElC;IAED;;OAEG;WACU,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAerD;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;CASvC"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const octokit_1 = require("octokit");
|
|
4
6
|
require("dotenv/config");
|
|
5
7
|
const core_ts_lib_1 = require("@aneuhold/core-ts-lib");
|
|
8
|
+
const GitHubService_1 = __importDefault(require("../GitHubService"));
|
|
6
9
|
/**
|
|
7
10
|
* A class which can be used to load configuration into the ConfigService
|
|
8
11
|
* from a pre-defined location. This requries that a `.env` file exists in the
|
|
@@ -10,7 +13,6 @@ const core_ts_lib_1 = require("@aneuhold/core-ts-lib");
|
|
|
10
13
|
*/
|
|
11
14
|
class ConfigService {
|
|
12
15
|
static env = null;
|
|
13
|
-
static gitHub = null;
|
|
14
16
|
static configObject = null;
|
|
15
17
|
/**
|
|
16
18
|
* Returns the configuration object that has been loaded in for the current
|
|
@@ -22,24 +24,17 @@ class ConfigService {
|
|
|
22
24
|
}
|
|
23
25
|
return ConfigService.configObject;
|
|
24
26
|
}
|
|
27
|
+
static get isInitialized() {
|
|
28
|
+
return !!ConfigService.configObject;
|
|
29
|
+
}
|
|
25
30
|
/**
|
|
26
31
|
* Loads configuration from the GitHub repository into the ConfigService.
|
|
27
32
|
*/
|
|
28
33
|
static async useConfig(env) {
|
|
29
34
|
ConfigService.env = env;
|
|
30
|
-
if (!ConfigService.gitHub) {
|
|
31
|
-
ConfigService.gitHub = ConfigService.getGitHubClient();
|
|
32
|
-
}
|
|
33
35
|
try {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
format: 'raw'
|
|
37
|
-
},
|
|
38
|
-
owner: 'aneuhold',
|
|
39
|
-
repo: 'config',
|
|
40
|
-
path: `${env}.jsonc`
|
|
41
|
-
});
|
|
42
|
-
const strippedJson = ConfigService.stripJsonComments(result.data);
|
|
36
|
+
const jsonString = await GitHubService_1.default.getContentFromRepo('config', `${env}.jsonc`);
|
|
37
|
+
const strippedJson = core_ts_lib_1.StringService.stripJsonComments(jsonString);
|
|
43
38
|
ConfigService.configObject = JSON.parse(strippedJson);
|
|
44
39
|
}
|
|
45
40
|
catch (error) {
|
|
@@ -47,19 +42,6 @@ class ConfigService {
|
|
|
47
42
|
throw error;
|
|
48
43
|
}
|
|
49
44
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Creates a new GitHub client using `CONFIG_GITHUB_TOKEN` from the
|
|
52
|
-
* local environment or .env file.
|
|
53
|
-
*/
|
|
54
|
-
static getGitHubClient() {
|
|
55
|
-
const authToken = process.env.CONFIG_GITHUB_TOKEN;
|
|
56
|
-
if (!authToken) {
|
|
57
|
-
throw new Error('No CONFIG_GITHUB_TOKEN key found in environment variables.');
|
|
58
|
-
}
|
|
59
|
-
return new octokit_1.Octokit({
|
|
60
|
-
auth: authToken
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
45
|
/**
|
|
64
46
|
* Inserts the provided configuration into the local environment.
|
|
65
47
|
*
|
|
@@ -75,13 +57,5 @@ class ConfigService {
|
|
|
75
57
|
}
|
|
76
58
|
});
|
|
77
59
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Strips JSON comments from the provided JSON string. Only `//` comments
|
|
80
|
-
* are supported at the moment.
|
|
81
|
-
*/
|
|
82
|
-
static stripJsonComments = (jsonString) => {
|
|
83
|
-
const commentRegex = /\/\/(.*)/g;
|
|
84
|
-
return jsonString.replace(commentRegex, '');
|
|
85
|
-
};
|
|
86
60
|
}
|
|
87
61
|
exports.default = ConfigService;
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const console_1 = require("console");
|
|
7
6
|
const ConfigService_1 = __importDefault(require("./ConfigService"));
|
|
8
7
|
describe('ConfigService', () => {
|
|
9
8
|
describe('useConfig', () => {
|
|
@@ -15,7 +14,7 @@ describe('ConfigService', () => {
|
|
|
15
14
|
it('should load configuration from GitHub', async () => {
|
|
16
15
|
const env = 'local';
|
|
17
16
|
await ConfigService_1.default.useConfig(env);
|
|
18
|
-
(
|
|
17
|
+
expect(ConfigService_1.default.config.someKey).toEqual('SOME_VALUE');
|
|
19
18
|
});
|
|
20
19
|
});
|
|
21
20
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
export type ConfigEnv = 'local' | 'dev' | 'prod';
|
|
3
|
+
/**
|
|
4
|
+
* A class which can be used to interact with GitHub.
|
|
5
|
+
*/
|
|
6
|
+
export default class GitHubService {
|
|
7
|
+
private static gitHub;
|
|
8
|
+
static getContentFromRepo(repoName: string, filePath: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GitHub client using `CONFIG_GITHUB_TOKEN` from the
|
|
11
|
+
* local environment or .env file.
|
|
12
|
+
*/
|
|
13
|
+
private static getGitHubClient;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=GitHubService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubService.d.ts","sourceRoot":"","sources":["../../src/services/GitHubService.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,CAAC;AAGvB,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAwB;WAEhC,kBAAkB,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC;IAsBlB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;CAW/B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const octokit_1 = require("octokit");
|
|
4
|
+
require("dotenv/config");
|
|
5
|
+
const core_ts_lib_1 = require("@aneuhold/core-ts-lib");
|
|
6
|
+
/**
|
|
7
|
+
* A class which can be used to interact with GitHub.
|
|
8
|
+
*/
|
|
9
|
+
class GitHubService {
|
|
10
|
+
static gitHub = null;
|
|
11
|
+
static async getContentFromRepo(repoName, filePath) {
|
|
12
|
+
if (!GitHubService.gitHub) {
|
|
13
|
+
GitHubService.gitHub = GitHubService.getGitHubClient();
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const result = await GitHubService.gitHub.rest.repos.getContent({
|
|
17
|
+
mediaType: {
|
|
18
|
+
format: 'raw'
|
|
19
|
+
},
|
|
20
|
+
owner: 'aneuhold',
|
|
21
|
+
repo: repoName,
|
|
22
|
+
path: filePath
|
|
23
|
+
});
|
|
24
|
+
return result.data;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
core_ts_lib_1.Logger.error(`Failed to load ${filePath} from ${repoName}, error: ${error}`);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new GitHub client using `CONFIG_GITHUB_TOKEN` from the
|
|
33
|
+
* local environment or .env file.
|
|
34
|
+
*/
|
|
35
|
+
static getGitHubClient() {
|
|
36
|
+
const authToken = process.env.CONFIG_GITHUB_TOKEN;
|
|
37
|
+
if (!authToken) {
|
|
38
|
+
throw new Error('No CONFIG_GITHUB_TOKEN key found in environment variables.');
|
|
39
|
+
}
|
|
40
|
+
return new octokit_1.Octokit({
|
|
41
|
+
auth: authToken
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = GitHubService;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import { Translations } from '@aneuhold/core-ts-api-lib';
|
|
3
|
+
export declare const TranslationProject: {
|
|
4
|
+
readonly dashboard: "dashboard";
|
|
5
|
+
};
|
|
6
|
+
export type TranslationProject = (typeof TranslationProject)[keyof typeof TranslationProject];
|
|
7
|
+
/**
|
|
8
|
+
* A class which can be used to get translations for personal projects. It is
|
|
9
|
+
* expected that the translations will be loaded in fresh each time this class
|
|
10
|
+
* is called.
|
|
11
|
+
*/
|
|
12
|
+
export default class TranslationService {
|
|
13
|
+
/**
|
|
14
|
+
* Gets translations for the provided project.
|
|
15
|
+
*/
|
|
16
|
+
static getTranslations(project: TranslationProject): Promise<Translations>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=TranslationService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationService.d.ts","sourceRoot":"","sources":["../../../src/services/TranslationService/TranslationService.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,eAAO,MAAM,kBAAkB;;CAErB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;OAEG;WACU,eAAe,CAAC,OAAO,EAAE,kBAAkB;CAazD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TranslationProject = void 0;
|
|
7
|
+
require("dotenv/config");
|
|
8
|
+
const core_ts_lib_1 = require("@aneuhold/core-ts-lib");
|
|
9
|
+
const GitHubService_1 = __importDefault(require("../GitHubService"));
|
|
10
|
+
exports.TranslationProject = {
|
|
11
|
+
dashboard: 'dashboard'
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A class which can be used to get translations for personal projects. It is
|
|
15
|
+
* expected that the translations will be loaded in fresh each time this class
|
|
16
|
+
* is called.
|
|
17
|
+
*/
|
|
18
|
+
class TranslationService {
|
|
19
|
+
/**
|
|
20
|
+
* Gets translations for the provided project.
|
|
21
|
+
*/
|
|
22
|
+
static async getTranslations(project) {
|
|
23
|
+
try {
|
|
24
|
+
const jsonString = await GitHubService_1.default.getContentFromRepo('translations', `${project}.jsonc`);
|
|
25
|
+
const strippedJson = core_ts_lib_1.StringService.stripJsonComments(jsonString);
|
|
26
|
+
return JSON.parse(strippedJson);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
core_ts_lib_1.Logger.error(`Failed to load ${project}.json, error: ${error}`);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = TranslationService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationService.spec.d.ts","sourceRoot":"","sources":["../../../src/services/TranslationService/TranslationService.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const TranslationService_1 = __importStar(require("./TranslationService"));
|
|
27
|
+
describe('TranslationService', () => {
|
|
28
|
+
describe('getTranslations', () => {
|
|
29
|
+
/**
|
|
30
|
+
* Depends upon a GitHub token being available in the local environment.
|
|
31
|
+
* This will be a local `.env` file with the CONFIG_GITHUB_TOKEN variable
|
|
32
|
+
* set.
|
|
33
|
+
*/
|
|
34
|
+
it('should load translations from GitHub', async () => {
|
|
35
|
+
const translations = await TranslationService_1.default.getTranslations(TranslationService_1.TranslationProject.dashboard);
|
|
36
|
+
expect(translations['test-translation'].value).toEqual('something');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aneuhold/be-ts-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A backend TypeScript library used for common functionality in personal backend projects.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -28,13 +28,15 @@
|
|
|
28
28
|
"link:local": "cd lib && yarn link",
|
|
29
29
|
"unlink:local": "cd lib && yarn unlink",
|
|
30
30
|
"upgrade:all": "yarn upgrade --latest",
|
|
31
|
+
"upgrade:core": "yarn upgrade --latest --pattern @aneuhold",
|
|
31
32
|
"test": "jest"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@aneuhold/core-ts-lib": "^1.
|
|
35
|
+
"@aneuhold/core-ts-api-lib": "^1.0.4",
|
|
36
|
+
"@aneuhold/core-ts-lib": "^1.1.8",
|
|
37
|
+
"dotenv": "^16.3.1",
|
|
35
38
|
"node-fetch": "^2",
|
|
36
|
-
"octokit": "^3.1.2"
|
|
37
|
-
"dotenv": "^16.3.1"
|
|
39
|
+
"octokit": "^3.1.2"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@types/jest": "^29.5.8",
|