@cyberskill/shared 1.216.0 → 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.
Files changed (93) hide show
  1. package/README.md +330 -222
  2. package/dist/config/config.util.d.ts +17 -0
  3. package/dist/config/env/env.util.d.ts +26 -0
  4. package/dist/config/eslint/index.d.ts +4 -0
  5. package/dist/config/graphql-codegen/graphql-codegen.util.cjs +1 -1
  6. package/dist/config/graphql-codegen/graphql-codegen.util.d.ts +23 -0
  7. package/dist/config/graphql-codegen/graphql-codegen.util.js +2 -1
  8. package/dist/config/vitest/vitest.e2e.cjs +1 -1
  9. package/dist/config/vitest/vitest.e2e.d.ts +16 -0
  10. package/dist/config/vitest/vitest.e2e.js +1 -1
  11. package/dist/config/vitest/vitest.unit.cjs +1 -1
  12. package/dist/config/vitest/vitest.unit.d.ts +18 -0
  13. package/dist/config/vitest/vitest.unit.js +1 -1
  14. package/dist/constant/common.d.ts +4 -0
  15. package/dist/constant/index.d.ts +3 -0
  16. package/dist/node/apollo-server/apollo-server.util.d.ts +15 -1
  17. package/dist/node/apollo-server/index.cjs +1 -1
  18. package/dist/node/apollo-server/index.js +1 -1
  19. package/dist/node/command/command.type.d.ts +26 -6
  20. package/dist/node/command/command.util.d.ts +50 -0
  21. package/dist/node/express/express.util.cjs +1 -1
  22. package/dist/node/express/express.util.d.ts +47 -0
  23. package/dist/node/express/express.util.js +9 -9
  24. package/dist/node/fs/fs.type.d.ts +6 -0
  25. package/dist/node/fs/fs.util.d.ts +48 -1
  26. package/dist/node/log/log.type.d.ts +6 -1
  27. package/dist/node/log/log.util.cjs +1 -1
  28. package/dist/node/log/log.util.d.ts +30 -2
  29. package/dist/node/log/log.util.js +33 -20
  30. package/dist/node/mongo/mongo.constant.d.ts +5 -0
  31. package/dist/node/mongo/mongo.type.d.ts +4 -4
  32. package/dist/node/mongo/mongo.util.cjs +5 -5
  33. package/dist/node/mongo/mongo.util.d.ts +337 -3
  34. package/dist/node/mongo/mongo.util.js +406 -79
  35. package/dist/node/package/package.type.d.ts +2 -2
  36. package/dist/node/package/package.util.cjs +1 -1
  37. package/dist/node/package/package.util.d.ts +52 -1
  38. package/dist/node/package/package.util.js +97 -92
  39. package/dist/node/path/path.constant.d.ts +9 -0
  40. package/dist/node/path/path.util.d.ts +24 -0
  41. package/dist/node/storage/storage.util.d.ts +44 -0
  42. package/dist/node/storage/storage.util.js +39 -0
  43. package/dist/node/upload/upload.util.d.ts +21 -0
  44. package/dist/node/ws/ts.util.d.ts +16 -0
  45. package/dist/react/apollo-client/apollo-client.component.d.ts +19 -1
  46. package/dist/react/apollo-client/apollo-client.component.js +1 -4
  47. package/dist/react/apollo-client/apollo-client.constant.d.ts +5 -0
  48. package/dist/react/apollo-client/apollo-client.context.d.ts +15 -0
  49. package/dist/react/apollo-client/apollo-client.hook.d.ts +12 -0
  50. package/dist/react/apollo-client/apollo-client.util.d.ts +48 -0
  51. package/dist/react/apollo-client/apollo-client.util.js +9 -0
  52. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.d.ts +19 -1
  53. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.component.js +1 -4
  54. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.rsc.d.ts +10 -0
  55. package/dist/react/apollo-client-nextjs/apollo-client-nextjs.util.d.ts +10 -0
  56. package/dist/react/apollo-error/apollo-error.component.cjs +1 -1
  57. package/dist/react/apollo-error/apollo-error.component.d.ts +17 -0
  58. package/dist/react/apollo-error/apollo-error.component.js +10 -10
  59. package/dist/react/apollo-error/apollo-error.hook.d.ts +12 -0
  60. package/dist/react/apollo-error/apollo-error.provider.d.ts +15 -0
  61. package/dist/react/apollo-error/apollo-error.util.d.ts +17 -0
  62. package/dist/react/i18next/i18next.hook.d.ts +9 -0
  63. package/dist/react/i18next/i18next.util.d.ts +10 -0
  64. package/dist/react/loading/loading.component.d.ts +21 -0
  65. package/dist/react/loading/loading.hook.d.ts +12 -0
  66. package/dist/react/loading/loading.provider.d.ts +15 -0
  67. package/dist/react/log/log.util.d.ts +17 -0
  68. package/dist/react/next-intl/next-intl.constant.d.ts +9 -0
  69. package/dist/react/next-intl/next-intl.hoc.d.ts +16 -0
  70. package/dist/react/next-intl/next-intl.hook.d.ts +21 -0
  71. package/dist/react/next-intl/next-intl.provider.d.ts +21 -0
  72. package/dist/react/storage/storage.hook.d.ts +19 -0
  73. package/dist/react/storage/storage.hook.js +28 -30
  74. package/dist/react/storage/storage.util.d.ts +39 -0
  75. package/dist/react/storage/storage.util.js +33 -0
  76. package/dist/react/userback/userback.component.d.ts +18 -0
  77. package/dist/typescript/common.type.d.ts +6 -0
  78. package/dist/typescript/index.d.ts +3 -0
  79. package/dist/util/common/common.util.d.ts +19 -7
  80. package/dist/util/common/index.d.ts +3 -0
  81. package/dist/util/index.d.ts +3 -0
  82. package/dist/util/object/object.util.d.ts +25 -12
  83. package/dist/util/serializer/serializer.type.d.ts +1 -1
  84. package/dist/util/serializer/serializer.util.d.ts +8 -0
  85. package/dist/util/serializer/serializer.util.js +4 -4
  86. package/dist/util/string/string.util.cjs +1 -1
  87. package/dist/util/string/string.util.d.ts +30 -17
  88. package/dist/util/string/string.util.js +14 -16
  89. package/dist/util/validate/validate.util.d.ts +9 -3
  90. package/dist/util/validate/validate.util.js +5 -3
  91. package/package.json +21 -18
  92. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.15_@vitest_browser@3.2.4_jiti@2.4.2_j_e4a333d8aa4b05d17db10875e249d94f}/node_modules/vitest/dist/config.cjs +0 -0
  93. /package/dist/node_modules/.pnpm/{vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.13_@vitest_browser@3.2.4_jiti@2.4.2_j_cac3da623d5688a51c0b1a2270e144db → vitest@3.2.4_@types_debug@4.1.12_@types_node@24.0.15_@vitest_browser@3.2.4_jiti@2.4.2_j_e4a333d8aa4b05d17db10875e249d94f}/node_modules/vitest/dist/config.js +0 -0
package/README.md CHANGED
@@ -3,13 +3,12 @@
3
3
 
4
4
  # CyberSkill Shared
5
5
 
6
- **A comprehensive utility library for consistent development across CyberSkill projects**
6
+ **Enterprise-grade utility library for consistent, scalable development across CyberSkill projects**
7
7
 
8
- [![npm version](https://img.shields.io/npm/v/@cyberskill/shared)](https://npmjs.com/package/@cyberskill/shared)
9
- [![npm downloads](https://img.shields.io/npm/dm/@cyberskill/shared)](https://npmjs.com/package/@cyberskill/shared)
10
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
- [![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
12
- [![Node.js](https://img.shields.io/badge/Node.js-43853D?logo=node.js&logoColor=white)](https://nodejs.org/)
8
+ [![📦 npm version](https://img.shields.io/npm/v/@cyberskill/shared?style=for-the-badge&logo=npm)](https://npmjs.com/package/@cyberskill/shared)
9
+ [![📥 npm downloads](https://img.shields.io/npm/dm/@cyberskill/shared?style=for-the-badge&logo=npm)](https://npmjs.com/package/@cyberskill/shared)
10
+ [![📚 JSDoc Documentation](https://img.shields.io/badge/JSDoc-Documentation-blue?style=for-the-badge&logo=javascript)](https://www.jsdocs.io/package/@cyberskill/shared)
11
+ [![📄 License: MIT](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge&logo=opensourceinitiative)](https://opensource.org/licenses/MIT)
13
12
 
14
13
  </div>
15
14
 
@@ -17,70 +16,162 @@
17
16
 
18
17
  ## 📋 Table of Contents
19
18
 
20
- - [Overview](#overview)
21
- - [Features](#features)
22
- - [Installation](#installation)
23
- - [Quick Start](#quick-start)
24
- - [Documentation](#documentation)
25
- - [API Reference](#api-reference)
26
- - [Development](#development)
27
- - [Contributing](#contributing)
28
- - [License](#license)
19
+ - [Overview](#-overview)
20
+ - [Key Features](#-key-features)
21
+ - [Architecture](#️-architecture)
22
+ - [Installation](#-installation)
23
+ - [Quick Start](#-quick-start)
24
+ - [API Reference](#-api-reference)
25
+ - [Development](#️-development)
26
+ - [Contributing](#-contributing)
27
+ - [Support](#-support)
28
+ - [License](#-license)
29
29
 
30
30
  ---
31
31
 
32
- ## 📖 Overview
32
+ ## 🎯 Overview
33
33
 
34
- CyberSkill Shared is a modular, TypeScript-first utility library designed to standardize development practices across CyberSkill projects. Built with enterprise-grade architecture, it provides a comprehensive suite of utilities, configurations, and components that ensure consistency, maintainability, and developer productivity.
34
+ CyberSkill Shared is a comprehensive, enterprise-grade utility library designed to standardize development practices across CyberSkill projects. Built with TypeScript-first architecture, it provides a robust foundation of utilities, configurations, and components that ensure consistency, maintainability, and developer productivity at scale.
35
35
 
36
- ### 🎯 Key Benefits
36
+ ### 🏆 Why Choose CyberSkill Shared?
37
37
 
38
- - **🔄 Consistency**: Standardized patterns and utilities across all projects
39
- - **⚡ Productivity**: Pre-built solutions for common development tasks
40
- - **🛡️ Reliability**: Type-safe implementations with comprehensive testing
41
- - **📈 Scalability**: Modular architecture that grows with your needs
42
- - **🔧 Maintainability**: Well-documented, clean, and extensible codebase
38
+ | Feature | Benefit |
39
+ | ---------------------- | ------------------------------------------------------- |
40
+ | **🔄 Consistency** | Standardized patterns and utilities across all projects |
41
+ | **⚡ Productivity** | Pre-built solutions for common development tasks |
42
+ | **🛡️ Reliability** | Type-safe implementations with comprehensive testing |
43
+ | **📈 Scalability** | Modular architecture that grows with your needs |
44
+ | **🔧 Maintainability** | Well-documented, clean, and extensible codebase |
45
+ | **🚀 Performance** | Optimized for production with minimal bundle impact |
46
+ | **🔒 Security** | Built-in security best practices and validation |
47
+
48
+ ### 🎯 Target Use Cases
49
+
50
+ - **Enterprise Applications**: Large-scale applications requiring consistency and maintainability
51
+ - **Microservices**: Distributed systems needing shared utilities and configurations
52
+ - **Full-Stack Development**: Projects spanning frontend and backend with shared logic
53
+ - **Team Collaboration**: Development teams requiring standardized tooling and patterns
54
+ - **Rapid Prototyping**: Quick development with pre-built, tested components
43
55
 
44
56
  ---
45
57
 
46
- ## ✨ Features
58
+ ## ✨ Key Features
47
59
 
48
- ### 🛠️ Core Utilities
60
+ ### 🛠️ Core Utilities & Helpers
61
+
62
+ <details>
63
+ <summary><strong>🔧 Utility Functions</strong></summary>
49
64
 
50
65
  - **Type-safe utilities** for common operations
51
66
  - **Object manipulation** and validation helpers
52
67
  - **String processing** and formatting functions
53
68
  - **Serialization** and data transformation tools
69
+ - **Validation** frameworks with comprehensive error handling
70
+
71
+ </details>
54
72
 
55
- ### ⚙️ Configuration Management
73
+ <details>
74
+ <summary><strong>⚙️ Configuration Management</strong></summary>
56
75
 
57
- - **Environment configuration** with type safety
58
- - **ESLint configurations** for consistent code quality
59
- - **Testing setups** for unit and integration tests
60
- - **Build tool configurations** optimized for performance
76
+ - **Environment configuration** with type safety and validation
77
+ - **ESLint configurations** for consistent code quality across projects
78
+ - **Testing setups** for unit, integration, and e2e tests
79
+ - **Build tool configurations** optimized for performance and DX
80
+ - **Git hooks** and commit message validation
61
81
 
62
- ### 🌐 Node.js Modules
82
+ </details>
63
83
 
64
- - **Express.js utilities** for API development
65
- - **MongoDB integration** helpers
66
- - **WebSocket management** tools
67
- - **File system operations** with enhanced error handling
68
- - **CLI development** utilities
84
+ <details>
85
+ <summary><strong>🌐 Node.js Integration</strong></summary>
69
86
 
70
- ### ⚛️ React Components
87
+ - **Express.js utilities** for API development with middleware support
88
+ - **MongoDB integration** with advanced query builders and validation
89
+ - **WebSocket management** tools for real-time applications
90
+ - **File system operations** with enhanced error handling and validation
91
+ - **CLI development** utilities for command-line applications
92
+ - **Package management** with dependency resolution and updates
71
93
 
72
- - **Apollo Client** integration and error handling
73
- - **Internationalization** (i18n) support
94
+ </details>
95
+
96
+ <details>
97
+ <summary><strong>⚛️ React Ecosystem</strong></summary>
98
+
99
+ - **Apollo Client** integration with error handling and caching
100
+ - **Internationalization** (i18n) support for multi-language applications
74
101
  - **Loading states** and user feedback components
75
- - **Storage management** hooks and utilities
76
- - **Toast notifications** system
102
+ - **Storage management** hooks and utilities for client-side persistence
103
+ - **Toast notifications** system with customizable themes
104
+ - **User feedback** integration for product improvement
105
+
106
+ </details>
107
+
108
+ <details>
109
+ <summary><strong>📝 TypeScript Excellence</strong></summary>
77
110
 
78
- ### 📝 TypeScript Support
111
+ - **Comprehensive type definitions** for all utilities and components
112
+ - **React component types** with proper prop validation
113
+ - **Utility type helpers** for advanced TypeScript patterns
114
+ - **Style declaration files** for CSS-in-JS solutions
115
+ - **Generic type support** for flexible, reusable components
79
116
 
80
- - **Comprehensive type definitions**
81
- - **React component types**
82
- - **Utility type helpers**
83
- - **Style declaration files**
117
+ </details>
118
+
119
+ ---
120
+
121
+ ## 🏗️ Architecture
122
+
123
+ ### 📁 Project Structure
124
+
125
+ ```text
126
+ shared/
127
+ ├── 📁 public/ # Static assets and configuration
128
+ │ ├── favicon/ # Application icons and manifest
129
+ │ └── tsconfig.base.json # Base TypeScript configuration
130
+ ├── 📁 src/
131
+ │ ├── 📁 config/ # Application configuration
132
+ │ │ ├── commitlint/ # Git commit message validation
133
+ │ │ ├── eslint/ # Code quality and style rules
134
+ │ │ ├── env/ # Environment variable management
135
+ │ │ ├── graphql-codegen/ # GraphQL code generation setup
136
+ │ │ ├── lint-staged/ # Pre-commit code quality checks
137
+ │ │ └── vitest/ # Testing framework configuration
138
+ │ ├── 📁 constant/ # Shared constants and enums
139
+ │ ├── 📁 node/ # Node.js utilities and modules
140
+ │ │ ├── apollo-server/ # Apollo Server integration helpers
141
+ │ │ ├── cli/ # Command-line interface utilities
142
+ │ │ ├── command/ # Command execution and management
143
+ │ │ ├── express/ # Express.js framework utilities
144
+ │ │ ├── fs/ # File system operations
145
+ │ │ ├── log/ # Structured logging and error handling
146
+ │ │ ├── mongo/ # MongoDB ODM and query builders
147
+ │ │ ├── package/ # Package management and dependency resolution
148
+ │ │ ├── path/ # Path manipulation and resolution
149
+ │ │ ├── storage/ # Data persistence and caching
150
+ │ │ ├── upload/ # File upload handling and validation
151
+ │ │ └── ws/ # WebSocket connection management
152
+ │ ├── 📁 react/ # React utilities and components
153
+ │ │ ├── apollo-client/ # Apollo Client setup and configuration
154
+ │ │ ├── apollo-error/ # GraphQL error handling and display
155
+ │ │ ├── i18next/ # Internationalization framework
156
+ │ │ ├── loading/ # Loading state management and UI
157
+ │ │ ├── log/ # Client-side logging utilities
158
+ │ │ ├── next-intl/ # Next.js internationalization
159
+ │ │ ├── storage/ # Browser storage management
160
+ │ │ ├── toast/ # Toast notification system
161
+ │ │ └── userback/ # User feedback and analytics
162
+ │ ├── 📁 typescript/ # TypeScript type definitions
163
+ │ └── 📁 util/ # Utility functions and helpers
164
+ │ ├── common/ # Common utility types and functions
165
+ │ ├── object/ # Object manipulation and transformation
166
+ │ ├── serializer/ # Data serialization and deserialization
167
+ │ ├── string/ # String processing and formatting
168
+ │ └── validate/ # Data validation and sanitization
169
+ ├── 📄 package.json # Project manifest and dependencies
170
+ ├── 📄 tsconfig.json # TypeScript compiler configuration
171
+ ├── 📄 eslint.config.js # ESLint configuration
172
+ ├── 📄 vite.config.ts # Vite build tool configuration
173
+ └── 📄 README.md # Project documentation
174
+ ```
84
175
 
85
176
  ---
86
177
 
@@ -88,10 +179,11 @@ CyberSkill Shared is a modular, TypeScript-first utility library designed to sta
88
179
 
89
180
  ### Prerequisites
90
181
 
91
- - Node.js 18+
92
- - pnpm 8+
182
+ - **Node.js**: 18.0.0 or higher
183
+ - **pnpm**: 8.0.0 or higher (recommended)
184
+ - **TypeScript**: 5.0.0 or higher
93
185
 
94
- ### Install Package
186
+ ### Package Installation
95
187
 
96
188
  ```bash
97
189
  # Using pnpm (recommended)
@@ -104,6 +196,21 @@ npm install @cyberskill/shared
104
196
  yarn add @cyberskill/shared
105
197
  ```
106
198
 
199
+ ### TypeScript Configuration
200
+
201
+ Add to your `tsconfig.json`:
202
+
203
+ ```json
204
+ {
205
+ "compilerOptions": {
206
+ "baseUrl": ".",
207
+ "paths": {
208
+ "@cyberskill/shared/*": ["node_modules/@cyberskill/shared/src/*"]
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
107
214
  ---
108
215
 
109
216
  ## 🏃 Quick Start
@@ -111,116 +218,144 @@ yarn add @cyberskill/shared
111
218
  ### Basic Usage
112
219
 
113
220
  ```typescript
114
- import { formatCurrency, validateEmail } from '@cyberskill/shared';
115
-
116
- // Validate email
117
- const isValid = validateEmail('user@example.com');
118
-
119
- // Format currency
120
- const formatted = formatCurrency(1234.56, 'USD');
221
+ import {
222
+ catchError,
223
+ formatCurrency,
224
+ isEmpty,
225
+ validateEmail
226
+ } from '@cyberskill/shared';
227
+
228
+ // Email validation
229
+ const isValidEmail = validateEmail('user@example.com');
230
+ console.log(isValidEmail); // true
231
+
232
+ // Currency formatting
233
+ const formattedPrice = formatCurrency(1234.56, 'USD');
234
+ console.log(formattedPrice); // "$1,234.56"
235
+
236
+ // Empty value checking
237
+ const isEmptyValue = isEmpty(null); // true
238
+ const hasValue = isEmpty('hello'); // false
239
+
240
+ // Error handling
241
+ try {
242
+ // Your code here
243
+ }
244
+ catch (error) {
245
+ const handledError = catchError(error);
246
+ console.log(handledError.message);
247
+ }
121
248
  ```
122
249
 
123
- ### React Components
250
+ ### React Integration
124
251
 
125
252
  ```tsx
126
- import { LoadingProvider, useLoading } from '@cyberskill/shared';
127
-
253
+ import {
254
+ ApolloProvider,
255
+ LoadingProvider,
256
+ useApolloError,
257
+ useLoading
258
+ } from '@cyberskill/shared';
259
+ import React from 'react';
260
+
261
+ // Main application wrapper
262
+ /**
263
+ *
264
+ */
128
265
  // eslint-disable-next-line react-refresh/only-export-components
129
266
  function App() {
130
267
  return (
131
- <LoadingProvider>
132
- <MyComponent />
133
- </LoadingProvider>
268
+ <ApolloProvider options={{ uri: 'https://api.example.com/graphql' }}>
269
+ <LoadingProvider>
270
+ <MyApplication />
271
+ </LoadingProvider>
272
+ </ApolloProvider>
134
273
  );
135
274
  }
136
275
 
276
+ // Component with loading and error handling
277
+ /**
278
+ *
279
+ */
137
280
  // eslint-disable-next-line react-refresh/only-export-components
138
281
  function MyComponent() {
139
282
  const { showLoading, hideLoading } = useLoading();
283
+ const { showError } = useApolloError();
284
+
285
+ const handleAsyncOperation = async () => {
286
+ try {
287
+ showLoading();
288
+ // Your async operation
289
+ await someAsyncTask();
290
+ }
291
+ catch (error) {
292
+ showError(error);
293
+ }
294
+ finally {
295
+ hideLoading();
296
+ }
297
+ };
140
298
 
141
- // Use loading states
142
- return <div>Your component</div>;
299
+ return (
300
+ <div>
301
+ <button type="button" onClick={handleAsyncOperation}>
302
+ Perform Operation
303
+ </button>
304
+ </div>
305
+ );
143
306
  }
144
307
  ```
145
308
 
146
- ---
147
-
148
- ## 📚 Documentation
149
-
150
- For detailed documentation, visit our [documentation site](https://docs.cyberskill.com/shared) or check the [JSDocs reference](https://www.jsdocs.io/package/@cyberskill/shared).
151
-
152
- ### Key Documentation Sections
153
-
154
- - [Getting Started Guide](https://docs.cyberskill.com/shared/getting-started)
155
- - [API Reference](https://docs.cyberskill.com/shared/api)
156
- - [Migration Guide](https://docs.cyberskill.com/shared/migration)
157
- - [Best Practices](https://docs.cyberskill.com/shared/best-practices)
309
+ ### Node.js Integration
158
310
 
159
- ---
160
-
161
- ## 🔧 API Reference
162
-
163
- ### Core Modules
164
-
165
- | Module | Description | Import Path |
166
- | ------------- | --------------------------- | ------------------------------- |
167
- | **Utils** | Common utility functions | `@cyberskill/shared/util` |
168
- | **Constants** | Shared constants and enums | `@cyberskill/shared/constant` |
169
- | **Types** | TypeScript type definitions | `@cyberskill/shared/typescript` |
170
- | **Config** | Configuration utilities | `@cyberskill/shared/config` |
171
-
172
- ### Node.js Modules
173
-
174
- | Module | Description | Import Path |
175
- | ----------------- | ------------------------------ | --------------------------------------- |
176
- | **apollo-server** | Apollo Server utilities | `@cyberskill/shared/node/apollo-server` |
177
- | **cli** | Command-line interface helpers | `@cyberskill/shared/node/cli` |
178
- | **command** | Command execution utilities | `@cyberskill/shared/node/command` |
179
- | **express** | Express.js utilities | `@cyberskill/shared/node/express` |
180
- | **fs** | File system helpers | `@cyberskill/shared/node/fs` |
181
- | **log** | Logging utilities | `@cyberskill/shared/node/log` |
182
- | **mongo** | MongoDB helpers | `@cyberskill/shared/node/mongo` |
183
- | **package** | Package management utilities | `@cyberskill/shared/node/package` |
184
- | **path** | Path utilities | `@cyberskill/shared/node/path` |
185
- | **storage** | Storage helpers | `@cyberskill/shared/node/storage` |
186
- | **upload** | File upload utilities | `@cyberskill/shared/node/upload` |
187
- | **ws** | WebSocket utilities | `@cyberskill/shared/node/ws` |
188
-
189
- ### React Modules
190
-
191
- | Module | Description | Import Path |
192
- | ----------------- | ---------------------------- | ---------------------------------------- |
193
- | **apollo-client** | Apollo Client integration | `@cyberskill/shared/react/apollo-client` |
194
- | **apollo-error** | Apollo error handling | `@cyberskill/shared/react/apollo-error` |
195
- | **i18next** | Internationalization (i18n) | `@cyberskill/shared/react/i18next` |
196
- | **loading** | Loading state management | `@cyberskill/shared/react/loading` |
197
- | **log** | Logging utilities | `@cyberskill/shared/react/log` |
198
- | **next-intl** | Next.js internationalization | `@cyberskill/shared/react/next-intl` |
199
- | **storage** | Client-side storage | `@cyberskill/shared/react/storage` |
200
- | **toast** | Toast notification system | `@cyberskill/shared/react/toast` |
201
- | **userback** | User feedback integration | `@cyberskill/shared/react/userback` |
202
-
203
- ### Util Modules
204
-
205
- | Module | Description | Import Path |
206
- | -------------- | -------------------------------- | ------------------------------------ |
207
- | **common** | Common utility types and helpers | `@cyberskill/shared/util/common` |
208
- | **object** | Object manipulation utilities | `@cyberskill/shared/util/object` |
209
- | **serializer** | Serialization and transformation | `@cyberskill/shared/util/serializer` |
210
- | **string** | String processing utilities | `@cyberskill/shared/util/string` |
211
- | **validate** | Validation helpers | `@cyberskill/shared/util/validate` |
311
+ ```typescript
312
+ import {
313
+ createCorsOptions,
314
+ mongo,
315
+ RESPONSE_STATUS,
316
+ throwError
317
+ } from '@cyberskill/shared';
318
+ // Express.js setup with CORS
319
+ import express from 'express';
320
+
321
+ const app = express();
322
+
323
+ const corsOptions = createCorsOptions({
324
+ isDev: process.env.NODE_ENV === 'development',
325
+ whiteList: ['https://example.com', 'https://api.example.com']
326
+ });
327
+
328
+ app.use(cors(corsOptions));
329
+
330
+ // MongoDB integration
331
+ const mongoose = await mongo.connect({
332
+ uri: process.env.MONGODB_URI,
333
+ options: {
334
+ maxPoolSize: 10,
335
+ serverSelectionTimeoutMS: 5000
336
+ }
337
+ });
338
+
339
+ // Error handling
340
+ app.use('/api/users', (req, res, next) => {
341
+ try {
342
+ // Your route logic
343
+ }
344
+ catch (error) {
345
+ throwError({
346
+ message: 'User operation failed',
347
+ status: RESPONSE_STATUS.INTERNAL_SERVER_ERROR,
348
+ type: 'rest'
349
+ });
350
+ }
351
+ });
352
+ ```
212
353
 
213
354
  ---
214
355
 
215
356
  ## 🛠️ Development
216
357
 
217
- ### Prerequisites
218
-
219
- - Node.js 22+
220
- - pnpm 10+
221
- - Git
222
-
223
- ### Setup
358
+ ### Quick Setup
224
359
 
225
360
  ```bash
226
361
  # Clone the repository
@@ -232,105 +367,60 @@ pnpm install
232
367
 
233
368
  # Build the project
234
369
  pnpm run build
370
+
371
+ # Start development mode
372
+ pnpm run dev
235
373
  ```
236
374
 
237
375
  ### Available Scripts
238
376
 
239
- | Command | Description |
240
- | -------------------- | -------------------------------------- |
241
- | `pnpm run dev` | Start development mode with hot reload |
242
- | `pnpm run build` | Build for production |
243
- | `pnpm run lint` | Check for linting issues |
244
- | `pnpm run lint:fix` | Fix linting issues automatically |
245
- | `pnpm run test:unit` | Run unit tests |
246
- | `pnpm run test:e2e` | Run end-to-end tests |
247
- | `pnpm run inspect` | Inspect project dependencies |
248
- | `pnpm run reset` | Reset project state |
249
- | `pnpm run ready` | Prepare project for development |
377
+ | Command | Description | Usage |
378
+ | ------------------- | -------------------------------------- | ------------ |
379
+ | `pnpm run dev` | Start development mode with hot reload | Development |
380
+ | `pnpm run build` | Build for production | Production |
381
+ | `pnpm run lint` | Check for linting issues | Code Quality |
382
+ | `pnpm run lint:fix` | Fix linting issues automatically | Code Quality |
383
+ | `pnpm run test` | Run tests | Testing |
384
+ | `pnpm run inspect` | Inspect project dependencies | Analysis |
385
+ | `pnpm run reset` | Reset project state | Maintenance |
386
+ | `pnpm run ready` | Prepare project for development | Setup |
250
387
 
251
- ### Project Structure
388
+ For detailed development guidelines, code standards, and contribution workflow, see our [Contributing Guide](CONTRIBUTING.md).
252
389
 
253
- ```text
254
- shared/
255
- ├── public/ # Static assets (favicons, manifest, etc.)
256
- ├── src/
257
- │ ├── config/ # App configuration (commitlint, eslint, env, graphql-codegen, lint-staged, vitest)
258
- │ ├── constant/ # Static values and constants
259
- │ ├── node/ # Node.js utilities and modules
260
- │ │ ├── apollo-server/ # Apollo Server helpers
261
- │ │ ├── cli/ # CLI utilities
262
- │ │ ├── command/ # Command execution helpers
263
- │ │ ├── express/ # Express.js utilities
264
- │ │ ├── fs/ # File system helpers
265
- │ │ ├── log/ # Logging utilities
266
- │ │ ├── mongo/ # MongoDB helpers
267
- │ │ ├── package/ # Package management
268
- │ │ ├── path/ # Path utilities
269
- │ │ ├── storage/ # Storage helpers
270
- │ │ ├── upload/ # File upload utilities
271
- │ │ └── ws/ # WebSocket utilities
272
- │ ├── react/ # React utilities and modules
273
- │ │ ├── apollo-client/ # Apollo Client integration
274
- │ │ ├── apollo-error/ # Apollo error handling
275
- │ │ ├── i18next/ # Internationalization (i18n)
276
- │ │ ├── loading/ # Loading state management
277
- │ │ ├── log/ # Logging utilities
278
- │ │ ├── next-intl/ # Next.js internationalization
279
- │ │ ├── storage/ # Client-side storage
280
- │ │ ├── toast/ # Toast notifications
281
- │ │ └── userback/ # User feedback integration
282
- │ ├── typescript/ # TypeScript types and interfaces
283
- │ └── util/ # Utility functions and helpers
284
- │ ├── common/ # Common utilities
285
- │ ├── object/ # Object manipulation
286
- │ ├── serializer/ # Serialization helpers
287
- │ ├── string/ # String utilities
288
- │ └── validate/ # Validation helpers
289
- ├── package.json # Project manifest
290
- ├── tsconfig.json # TypeScript configuration
291
- └── ... # Other configuration and metadata files
292
- ```
390
+ ---
293
391
 
294
- ### Testing
392
+ ## 🤝 Contributing
295
393
 
296
- ```bash
297
- # Run all tests
298
- pnpm run test
394
+ We welcome contributions from the community! Please read our [Contributing Guide](CONTRIBUTING.md) for detailed information about our development process, code standards, and contribution workflow.
299
395
 
300
- # Run unit tests only
301
- pnpm run test:unit
396
+ ### Quick Start for Contributors
302
397
 
303
- # Run e2e tests only
304
- pnpm run test:e2e
398
+ 1. **Fork** the repository
399
+ 2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)
400
+ 3. **Make** your changes following our standards
401
+ 4. **Test** your changes thoroughly
402
+ 5. **Commit** with conventional commit messages
403
+ 6. **Push** to your branch and create a Pull Request
305
404
 
306
- # Run tests with coverage
307
- pnpm run test:coverage
308
- ```
405
+ For complete guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
309
406
 
310
407
  ---
311
408
 
312
- ## 🤝 Contributing
409
+ ## 🆘 Support
410
+
411
+ ### Getting Help
313
412
 
314
- We welcome contributions from the community! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
413
+ - **🐛 Issues**: [GitHub Issues](https://github.com/cyberskill-world/shared/issues)
414
+ - **💬 Discussions**: [GitHub Discussions](https://github.com/cyberskill-world/shared/discussions)
415
+ - **📧 Email**: [support@cyberskill.world](mailto:support@cyberskill.world)
315
416
 
316
- ### Development Workflow
417
+ ### Community Resources
317
418
 
318
- 1. Fork the repository
319
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
320
- 3. Make your changes
321
- 4. Add tests for new functionality
322
- 5. Ensure all tests pass (`pnpm run test`)
323
- 6. Commit your changes (`git commit -m 'Add amazing feature'`)
324
- 7. Push to the branch (`git push origin feature/amazing-feature`)
325
- 8. Open a Pull Request
419
+ - **📚 API Reference**: [JSDocs](https://www.jsdocs.io/package/@cyberskill/shared)
326
420
 
327
- ### Code Standards
421
+ ### Migration Support
328
422
 
329
- - Follow TypeScript best practices
330
- - Write comprehensive tests
331
- - Update documentation for new features
332
- - Follow our ESLint configuration
333
- - Use conventional commit messages
423
+ - **📋 Changelog**: [Release Notes](https://github.com/cyberskill-world/shared/releases)
334
424
 
335
425
  ---
336
426
 
@@ -338,15 +428,30 @@ We welcome contributions from the community! Please read our [Contributing Guide
338
428
 
339
429
  This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
340
430
 
431
+ **MIT License Benefits:**
432
+
433
+ - ✅ Commercial use allowed
434
+ - ✅ Modification permitted
435
+ - ✅ Distribution allowed
436
+ - ✅ Private use allowed
437
+ - ✅ No warranty provided
438
+ - ✅ No liability for damages
439
+
341
440
  ---
342
441
 
343
442
  ## 🏢 About CyberSkill
344
443
 
345
- CyberSkill JSC is a technology company focused on building innovative solutions for the cybersecurity industry. Our shared libraries and tools help developers create secure, scalable, and maintainable applications.
444
+ CyberSkill JSC is a leading technology company focused on building innovative solutions for the cybersecurity industry. Our shared libraries and tools help developers create secure, scalable, and maintainable applications that meet enterprise-grade standards.
445
+
446
+ ### Company Information
447
+
448
+ - **🌐 Website**: [https://cyberskill.world](https://cyberskill.world)
449
+ - **🐙 GitHub**: [https://github.com/cyberskill-world](https://github.com/cyberskill-world)
450
+ - **📧 Contact**: [hello@cyberskill.world](mailto:hello@cyberskill.world)
451
+
452
+ ### Our Mission
346
453
 
347
- - **Website**: [https://cyberskill.com](https://cyberskill.com)
348
- - **GitHub**: [https://github.com/cyberskill-world](https://github.com/cyberskill-world)
349
- - **Documentation**: [https://docs.cyberskill.com](https://docs.cyberskill.com)
454
+ To provide developers with the tools and utilities they need to build secure, scalable, and maintainable applications that protect users and organizations in an increasingly complex digital landscape.
350
455
 
351
456
  ---
352
457
 
@@ -354,9 +459,12 @@ CyberSkill JSC is a technology company focused on building innovative solutions
354
459
  <p>Made with ❤️ by the <a href="https://github.com/cyberskill-world">CyberSkill Team</a></p>
355
460
 
356
461
  <p>
357
- <a href="https://cyberskill.com">Website</a> •
358
- <a href="https://docs.cyberskill.com">Documentation</a> •
462
+ <a href="https://cyberskill.world">Website</a> •
359
463
  <a href="https://github.com/cyberskill-world/shared/issues">Issues</a> •
360
464
  <a href="https://github.com/cyberskill-world/shared/discussions">Discussions</a>
361
465
  </p>
466
+
467
+ <p>
468
+ <sub>If this project helps you, please consider giving us a ⭐ on GitHub!</sub>
469
+ </p>
362
470
  </div>