@vfourny/node-toolkit 1.1.1 → 1.1.2
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 +122 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,13 +7,15 @@ Welcome to **VFourny's Node Toolkit**! This repository contains a collection of
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
9
9
|
- [Installation](#installation)
|
|
10
|
-
- [Variables
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
10
|
+
- [Environment Variables](#environment-variables)
|
|
11
|
+
- [Configuration Files](#configuration-files)
|
|
12
|
+
- [ESLint](#eslint)
|
|
13
13
|
- [Prettier](#prettier)
|
|
14
14
|
- [TypeScript](#typescript)
|
|
15
|
+
- [Vitest](#vitest)
|
|
15
16
|
- [Semantic Release](#semantic-release)
|
|
16
17
|
- [Commitlint](#commitlint)
|
|
18
|
+
- [Utility Functions](#utility-functions)
|
|
17
19
|
|
|
18
20
|
## Installation
|
|
19
21
|
|
|
@@ -33,7 +35,8 @@ npm install -D eslint prettier typescript commitlint semantic-release
|
|
|
33
35
|
|
|
34
36
|
**Minimum versions:**
|
|
35
37
|
|
|
36
|
-
- Node.js: `>=
|
|
38
|
+
- Node.js: `>= 22`
|
|
39
|
+
- npm: `>= 10.9.4`
|
|
37
40
|
- ESLint: `^9.3.0`
|
|
38
41
|
- Prettier: `^3.2.5`
|
|
39
42
|
- TypeScript: `^5.5.2`
|
|
@@ -171,7 +174,65 @@ export default {
|
|
|
171
174
|
|
|
172
175
|
### TypeScript
|
|
173
176
|
|
|
174
|
-
|
|
177
|
+
This package provides multiple TypeScript configurations for different project types:
|
|
178
|
+
|
|
179
|
+
#### For Node.js Projects
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"extends": "@vfourny/node-toolkit/tsconfig/node",
|
|
184
|
+
"compilerOptions": {
|
|
185
|
+
"baseUrl": ".",
|
|
186
|
+
"paths": {
|
|
187
|
+
"@/*": ["./src/*"]
|
|
188
|
+
}
|
|
189
|
+
// Your custom configurations
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### For Vue Projects
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"extends": "@vfourny/node-toolkit/tsconfig/vue",
|
|
199
|
+
"compilerOptions": {
|
|
200
|
+
"baseUrl": ".",
|
|
201
|
+
"paths": {
|
|
202
|
+
"@/*": ["./src/*"]
|
|
203
|
+
}
|
|
204
|
+
// Your custom configurations
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### For Nuxt Projects
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"extends": "@vfourny/node-toolkit/tsconfig/nuxt",
|
|
214
|
+
"compilerOptions": {
|
|
215
|
+
"baseUrl": ".",
|
|
216
|
+
"paths": {
|
|
217
|
+
"@/*": ["./src/*"]
|
|
218
|
+
}
|
|
219
|
+
// Your custom configurations
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### For Test Files
|
|
225
|
+
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"extends": "@vfourny/node-toolkit/tsconfig/test",
|
|
229
|
+
"compilerOptions": {
|
|
230
|
+
// Your custom configurations
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
#### Default Import (Node.js)
|
|
175
236
|
|
|
176
237
|
```json
|
|
177
238
|
{
|
|
@@ -188,6 +249,40 @@ To import the TypeScript configuration into your project, add the following code
|
|
|
188
249
|
|
|
189
250
|
**Important:** The `paths` configuration is required for the ESLint import resolver to work correctly with absolute imports using the `@/` prefix.
|
|
190
251
|
|
|
252
|
+
**Base Configuration:** All TypeScript configurations extend from `@vfourny/node-toolkit/tsconfig/base` which provides strict TypeScript settings including:
|
|
253
|
+
- Strict mode enabled
|
|
254
|
+
- No implicit any
|
|
255
|
+
- No unused locals/parameters
|
|
256
|
+
- ESNext module resolution
|
|
257
|
+
- ES2020 target
|
|
258
|
+
|
|
259
|
+
### Vitest
|
|
260
|
+
|
|
261
|
+
To use the Vitest configuration in your project, create a `vitest.config.ts` file:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// vitest.config.ts
|
|
265
|
+
import { defineConfig, mergeConfig } from 'vitest/config'
|
|
266
|
+
import baseConfig from '@vfourny/node-toolkit/vitest'
|
|
267
|
+
|
|
268
|
+
export default mergeConfig(
|
|
269
|
+
baseConfig,
|
|
270
|
+
defineConfig({
|
|
271
|
+
test: {
|
|
272
|
+
include: ['tests/**/*.test.ts'],
|
|
273
|
+
// Your custom configurations
|
|
274
|
+
},
|
|
275
|
+
})
|
|
276
|
+
)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Features:**
|
|
280
|
+
- Node.js environment by default
|
|
281
|
+
- Global test APIs enabled (`describe`, `it`, `expect`, etc.)
|
|
282
|
+
- V8 coverage provider
|
|
283
|
+
- Text, JSON, and HTML coverage reports
|
|
284
|
+
- Default reporter for test results
|
|
285
|
+
|
|
191
286
|
### Semantic Release
|
|
192
287
|
|
|
193
288
|
To import the Semantic Release configuration into your project, add the following code to your [Semantic Release](https://semantic-release.gitbook.io/semantic-release) configuration file:
|
|
@@ -211,6 +306,28 @@ export default {
|
|
|
211
306
|
}
|
|
212
307
|
```
|
|
213
308
|
|
|
309
|
+
## Utility Functions
|
|
310
|
+
|
|
311
|
+
This package also exports utility functions that can be used in your projects:
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
import { kebabCase, lowerCaseFirstLetter } from '@vfourny/node-toolkit'
|
|
315
|
+
|
|
316
|
+
// Convert strings to kebab-case
|
|
317
|
+
kebabCase('HelloWorld') // 'hello-world'
|
|
318
|
+
kebabCase('myVariableName') // 'my-variable-name'
|
|
319
|
+
kebabCase('hello_world') // 'hello-world'
|
|
320
|
+
|
|
321
|
+
// Convert first letter to lowercase
|
|
322
|
+
lowerCaseFirstLetter('HelloWorld') // 'helloWorld'
|
|
323
|
+
lowerCaseFirstLetter('HELLO') // 'hELLO'
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Available Functions
|
|
327
|
+
|
|
328
|
+
- **`kebabCase(string: string): string`** - Converts camelCase, PascalCase, snake_case, or space-separated strings to kebab-case
|
|
329
|
+
- **`lowerCaseFirstLetter(string: string): string`** - Converts the first letter of a string to lowercase while preserving the rest
|
|
330
|
+
|
|
214
331
|
---
|
|
215
332
|
|
|
216
333
|
_Thank you for using **VFourny's Node Toolkit**! For any questions or support, please open an issue on the GitHub repository._
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vfourny/node-toolkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Toolkit for Node.js projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/libs/index.js",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"registry": "https://registry.npmjs.org/"
|
|
121
121
|
},
|
|
122
122
|
"engines": {
|
|
123
|
-
"node": ">= 22
|
|
123
|
+
"node": ">= 22",
|
|
124
124
|
"npm": ">= 10.9.4"
|
|
125
125
|
}
|
|
126
126
|
}
|