Skip to content

Commit b7547a0

Browse files
committed
chore: release version 1.0.0
1 parent dfd3426 commit b7547a0

File tree

9 files changed

+103
-97
lines changed

9 files changed

+103
-97
lines changed

.npmignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@
66

77
tsconfig.json
88
.prettierrc
9+
scripts
10+
examples
11+
docs
12+
tests
13+
.git
14+
.gitignore
15+
tsconfig
16+
.env
17+
src

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
registry=https://registry.npmjs.org/
2+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

docs/CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Changelog
2+
3+
All notable changes to the `@medishn/toolkit` package will be documented in this file.
4+
5+
---
6+
7+
## [1.0.0] - 2025-02-24
8+
9+
### **Added**
10+
11+
- **Core Utilities**
12+
13+
- Introduced `ObjectInspector` for type-safe, chainable object inspection and manipulation.
14+
- Added `Merger` class for deep object merging with type safety.
15+
- Implemented `inspect` and `merge` utility functions for streamlined object operations.
16+
17+
- **Type Utilities**
18+
19+
- Added essential type helpers:
20+
- `Maybe<T>` for nullable values.
21+
- `Dictionary<T>` for key-value object structures.
22+
- `Constructor<T>` for class constructor types.
23+
- `Primitive` and `PrimitiveObject` for primitive value handling.
24+
- `Nullable<T>`, `NonNull<T>`, `NonUndefined<T>`, and `NonNullable<T>` for type safety.
25+
- Included utility types: `Noop`, `Callback`, and `Numeric`.
26+
27+
- **Logger**
28+
29+
- Introduced `Logger` class with support for multiple log levels (`info`, `warn`, `error`, `debug`, `verbose`).
30+
- Added colorized output for development environments.
31+
- Implemented context-based logging and customizable log formats.
32+
33+
- **Error Handling**
34+
35+
- Added comprehensive HTTP exception classes for standardized error handling.
36+
- Included RFC 7807 Problem Details format compliance.
37+
- Pre-defined exceptions for all standard HTTP status codes.
38+
39+
- **Type Guards**
40+
41+
- Added 40+ type guards for runtime type checking:
42+
- Primitive checks (`isString`, `isNumber`, `isBoolean`, etc.).
43+
- Structural checks (`isObject`, `isArray`, `isFunction`, etc.).
44+
- Specialized checks (`isDate`, `isPromise`, `isSymbol`, etc.).
45+
46+
- **HTTP Utilities**
47+
48+
- Added `HttpStatus` enum with named constants for all HTTP status codes (1xx-5xx).
49+
50+
- **Documentation**
51+
- Comprehensive API documentation for all utilities.
52+
- Usage examples and best practices for each feature.
53+
54+
---
55+
56+
### **Documentation**
57+
58+
- Added detailed usage guides for all features.
59+
- Included examples for common use cases.
60+
- Provided migration guides for developers transitioning from similar libraries.
61+
62+
This release marks the stable 1.0.0 version of `@medishn/toolkit`, providing a robust set of utilities for modern TypeScript development. For detailed migration instructions and usage examples, refer to the [official documentation](https://github.com/medishen/toolkit/docs).

docs/FAQ.md

Lines changed: 0 additions & 79 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@medishn/toolkit",
33
"version": "1.0.0",
4-
"description": "",
4+
"description": "a toolkit",
55
"files": [
66
"dist/",
77
"README.md"
@@ -14,9 +14,9 @@
1414
},
1515
"scripts": {
1616
"test": "mocha --require ts-node/register tests/integration/*.spec.ts",
17-
"build": "tsc -b ./packages/tsconfig.build.json",
18-
"chmod": "chmod +x ./scripts/release.sh",
19-
"release": "npm run chmod && ./scripts/release.sh"
17+
"build": "tsc",
18+
"chmod": "chmod +x ./scripts/release",
19+
"release": "npm run chmod && ./scripts/release"
2020
},
2121
"repository": {
2222
"type": "git",

scripts/release

100644100755
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,21 @@
1-
!#/bin/bash
1+
#!/bin/bash
2+
set -e
3+
npm run build
4+
VERSION=$(node -p "require('./package.json').version")
5+
6+
CHANGELOG_CONTENT=$(awk "/## \[${VERSION}\]/{flag=1;next}/## \[/{flag=0}flag" docs/CHANGELOG.md | sed '/^$/d')
7+
8+
if [ -z "$CHANGELOG_CONTENT" ]; then
9+
echo "Changelog for version ${VERSION} not found. Please ensure the changelog is updated."
10+
exit 1
11+
fi
12+
if [ -n "$(git status --porcelain)" ]; then
13+
git add .
14+
git commit -m "chore: release version ${VERSION}"
15+
git tag -a "v${VERSION}" -m "Release ${VERSION}" -m "${CHANGELOG_CONTENT}"
16+
git push origin main --tags
17+
else
18+
echo "No changes to commit."
19+
fi
20+
npm publish --access public
21+
echo "Version ${VERSION} successfully published."

src/object/merger.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ export class Merger<T extends object> {
4949
}
5050

5151
private mergeObjects<T extends object, U extends object>(target: T, source: U): T {
52-
const merged = { ...target };
52+
const merged:any = { ...target };
5353

5454
for (const key of Object.keys(source)) {
55-
const targetValue = target[key];
56-
const sourceValue = source[key];
55+
const targetValue = (target as any)[key];
56+
const sourceValue = (source as any)[key];
5757

5858
merged[key] = this.deepMerge(targetValue, sourceValue);
5959
}

src/object/object-inspector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class ObjectInspector<T extends object> {
169169
): ObjectInspector<{ [K in keyof T]: U }> {
170170
if (!this.is('object')) throw new Error('Cannot map non-object');
171171

172-
const result = {} as { [K in keyof T]: U };
172+
const result:any = {} as { [K in keyof T]: U };
173173
if (Array.isArray(this.target)) {
174174
for (let i = 0; i < (this.target as any).length; i++) {
175175
const key = i.toString();

tsconfig.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,15 @@
55
"strict": true,
66
"esModuleInterop": true,
77
"removeComments": true,
8-
"composite": true,
98
"declaration": true,
109
"strictNullChecks": true,
1110
"forceConsistentCasingInFileNames": true,
12-
"experimentalDecorators": true,
13-
"emitDecoratorMetadata": true,
14-
"useUnknownInCatchVariables": false,
1511
"allowJs": false,
1612
"skipLibCheck": true,
1713
"moduleResolution": "node",
1814
"rootDir": "src",
1915
"outDir": "dist",
20-
"types": ["node"],
21-
"noImplicitAny": false,
22-
"noUnusedLocals": false,
23-
"strictPropertyInitialization": false,
24-
"noLib": false
16+
"types": ["node"]
2517
},
2618
"include": ["src/**/*"],
2719
"preserveSymlinks": true,

0 commit comments

Comments
 (0)