@guanghechen/config 1.0.4 → 2.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/README.md +71 -0
- package/lib/cjs/index.cjs +3 -3
- package/lib/esm/index.mjs +1 -1
- package/lib/types/index.d.ts +3 -2
- package/package.json +16 -9
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<header>
|
|
2
|
+
<h1 align="center">
|
|
3
|
+
<a href="https://github.com/guanghechen/sora/tree/@guanghechen/config@2.0.0/packages/config#readme">@guanghechen/config</a>
|
|
4
|
+
</h1>
|
|
5
|
+
<div align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/package/@guanghechen/config">
|
|
7
|
+
<img
|
|
8
|
+
alt="Npm Version"
|
|
9
|
+
src="https://img.shields.io/npm/v/@guanghechen/config.svg"
|
|
10
|
+
/>
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@guanghechen/config">
|
|
13
|
+
<img
|
|
14
|
+
alt="Npm Download"
|
|
15
|
+
src="https://img.shields.io/npm/dm/@guanghechen/config.svg"
|
|
16
|
+
/>
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://www.npmjs.com/package/@guanghechen/config">
|
|
19
|
+
<img
|
|
20
|
+
alt="Npm License"
|
|
21
|
+
src="https://img.shields.io/npm/l/@guanghechen/config.svg"
|
|
22
|
+
/>
|
|
23
|
+
</a>
|
|
24
|
+
<a href="#install">
|
|
25
|
+
<img
|
|
26
|
+
alt="Module Formats: cjs, esm"
|
|
27
|
+
src="https://img.shields.io/badge/module_formats-cjs%2C%20esm-green.svg"
|
|
28
|
+
/>
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://github.com/nodejs/node">
|
|
31
|
+
<img
|
|
32
|
+
alt="Node.js Version"
|
|
33
|
+
src="https://img.shields.io/node/v/@guanghechen/config"
|
|
34
|
+
/>
|
|
35
|
+
</a>
|
|
36
|
+
<a href="https://github.com/facebook/jest">
|
|
37
|
+
<img
|
|
38
|
+
alt="Tested with Jest"
|
|
39
|
+
src="https://img.shields.io/badge/tested_with-jest-9c465e.svg"
|
|
40
|
+
/>
|
|
41
|
+
</a>
|
|
42
|
+
<a href="https://github.com/prettier/prettier">
|
|
43
|
+
<img
|
|
44
|
+
alt="Code Style: prettier"
|
|
45
|
+
src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"
|
|
46
|
+
/>
|
|
47
|
+
</a>
|
|
48
|
+
</div>
|
|
49
|
+
</header>
|
|
50
|
+
<br/>
|
|
51
|
+
|
|
52
|
+
Utilities for defining config followed by semantic version.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
- npm
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install --save @guanghechen/config
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- yarn
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
yarn add @guanghechen/config
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
[homepage]:
|
|
71
|
+
https://github.com/guanghechen/sora/tree/@guanghechen/config@2.0.0/packages/config#readme
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var byte = require('@guanghechen/byte');
|
|
4
4
|
var invariant = require('@guanghechen/invariant');
|
|
5
|
-
var
|
|
5
|
+
var version = require('@guanghechen/version');
|
|
6
6
|
var node_crypto = require('node:crypto');
|
|
7
7
|
var config_types = require('@guanghechen/config.types');
|
|
8
8
|
|
|
@@ -31,8 +31,8 @@ class BaseConfigKeeper {
|
|
|
31
31
|
get data() {
|
|
32
32
|
return this._instance;
|
|
33
33
|
}
|
|
34
|
-
compatible(version) {
|
|
35
|
-
return
|
|
34
|
+
compatible(version$1) {
|
|
35
|
+
return version.satisfies(version$1, this.__compatible_version__);
|
|
36
36
|
}
|
|
37
37
|
async destroy() {
|
|
38
38
|
await this._resource.destroy();
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { bytes2text, randomBytes, text2bytes } from '@guanghechen/byte';
|
|
2
2
|
import { invariant } from '@guanghechen/invariant';
|
|
3
|
-
import { satisfies } from '
|
|
3
|
+
import { satisfies } from '@guanghechen/version';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
export * from '@guanghechen/config.types';
|
|
6
6
|
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IConfigKeeper, IConfig } from '@guanghechen/config.types';
|
|
2
2
|
export * from '@guanghechen/config.types';
|
|
3
|
-
import { ITextResource } from '@guanghechen/resource
|
|
3
|
+
import { ITextResource } from '@guanghechen/resource';
|
|
4
4
|
|
|
5
5
|
type IHashAlgorithm = 'md5' | 'sha1' | 'sha256' | 'sha512';
|
|
6
6
|
|
|
@@ -53,4 +53,5 @@ declare class PlainJsonConfigKeeper<Data> extends JsonConfigKeeper<Data, Data> i
|
|
|
53
53
|
protected deserialize(data: Data): Promise<Data>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export { BaseConfigKeeper,
|
|
56
|
+
export { BaseConfigKeeper, JsonConfigKeeper, PlainJsonConfigKeeper };
|
|
57
|
+
export type { IBaseConfigKeeperProps, IJsonConfigKeeperProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guanghechen/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"description": "Utilities for defining config followed by semantic version.",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/guanghechen/sora/tree/@guanghechen/config@1.0.
|
|
11
|
+
"url": "https://github.com/guanghechen/sora/tree/@guanghechen/config@1.0.5",
|
|
12
12
|
"directory": "packages/config"
|
|
13
13
|
},
|
|
14
|
-
"homepage": "https://github.com/guanghechen/sora/tree/@guanghechen/config@1.0.
|
|
14
|
+
"homepage": "https://github.com/guanghechen/sora/tree/@guanghechen/config@1.0.5/packages/config#readme",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -26,6 +26,13 @@
|
|
|
26
26
|
"module": "./lib/esm/index.mjs",
|
|
27
27
|
"types": "./lib/types/index.d.ts",
|
|
28
28
|
"license": "MIT",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "rollup -c ../../rollup.config.mjs",
|
|
31
|
+
"clean": "rimraf lib",
|
|
32
|
+
"test": "vitest run --config ../../vitest.config.ts",
|
|
33
|
+
"test:coverage": "vitest run --config ../../vitest.config.ts --coverage",
|
|
34
|
+
"test:update": "vitest run --config ../../vitest.config.ts -u"
|
|
35
|
+
},
|
|
29
36
|
"files": [
|
|
30
37
|
"lib/",
|
|
31
38
|
"!lib/**/*.map",
|
|
@@ -35,11 +42,11 @@
|
|
|
35
42
|
"README.md"
|
|
36
43
|
],
|
|
37
44
|
"dependencies": {
|
|
38
|
-
"@guanghechen/byte": "^
|
|
39
|
-
"@guanghechen/config.types": "^
|
|
40
|
-
"@guanghechen/invariant": "^
|
|
41
|
-
"@guanghechen/resource
|
|
42
|
-
"
|
|
45
|
+
"@guanghechen/byte": "^2.0.0",
|
|
46
|
+
"@guanghechen/config.types": "^2.0.0",
|
|
47
|
+
"@guanghechen/invariant": "^7.0.0",
|
|
48
|
+
"@guanghechen/resource": "^2.0.0",
|
|
49
|
+
"@guanghechen/version": "^1.0.0"
|
|
43
50
|
},
|
|
44
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "12990a720b31d50d217e2e17a6191256dc94eda6"
|
|
45
52
|
}
|