configuru 0.6.1 → 0.6.2
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/.github/workflows/lint.yml +33 -0
- package/.github/workflows/npm-publish.yml +37 -0
- package/.github/workflows/test.yml +33 -0
- package/.husky/pre-commit +4 -0
- package/dist/lib/helpers.js +6 -2
- package/dist/lib/helpers.js.map +1 -1
- package/dist/lib/loader.js +22 -20
- package/dist/lib/loader.js.map +1 -1
- package/dist/lib/polishers.js +17 -15
- package/dist/lib/polishers.js.map +1 -1
- package/dist/lib/storage.js +4 -4
- package/dist/lib/storage.js.map +1 -1
- package/dist/test/loader.test.js +1 -1
- package/dist/test/loader.test.js.map +1 -1
- package/package.json +17 -15
- package/src/lib/loader.ts +27 -25
- package/src/lib/polishers.ts +21 -17
- package/.huskyrc.json +0 -5
- package/CHANGELOG.md +0 -198
- package/dist/test/polishers.test.d.ts +0 -1
- package/dist/test/polishers.test.js +0 -50
- package/dist/test/polishers.test.js.map +0 -1
- package/src/test/__snapshots__/polishers.test.ts.snap +0 -61
- package/src/test/polishers.test.ts +0 -89
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [14, 16]
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Check out code
|
|
19
|
+
uses: actions/checkout@v3
|
|
20
|
+
|
|
21
|
+
- name: Setup node
|
|
22
|
+
uses: actions/setup-node@v3
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ matrix.node-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm i --ignore-scripts
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: npm run cs:eslint:check
|
|
31
|
+
|
|
32
|
+
- name: Run tests
|
|
33
|
+
run: npm run cs:prettier:check
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Publish to NPM
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
version: [12, 14, 16, 18]
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
- uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: ${{ matrix.version }}
|
|
21
|
+
- run: npm i --ignore-scripts
|
|
22
|
+
- run: npm test
|
|
23
|
+
|
|
24
|
+
publish-npm:
|
|
25
|
+
needs: build
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
steps:
|
|
28
|
+
- uses: actions/checkout@v3
|
|
29
|
+
- uses: actions/setup-node@v3
|
|
30
|
+
with:
|
|
31
|
+
node-version: 16
|
|
32
|
+
registry-url: https://registry.npmjs.org/
|
|
33
|
+
- run: npm i --ignore-scripts
|
|
34
|
+
- run: npm run build
|
|
35
|
+
- run: npm publish
|
|
36
|
+
env:
|
|
37
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
tests:
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [12, 14, 16, 18]
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Check out code
|
|
19
|
+
uses: actions/checkout@v3
|
|
20
|
+
|
|
21
|
+
- name: Setup node
|
|
22
|
+
uses: actions/setup-node@v3
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ matrix.node-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm i --ignore-scripts
|
|
28
|
+
|
|
29
|
+
- name: Run tests with coverage
|
|
30
|
+
run: npm run test:coverage
|
|
31
|
+
|
|
32
|
+
- name: Run codecov
|
|
33
|
+
run: npm run test:codecov
|
package/dist/lib/helpers.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
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);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -39,7 +43,7 @@ exports.JSONC = {
|
|
|
39
43
|
var errors = [];
|
|
40
44
|
var parsed = jsonParser.parse(text, errors);
|
|
41
45
|
if (errors.length) {
|
|
42
|
-
throw new SyntaxError(jsonParser.printParseErrorCode(errors[0].error)
|
|
46
|
+
throw new SyntaxError("".concat(jsonParser.printParseErrorCode(errors[0].error), " at position ").concat(errors[0].offset));
|
|
43
47
|
}
|
|
44
48
|
return parsed;
|
|
45
49
|
},
|
package/dist/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/lib/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/lib/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA0C;AAEnC,IAAM,SAAS,GAAG,UAAC,GAAQ,IAAK,OAAA,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,EAAjC,CAAiC,CAAA;AAA3D,QAAA,SAAS,aAAkD;AAEjE,IAAM,SAAS,GAAG,UAAC,CAAM;IAC9B,OAAA,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AAA/C,CAA+C,CAAA;AADpC,QAAA,SAAS,aAC2B;AAC1C,IAAM,QAAQ,GAAG,UAAI,CAAI,IAAK,OAAA,CAAC,EAAD,CAAC,CAAA;AAAzB,QAAA,QAAQ,YAAiB;AAE/B,IAAM,QAAQ,GAAG,UAAC,CAAM;IAC7B,OAAA,OAAO,CAAC,KAAK,QAAQ;QACrB,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,iBAAiB;AADvD,CACuD,CAAA;AAF5C,QAAA,QAAQ,YAEoC;AAE5C,QAAA,KAAK,GAAG;IACnB,KAAK,EAAE,UAAC,IAAY;QAClB,IAAM,MAAM,GAA4B,EAAE,CAAA;QAC1C,IAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAC7C,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,IAAI,WAAW,CACnB,UAAG,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,0BAChD,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAChB,CACH,CAAA;SACF;QACD,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA"}
|
package/dist/lib/loader.js
CHANGED
|
@@ -20,28 +20,30 @@ var defaultOpts = {
|
|
|
20
20
|
envMode: 'default',
|
|
21
21
|
};
|
|
22
22
|
var createAtomLoaderFactory = function (storage) {
|
|
23
|
-
var load = function (transform, hidden, nullable) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
var load = function (transform, hidden, nullable) {
|
|
24
|
+
return function (key) {
|
|
25
|
+
var safeTransform = function (x) {
|
|
26
|
+
try {
|
|
27
|
+
return transform(x);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
throw new Error("Failed to transform value >".concat(String(value), "< from key >").concat(key, "<"));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var value = storage[key];
|
|
34
|
+
var missing = value === undefined || value === null;
|
|
35
|
+
if (!nullable && missing) {
|
|
36
|
+
throw new Error("Missing required value ".concat(key));
|
|
27
37
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
throw new Error("Missing required value " + key);
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
hidden: hidden,
|
|
39
|
-
nullable: nullable,
|
|
40
|
-
rawValue: value,
|
|
41
|
-
value: missing ? null : safeTransform(value),
|
|
42
|
-
__CONFIGURU_LEAF: true,
|
|
38
|
+
return {
|
|
39
|
+
hidden: hidden,
|
|
40
|
+
nullable: nullable,
|
|
41
|
+
rawValue: value,
|
|
42
|
+
value: missing ? null : safeTransform(value),
|
|
43
|
+
__CONFIGURU_LEAF: true,
|
|
44
|
+
};
|
|
43
45
|
};
|
|
44
|
-
};
|
|
46
|
+
};
|
|
45
47
|
return function (transform) {
|
|
46
48
|
return Object.assign(load(transform, false, false), {
|
|
47
49
|
hidden: Object.assign(load(transform, true, false), {
|
package/dist/lib/loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/lib/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,qCAA+C;AAQ/C,IAAM,WAAW,GAAwB;IACvC,iBAAiB,EAAE,MAAM;IACzB,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;IACzC,OAAO,EAAE,SAAS;CACnB,CAAA;AAcM,IAAM,uBAAuB,GAAG,UAAC,OAAyB;IAC/D,IAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/lib/loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,qCAA+C;AAQ/C,IAAM,WAAW,GAAwB;IACvC,iBAAiB,EAAE,MAAM;IACzB,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;IACzC,OAAO,EAAE,SAAS;CACnB,CAAA;AAcM,IAAM,uBAAuB,GAAG,UAAC,OAAyB;IAC/D,IAAM,IAAI,GACR,UACE,SAAwB,EACxB,MAAe,EACf,QAAiB;QAEnB,OAAA,UAAC,GAAW;YACV,IAAM,aAAa,GAAG,UAAC,CAAM;gBAC3B,IAAI;oBACF,OAAO,SAAS,CAAC,CAAC,CAAC,CAAA;iBACpB;gBAAC,OAAO,CAAC,EAAE;oBACV,MAAM,IAAI,KAAK,CACb,qCAA8B,MAAM,CAAC,KAAK,CAAC,yBAAe,GAAG,MAAG,CACjE,CAAA;iBACF;YACH,CAAC,CAAA;YACD,IAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;YAC1B,IAAM,OAAO,GAAG,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAA;YACrD,IAAI,CAAC,QAAQ,IAAI,OAAO,EAA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,CAAC;QAC3B,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;QAC5B,MAAM,EAAE,UAAI,EAAiB,IAAK,OAAA,UAAU,CAAC,EAAE,CAAC,EAAd,CAAc;KACjD,CAAA;AACH,CAAC,CAAA;AAXY,QAAA,YAAY,gBAWxB"}
|
package/dist/lib/polishers.js
CHANGED
|
@@ -5,21 +5,23 @@ var helpers_1 = require("./helpers");
|
|
|
5
5
|
var isLoadedValue = function (x) {
|
|
6
6
|
return Object.keys(x || {}).includes('__CONFIGURU_LEAF');
|
|
7
7
|
};
|
|
8
|
-
var mapConfig = function (fn) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
var mapConfig = function (fn) {
|
|
9
|
+
return function (val) {
|
|
10
|
+
if (isLoadedValue(val)) {
|
|
11
|
+
return mapConfig(fn)(fn(val));
|
|
12
|
+
}
|
|
13
|
+
if (Array.isArray(val)) {
|
|
14
|
+
return val.map(mapConfig(fn));
|
|
15
|
+
}
|
|
16
|
+
if ((0, helpers_1.isObject)(val)) {
|
|
17
|
+
return Object.keys(val).reduce(function (res, key) {
|
|
18
|
+
res[key] = mapConfig(fn)(val[key]);
|
|
19
|
+
return res;
|
|
20
|
+
}, {});
|
|
21
|
+
}
|
|
22
|
+
return val;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
23
25
|
exports.values = mapConfig(function (x) { return x.value; });
|
|
24
26
|
exports.safeValues = mapConfig(function (x) {
|
|
25
27
|
return x.hidden ? (0, helpers_1.anonymize)(x.rawValue) : x.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polishers.js","sourceRoot":"","sources":["../../src/lib/polishers.ts"],"names":[],"mappings":";;;AAAA,qCAA+C;
|
|
1
|
+
{"version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dist/lib/storage.js
CHANGED
|
@@ -52,15 +52,15 @@ var loadFile = function (filePath) {
|
|
|
52
52
|
]);
|
|
53
53
|
var resolvedPath = testPaths.find(fileExistsSync);
|
|
54
54
|
if (!resolvedPath) {
|
|
55
|
-
throw new Error("File path set, but none of the following tested derivations exist:\n"
|
|
56
|
-
.map(function (p) { return " - "
|
|
57
|
-
.join('\n'));
|
|
55
|
+
throw new Error("File path set, but none of the following tested derivations exist:\n".concat(testPaths
|
|
56
|
+
.map(function (p) { return " - ".concat((0, path_1.join)((0, path_1.resolve)('.'), p)); })
|
|
57
|
+
.join('\n')));
|
|
58
58
|
}
|
|
59
59
|
try {
|
|
60
60
|
return helpers_1.JSONC.parse((0, fs_1.readFileSync)(resolvedPath, 'utf-8'));
|
|
61
61
|
}
|
|
62
62
|
catch (error) {
|
|
63
|
-
throw new Error("Invalid config file in "
|
|
63
|
+
throw new Error("Invalid config file in ".concat((0, path_1.join)((0, path_1.resolve)('.'), resolvedPath)));
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
var createConfigStorage = function (opts) {
|
package/dist/lib/storage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/lib/storage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,yBAA2C;AAC3C,6BAAmD;AACnD,qCAAiC;AAGjC,IAAM,cAAc,GAAG,UAAC,IAAY;IAClC,IAAI;QACF,OAAO,IAAA,aAAQ,EAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAA;KAC/B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAA;KACb;AACH,CAAC,CAAA;AACD,IAAM,SAAS,GAAG,UAAC,KAA8B;IAC/C,OAAA,MAAM,CAAC,MAAM,OAAb,MAAM,iBAAQ,EAAE,GAAK,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,UAAC,EAAM;;YAAL,CAAC,QAAA,EAAE,CA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= _a.string, custom = _a.custom;
|
|
17
17
|
var schema = {
|
|
18
18
|
foo: string('FOO'),
|
|
19
|
-
stamp: custom(function (foo) { return foo
|
|
19
|
+
stamp: custom(function (foo) { return "".concat(foo, "bar"); })('FOO'),
|
|
20
20
|
expanded: custom(function (x) {
|
|
21
21
|
return x
|
|
22
22
|
.split('')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.test.js","sourceRoot":"","sources":["../../src/test/loader.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,wCAAqE;AACrE,8CAAyC;AAEzC,IAAM,MAAM,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,IAAI;CACX,CAAA;AAED,IAAM,YAAY,GAAG,IAAA,gCAAuB,EAAC,MAAM,CAAC,CAAC,UAAA,CAAC,IAAI,OAAA,MAAM,CAAC,CAAC,CAAC,EAAT,CAAS,CAAC,CAAA;AAEpE,QAAQ,CAAC,QAAQ,EAAE;IACX,IAAA,KAAqB,IAAA,qBAAY,EAAC;QACtC,iBAAiB,EAAE,IAAA,cAAO,EAAC,SAAS,EAAE,wBAAwB,CAAC;KAChE,CAAC,EAFM,MAAM,YAAA,EAAE,MAAM,YAEpB,CAAA;IACF,IAAM,MAAM,GAAG;QACb,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC,UAAC,GAAW,IAAK,
|
|
1
|
+
{"version":3,"file":"loader.test.js","sourceRoot":"","sources":["../../src/test/loader.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,wCAAqE;AACrE,8CAAyC;AAEzC,IAAM,MAAM,GAAG;IACb,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,IAAI;CACX,CAAA;AAED,IAAM,YAAY,GAAG,IAAA,gCAAuB,EAAC,MAAM,C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CAAC,gRAQrD,CAAC,CAAA;QACV,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "configuru",
|
|
3
3
|
"description": "Manage the configuration of your Nodejs application with multiple environments and custom preferences, utilizing Configuru in CI and development as well!",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.2",
|
|
5
5
|
"author": "Jaroslav Šmolík <grissius@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Jaroslav Šmolík <grissius@gmail.com>"
|
|
8
8
|
],
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=12"
|
|
12
|
+
},
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
15
|
"url": "https://github.com/AckeeCZ/configuru"
|
|
@@ -38,26 +41,25 @@
|
|
|
38
41
|
"cs:eslint:fix": "npm run cs:eslint:check -- --fix",
|
|
39
42
|
"cs:prettier:check": "prettier --ignore-path .gitignore --check '**/*.{ts,js,json,md}'",
|
|
40
43
|
"cs:prettier:fix": "npm run cs:prettier:check -- --write '**/*.{ts,js,json,md}'",
|
|
41
|
-
"prepare": "
|
|
44
|
+
"prepare": "husky install",
|
|
42
45
|
"docs": "typedoc --options typedoc.json src/lib/*.ts",
|
|
43
46
|
"check": "npm-check -i app -i errors -i config -i index & exit 0"
|
|
44
47
|
},
|
|
45
48
|
"dependencies": {
|
|
46
|
-
"jsonc-parser": "^
|
|
49
|
+
"jsonc-parser": "^3.1.0"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
49
|
-
"@ackee/styleguide-backend-config": "^0.2
|
|
50
|
-
"@types/jest": "^
|
|
51
|
-
"@types/node": "^
|
|
52
|
-
"codecov": "^3.
|
|
53
|
-
"husky": "^
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"lint-staged": "^10.4.0",
|
|
52
|
+
"@ackee/styleguide-backend-config": "^0.3.2",
|
|
53
|
+
"@types/jest": "^28.1.4",
|
|
54
|
+
"@types/node": "^18.0.3",
|
|
55
|
+
"codecov": "^3.8.2",
|
|
56
|
+
"husky": "^8.0.1",
|
|
57
|
+
"jest": "^28.1.2",
|
|
58
|
+
"lint-staged": "^13.0.3",
|
|
57
59
|
"npm-check": "^5.9.2",
|
|
58
|
-
"prettier": "^2.1
|
|
59
|
-
"ts-jest": "^
|
|
60
|
-
"typedoc": "^0.
|
|
61
|
-
"typescript": "^4.
|
|
60
|
+
"prettier": "^2.7.1",
|
|
61
|
+
"ts-jest": "^28.0.5",
|
|
62
|
+
"typedoc": "^0.23.7",
|
|
63
|
+
"typescript": "^4.7.4"
|
|
62
64
|
}
|
|
63
65
|
}
|
package/src/lib/loader.ts
CHANGED
|
@@ -26,33 +26,35 @@ export interface LoadedValue<
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export const createAtomLoaderFactory = (storage: Record<any, any>) => {
|
|
29
|
-
const load =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
const load =
|
|
30
|
+
<T, N extends boolean>(
|
|
31
|
+
transform: (x: any) => T,
|
|
32
|
+
hidden: boolean,
|
|
33
|
+
nullable: boolean
|
|
34
|
+
) =>
|
|
35
|
+
(key: string): LoadedValue<T, N> => {
|
|
36
|
+
const safeTransform = (x: any) => {
|
|
37
|
+
try {
|
|
38
|
+
return transform(x)
|
|
39
|
+
} catch (e) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Failed to transform value >${String(value)}< from key >${key}<`
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const value = storage[key]
|
|
46
|
+
const missing = value === undefined || value === null
|
|
47
|
+
if (!nullable && missing) {
|
|
48
|
+
throw new Error(`Missing required value ${key}`)
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
hidden,
|
|
52
|
+
nullable,
|
|
53
|
+
rawValue: value,
|
|
54
|
+
value: missing ? null : (safeTransform(value) as any),
|
|
55
|
+
__CONFIGURU_LEAF: true,
|
|
41
56
|
}
|
|
42
57
|
}
|
|
43
|
-
const value = storage[key]
|
|
44
|
-
const missing = value === undefined || value === null
|
|
45
|
-
if (!nullable && missing) {
|
|
46
|
-
throw new Error(`Missing required value ${key}`)
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
hidden,
|
|
50
|
-
nullable,
|
|
51
|
-
rawValue: value,
|
|
52
|
-
value: missing ? null : (safeTransform(value) as any),
|
|
53
|
-
__CONFIGURU_LEAF: true,
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
58
|
return <T>(transform: (x: any) => T) =>
|
|
57
59
|
Object.assign(load<T, false>(transform, false, false), {
|
|
58
60
|
hidden: Object.assign(load<T, false>(transform, true, false), {
|
package/src/lib/polishers.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { anonymize, isObject } from './helpers'
|
|
2
2
|
import { LoadedValue } from './loader'
|
|
3
3
|
|
|
4
|
-
type LoadedToValue<X> = X extends LoadedValue<any, any>
|
|
4
|
+
type LoadedToValue<X> = X extends LoadedValue<any, any>
|
|
5
|
+
? X['value'] extends Record<any, any>
|
|
6
|
+
? Values<X['value']>
|
|
7
|
+
: X['value']
|
|
8
|
+
: X
|
|
5
9
|
|
|
6
10
|
type Values<C> = C extends (...args: any[]) => any
|
|
7
11
|
? C
|
|
@@ -26,23 +30,23 @@ type AnonymousValues<C> = C extends (...args: any[]) => any
|
|
|
26
30
|
const isLoadedValue = (x: any) =>
|
|
27
31
|
Object.keys(x || {}).includes('__CONFIGURU_LEAF')
|
|
28
32
|
|
|
29
|
-
const mapConfig =
|
|
30
|
-
|
|
31
|
-
): any => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
const mapConfig =
|
|
34
|
+
(fn: (v: LoadedValue<any, any>) => any) =>
|
|
35
|
+
(val: any): any => {
|
|
36
|
+
if (isLoadedValue(val)) {
|
|
37
|
+
return mapConfig(fn)(fn(val))
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(val)) {
|
|
40
|
+
return val.map(mapConfig(fn))
|
|
41
|
+
}
|
|
42
|
+
if (isObject(val)) {
|
|
43
|
+
return Object.keys(val).reduce((res: any, key) => {
|
|
44
|
+
res[key] = mapConfig(fn)(val[key])
|
|
45
|
+
return res
|
|
46
|
+
}, {})
|
|
47
|
+
}
|
|
48
|
+
return val
|
|
43
49
|
}
|
|
44
|
-
return val
|
|
45
|
-
}
|
|
46
50
|
|
|
47
51
|
export const values = mapConfig(x => x.value) as <T extends Record<any, any>>(
|
|
48
52
|
config: T
|
package/.huskyrc.json
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
<a name="0.4.0"></a>
|
|
4
|
-
|
|
5
|
-
## 0.4.0 (2020-04-17)
|
|
6
|
-
|
|
7
|
-
### Added
|
|
8
|
-
|
|
9
|
-
- ✅ Update test snapshots [[00566d9](https://github.com/AckeeCZ/configuru/commit/00566d9e0e33e766cf63171dd59faed651e33fe6)]
|
|
10
|
-
- ✨ Make the whole string hidden after anonymize [[422fe99](https://github.com/AckeeCZ/configuru/commit/422fe997bec9a4743311cbfe5eee8656fc503745)]
|
|
11
|
-
- ✅ Add tests [[5db3a59](https://github.com/AckeeCZ/configuru/commit/5db3a596eb0337d9a7da33daea9828897d81f1d3)]
|
|
12
|
-
- ✨ Add codecov coverage reporting [[ebfa389](https://github.com/AckeeCZ/configuru/commit/ebfa3897a216cd69d0429f0e63eaf8c98dd20d6c)]
|
|
13
|
-
- ✨ Add path probing, update tests [[5e032de](https://github.com/AckeeCZ/configuru/commit/5e032dee5b78456a0762d20c79f39616b9e5f287)]
|
|
14
|
-
|
|
15
|
-
### Changed
|
|
16
|
-
|
|
17
|
-
- ⬆️ Upgrade deps [[b0ca55f](https://github.com/AckeeCZ/configuru/commit/b0ca55f6f52f71d22668ed2d6bc6db32dbef2849)]
|
|
18
|
-
- ♻️ Remove use of node path [[8a01058](https://github.com/AckeeCZ/configuru/commit/8a01058010543b259d948f05557a77a1059469cc)]
|
|
19
|
-
|
|
20
|
-
### Miscellaneous
|
|
21
|
-
|
|
22
|
-
- 0.4.0 [[b52bfcb](https://github.com/AckeeCZ/configuru/commit/b52bfcb68d9867fb7e768b630f9778693d40a42f)]
|
|
23
|
-
- Merge pull request [#22](https://github.com/AckeeCZ/configuru/issues/22) from AckeeCZ/feat/anonymize [[23fc9fc](https://github.com/AckeeCZ/configuru/commit/23fc9fc03e46642afccf5f61e73b849de4ebbf68)]
|
|
24
|
-
- Merge pull request [#20](https://github.com/AckeeCZ/configuru/issues/20) from AckeeCZ/refactor/tests [[298085b](https://github.com/AckeeCZ/configuru/commit/298085ba63c9225d2e248dbcedda336e6a8012dc)]
|
|
25
|
-
- Merge pull request [#18](https://github.com/AckeeCZ/configuru/issues/18) from AckeeCZ/fix/14-support-functions [[a5a7df6](https://github.com/AckeeCZ/configuru/commit/a5a7df6eca0bee73f685242a7792f07ea2488250)]
|
|
26
|
-
- Merge pull request [#19](https://github.com/AckeeCZ/configuru/issues/19) from AckeeCZ/fix/17-path-probing [[eb3104e](https://github.com/AckeeCZ/configuru/commit/eb3104e550d0e024afc9bd152777dae20667229a)]
|
|
27
|
-
- 📝 Update docs [[31d35e6](https://github.com/AckeeCZ/configuru/commit/31d35e6bed67beda39889497b69d2053deef9b7c)]
|
|
28
|
-
- 📝 Update coverage badge [[5a15b3d](https://github.com/AckeeCZ/configuru/commit/5a15b3dbb095f0a9de4691f26c4d5476c0021d62)]
|
|
29
|
-
- 📸 Storage snapshots to inline snapshots [[d2c95c4](https://github.com/AckeeCZ/configuru/commit/d2c95c4512fb33cd1e976a476dfd5d6d28a362d6)]
|
|
30
|
-
- 🏷️ Fix function lost in type inference [[a34e847](https://github.com/AckeeCZ/configuru/commit/a34e84727289596de831e6471385151402700905)]
|
|
31
|
-
|
|
32
|
-
<a name="0.3.1"></a>
|
|
33
|
-
|
|
34
|
-
## 0.3.1 (2020-01-06)
|
|
35
|
-
|
|
36
|
-
### Changed
|
|
37
|
-
|
|
38
|
-
- 🚸 Allow passing partial options [[99caa5f](https://github.com/AckeeCZ/configuru/commit/99caa5faf34c4a095391c63c81d4b96ebfddfc54)]
|
|
39
|
-
|
|
40
|
-
### Miscellaneous
|
|
41
|
-
|
|
42
|
-
- Merge pull request [#13](https://github.com/AckeeCZ/configuru/issues/13) from AckeeCZ/fix/6-parsing-crash [[c00effc](https://github.com/AckeeCZ/configuru/commit/c00effc921c962505482430bd7899c118be2678b)]
|
|
43
|
-
- Merge pull request [#12](https://github.com/AckeeCZ/configuru/issues/12) from AckeeCZ/fix/10-option-merging [[2cb4ccf](https://github.com/AckeeCZ/configuru/commit/2cb4ccf8860d7c504d2e4109f72a9a83300036bf)]
|
|
44
|
-
- 🥅 Add transform error handling [[8a49e2c](https://github.com/AckeeCZ/configuru/commit/8a49e2cbf06d063e5345b6b7495420f469515520)]
|
|
45
|
-
|
|
46
|
-
<a name="0.3.0"></a>
|
|
47
|
-
|
|
48
|
-
## 0.3.0 (2019-12-13)
|
|
49
|
-
|
|
50
|
-
### Added
|
|
51
|
-
|
|
52
|
-
- ✅ Add jsonc tests [[2870527](https://github.com/AckeeCZ/configuru/commit/2870527a4eb5e903e439bf83914403266fd4cf87)]
|
|
53
|
-
- ✨ Parse files with jsonc [[c528316](https://github.com/AckeeCZ/configuru/commit/c52831646d15b372b369d85660890ca27941901f)]
|
|
54
|
-
- ✨ Add jsonc helper [[a12de88](https://github.com/AckeeCZ/configuru/commit/a12de88f4a4530de1bb05ad850d5d95fe3fc70ab)]
|
|
55
|
-
- ➕ Add jsonc-parser [[0cab89d](https://github.com/AckeeCZ/configuru/commit/0cab89df5a9cdc0550c2701f91f9482ee7346b22)]
|
|
56
|
-
|
|
57
|
-
### Changed
|
|
58
|
-
|
|
59
|
-
- ♻️ Add missing newline at the end of the file [[d953516](https://github.com/AckeeCZ/configuru/commit/d953516965d8c0afcdb7ae7718701c0c339fca98)]
|
|
60
|
-
|
|
61
|
-
### Miscellaneous
|
|
62
|
-
|
|
63
|
-
- 📝 Update changelog [[fbb01ff](https://github.com/AckeeCZ/configuru/commit/fbb01ffb42e5b09e08dc4210a4cf1dc3e5cf76e7)]
|
|
64
|
-
- Merge pull request [#11](https://github.com/AckeeCZ/configuru/issues/11) from smoliji/feat/jsonc [[37d0930](https://github.com/AckeeCZ/configuru/commit/37d0930735cd7d765c2046fb726cea2a5152d2ab)]
|
|
65
|
-
- 📝 Update jsonc feature emoji [[c95ae0b](https://github.com/AckeeCZ/configuru/commit/c95ae0bbbaf12982a1ec6843fd23215d10b06c43)]
|
|
66
|
-
- 📝 Mention jsonc feature [[560d5ec](https://github.com/AckeeCZ/configuru/commit/560d5ec139f30f6d3e92babda5b6d18064175575)]
|
|
67
|
-
- Merge pull request [#9](https://github.com/AckeeCZ/configuru/issues/9) from AckeeCZ/feat/add-missing-nodejs-types [[17c5ac4](https://github.com/AckeeCZ/configuru/commit/17c5ac4ef47c7650dee9e260967b63c92437dc85)]
|
|
68
|
-
- Add @types/node [[3acf85f](https://github.com/AckeeCZ/configuru/commit/3acf85f74221a1c2068d362a538e24fe9d08ceb9)]
|
|
69
|
-
- Merge pull request [#8](https://github.com/AckeeCZ/configuru/issues/8) from AckeeCZ/feature/more-secret-secret [[b1a2c5f](https://github.com/AckeeCZ/configuru/commit/b1a2c5fe3355616862123d74e969d519451f57a3)]
|
|
70
|
-
- Update anonymize [[eb80138](https://github.com/AckeeCZ/configuru/commit/eb801389df695bc3fea04d2d93cd6449d85d7054)]
|
|
71
|
-
|
|
72
|
-
<a name="0.2.2"></a>
|
|
73
|
-
|
|
74
|
-
## 0.2.2 (2019-05-27)
|
|
75
|
-
|
|
76
|
-
### Miscellaneous
|
|
77
|
-
|
|
78
|
-
- Release version 0.2.2 [[62b8632](https://github.com/AckeeCZ/configuru/commit/62b863290d1a0ae3b392a6311250eab6b4adb69d)]
|
|
79
|
-
- Merge pull request [#5](https://github.com/AckeeCZ/configuru/issues/5) from AckeeCZ/feature/map-polishing [[cff805b](https://github.com/AckeeCZ/configuru/commit/cff805be55e6846ddba389b25aae61f7ec97fccf)]
|
|
80
|
-
- Update changelog [[cf6043a](https://github.com/AckeeCZ/configuru/commit/cf6043ad5c6120ee471b06524b55ad0d60883a22)]
|
|
81
|
-
- Update tests [[ae473f0](https://github.com/AckeeCZ/configuru/commit/ae473f0157534b089c5d737088618cbc2f0694f1)]
|
|
82
|
-
- Update polishers to map over collection [[56246fc](https://github.com/AckeeCZ/configuru/commit/56246fc1e21308810f417c967ba231e655836ed5)]
|
|
83
|
-
|
|
84
|
-
<a name="0.2.1"></a>
|
|
85
|
-
|
|
86
|
-
## 0.2.1 (2019-05-02)
|
|
87
|
-
|
|
88
|
-
### Miscellaneous
|
|
89
|
-
|
|
90
|
-
- Release version 0.2.1 [[0b04f54](https://github.com/AckeeCZ/configuru/commit/0b04f54b1fd642f3d810e834258709897e94a66d)]
|
|
91
|
-
- Merge pull request [#2](https://github.com/AckeeCZ/configuru/issues/2) from AckeeCZ/feature/storage-file-errors [[e699ee6](https://github.com/AckeeCZ/configuru/commit/e699ee6ee2cdd5ba01e77cc6d74a4ac3e25cbaa5)]
|
|
92
|
-
- Fix changlog order [[7c95aaa](https://github.com/AckeeCZ/configuru/commit/7c95aaa70215b6107cb30019a7f611d2c8f44cf0)]
|
|
93
|
-
- Update changelog [[cafb8bf](https://github.com/AckeeCZ/configuru/commit/cafb8bf53b9accb9f17b6bccc3efce6e3a652b78)]
|
|
94
|
-
- Update changelog [[8a89423](https://github.com/AckeeCZ/configuru/commit/8a89423ccf70f69f5bb0dc085a24fe57dca1d513)]
|
|
95
|
-
- Merge remote-tracking branch 'origin/master' into feature/storage-file-errors [[a0deaa4](https://github.com/AckeeCZ/configuru/commit/a0deaa4897c73ffa77b0c109f0350bab8cbeabb5)]
|
|
96
|
-
- Merge pull request [#4](https://github.com/AckeeCZ/configuru/issues/4) from AckeeCZ/fix/arrays [[b6b839d](https://github.com/AckeeCZ/configuru/commit/b6b839d081bb04ef95543f6001188cfbd39da860)]
|
|
97
|
-
- Update changelog [[39ecc2f](https://github.com/AckeeCZ/configuru/commit/39ecc2f0efa647eb12f5333314e2612605c3cf0f)]
|
|
98
|
-
- Add test for polishing arrays [[be67a28](https://github.com/AckeeCZ/configuru/commit/be67a28adbf33374a9f3b050913380a81eefa900)]
|
|
99
|
-
- Fix isObject import [[ce5037f](https://github.com/AckeeCZ/configuru/commit/ce5037f2f73c98440c450324c8fd147ebacd9a3d)]
|
|
100
|
-
- Throw a descriptive error on invalid config file [[6f7bffb](https://github.com/AckeeCZ/configuru/commit/6f7bffb6673feb1054cdcb54dfc627be7f1d5ea6)]
|
|
101
|
-
|
|
102
|
-
<a name="0.2.0"></a>
|
|
103
|
-
|
|
104
|
-
## 0.2.0 (2019-04-30)
|
|
105
|
-
|
|
106
|
-
### Miscellaneous
|
|
107
|
-
|
|
108
|
-
- Release version 0.2.0 [[a1fee8a](https://github.com/AckeeCZ/configuru/commit/a1fee8a4accc5c489113a098fb86f2d164c50d36)]
|
|
109
|
-
- Merge pull request [#1](https://github.com/AckeeCZ/configuru/issues/1) from AckeeCZ/feature/simplify-api [[af7d8ac](https://github.com/AckeeCZ/configuru/commit/af7d8ac0cdab8b22e6d8af8986a3b412fbcb46e9)]
|
|
110
|
-
- Remove node 6 Travis build [[fd25c27](https://github.com/AckeeCZ/configuru/commit/fd25c2741835b287ee07adc16abf1b2d7e91d2d7)]
|
|
111
|
-
- Remove rej hunk [[9463d7c](https://github.com/AckeeCZ/configuru/commit/9463d7c1f3e655c037b4a6aff099d71618a09799)]
|
|
112
|
-
- Update changelog [[a5187f1](https://github.com/AckeeCZ/configuru/commit/a5187f1b0f6dcd4cd9db554dacbf11e8080532ab)]
|
|
113
|
-
- Update readme [[ec5f1fa](https://github.com/AckeeCZ/configuru/commit/ec5f1fa15cf284b9f2caa3c0cbf2500178c939c7)]
|
|
114
|
-
- Add custom loader [[0bc0d98](https://github.com/AckeeCZ/configuru/commit/0bc0d988101015162cd3cd8d7c29b3867372c985)]
|
|
115
|
-
- Update exports [[6b3125d](https://github.com/AckeeCZ/configuru/commit/6b3125d1441c8f7de45abfb8ba75a809f6193705)]
|
|
116
|
-
- Add safe values [[4950e64](https://github.com/AckeeCZ/configuru/commit/4950e64c189c4e4947b73dadbe69468c1dd8f030)]
|
|
117
|
-
- Add safeValues polisher [[2c7e8a9](https://github.com/AckeeCZ/configuru/commit/2c7e8a95c3bc1e175b5bac0f536e2b13321cea64)]
|
|
118
|
-
- Add type tests [[06f3a1d](https://github.com/AckeeCZ/configuru/commit/06f3a1d38ac4532b20e4fd063d936fdabee6867f)]
|
|
119
|
-
- Add value polisher [[4eb0487](https://github.com/AckeeCZ/configuru/commit/4eb048732c153cda9a9d6204e4cf17a6bcac2dba)]
|
|
120
|
-
- Update loaders to return objects [[81b6569](https://github.com/AckeeCZ/configuru/commit/81b6569d5bd1f536538cc5669ad1ff8bcd6d44be)]
|
|
121
|
-
- Remove anonymize fn from loaders [[950b8a8](https://github.com/AckeeCZ/configuru/commit/950b8a814a46b6d438ed469d5e8534c17c91a601)]
|
|
122
|
-
|
|
123
|
-
<a name="0.1.5"></a>
|
|
124
|
-
|
|
125
|
-
## 0.1.5 (2019-04-24)
|
|
126
|
-
|
|
127
|
-
### Miscellaneous
|
|
128
|
-
|
|
129
|
-
- Release version 0.1.5 [[f5149ef](https://github.com/AckeeCZ/configuru/commit/f5149ef2b31f0845c78770ad836d5916fed0d95b)]
|
|
130
|
-
- Update readme [[d628278](https://github.com/AckeeCZ/configuru/commit/d6282783d25eca5b169dfa9f29122e82715805a2)]
|
|
131
|
-
- Export loader type [[f8f7097](https://github.com/AckeeCZ/configuru/commit/f8f70972382b944af2f813cd61e7b9a164eff6f5)]
|
|
132
|
-
|
|
133
|
-
<a name="0.1.4"></a>
|
|
134
|
-
|
|
135
|
-
## 0.1.4 (2019-04-24)
|
|
136
|
-
|
|
137
|
-
### Miscellaneous
|
|
138
|
-
|
|
139
|
-
- Release version 0.1.4 [[9ef7cda](https://github.com/AckeeCZ/configuru/commit/9ef7cda8a59358a84aadd29d35d77cb9d3f553b5)]
|
|
140
|
-
- Update changelog [[02d6d21](https://github.com/AckeeCZ/configuru/commit/02d6d2142be86a983aebdb46d862549ce9d39f6d)]
|
|
141
|
-
- Fix config merging, update tests [[cdc2602](https://github.com/AckeeCZ/configuru/commit/cdc2602994699522d4083c96a1199f4780833530)]
|
|
142
|
-
- Fix main file path [[8a49b38](https://github.com/AckeeCZ/configuru/commit/8a49b38d3041b85379b0678bf063489585b166af)]
|
|
143
|
-
|
|
144
|
-
<a name="0.1.3"></a>
|
|
145
|
-
|
|
146
|
-
## 0.1.3 (2019-04-24)
|
|
147
|
-
|
|
148
|
-
### Miscellaneous
|
|
149
|
-
|
|
150
|
-
- Release version 0.1.3 [[3ab3b8f](https://github.com/AckeeCZ/configuru/commit/3ab3b8f3226bb3104ebebfe8d046770c15c53da7)]
|
|
151
|
-
- Fix docs build [[2339e81](https://github.com/AckeeCZ/configuru/commit/2339e81de695e524c82b9da81da52313f66d609f)]
|
|
152
|
-
|
|
153
|
-
<a name="0.1.2"></a>
|
|
154
|
-
|
|
155
|
-
## 0.1.2 (2019-04-24)
|
|
156
|
-
|
|
157
|
-
### Miscellaneous
|
|
158
|
-
|
|
159
|
-
- Release version 0.1.2 [[1457774](https://github.com/AckeeCZ/configuru/commit/14577741cc4a8bb786f8f9ffab0d71477e8d9bba)]
|
|
160
|
-
- Fix test and lint [[a1f49b3](https://github.com/AckeeCZ/configuru/commit/a1f49b3852ac119c33b0b1927f0fdeb512a3423d)]
|
|
161
|
-
|
|
162
|
-
<a name="0.1.0"></a>
|
|
163
|
-
|
|
164
|
-
## 0.1.0 (2019-04-24)
|
|
165
|
-
|
|
166
|
-
### Miscellaneous
|
|
167
|
-
|
|
168
|
-
- Release version 0.1.0 [[11a6afe](https://github.com/AckeeCZ/configuru/commit/11a6afedc43d9ca0888bf32bc1b33f7c7af8c5e4)]
|
|
169
|
-
- Update changelog [[1352b37](https://github.com/AckeeCZ/configuru/commit/1352b3722e7ed00bb701fdd871fac31e063e4953)]
|
|
170
|
-
- Add env modes [[51cb54a](https://github.com/AckeeCZ/configuru/commit/51cb54a34e0a706b6350408b0c3d1b62084c91dc)]
|
|
171
|
-
- Add atom loader [[4d21f89](https://github.com/AckeeCZ/configuru/commit/4d21f89c32fb684ace2193be0c0bb788292028e3)]
|
|
172
|
-
- Fix missing newline [[bc4c0a1](https://github.com/AckeeCZ/configuru/commit/bc4c0a18279d84d2a7401a4851ec5091d2e08c06)]
|
|
173
|
-
- Remove dummy loader [[d1ca1e5](https://github.com/AckeeCZ/configuru/commit/d1ca1e59b68d2e1d54261b781544a296f3b6d7f5)]
|
|
174
|
-
- Refactor config loader [[1078b1b](https://github.com/AckeeCZ/configuru/commit/1078b1b9e0b8aae302c952aa82480e3deb7f356a)]
|
|
175
|
-
- Update meta [[9152259](https://github.com/AckeeCZ/configuru/commit/915225931b5a4cce971fdf25127daf37483eed79)]
|
|
176
|
-
- Add basic implementation from the template [[70ebc2a](https://github.com/AckeeCZ/configuru/commit/70ebc2a0c031ad36b2ff37a5170bde128110151b)]
|
|
177
|
-
|
|
178
|
-
<a name="0.0.1"></a>
|
|
179
|
-
|
|
180
|
-
## 0.0.1 (2019-04-10)
|
|
181
|
-
|
|
182
|
-
### Miscellaneous
|
|
183
|
-
|
|
184
|
-
- Release version 0.0.1 [[7f0607d](https://github.com/AckeeCZ/configuru/commit/7f0607d622e1a10334e9bd72cde5bb1a286b634a)]
|
|
185
|
-
- Update changelog [[dadb8c7](https://github.com/AckeeCZ/configuru/commit/dadb8c7a57e907970a519e6fe61a3fe0e36e57c0)]
|
|
186
|
-
- Update readme [[3c38d62](https://github.com/AckeeCZ/configuru/commit/3c38d6209a2b1dee41a92e46e4ac2af66232d933)]
|
|
187
|
-
- Update secrets [[c8b9f71](https://github.com/AckeeCZ/configuru/commit/c8b9f71dbb460d05fe97667d18933a16225ec1fc)]
|
|
188
|
-
- Update travis configuration [[247cfba](https://github.com/AckeeCZ/configuru/commit/247cfba0da100daa4e52cb585c4abc8e9c0437f1)]
|
|
189
|
-
- Update badges [[b3da7f4](https://github.com/AckeeCZ/configuru/commit/b3da7f445493435d37982f4fa3ace79369ca183e)]
|
|
190
|
-
- Add changelog [[aa60311](https://github.com/AckeeCZ/configuru/commit/aa603113580e9e4c7e1d9752cc59aebeebb01371)]
|
|
191
|
-
|
|
192
|
-
<a name="0.0.0"></a>
|
|
193
|
-
|
|
194
|
-
## 0.0.0 (2019-04-10)
|
|
195
|
-
|
|
196
|
-
### Miscellaneous
|
|
197
|
-
|
|
198
|
-
- Initialize repository [[ea0b2cd](https://github.com/AckeeCZ/configuru/commit/ea0b2cddb3a544394437b98cade010da358ec771)]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var intspector_1 = require("intspector");
|
|
4
|
-
var loader_1 = require("../lib/loader");
|
|
5
|
-
var polishers_1 = require("../lib/polishers");
|
|
6
|
-
var typeTest = (0, intspector_1.inspectWithPreamble)("\nimport { createAtomLoaderFactory } from 'lib/loader';\nimport { values, safeValues } from 'lib/polishers';\n\nconst storage = {\n FOO: 'foo',\n BAR: 'bar',\n BAZ: 123,\n QUIX: 'abcdefghijklmnopqrstuvwxyz',\n};\nconst string = createAtomLoaderFactory(storage)(String);\nconst number = createAtomLoaderFactory(storage)(Number);\n\nconst config1 = {\n my: {\n deep: {\n poem: string('FOO'),\n },\n },\n bar: string('BAR'),\n withConstant: {\n baz: number.hidden('BAZ'),\n ans: 42,\n quix: string.hidden('QUIX'),\n bar: ['b', 'a', 'r'],\n },\n array: [\n { fox: number.hidden('BAZ') },\n { sox: '123' },\n ],\n function: (foo: number) => String(foo),\n};\nconst config1Values = values(config1);\nconst config1SafeValues = safeValues(config1);\n");
|
|
7
|
-
var storage = {
|
|
8
|
-
FOO: 'foo',
|
|
9
|
-
BAR: 'bar',
|
|
10
|
-
BAZ: 123,
|
|
11
|
-
QUIX: 'abcdefghijklmnopqrstuvwxyz',
|
|
12
|
-
};
|
|
13
|
-
var string = (0, loader_1.createAtomLoaderFactory)(storage)(String);
|
|
14
|
-
var number = (0, loader_1.createAtomLoaderFactory)(storage)(Number);
|
|
15
|
-
var config1 = {
|
|
16
|
-
my: {
|
|
17
|
-
deep: {
|
|
18
|
-
poem: string('FOO'),
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
bar: string('BAR'),
|
|
22
|
-
withConstant: {
|
|
23
|
-
baz: number.hidden('BAZ'),
|
|
24
|
-
ans: 42,
|
|
25
|
-
quix: string.hidden('QUIX'),
|
|
26
|
-
bar: ['b', 'a', 'r'],
|
|
27
|
-
},
|
|
28
|
-
array: [{ fox: number.hidden('BAZ') }, { sox: '123' }],
|
|
29
|
-
function: function (foo) { return String(foo); },
|
|
30
|
-
};
|
|
31
|
-
/* tslint:disable:ter-max-len */
|
|
32
|
-
describe('polishers', function () {
|
|
33
|
-
describe('values', function () {
|
|
34
|
-
test('integration', function () {
|
|
35
|
-
expect((0, polishers_1.values)(config1)).toMatchSnapshot();
|
|
36
|
-
});
|
|
37
|
-
test('types', function () {
|
|
38
|
-
expect(typeTest('typeof config1Values')).toMatchInlineSnapshot('"{ my: { deep: { poem: string; }; }; bar: string; withConstant: { baz: number; ans: number; quix: string; bar: string[]; }; array: ({ fox: number; sox?: undefined; } | { sox: string; fox?: undefined; })[]; function: (foo: number) => string; }"');
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
describe('safeValues', function () {
|
|
42
|
-
test('integration', function () {
|
|
43
|
-
expect((0, polishers_1.safeValues)(config1)).toMatchSnapshot();
|
|
44
|
-
});
|
|
45
|
-
test('types', function () {
|
|
46
|
-
expect(typeTest('typeof config1SafeValues')).toMatchInlineSnapshot('"{ my: { deep: { poem: string; }; }; bar: string; withConstant: { baz: string; ans: number; quix: string; bar: string[]; }; array: ({ fox: string; sox?: undefined; } | { sox: string; fox?: undefined; })[]; function: (foo: number) => string; }"');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=polishers.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polishers.test.js","sourceRoot":"","sources":["../../src/test/polishers.test.ts"],"names":[],"mappings":";;AAAA,yCAAgD;AAChD,wCAAuD;AACvD,8CAAqD;AAErD,IAAM,QAAQ,GAAG,IAAA,gCAAmB,EAAC,+0BAkCpC,CAAC,CAAA;AAEF,IAAM,OAAO,GAAG;IACd,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,4BAA4B;CACnC,CAAA;AACD,IAAM,MAAM,GAAG,IAAA,gCAAuB,EAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AACvD,IAAM,MAAM,GAAG,IAAA,gCAAuB,EAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,IAAM,OAAO,GAAG;IACd,EAAE,EAAE;QACF,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;SACpB;KACF;IACD,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC;IAClB,YAAY,EAAE;QACZ,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;QACzB,GAAG,EAAE,EAAE;QACP,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|
6
|
-
Object {
|
|
7
|
-
"fox": "[redacted]",
|
|
8
|
-
},
|
|
9
|
-
Object {
|
|
10
|
-
"sox": "123",
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
"bar": "bar",
|
|
14
|
-
"function": [Function],
|
|
15
|
-
"my": Object {
|
|
16
|
-
"deep": Object {
|
|
17
|
-
"poem": "foo",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
"withConstant": Object {
|
|
21
|
-
"ans": 42,
|
|
22
|
-
"bar": Array [
|
|
23
|
-
"b",
|
|
24
|
-
"a",
|
|
25
|
-
"r",
|
|
26
|
-
],
|
|
27
|
-
"baz": "[redacted]",
|
|
28
|
-
"quix": "[redacted]",
|
|
29
|
-
},
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`polishers values integration 1`] = `
|
|
34
|
-
Object {
|
|
35
|
-
"array": Array [
|
|
36
|
-
Object {
|
|
37
|
-
"fox": 123,
|
|
38
|
-
},
|
|
39
|
-
Object {
|
|
40
|
-
"sox": "123",
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
"bar": "bar",
|
|
44
|
-
"function": [Function],
|
|
45
|
-
"my": Object {
|
|
46
|
-
"deep": Object {
|
|
47
|
-
"poem": "foo",
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
"withConstant": Object {
|
|
51
|
-
"ans": 42,
|
|
52
|
-
"bar": Array [
|
|
53
|
-
"b",
|
|
54
|
-
"a",
|
|
55
|
-
"r",
|
|
56
|
-
],
|
|
57
|
-
"baz": 123,
|
|
58
|
-
"quix": "abcdefghijklmnopqrstuvwxyz",
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
`;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { inspectWithPreamble } from 'intspector'
|
|
2
|
-
import { createAtomLoaderFactory } from '../lib/loader'
|
|
3
|
-
import { safeValues, values } from '../lib/polishers'
|
|
4
|
-
|
|
5
|
-
const typeTest = inspectWithPreamble(`
|
|
6
|
-
import { createAtomLoaderFactory } from 'lib/loader';
|
|
7
|
-
import { values, safeValues } from 'lib/polishers';
|
|
8
|
-
|
|
9
|
-
const storage = {
|
|
10
|
-
FOO: 'foo',
|
|
11
|
-
BAR: 'bar',
|
|
12
|
-
BAZ: 123,
|
|
13
|
-
QUIX: 'abcdefghijklmnopqrstuvwxyz',
|
|
14
|
-
};
|
|
15
|
-
const string = createAtomLoaderFactory(storage)(String);
|
|
16
|
-
const number = createAtomLoaderFactory(storage)(Number);
|
|
17
|
-
|
|
18
|
-
const config1 = {
|
|
19
|
-
my: {
|
|
20
|
-
deep: {
|
|
21
|
-
poem: string('FOO'),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
bar: string('BAR'),
|
|
25
|
-
withConstant: {
|
|
26
|
-
baz: number.hidden('BAZ'),
|
|
27
|
-
ans: 42,
|
|
28
|
-
quix: string.hidden('QUIX'),
|
|
29
|
-
bar: ['b', 'a', 'r'],
|
|
30
|
-
},
|
|
31
|
-
array: [
|
|
32
|
-
{ fox: number.hidden('BAZ') },
|
|
33
|
-
{ sox: '123' },
|
|
34
|
-
],
|
|
35
|
-
function: (foo: number) => String(foo),
|
|
36
|
-
};
|
|
37
|
-
const config1Values = values(config1);
|
|
38
|
-
const config1SafeValues = safeValues(config1);
|
|
39
|
-
`)
|
|
40
|
-
|
|
41
|
-
const storage = {
|
|
42
|
-
FOO: 'foo',
|
|
43
|
-
BAR: 'bar',
|
|
44
|
-
BAZ: 123,
|
|
45
|
-
QUIX: 'abcdefghijklmnopqrstuvwxyz',
|
|
46
|
-
}
|
|
47
|
-
const string = createAtomLoaderFactory(storage)(String)
|
|
48
|
-
const number = createAtomLoaderFactory(storage)(Number)
|
|
49
|
-
|
|
50
|
-
const config1 = {
|
|
51
|
-
my: {
|
|
52
|
-
deep: {
|
|
53
|
-
poem: string('FOO'),
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
bar: string('BAR'),
|
|
57
|
-
withConstant: {
|
|
58
|
-
baz: number.hidden('BAZ'),
|
|
59
|
-
ans: 42,
|
|
60
|
-
quix: string.hidden('QUIX'),
|
|
61
|
-
bar: ['b', 'a', 'r'],
|
|
62
|
-
},
|
|
63
|
-
array: [{ fox: number.hidden('BAZ') }, { sox: '123' }],
|
|
64
|
-
function: (foo: number) => String(foo),
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/* tslint:disable:ter-max-len */
|
|
68
|
-
describe('polishers', () => {
|
|
69
|
-
describe('values', () => {
|
|
70
|
-
test('integration', () => {
|
|
71
|
-
expect(values(config1)).toMatchSnapshot()
|
|
72
|
-
})
|
|
73
|
-
test('types', () => {
|
|
74
|
-
expect(typeTest('typeof config1Values')).toMatchInlineSnapshot(
|
|
75
|
-
'"{ my: { deep: { poem: string; }; }; bar: string; withConstant: { baz: number; ans: number; quix: string; bar: string[]; }; array: ({ fox: number; sox?: undefined; } | { sox: string; fox?: undefined; })[]; function: (foo: number) => string; }"'
|
|
76
|
-
)
|
|
77
|
-
})
|
|
78
|
-
})
|
|
79
|
-
describe('safeValues', () => {
|
|
80
|
-
test('integration', () => {
|
|
81
|
-
expect(safeValues(config1)).toMatchSnapshot()
|
|
82
|
-
})
|
|
83
|
-
test('types', () => {
|
|
84
|
-
expect(typeTest('typeof config1SafeValues')).toMatchInlineSnapshot(
|
|
85
|
-
'"{ my: { deep: { poem: string; }; }; bar: string; withConstant: { baz: string; ans: number; quix: string; bar: string[]; }; array: ({ fox: string; sox?: undefined; } | { sox: string; fox?: undefined; })[]; function: (foo: number) => string; }"'
|
|
86
|
-
)
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
})
|