Skip to content

Commit f4b1a09

Browse files
committed
Update README, package.json and tsconfig.json
1 parent 18f3620 commit f4b1a09

File tree

4 files changed

+34
-19
lines changed

4 files changed

+34
-19
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ interface Todo {
4646
const initialState: Todo[] = [
4747
{
4848
id: Date.now(),
49-
name: '🧪 Write unit tests',
49+
name: 'Be Awesome 🦄',
5050
done: false
5151
}
5252
]
@@ -68,9 +68,7 @@ const todosSlice = createSlice({
6868
}
6969
},
7070
selectors: {
71-
selectCompleted(state) {
72-
return state.filter((todo) => todo.done)
73-
}
71+
selectCompleted: (state) => state.filter((todo) => todo.done)
7472
}
7573
})
7674
```
@@ -131,8 +129,8 @@ describe('TodoList', () => {
131129
it('should render todos', () => {
132130
mockSlice(todosSlice, {
133131
state: [
134-
{ id: 0, name: '🧪 Write unit tests', done: false },
135-
{ id: 1, name: '📝 Update README', done: false }
132+
{ id: 0, name: 'Be Awesome 🦄', done: false },
133+
{ id: 1, name: 'Spread Good Vibes 🍀', done: false }
136134
]
137135
})
138136

@@ -154,7 +152,7 @@ describe('TodoList', () => {
154152

155153
it('should render completed todo count', () => {
156154
mockSlice(todosSlice, {
157-
selectCompleted: () => [{ id: 0, name: '🧪 Write unit tests', done: true }]
155+
selectCompleted: () => [{ id: 0, name: 'Be Awesome 🦄', done: true }]
158156
})
159157

160158
render(<App />)
@@ -174,7 +172,7 @@ describe('TodoList', () => {
174172

175173
it('should toggle todos', () => {
176174
const { toggleTodo } = mockSlice(todosSlice, {
177-
state: [{ id: 0, name: '🧪 Write unit tests', done: false }]
175+
state: [{ id: 0, name: 'Be Awesome 🦄', done: false }]
178176
})
179177

180178
render(<App />)

package.json

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "use-rtk-slice",
3-
"version": "0.1.0",
3+
"version": "1.0.0",
44
"description": "A React hook for streamlining the usage of Redux Toolkit slices",
5-
"type": "module",
65
"main": "dist/index.js",
76
"types": "dist/index.d.ts",
87
"publishConfig": {
@@ -26,9 +25,22 @@
2625
"url": "git+ssh://[email protected]/Lambdaphile/use-rtk-slice.git"
2726
},
2827
"files": [
29-
"dist"
28+
"dist",
29+
"dist/test/vitest",
30+
"dist/test/jest"
3031
],
31-
"author": "Emrah Seidov",
32+
"exports": {
33+
".": "./dist/index.js",
34+
"./test/vitest": "./dist/test/vitest/index.js",
35+
"./test/jest": "./dist/test/jest/index.js"
36+
},
37+
"typesVersions": {
38+
"*": {
39+
"test/vitest": ["dist/test/vitest/index.d.ts"],
40+
"test/jest": ["dist/test/jest/index.d.ts"]
41+
}
42+
},
43+
"author": "Emrah Seidov (Lambdaphile)",
3244
"license": "MIT",
3345
"devDependencies": {
3446
"@babel/core": "^7.27.1",

tsconfig.build.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
22
"extends": "./tsconfig.json",
3-
"include": ["src/index.ts"]
3+
"include": [
4+
"src/index.ts",
5+
"src/test/vitest/index.ts",
6+
"src/test/jest/index.ts"
7+
]
48
}

tsconfig.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/* Language and Environment */
1414
"target": "ES2015", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
1515
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16-
"jsx": "preserve", /* Specify what JSX code is generated. */
16+
"jsx": "preserve", /* Specify what JSX code is generated. */
1717
// "libReplacement": true, /* Enable lib replacement. */
1818
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
1919
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
@@ -26,14 +26,14 @@
2626
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
2727

2828
/* Modules */
29-
"module": "commonjs", /* Specify what module code is generated. */
29+
"module": "CommonJS", /* Specify what module code is generated. */
3030
// "rootDir": "./", /* Specify the root folder within your source files. */
3131
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
3232
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
3333
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
3434
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
3535
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
36+
"types": ["jest"], /* Specify type package names to be included without being referenced in a source file. */
3737
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
3838
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
3939
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
@@ -52,14 +52,14 @@
5252
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
5353

5454
/* Emit */
55-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
55+
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
5656
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
5757
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
5858
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
5959
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
6060
// "noEmit": true, /* Disable emitting files from a compilation. */
6161
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
62-
"outDir": "./dist", /* Specify an output folder for all emitted files. */
62+
"outDir": "./dist", /* Specify an output folder for all emitted files. */
6363
// "removeComments": true, /* Disable emitting comments. */
6464
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
6565
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
@@ -108,6 +108,7 @@
108108

109109
/* Completeness */
110110
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
111-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
111+
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
112+
"lib": ["es2017", "dom"],
112113
}
113114
}

0 commit comments

Comments
 (0)