@jsverse/transloco-validator 7.0.0
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 +47 -0
- package/README.md +3 -0
- package/package.json +38 -0
- package/src/index.js +7 -0
- package/src/lib/transloco-validator.js +18 -0
- package/src/test-setup.js +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
# [7.0.0](https://github.com/jsverse/transloco/compare/transloco-validator-6.0.0...transloco-validator-7.0.0) (2024-03-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### chore
|
|
9
|
+
|
|
10
|
+
* **validator:** ๐ค update package scope ([80737e7](https://github.com/jsverse/transloco/commit/80737e7e2568db0361987a4946a675426dcea867))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### BREAKING CHANGES
|
|
14
|
+
|
|
15
|
+
* **validator:** ๐งจ The package is now published under the jsverse scope
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# [6.0.0](https://github.com/jsverse/transloco/compare/transloco-validator-5.0.1...transloco-validator-6.0.0) (2024-03-23)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [5.0.1](https://github.com/jsverse/transloco/compare/transloco-validator-5.0.0...transloco-validator-5.0.1) (2023-08-01)
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
- **validator:** ๐ remove redundant peerDependencies ([806bd0a](https://github.com/jsverse/transloco/commit/806bd0a4090132a2015911605592041d8af3aca1)), closes [#677](https://github.com/jsverse/transloco/issues/677)
|
|
28
|
+
|
|
29
|
+
# [5.0.0](https://github.com/jsverse/transloco/compare/transloco-validator-4.0.0...transloco-validator-5.0.0) (2023-07-30)
|
|
30
|
+
|
|
31
|
+
# [4.0.0](https://github.com/jsverse/transloco/compare/transloco-validator-3.0.1...transloco-validator-4.0.0) (2023-06-17)
|
|
32
|
+
|
|
33
|
+
### chore
|
|
34
|
+
|
|
35
|
+
- ๐ค upgrade to angular v16 ([#661](https://github.com/jsverse/transloco/issues/661)) ([08db7e7](https://github.com/jsverse/transloco/commit/08db7e7d1f64846fa0b07123dee8ff5bff20b4f0))
|
|
36
|
+
- **validator:** ๐ค min node version is 16 ([b0453fc](https://github.com/jsverse/transloco/commit/b0453fc1b3f8d1eadace1b781d459cfe537688ff))
|
|
37
|
+
|
|
38
|
+
### BREAKING CHANGES
|
|
39
|
+
|
|
40
|
+
- **validator:** ๐งจ Min node version is 16
|
|
41
|
+
- ๐งจ Angular 16
|
|
42
|
+
|
|
43
|
+
## [3.0.1](https://github.com/jsverse/transloco/compare/transloco-validator-3.0.0...transloco-validator-3.0.1) (2021-10-25)
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
- **validator:** ๐ bad import crash ([09a3d9d](https://github.com/jsverse/transloco/commit/09a3d9d4fc271e033770a6ac7d6622ec2cdb6896))
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jsverse/transloco-validator",
|
|
3
|
+
"version": "7.0.0",
|
|
4
|
+
"description": "Transloco translation files validator",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=16"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"transloco-validator": "src/index.js"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/jsverse/transloco/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://jsverse.github.io/transloco/docs/tools/validator",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/jsverse/transloco"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"angular",
|
|
25
|
+
"angular 2",
|
|
26
|
+
"i18n",
|
|
27
|
+
"transloco",
|
|
28
|
+
"translate",
|
|
29
|
+
"translation validator",
|
|
30
|
+
"JSON validator",
|
|
31
|
+
"validator"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"find-duplicated-property-keys": "^1.2.9"
|
|
36
|
+
},
|
|
37
|
+
"type": "commonjs"
|
|
38
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const transloco_validator_1 = tslib_1.__importDefault(require("./lib/transloco-validator"));
|
|
6
|
+
const translationFilePaths = process.argv.slice(2);
|
|
7
|
+
(0, transloco_validator_1.default)(translationFilePaths);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
5
|
+
const find_duplicated_property_keys_1 = tslib_1.__importDefault(require("find-duplicated-property-keys"));
|
|
6
|
+
function default_1(translationFilePaths) {
|
|
7
|
+
translationFilePaths.forEach((path) => {
|
|
8
|
+
const translation = fs_1.default.readFileSync(path, 'utf-8');
|
|
9
|
+
// Verify that we can parse the JSON
|
|
10
|
+
JSON.parse(translation);
|
|
11
|
+
// Verify that we don't have any duplicate keys
|
|
12
|
+
const result = (0, find_duplicated_property_keys_1.default)(translation);
|
|
13
|
+
if (result.length) {
|
|
14
|
+
throw new Error(`Found duplicate keys: ${result.map(({ key }) => key)} (${path})`);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.default = default_1;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
require("zone.js");
|
|
5
|
+
require("zone.js/testing");
|
|
6
|
+
const testing_1 = require("@angular/core/testing");
|
|
7
|
+
const testing_2 = require("@angular/platform-browser-dynamic/testing");
|
|
8
|
+
// First, initialize the Angular testing environment.
|
|
9
|
+
(0, testing_1.getTestBed)().initTestEnvironment(testing_2.BrowserDynamicTestingModule, (0, testing_2.platformBrowserDynamicTesting)(), {
|
|
10
|
+
teardown: { destroyAfterEach: false },
|
|
11
|
+
});
|