properties-file 2.0.8 → 2.0.9

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Avansai
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Avansai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -40,9 +40,9 @@ Both APIs (`getProperties` and `propertiesToJson`) directly under `properties-fi
40
40
  This API is probably the most used. You have a `.properties` file that you want to open and access like a simple key/value JSON object. Here is how this can be done with a single API call:
41
41
 
42
42
  ```ts
43
- import { propertiesToJson } from 'properties-file';
43
+ import { propertiesToJson } from 'properties-file'
44
44
 
45
- console.log(propertiesToJson('hello-world.properties'));
45
+ console.log(propertiesToJson('hello-world.properties'))
46
46
  ```
47
47
 
48
48
  Output:
@@ -54,11 +54,11 @@ Output:
54
54
  If you cannot use `fs` and already have the content of a `.properties` file, your code would look like this instead:
55
55
 
56
56
  ```ts
57
- import { propertiesToJson } from 'properties-file/content';
57
+ import { propertiesToJson } from 'properties-file/content'
58
58
 
59
59
  // ...some code to get the .properties file content into a variable called `propertiesFileContent`
60
60
 
61
- console.log(propertiesToJson(propertiesFileContent));
61
+ console.log(propertiesToJson(propertiesFileContent))
62
62
  ```
63
63
 
64
64
  ### `getProperties` (advanced use case)
@@ -84,13 +84,13 @@ world: world3
84
84
  ```
85
85
 
86
86
  ```ts
87
- import { getProperties } from 'properties-file';
87
+ import { getProperties } from 'properties-file'
88
88
 
89
- const properties = getProperties('assets/tests/collisions-test.properties');
89
+ const properties = getProperties('assets/tests/collisions-test.properties')
90
90
 
91
91
  properties.collection.forEach((property) => {
92
- console.log(`${property.key} => '${property.value}'`);
93
- });
92
+ console.log(`${property.key} => '${property.value}'`)
93
+ })
94
94
 
95
95
  /**
96
96
  * Outputs:
@@ -100,7 +100,7 @@ properties.collection.forEach((property) => {
100
100
  *
101
101
  */
102
102
 
103
- const keyCollisions = properties.getKeyCollisions();
103
+ const keyCollisions = properties.getKeyCollisions()
104
104
 
105
105
  keyCollisions.forEach((keyCollision) => {
106
106
  console.warn(
@@ -109,8 +109,8 @@ keyCollisions.forEach((keyCollision) => {
109
109
  }' on lines ${keyCollision.startingLineNumbers.join(
110
110
  ', '
111
111
  )} (will use the value at line ${keyCollision.getApplicableLineNumber()}).`
112
- );
113
- });
112
+ )
113
+ })
114
114
 
115
115
  /**
116
116
  * Outputs:
@@ -140,7 +140,7 @@ module.exports = {
140
140
  },
141
141
  ],
142
142
  },
143
- };
143
+ }
144
144
  ```
145
145
 
146
146
  As soon as you configure Webpack, the `.properties` type should be available in your IDE when using `import`. If you ever need to add it manually, you can add a `*.properties` type declaration file at the root of your application, like this:
@@ -156,9 +156,9 @@ declare module '*.properties' {
156
156
  By adding these configurations you should now be able to import directly `.properties` files just like this:
157
157
 
158
158
  ```ts
159
- import helloWorld from './hello-world.properties';
159
+ import helloWorld from './hello-world.properties'
160
160
 
161
- console.dir(helloWorld);
161
+ console.dir(helloWorld)
162
162
  ```
163
163
 
164
164
  Output:
package/lib/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  /// <reference types="./properties-file" />
2
2
 
3
- export { Properties, KeyLineNumbers } from './properties';
3
+ export { getProperties, propertiesToJson } from './file';
4
+ export { KeyLineNumbers, Properties } from './properties';
4
5
  export { Property } from './property';
5
6
  export { PropertyLine } from './property-line';
6
- export { getProperties } from './file';
7
- export { propertiesToJson } from './file';
8
7
  /**
9
8
  * A simple "key/value" object.
10
9
  */
package/lib/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.propertiesToJson = exports.getProperties = exports.PropertyLine = exports.Property = exports.Properties = void 0;
3
+ exports.PropertyLine = exports.Property = exports.Properties = exports.propertiesToJson = exports.getProperties = void 0;
4
+ var file_1 = require("./file");
5
+ Object.defineProperty(exports, "getProperties", { enumerable: true, get: function () { return file_1.getProperties; } });
6
+ Object.defineProperty(exports, "propertiesToJson", { enumerable: true, get: function () { return file_1.propertiesToJson; } });
4
7
  var properties_1 = require("./properties");
5
8
  Object.defineProperty(exports, "Properties", { enumerable: true, get: function () { return properties_1.Properties; } });
6
9
  var property_1 = require("./property");
7
10
  Object.defineProperty(exports, "Property", { enumerable: true, get: function () { return property_1.Property; } });
8
11
  var property_line_1 = require("./property-line");
9
12
  Object.defineProperty(exports, "PropertyLine", { enumerable: true, get: function () { return property_line_1.PropertyLine; } });
10
- var file_1 = require("./file");
11
- Object.defineProperty(exports, "getProperties", { enumerable: true, get: function () { return file_1.getProperties; } });
12
- var file_2 = require("./file");
13
- Object.defineProperty(exports, "propertiesToJson", { enumerable: true, get: function () { return file_2.propertiesToJson; } });
@@ -1,7 +1,7 @@
1
- /** This allows to get the correct type when using `import` on `.properties` files. */
2
- declare module '*.properties' {
3
- const properties: {
4
- readonly [key: string]: string;
5
- };
6
- export default properties;
7
- }
1
+ /** This allows to get the correct type when using `import` on `.properties` files. */
2
+ declare module '*.properties' {
3
+ const properties: {
4
+ readonly [key: string]: string
5
+ }
6
+ export default properties
7
+ }
package/package.json CHANGED
@@ -1,70 +1,74 @@
1
- {
2
- "name": "properties-file",
3
- "version": "2.0.8",
4
- "description": ".properties file parser, JSON converter and Webpack loader.",
5
- "author": "Avansai (https://avansai.com)",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/Avansai/properties-file.git"
9
- },
10
- "main": "lib/index.js",
11
- "types": "lib/index.d.ts",
12
- "exports": {
13
- ".": "./lib/index.js",
14
- "./content": "./lib/content/index.js",
15
- "./webpack-loader": "./lib/loader/webpack.js"
16
- },
17
- "typesVersions": {
18
- "*": {
19
- "content": [
20
- "lib/content/index.d.ts"
21
- ],
22
- "webpack-loader": [
23
- "lib/loader/webpack.d.ts"
24
- ]
25
- }
26
- },
27
- "license": "MIT",
28
- "files": [
29
- "lib"
30
- ],
31
- "keywords": [
32
- ".properties",
33
- "properties",
34
- ".properties file",
35
- "properties file",
36
- "parser",
37
- "Java",
38
- "intl",
39
- "i18n",
40
- "properties Webpack loader",
41
- "Webpack loader",
42
- "internationalization"
43
- ],
44
- "scripts": {
45
- "build": "rm -Rf ./lib && tsc && npm run add-import-type && npm run lint && npm test",
46
- "add-import-type": "node ./src/add-import-type",
47
- "test": "jest --coverage",
48
- "tmp-test": "tsc && node ./lib/tmp.js",
49
- "lint": "eslint . --fix",
50
- "prettier-check": "prettier --check .",
51
- "prettier-fix": "prettier --write .",
52
- "release": "dotenv -- release-it --only-version"
53
- },
54
- "devDependencies": {
55
- "@release-it/conventional-changelog": "^5.0.0",
56
- "@types/jest": "^28.1.6",
57
- "@typescript-eslint/eslint-plugin": "^5.31.0",
58
- "@typescript-eslint/parser": "^5.31.0",
59
- "dotenv-cli": "^6.0.0",
60
- "eslint": "^8.20.0",
61
- "eslint-config-prettier": "^8.5.0",
62
- "eslint-plugin-jest": "^26.6.0",
63
- "jest": "^28.1.3",
64
- "prettier": "2.7.1",
65
- "release-it": "^15.1.4",
66
- "ts-jest": "^28.0.7",
67
- "ts-node": "^10.9.1",
68
- "typescript": "^4.7.4"
69
- }
70
- }
1
+ {
2
+ "name": "properties-file",
3
+ "version": "2.0.9",
4
+ "description": ".properties file parser, JSON converter and Webpack loader.",
5
+ "author": "Avansai (https://avansai.com)",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Avansai/properties-file.git"
9
+ },
10
+ "main": "lib/index.js",
11
+ "types": "lib/index.d.ts",
12
+ "exports": {
13
+ ".": "./lib/index.js",
14
+ "./content": "./lib/content/index.js",
15
+ "./webpack-loader": "./lib/loader/webpack.js"
16
+ },
17
+ "typesVersions": {
18
+ "*": {
19
+ "content": [
20
+ "lib/content/index.d.ts"
21
+ ],
22
+ "webpack-loader": [
23
+ "lib/loader/webpack.d.ts"
24
+ ]
25
+ }
26
+ },
27
+ "license": "MIT",
28
+ "files": [
29
+ "lib"
30
+ ],
31
+ "keywords": [
32
+ ".properties",
33
+ "properties",
34
+ ".properties file",
35
+ "properties file",
36
+ "parser",
37
+ "Java",
38
+ "intl",
39
+ "i18n",
40
+ "properties Webpack loader",
41
+ "Webpack loader",
42
+ "internationalization"
43
+ ],
44
+ "scripts": {
45
+ "build": "rm -Rf ./lib && tsc && npm run add-import-type && npm run lint && npm test",
46
+ "lint": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --fix .",
47
+ "lint-print-config": "eslint --print-config ./eslintrc.yaml",
48
+ "prettier": "prettier --write .",
49
+ "add-import-type": "node ./src/add-import-type",
50
+ "test": "jest --coverage",
51
+ "release": "dotenv -- release-it --only-version"
52
+ },
53
+ "devDependencies": {
54
+ "@release-it/conventional-changelog": "^5.0.0",
55
+ "@types/jest": "^28.1.6",
56
+ "@typescript-eslint/eslint-plugin": "^5.31.0",
57
+ "@typescript-eslint/parser": "^5.31.0",
58
+ "dotenv-cli": "^6.0.0",
59
+ "eslint": "^8.21.0",
60
+ "eslint-config-prettier": "^8.5.0",
61
+ "eslint-import-resolver-node": "^0.3.6",
62
+ "eslint-import-resolver-typescript": "^3.3.0",
63
+ "eslint-plugin-import": "^2.26.0",
64
+ "eslint-plugin-jest": "^26.7.0",
65
+ "eslint-plugin-prettier": "^4.2.1",
66
+ "jest": "^28.1.3",
67
+ "prettier": "^2.7.1",
68
+ "prettier-plugin-organize-imports": "^3.0.0",
69
+ "release-it": "^15.2.0",
70
+ "ts-jest": "^28.0.7",
71
+ "ts-node": "^10.9.1",
72
+ "typescript": "^4.7.4"
73
+ }
74
+ }