vitest-plus-core 0.0.0-stage → 0.1.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 +36 -3
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/package.json +29 -4
package/README.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# vitest-plus-core
|
|
2
|
+
|
|
3
|
+
Core library for vitest-plus. Replace the example exports in `src/index.ts` with your real API.
|
|
4
|
+
|
|
5
|
+
## Develop
|
|
6
|
+
|
|
7
|
+
Install [Bun](https://bun.sh), then:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun install
|
|
11
|
+
bun test
|
|
12
|
+
bun run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Publish to npm
|
|
16
|
+
|
|
17
|
+
1. Create an account at [npmjs.com](https://www.npmjs.com/signup) if needed.
|
|
18
|
+
2. Log in: `bun login`
|
|
19
|
+
3. Dry run: `bun publish --dry-run`
|
|
20
|
+
4. Publish: `bun publish --access public`
|
|
21
|
+
|
|
22
|
+
Bump `version` in `package.json` before each release.
|
|
23
|
+
|
|
24
|
+
## Install (for consumers)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bun add vitest-plus-core
|
|
28
|
+
npm install vitest-plus-core
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
import { formatName, bumpPatch } from "vitest-plus-core";
|
|
33
|
+
|
|
34
|
+
formatName("Ada", "Lovelace"); // "Ada Lovelace"
|
|
35
|
+
bumpPatch("0.1.0"); // "0.1.1"
|
|
36
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a display name from optional first and last name parts.
|
|
3
|
+
*/
|
|
4
|
+
export declare function formatName(first?: string, last?: string): string;
|
|
5
|
+
/**
|
|
6
|
+
* Increment a semver patch segment (e.g. 1.2.3 → 1.2.4).
|
|
7
|
+
* Only supports `major.minor.patch` with numeric parts.
|
|
8
|
+
*/
|
|
9
|
+
export declare function bumpPatch(version: string): string;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOjD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
function formatName(first, last) {
|
|
3
|
+
return [first, last].filter(Boolean).join(" ").trim();
|
|
4
|
+
}
|
|
5
|
+
function bumpPatch(version) {
|
|
6
|
+
const parts = version.split(".");
|
|
7
|
+
if (parts.length !== 3 || parts.some((p) => !/^\d+$/.test(p))) {
|
|
8
|
+
throw new Error(`Invalid semver: ${version}`);
|
|
9
|
+
}
|
|
10
|
+
const patch = Number(parts[2]) + 1;
|
|
11
|
+
return `${parts[0]}.${parts[1]}.${patch}`;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
bumpPatch,
|
|
15
|
+
formatName
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-plus-core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Core utilities for vitest-plus",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target node && bun run build:types",
|
|
19
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
20
|
+
"prepublishOnly": "bun run build",
|
|
21
|
+
"test": "bun test"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"typescript": "^5.7.3"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
}
|
|
31
|
+
}
|