@things-factory/i18n-base 10.1.146 → 10.1.149

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/package.json CHANGED
@@ -1,8 +1,23 @@
1
1
  {
2
2
  "name": "@things-factory/i18n-base",
3
- "version": "10.1.146",
3
+ "version": "10.1.149",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
+ "exports": {
7
+ ".": {
8
+ "browser": "./dist-client/index.js",
9
+ "default": "./dist-server/index.js"
10
+ },
11
+ "./translator": "./dist-server/translator.js",
12
+ "./*": "./*"
13
+ },
14
+ "typesVersions": {
15
+ "*": {
16
+ "translator": [
17
+ "dist-server/translator.d.ts"
18
+ ]
19
+ }
20
+ },
6
21
  "things-factory": true,
7
22
  "author": "heartyoh <heartyoh@hatiolab.com>",
8
23
  "description": "Server side for handling translation.",
@@ -24,12 +39,14 @@
24
39
  "clean:client": "npx rimraf dist-client",
25
40
  "clean:server": "npx rimraf dist-server",
26
41
  "clean": "npm run clean:server && npm run clean:client",
27
- "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
42
+ "migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration",
43
+ "test": "tsc -p server/tsconfig.json && node --test test/*.test.ts"
28
44
  },
29
45
  "dependencies": {
30
46
  "@operato/i18n": "^10.0.0",
31
- "@things-factory/auth-base": "^10.1.146",
32
- "@things-factory/shell": "^10.1.146"
47
+ "@things-factory/auth-base": "^10.1.149",
48
+ "@things-factory/env": "^10.1.149",
49
+ "@things-factory/shell": "^10.1.149"
33
50
  },
34
- "gitHead": "7aeb3de935ec913d271866b27d931b2278259c13"
51
+ "gitHead": "816f88a9fa6110935a3f71740458db8f7469d2e3"
35
52
  }
@@ -1 +0,0 @@
1
- export declare function build(fs: any): void;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.build = build;
4
- const tslib_1 = require("tslib");
5
- const fs_1 = tslib_1.__importDefault(require("fs"));
6
- const i18next_1 = tslib_1.__importDefault(require("i18next"));
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
- const { appRootPath } = require('@things-factory/env');
9
- function build(fs) {
10
- fs = fs || fs_1.default;
11
- const PUBLIC_ROOT = path_1.default.resolve(appRootPath, 'dist-app'); // webpack config output.path
12
- const ns = 'translations';
13
- var folder = path_1.default.join(PUBLIC_ROOT, 'translations');
14
- try {
15
- fs.readdirSync(folder).forEach(file => {
16
- try {
17
- var lng = file.split('.')[0];
18
- var resourcePath = path_1.default.join(folder, file);
19
- var resources = JSON.parse(fs.readFileSync(resourcePath));
20
- i18next_1.default.removeResourceBundle(lng, ns);
21
- i18next_1.default.addResourceBundle(lng, ns, resources, true, true);
22
- }
23
- catch (e) {
24
- console.error(e);
25
- }
26
- });
27
- }
28
- catch (e) { }
29
- }
30
- //# sourceMappingURL=translations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"translations.js","sourceRoot":"","sources":["../../server/middlewares/translations.ts"],"names":[],"mappings":";;AAMA,sBAoBC;;AA1BD,oDAAmB;AACnB,8DAA6B;AAC7B,wDAAuB;AAEvB,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAEtD,SAAgB,KAAK,CAAC,EAAE;IACtB,EAAE,GAAG,EAAE,IAAI,YAAE,CAAA;IAEb,MAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA,CAAC,6BAA6B;IAEvF,MAAM,EAAE,GAAG,cAAc,CAAA;IACzB,IAAI,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,CAAC,CAAA;IACnD,IAAI,CAAC;QACH,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACpC,IAAI,CAAC;gBACH,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;gBAC5B,IAAI,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;gBAC1C,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAA;gBACzD,iBAAO,CAAC,oBAAoB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;gBACrC,iBAAO,CAAC,iBAAiB,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;YAC3D,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YAClB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,CAAA,CAAC;AAChB,CAAC","sourcesContent":["import FS from 'fs'\nimport i18next from 'i18next'\nimport path from 'path'\n\nconst { appRootPath } = require('@things-factory/env')\n\nexport function build(fs) {\n fs = fs || FS\n\n const PUBLIC_ROOT = path.resolve(appRootPath, 'dist-app') // webpack config output.path\n\n const ns = 'translations'\n var folder = path.join(PUBLIC_ROOT, 'translations')\n try {\n fs.readdirSync(folder).forEach(file => {\n try {\n var lng = file.split('.')[0]\n var resourcePath = path.join(folder, file)\n var resources = JSON.parse(fs.readFileSync(resourcePath))\n i18next.removeResourceBundle(lng, ns)\n i18next.addResourceBundle(lng, ns, resources, true, true)\n } catch (e) {\n console.error(e)\n }\n })\n } catch (e) {}\n}\n"]}