@webnovel-proxy/core 0.0.0-stage → 0.0.1
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 +40 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -3
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @your-scope/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Browser- and Node-compatible shared utilities and Zod schemas.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. Replace `@your-scope/core` and the GitHub repository URL in `package.json`.
|
|
8
|
+
2. Run `corepack enable` and `pnpm install`. Commit the generated `pnpm-lock.yaml`.
|
|
9
|
+
3. Run `pnpm check`.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { clamp, userSchema } from "@your-scope/core";
|
|
15
|
+
import type { User } from "@your-scope/core";
|
|
16
|
+
|
|
17
|
+
const value = clamp(15, 0, 10);
|
|
18
|
+
const user: User = userSchema.parse({
|
|
19
|
+
id: "123e4567-e89b-42d3-a456-426614174000",
|
|
20
|
+
name: "Ada",
|
|
21
|
+
email: "ada@example.com",
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Both ESM and CommonJS are published. Consumers install `zod` transitively as a runtime dependency. Node-only utilities should live in a separate entry point/package; the main entry point must remain browser safe.
|
|
26
|
+
|
|
27
|
+
## Trusted publishing setup
|
|
28
|
+
|
|
29
|
+
1. The npm package must exist before you can add a trusted publisher (bootstrap the first release manually if required). Register the package on npm under your chosen name/scope.
|
|
30
|
+
2. In npmjs.com → package settings → Trusted publishing, register the GitHub owner/repo and workflow filename `publish.yml`. Enable **npm publish** permission.
|
|
31
|
+
3. Ensure `package.json` repository.url exactly matches the GitHub repository. Use a GitHub-hosted runner.
|
|
32
|
+
4. Publish a version by bumping `package.json` version, running `pnpm install` (commit the updated lockfile), merging it to `main`, then tagging that commit:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
git tag v0.1.0
|
|
36
|
+
git push origin v0.1.0
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
A pushed `vX.Y.Z` tag invokes `.github/workflows/publish.yml`, checks the manifest version, runs checks, and publishes with short-lived OIDC credentials (no `NPM_TOKEN`). Protect release tags and restrict who can edit the workflow. npm CLI >=11.5.1 and Node >=22.14 are required for trusted publishing.
|
|
40
|
+
|
|
41
|
+
Note: Before the first GitHub release, replace the package name and GitHub URL and configure npm's trusted publisher. The initial manual bootstrap publish may be needed depending on package availability and npm onboarding.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["z","Test"],"sources":["../src/schemas/test.ts"],"sourcesContent":["import * as z from \"zod\";\n\nexport const Test = z.object({\n\tid: z.uuid(),\n});\nexport type Test = z.infer<typeof Test>;\n"],"mappings":"A,sBAEA,MAAaC,EAAOD,EAAE,OAAO,CAC5B,GAAIA,EAAE,KAAK,CACZ,CAAC,E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webnovel-proxy/core",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"registry": "https://registry.npmjs.org/"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=26"
|
|
24
|
+
},
|
|
25
|
+
"devEngines": {
|
|
26
|
+
"packageManager": {
|
|
27
|
+
"name": "pnpm",
|
|
28
|
+
"version": ">=12.0.0 <13.0.0",
|
|
29
|
+
"onFail": "error"
|
|
30
|
+
},
|
|
31
|
+
"runtime": {
|
|
32
|
+
"name": "node",
|
|
33
|
+
"version": "26.13.0",
|
|
34
|
+
"onFail": "error"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"imports": {
|
|
38
|
+
"#/*": "./src/*"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"zod": "^4.6.7"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@eslint/js": "^9.39.5",
|
|
45
|
+
"@types/node": "^26.6.6",
|
|
46
|
+
"eslint": "^10.14.0",
|
|
47
|
+
"globals": "^17.13.0",
|
|
48
|
+
"prettier": "^3.9.10",
|
|
49
|
+
"tsdown": "^0.23.4",
|
|
50
|
+
"typescript": "^6.0.3",
|
|
51
|
+
"typescript-eslint": "^8.72.1"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsdown",
|
|
55
|
+
"dev": "tsdown --watch",
|
|
56
|
+
"typecheck": "tsc --noEmit",
|
|
57
|
+
"lint": "eslint --cache .",
|
|
58
|
+
"format": "prettier --write --cache .",
|
|
59
|
+
"format:check": "prettier --check src",
|
|
60
|
+
"check": "pnpm lint && pnpm typecheck && pnpm format:check && pnpm build"
|
|
61
|
+
}
|
|
6
62
|
}
|