@prezly/theme-kit-intl 10.8.0 → 10.9.1
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/build/formatting/datetime/lib.test.cjs +6 -2
- package/build/formatting/datetime/lib.test.mjs +6 -2
- package/build/formatting/messages/lib.cjs +4 -8
- package/build/formatting/messages/lib.mjs +4 -8
- package/build/locales/Locale.cjs +18 -3
- package/build/locales/Locale.mjs +18 -3
- package/build/locales/pickSuportedLocale.cjs +3 -4
- package/build/locales/pickSuportedLocale.mjs +3 -4
- package/package.json +75 -76
|
@@ -51,13 +51,17 @@ describe('formatDate', () => {
|
|
|
51
51
|
});
|
|
52
52
|
describe('formatTime', () => {
|
|
53
53
|
var date = new Date('2024-03-15T10:00:00.000Z');
|
|
54
|
+
|
|
55
|
+
// On 2024-03-15 Europe/London is at a zero UTC offset (pre-DST). The numeric offset is
|
|
56
|
+
// optional in these patterns because `timeZoneName: 'longOffset'` renders a zero offset as
|
|
57
|
+
// bare "GMT" on ICU >= 72 (Node >= 20) but as "GMT+00:00" on older ICU — both are valid.
|
|
54
58
|
it('appends the timezone offset when a moment-style timeFormat is provided', () => {
|
|
55
59
|
var result = (0, _lib.formatTime)(date, {
|
|
56
60
|
locale: 'en',
|
|
57
61
|
timezone: 'Europe/London',
|
|
58
62
|
timeFormat: 'HH:mm'
|
|
59
63
|
});
|
|
60
|
-
expect(result).toMatch(/^10:00 GMT[+-]\d{2}:\d{2}
|
|
64
|
+
expect(result).toMatch(/^10:00 GMT(?:[+-]\d{2}:\d{2})?$/);
|
|
61
65
|
});
|
|
62
66
|
it('supports 12-hour moment-style format', () => {
|
|
63
67
|
var result = (0, _lib.formatTime)(date, {
|
|
@@ -65,6 +69,6 @@ describe('formatTime', () => {
|
|
|
65
69
|
timezone: 'Europe/London',
|
|
66
70
|
timeFormat: 'hh:mm a'
|
|
67
71
|
});
|
|
68
|
-
expect(result).toMatch(/^10:00 (am|AM) GMT[+-]\d{2}:\d{2}
|
|
72
|
+
expect(result).toMatch(/^10:00 (am|AM) GMT(?:[+-]\d{2}:\d{2})?$/);
|
|
69
73
|
});
|
|
70
74
|
});
|
|
@@ -49,13 +49,17 @@ describe('formatDate', () => {
|
|
|
49
49
|
});
|
|
50
50
|
describe('formatTime', () => {
|
|
51
51
|
var date = new Date('2024-03-15T10:00:00.000Z');
|
|
52
|
+
|
|
53
|
+
// On 2024-03-15 Europe/London is at a zero UTC offset (pre-DST). The numeric offset is
|
|
54
|
+
// optional in these patterns because `timeZoneName: 'longOffset'` renders a zero offset as
|
|
55
|
+
// bare "GMT" on ICU >= 72 (Node >= 20) but as "GMT+00:00" on older ICU — both are valid.
|
|
52
56
|
it('appends the timezone offset when a moment-style timeFormat is provided', () => {
|
|
53
57
|
var result = formatTime(date, {
|
|
54
58
|
locale: 'en',
|
|
55
59
|
timezone: 'Europe/London',
|
|
56
60
|
timeFormat: 'HH:mm'
|
|
57
61
|
});
|
|
58
|
-
expect(result).toMatch(/^10:00 GMT[+-]\d{2}:\d{2}
|
|
62
|
+
expect(result).toMatch(/^10:00 GMT(?:[+-]\d{2}:\d{2})?$/);
|
|
59
63
|
});
|
|
60
64
|
it('supports 12-hour moment-style format', () => {
|
|
61
65
|
var result = formatTime(date, {
|
|
@@ -63,6 +67,6 @@ describe('formatTime', () => {
|
|
|
63
67
|
timezone: 'Europe/London',
|
|
64
68
|
timeFormat: 'hh:mm a'
|
|
65
69
|
});
|
|
66
|
-
expect(result).toMatch(/^10:00 (am|AM) GMT[+-]\d{2}:\d{2}
|
|
70
|
+
expect(result).toMatch(/^10:00 (am|AM) GMT(?:[+-]\d{2}:\d{2})?$/);
|
|
67
71
|
});
|
|
68
72
|
});
|
|
@@ -14,10 +14,8 @@ var _types = require("./types.cjs");
|
|
|
14
14
|
var getPluralRules = exports.getPluralRules = (0, _index2.withCache)(locale => new Intl.PluralRules(_index.Locale.from(locale).isoCode));
|
|
15
15
|
function formatMessageFragment(locale, _ref, dictionary) {
|
|
16
16
|
var _ref2, _dictionary$id;
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
defaultMessage
|
|
20
|
-
} = _ref;
|
|
17
|
+
var id = _ref.id,
|
|
18
|
+
defaultMessage = _ref.defaultMessage;
|
|
21
19
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
22
20
|
var format = (_ref2 = (_dictionary$id = dictionary[id]) !== null && _dictionary$id !== void 0 ? _dictionary$id : prepareMessage(defaultMessage)) !== null && _ref2 !== void 0 ? _ref2 : [{
|
|
23
21
|
type: 0,
|
|
@@ -27,10 +25,8 @@ function formatMessageFragment(locale, _ref, dictionary) {
|
|
|
27
25
|
}
|
|
28
26
|
function formatMessageString(locale, _ref3, dictionary) {
|
|
29
27
|
var _ref4, _dictionary$id2;
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
defaultMessage
|
|
33
|
-
} = _ref3;
|
|
28
|
+
var id = _ref3.id,
|
|
29
|
+
defaultMessage = _ref3.defaultMessage;
|
|
34
30
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
35
31
|
var format = (_ref4 = (_dictionary$id2 = dictionary[id]) !== null && _dictionary$id2 !== void 0 ? _dictionary$id2 : prepareMessage(defaultMessage)) !== null && _ref4 !== void 0 ? _ref4 : [{
|
|
36
32
|
type: _types.IntlMessageFormat.Type.LITERAL,
|
|
@@ -4,10 +4,8 @@ import { IntlMessageFormat } from "./types.mjs";
|
|
|
4
4
|
export var getPluralRules = withCache(locale => new Intl.PluralRules(Locale.from(locale).isoCode));
|
|
5
5
|
export function formatMessageFragment(locale, _ref, dictionary) {
|
|
6
6
|
var _ref2, _dictionary$id;
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
defaultMessage
|
|
10
|
-
} = _ref;
|
|
7
|
+
var id = _ref.id,
|
|
8
|
+
defaultMessage = _ref.defaultMessage;
|
|
11
9
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
12
10
|
var format = (_ref2 = (_dictionary$id = dictionary[id]) !== null && _dictionary$id !== void 0 ? _dictionary$id : prepareMessage(defaultMessage)) !== null && _ref2 !== void 0 ? _ref2 : [{
|
|
13
11
|
type: 0,
|
|
@@ -17,10 +15,8 @@ export function formatMessageFragment(locale, _ref, dictionary) {
|
|
|
17
15
|
}
|
|
18
16
|
export function formatMessageString(locale, _ref3, dictionary) {
|
|
19
17
|
var _ref4, _dictionary$id2;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
defaultMessage
|
|
23
|
-
} = _ref3;
|
|
18
|
+
var id = _ref3.id,
|
|
19
|
+
defaultMessage = _ref3.defaultMessage;
|
|
24
20
|
var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
25
21
|
var format = (_ref4 = (_dictionary$id2 = dictionary[id]) !== null && _dictionary$id2 !== void 0 ? _dictionary$id2 : prepareMessage(defaultMessage)) !== null && _ref4 !== void 0 ? _ref4 : [{
|
|
26
22
|
type: IntlMessageFormat.Type.LITERAL,
|
package/build/locales/Locale.cjs
CHANGED
|
@@ -5,6 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Locale = void 0;
|
|
7
7
|
var _isNotUndefined = require("@technically/is-not-undefined");
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
|
+
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
16
|
var KNOWN_SCRIPTS = ['hant', 'hans'];
|
|
9
17
|
var KNOWN_RTL_LANGUAGES = ['ar', 'he', 'ur'];
|
|
10
18
|
var LANG_CODE_REGEX = /^[a-z]{2,3}$/;
|
|
@@ -25,7 +33,10 @@ var Locale;
|
|
|
25
33
|
if (cached) {
|
|
26
34
|
return cached;
|
|
27
35
|
}
|
|
28
|
-
var
|
|
36
|
+
var _ref = locale.toLowerCase().split(/[_-]/g),
|
|
37
|
+
_ref2 = _toArray(_ref),
|
|
38
|
+
lang = _ref2[0],
|
|
39
|
+
rest = _arrayLikeToArray(_ref2).slice(1);
|
|
29
40
|
if (!lang.match(LANG_CODE_REGEX)) {
|
|
30
41
|
throw new Error("Invalid locale code provided: \"".concat(locale, "\"."));
|
|
31
42
|
}
|
|
@@ -37,8 +48,12 @@ var Locale;
|
|
|
37
48
|
if (regions.length > 1) {
|
|
38
49
|
throw new Error("Unable to parse the provided locale code: \"".concat(locale, "\". Multiple region codes detected."));
|
|
39
50
|
}
|
|
40
|
-
var
|
|
41
|
-
|
|
51
|
+
var _ref3 = scripts,
|
|
52
|
+
_ref4 = _slicedToArray(_ref3, 1),
|
|
53
|
+
scriptCode = _ref4[0];
|
|
54
|
+
var _ref5 = regions,
|
|
55
|
+
_ref6 = _slicedToArray(_ref5, 1),
|
|
56
|
+
regionCode = _ref6[0];
|
|
42
57
|
var code = [lang.toLowerCase(), regionCode, scriptCode ? toPascalCase(scriptCode) : undefined].filter(_isNotUndefined.isNotUndefined).join('_');
|
|
43
58
|
var isoCode = code.replace('_', '-');
|
|
44
59
|
var obj = {
|
package/build/locales/Locale.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
3
|
+
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
6
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
7
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
8
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
1
9
|
import { isNotUndefined } from '@technically/is-not-undefined';
|
|
2
10
|
var KNOWN_SCRIPTS = ['hant', 'hans'];
|
|
3
11
|
var KNOWN_RTL_LANGUAGES = ['ar', 'he', 'ur'];
|
|
@@ -19,7 +27,10 @@ export var Locale;
|
|
|
19
27
|
if (cached) {
|
|
20
28
|
return cached;
|
|
21
29
|
}
|
|
22
|
-
var
|
|
30
|
+
var _ref = locale.toLowerCase().split(/[_-]/g),
|
|
31
|
+
_ref2 = _toArray(_ref),
|
|
32
|
+
lang = _ref2[0],
|
|
33
|
+
rest = _arrayLikeToArray(_ref2).slice(1);
|
|
23
34
|
if (!lang.match(LANG_CODE_REGEX)) {
|
|
24
35
|
throw new Error("Invalid locale code provided: \"".concat(locale, "\"."));
|
|
25
36
|
}
|
|
@@ -31,8 +42,12 @@ export var Locale;
|
|
|
31
42
|
if (regions.length > 1) {
|
|
32
43
|
throw new Error("Unable to parse the provided locale code: \"".concat(locale, "\". Multiple region codes detected."));
|
|
33
44
|
}
|
|
34
|
-
var
|
|
35
|
-
|
|
45
|
+
var _ref3 = scripts,
|
|
46
|
+
_ref4 = _slicedToArray(_ref3, 1),
|
|
47
|
+
scriptCode = _ref4[0];
|
|
48
|
+
var _ref5 = regions,
|
|
49
|
+
_ref6 = _slicedToArray(_ref5, 1),
|
|
50
|
+
regionCode = _ref6[0];
|
|
36
51
|
var code = [lang.toLowerCase(), regionCode, scriptCode ? toPascalCase(scriptCode) : undefined].filter(isNotUndefined).join('_');
|
|
37
52
|
var isoCode = code.replace('_', '-');
|
|
38
53
|
var obj = {
|
|
@@ -24,10 +24,9 @@ var COUNTRY_TO_LOCALE = {
|
|
|
24
24
|
* See https://github.com/prezly/theme-nextjs-bea/blob/main/utils/lang.ts for a usage example.
|
|
25
25
|
*/
|
|
26
26
|
function pickSupportedLocale(locale) {
|
|
27
|
-
var
|
|
28
|
-
isoCode,
|
|
29
|
-
lang
|
|
30
|
-
} = _Locale.Locale.from(locale);
|
|
27
|
+
var _Locale$from = _Locale.Locale.from(locale),
|
|
28
|
+
isoCode = _Locale$from.isoCode,
|
|
29
|
+
lang = _Locale$from.lang;
|
|
31
30
|
if ((0, _isLocaleSupported.isLocaleSupported)(locale)) {
|
|
32
31
|
return isoCode;
|
|
33
32
|
}
|
|
@@ -18,10 +18,9 @@ var COUNTRY_TO_LOCALE = {
|
|
|
18
18
|
* See https://github.com/prezly/theme-nextjs-bea/blob/main/utils/lang.ts for a usage example.
|
|
19
19
|
*/
|
|
20
20
|
export function pickSupportedLocale(locale) {
|
|
21
|
-
var
|
|
22
|
-
isoCode,
|
|
23
|
-
lang
|
|
24
|
-
} = Locale.from(locale);
|
|
21
|
+
var _Locale$from = Locale.from(locale),
|
|
22
|
+
isoCode = _Locale$from.isoCode,
|
|
23
|
+
lang = _Locale$from.lang;
|
|
25
24
|
if (isLocaleSupported(locale)) {
|
|
26
25
|
return isoCode;
|
|
27
26
|
}
|
package/package.json
CHANGED
|
@@ -1,78 +1,77 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"./i18n": "./build/i18n",
|
|
15
|
-
"./i18n/*": "./build/i18n/*"
|
|
2
|
+
"name": "@prezly/theme-kit-intl",
|
|
3
|
+
"version": "10.9.1",
|
|
4
|
+
"description": "Translations for Prezly themes",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/index.mjs",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./build/index.d.ts",
|
|
11
|
+
"require": "./build/index.cjs",
|
|
12
|
+
"default": "./build/index.mjs"
|
|
16
13
|
},
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
14
|
+
"./i18n": "./build/i18n",
|
|
15
|
+
"./i18n/*": "./build/i18n/*"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"build",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">= 14.x",
|
|
23
|
+
"npm": ">= 7.x"
|
|
24
|
+
},
|
|
25
|
+
"devEngines": {
|
|
26
|
+
"node": ">= 14.x",
|
|
27
|
+
"npm": ">= 7.x"
|
|
28
|
+
},
|
|
29
|
+
"np": {
|
|
30
|
+
"yarn": false
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/prezly/theme-kit-js.git"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [],
|
|
37
|
+
"author": "Prezly Team <hello@prezly.com> (https://www.prezly.com)",
|
|
38
|
+
"license": "GNU GPL v3",
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/prezly/theme-kit-js/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/prezly/theme-kit-js/tree/main/packages/intl#readme",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@technically/is-not-undefined": "^1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@formatjs/cli": "4.8.4"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "rimraf --glob build/* *.tsbuildinfo",
|
|
54
|
+
"prebuild": "pnpm clean && pnpm build:locales && pnpm format",
|
|
55
|
+
"build": "pnpm intl:compile && pnpm build:types && pnpm build:esm && pnpm build:cjs",
|
|
56
|
+
"build:locales": "node ./build-locales.cjs > src/locales/supportedLocales.ts && biome format --write ./src/locales/supportedLocales.ts",
|
|
57
|
+
"build:types": "tsc --project .",
|
|
58
|
+
"build:esm": "babel --config-file=../../babel.esm.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.mjs",
|
|
59
|
+
"build:cjs": "babel --config-file=../../babel.cjs.json src/ --extensions=.ts --out-dir=build/ --out-file-extension=.cjs",
|
|
60
|
+
"watch": "tsc --watch --preserveWatchOutput --project .",
|
|
61
|
+
"lint": "biome lint ./src/",
|
|
62
|
+
"lint:fix": "biome lint --write ./src/",
|
|
63
|
+
"format": "biome format ./src/",
|
|
64
|
+
"format:fix": "biome format --write ./src/",
|
|
65
|
+
"typecheck": "tsc --noEmit --emitDeclarationOnly false --project .",
|
|
66
|
+
"test": "pnpm test:unit && pnpm test:build",
|
|
67
|
+
"test:unit": "jest",
|
|
68
|
+
"test:build": "pnpm test:build:i18n && pnpm test:build:i18n:dist && pnpm test:build:cjs && pnpm test:build:esm && pnpm test:build:types",
|
|
69
|
+
"test:build:types": "tsc --noEmit build/index.d.ts",
|
|
70
|
+
"test:build:i18n": "node tests/test-i18n.mjs",
|
|
71
|
+
"test:build:i18n:dist": "echo 'Checking if the build/i18n directory contains 55 files' && ls build/i18n/*.json | cut -d\\/ -f3 | cut -d. -f1 | sort | wc -l | grep -q 55 || (echo 'Fail' && false) && echo 'OK'",
|
|
72
|
+
"test:build:cjs": "node tests/test-build.cjs",
|
|
73
|
+
"test:build:esm": "node tests/test-build.mjs",
|
|
74
|
+
"intl:extract": "formatjs extract 'src/messages/**/*.ts' --out-file i18n/en.json --format crowdin --id-interpolation-pattern '[sha512:contenthash:base64:6]'",
|
|
75
|
+
"intl:compile": "formatjs compile-folder --ast --format crowdin i18n build/i18n"
|
|
76
|
+
}
|
|
77
|
+
}
|