Skip to content

Commit

Permalink
chore: update deps and update webpack config
Browse files Browse the repository at this point in the history
  • Loading branch information
ruanyl committed Jun 28, 2021
1 parent 7b4d9a7 commit dd0e12a
Show file tree
Hide file tree
Showing 11 changed files with 3,249 additions and 3,526 deletions.
16 changes: 8 additions & 8 deletions __test__/plugin.spec.tsx → __test__/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ describe('immer plugin', () => {
it('should update state object reference with object property value assignment', () => {
const model = app.model('counter', { total: 0 })
const [mutations] = model.mutations({
increase: () => s => {
increase: () => (s) => {
s.total = s.total + 1
return s
},
})

const beforeState = model.selectors.self(app.store.getState())
app.store.dispatch(mutations.increase())
const afterState = model.selectors.self(app.store.getState())
const beforeState = model.getState()
mutations.increase()
const afterState = model.getState()

expect(beforeState).not.toBe(afterState)
expect(beforeState).not.toEqual(afterState)
Expand All @@ -33,15 +33,15 @@ describe('immer plugin', () => {
it('should update state object reference with array push', () => {
const model = app.model('languages', { languages: Array<string>() })
const [mutations] = model.mutations({
add: (language: string) => s => {
add: (language: string) => (s) => {
s.languages.push(language)
return s
},
})

const beforeState = model.selectors.self(app.store.getState())
app.store.dispatch(mutations.add('English'))
const afterState = model.selectors.self(app.store.getState())
const beforeState = model.getState()
mutations.add('English')
const afterState = model.getState()

expect(beforeState).not.toBe(afterState)
expect(beforeState).not.toEqual(afterState)
Expand Down
13 changes: 1 addition & 12 deletions __test__/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"strictNullChecks": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"jsx": "react",
"target": "es5",
"lib": ["ES2015","ES2016", "ESNEXT", "DOM", "ES5", "ScriptHost"],
"noUnusedLocals": true
},
"extends": "../tsconfig.json",
"include": [
"**/*.spec.ts"
]
Expand Down
6 changes: 0 additions & 6 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,5 @@
</head>
<body>
<div id="root"></div>
<% for(var i=0; i<htmlWebpackPlugin.options.jsassets.length; i++) { %>
<script src="<%= htmlWebpackPlugin.options.jsassets[i] %>"></script>
<% } %>
<% for(var i=0; i<htmlWebpackPlugin.files.js.length; i++) { %>
<script src="<%= htmlWebpackPlugin.files.js[i] %>"></script>
<% } %>
</body>
</html>
19 changes: 4 additions & 15 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
module.exports = {
testEnvironment: 'jsdom',
transform: {
'^.+\\.tsx?$': 'ts-jest'
'^.+\\.tsx?$': 'ts-jest',
},
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'node',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testRegex: '(/__test__/.*|(\\.|/)(test|spec))\\.(ts|js)x?$',
coverageDirectory: 'coverage',
collectCoverageFrom: [
'src/**/*.{ts,tsx,js,jsx}',
'!src/**/*.d.ts',
],
setupFilesAfterEnv: ['./setupTests.ts'],
};
collectCoverageFrom: ['src/**/*.{ts,tsx,js,jsx}', '!src/**/*.d.ts'],
}
45 changes: 16 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "jest",
"build": "./node_modules/.bin/tsc --outDir lib --declaration",
"start": "webpack --config webpack.config.js && node server.js",
"start": "cross-env NODE_ENV='development' webpack serve --config-name app --open",
"prepublishOnly": "npm run build"
},
"repository": {
Expand All @@ -19,39 +19,26 @@
"immer"
],
"devDependencies": {
"@types/enzyme": "~3.1.10",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "~22.2.3",
"@types/react": "^16.9.2",
"@types/react-dom": "~16.8.4",
"@types/react-redux": "~7.1.7",
"ajv": "~6.9.1",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"express": "~4.16.3",
"glob": "~7.1.2",
"html-webpack-plugin": "~3.2.0",
"immer": "^7.0.3",
"immutable": "^4.0.0-rc.12",
"@types/jest": "~26.0.23",
"@types/react": "^17.0.11",
"@types/react-dom": "~17.0.8",
"ajv": "~8.6.0",
"cross-env": "^7.0.3",
"html-webpack-plugin": "~5.3.2",
"immer": "^9.0.3",
"import-sort-cli": "6.0.0",
"import-sort-parser-typescript": "6.0.0",
"import-sort-style-as": "1.2.3",
"jest": "^24.7.0",
"jest-enzyme": "^7.0.2",
"react": "~16.13.0",
"react-dom": "~16.13.0",
"react-redux": "~7.2.0",
"jest": "^27.0.6",
"react": "~17.0.2",
"react-dom": "~17.0.2",
"reapex": "^1.0.0-beta.21",
"redux": "^4.0.0",
"redux-saga": "^1.1.3",
"reselect": "^4.0.0",
"ts-jest": "^24.0.1",
"ts-loader": "~4.2.0",
"tslint": "~5.9.1",
"ts-jest": "^27.0.3",
"ts-loader": "~9.2.3",
"typescript": "4.3",
"webpack": "~4.42.0",
"webpack-cli": "^3.3.11",
"webpack-dev-middleware": "~3.7.2"
"webpack": "~5.41.0",
"webpack-cli": "^4.7.2",
"webpack-dev-server": "^3.11.2"
},
"dependencies": {},
"peerDependencies": {
Expand Down
30 changes: 0 additions & 30 deletions server.js

This file was deleted.

6 changes: 0 additions & 6 deletions setupTests.ts

This file was deleted.

3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@
},
"include": [
"src/**/*"
],
"exclude": [
"**/*.spec.ts"
]
}
123 changes: 0 additions & 123 deletions tslint.json

This file was deleted.

Loading

0 comments on commit dd0e12a

Please sign in to comment.