@vyriy/package 0.1.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 +21 -0
- package/README.md +61 -0
- package/index.d.ts +2 -0
- package/index.js +1 -0
- package/package.d.ts +2 -0
- package/package.js +9 -0
- package/package.json +39 -0
- package/types.d.ts +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vyriy contributors
|
|
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
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @vyriy/package
|
|
2
|
+
|
|
3
|
+
Helpers for reading and caching `package.json` in Vyriy projects.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
This package provides a small helper for reading the project `package.json`.
|
|
8
|
+
|
|
9
|
+
The file is read lazily:
|
|
10
|
+
|
|
11
|
+
- the first call reads and parses `package.json`
|
|
12
|
+
- the parsed result is cached
|
|
13
|
+
- all next calls return the cached object
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
With npm:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @vyriy/package
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
With Yarn:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn add @vyriy/package
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { getPackage } from '@vyriy/package';
|
|
33
|
+
|
|
34
|
+
const package = getPackage();
|
|
35
|
+
|
|
36
|
+
console.log(package.name);
|
|
37
|
+
console.log(package.version);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You can also narrow the fields you need:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { getPackage } from '@vyriy/package';
|
|
44
|
+
|
|
45
|
+
const { name, scripts } = getPackage();
|
|
46
|
+
|
|
47
|
+
console.log(name);
|
|
48
|
+
console.log(scripts?.build);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
`getPackage()`
|
|
54
|
+
|
|
55
|
+
- reads the root `package.json` file on first access
|
|
56
|
+
- caches the parsed object
|
|
57
|
+
- returns the cached `Package` object on later calls
|
|
58
|
+
|
|
59
|
+
## Exported Types
|
|
60
|
+
|
|
61
|
+
- `Package`
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './package.js';
|
package/package.d.ts
ADDED
package/package.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vyriy/package",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "Shared package.json helpers for Vyriy projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@vyriy/path": "0.1.9"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"types": "./index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./index.d.ts",
|
|
15
|
+
"import": "./index.js",
|
|
16
|
+
"default": "./index.js"
|
|
17
|
+
},
|
|
18
|
+
"./index": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"import": "./index.js",
|
|
21
|
+
"default": "./index.js"
|
|
22
|
+
},
|
|
23
|
+
"./index.js": {
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
|
+
"import": "./index.js",
|
|
26
|
+
"default": "./index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package": {
|
|
29
|
+
"types": "./package.d.ts",
|
|
30
|
+
"import": "./package.js",
|
|
31
|
+
"default": "./package.js"
|
|
32
|
+
},
|
|
33
|
+
"./package.js": {
|
|
34
|
+
"types": "./package.d.ts",
|
|
35
|
+
"import": "./package.js",
|
|
36
|
+
"default": "./package.js"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type Package = {
|
|
2
|
+
name: string;
|
|
3
|
+
version: string;
|
|
4
|
+
description: string;
|
|
5
|
+
private?: boolean;
|
|
6
|
+
type?: string;
|
|
7
|
+
main?: string;
|
|
8
|
+
types?: string;
|
|
9
|
+
packageManager?: string;
|
|
10
|
+
scripts?: Record<string, string>;
|
|
11
|
+
dependencies?: Record<string, string>;
|
|
12
|
+
devDependencies?: Record<string, string>;
|
|
13
|
+
peerDependencies?: Record<string, string>;
|
|
14
|
+
exports?: Record<string, unknown>;
|
|
15
|
+
engines?: Record<string, string>;
|
|
16
|
+
workspaces?: string[];
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
export type GetPackage = () => Package;
|