@dg-scripts/webpack-template 5.21.7 → 6.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.
- package/CHANGELOG.md +39 -1
- package/README.md +2 -3
- package/package.json +19 -20
- package/scripts/badge.ts +1 -1
- package/src/index.css +1 -1
- package/src/particle/__tests__/ExplodingParticle.test.ts +7 -6
- package/src/particle/__tests__/ParticleFactory.test.ts +1 -0
- package/tsconfig.json +2 -9
- package/vitest.config.ts +28 -0
- package/vitest.setup.ts +37 -0
- package/jest.config.js +0 -39
- package/jest.env.setup.js +0 -6
- package/jest.setup.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [6.0.0](https://github.com/sabertazimi/bod/compare/v5.21.8...v6.0.0) (2025-12-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **deps:** update dependencies (non-major) ([#1463](https://github.com/sabertazimi/bod/issues/1463)) ([7bb29a8](https://github.com/sabertazimi/bod/commit/7bb29a8a8885fd121c46f2fa89af4843c47171d3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
* refactor(test)!: migrate from Jest to Vitest across all packages (#1468) ([0072508](https://github.com/sabertazimi/bod/commit/0072508a2eb9ab6a472d4cd8146c341df18e80fc)), closes [#1468](https://github.com/sabertazimi/bod/issues/1468)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### BREAKING CHANGES
|
|
18
|
+
|
|
19
|
+
* Removed Jest.
|
|
20
|
+
|
|
21
|
+
* test: add timeout to template initialization test
|
|
22
|
+
|
|
23
|
+
* test: increase template initialization timeout to 120s
|
|
24
|
+
|
|
25
|
+
* test(coverage): simplify coverage configuration and enable in test:all
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [5.21.8](https://github.com/sabertazimi/bod/compare/v5.21.7...v5.21.8) (2025-12-04)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **deps:** update dependencies (non-major) ([#1453](https://github.com/sabertazimi/bod/issues/1453)) ([98d3ba9](https://github.com/sabertazimi/bod/commit/98d3ba9ce473b2df084b1db55a3498977cdbe11d))
|
|
37
|
+
* **deps:** update dependencies (non-major) ([#1459](https://github.com/sabertazimi/bod/issues/1459)) ([e6eb392](https://github.com/sabertazimi/bod/commit/e6eb392502da1923449d659326a3dab9447fc990))
|
|
38
|
+
* **deps:** update dependency inquirer to v13 ([#1456](https://github.com/sabertazimi/bod/issues/1456)) ([e5f4fd5](https://github.com/sabertazimi/bod/commit/e5f4fd5b90cd4ad453932d7d082d61910018c9da))
|
|
39
|
+
* **stylelint-config:** set import notation to string ([#1452](https://github.com/sabertazimi/bod/issues/1452)) ([f780e46](https://github.com/sabertazimi/bod/commit/f780e46c00c4712578016987a846cbfa546f266d))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
6
45
|
## [5.21.7](https://github.com/sabertazimi/bod/compare/v5.21.6...v5.21.7) (2025-11-19)
|
|
7
46
|
|
|
8
47
|
|
|
@@ -324,7 +363,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
324
363
|
* **deps-dev:** bump autoprefixer from 10.3.3 to 10.3.4 ([#92](https://github.com/sabertazimi/boilerplate/issues/92)) ([9103de6](https://github.com/sabertazimi/boilerplate/commit/9103de60e9be8f60fc6feaeaf2c6e6778e9e7859))
|
|
325
364
|
* **deps-dev:** bump clean-webpack-plugin from 3.0.0 to 4.0.0 ([#90](https://github.com/sabertazimi/boilerplate/issues/90)) ([7b5f704](https://github.com/sabertazimi/boilerplate/commit/7b5f704ed6b12a673fc1c2cdf9467a1baa16a78e))
|
|
326
365
|
* **deps-dev:** bump mini-css-extract-plugin from 2.2.1 to 2.2.2 ([#91](https://github.com/sabertazimi/boilerplate/issues/91)) ([0b761da](https://github.com/sabertazimi/boilerplate/commit/0b761da515cbaffd451d394033e5ea4c2aef28c4))
|
|
327
|
-
* **deps-dev:** bump stylelint-config-bod from 5.3.1 to 5.3.3 ([#96](https://github.com/sabertazimi/boilerplate/issues/96)) ([d3552ce](https://github.com/sabertazimi/boilerplate/commit/d3552cead3caa8edc320141bb94048c3e83b9951))
|
|
328
366
|
* **deps-dev:** bump webpack from 5.51.1 to 5.52.0 ([#97](https://github.com/sabertazimi/boilerplate/issues/97)) ([d35b2f1](https://github.com/sabertazimi/boilerplate/commit/d35b2f1065fd91ae98245c8f5db26f81bd210003))
|
|
329
367
|
* **Jest:** enable Jest config intellisense ([01f9140](https://github.com/sabertazimi/boilerplate/commit/01f9140e389f2e9c3e1c59c50afd855490a17b69))
|
|
330
368
|
* **webpack:** enable webpack config intellisense ([2bcb3aa](https://github.com/sabertazimi/boilerplate/commit/2bcb3aab2f12c0d2b00aae80bb9591f6c883f720))
|
package/README.md
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/sabertazimi)
|
|
4
4
|
[](https://raw.githubusercontent.com/sabertazimi/bod/main/LICENSE)
|
|
5
|
-
|
|
6
5
|
[](https://github.com/sabertazimi/bod/actions/workflows/ci.yml)
|
|
7
6
|
|
|
8
7
|
> Minimal wbepack boilerplate.
|
|
@@ -29,7 +28,7 @@ on repo [Bod](https://github.com/sabertazimi/bod).
|
|
|
29
28
|
- `Babel` transpile support.
|
|
30
29
|
- `Webpack` for hot reload development and dedicated building work
|
|
31
30
|
with bundle analysis and elegant progressbar.
|
|
32
|
-
- `
|
|
31
|
+
- `Vitest` and `Testing Library` for robust unit tests and detailed coverage report.
|
|
33
32
|
- `PostCSS` for CSS auto-prefixer support.
|
|
34
33
|
- `ESLint` with TypeScript parser for TypeScript style check.
|
|
35
34
|
- `StyleLint` with custom rules for CSS style check.
|
|
@@ -56,5 +55,5 @@ npm i -D sass @types/sass
|
|
|
56
55
|
## Contact
|
|
57
56
|
|
|
58
57
|
[](mailto:sabertazimi@gmail.com)
|
|
59
|
-
[](https://x.com/sabertazimi)
|
|
60
59
|
[](https://github.com/sabertazimi)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dg-scripts/webpack-template",
|
|
3
|
-
"version": "
|
|
4
|
-
"packageManager": "pnpm@10.
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"packageManager": "pnpm@10.24.0",
|
|
5
5
|
"description": "Minimal webpack boilerplate",
|
|
6
6
|
"author": "sabertazimi",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
|
-
"badge": "
|
|
38
|
+
"badge": "tsx scripts/badge.ts",
|
|
39
39
|
"build": "cross-env NODE_ENV=production webpack",
|
|
40
40
|
"dev": "cross-env NODE_ENV=development webpack serve",
|
|
41
41
|
"lint": "pnpm lint:style && pnpm lint:type-check",
|
|
@@ -45,54 +45,53 @@
|
|
|
45
45
|
"changeset": "commit-and-tag-version --dry-run -s",
|
|
46
46
|
"release": "commit-and-tag-version -s",
|
|
47
47
|
"start": "pnpm dev",
|
|
48
|
-
"test": "
|
|
49
|
-
"test:watch": "
|
|
48
|
+
"test": "vitest run",
|
|
49
|
+
"test:watch": "vitest"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@babel/core": "^7.28.5",
|
|
53
53
|
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
54
54
|
"@babel/plugin-transform-object-rest-spread": "^7.28.4",
|
|
55
55
|
"@babel/preset-env": "^7.28.5",
|
|
56
|
-
"@dg-scripts/eslint-config": "^
|
|
57
|
-
"@dg-scripts/stylelint-config": "^
|
|
56
|
+
"@dg-scripts/eslint-config": "^6.0.0",
|
|
57
|
+
"@dg-scripts/stylelint-config": "^6.0.0",
|
|
58
58
|
"@svgr/webpack": "^8.1.0",
|
|
59
|
-
"@types/jest": "^30.0.0",
|
|
60
59
|
"@types/node": "^24.10.1",
|
|
60
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
61
61
|
"babel-loader": "^10.0.0",
|
|
62
62
|
"cross-env": "^10.1.0",
|
|
63
63
|
"css-loader": "^7.1.2",
|
|
64
|
-
"css-minimizer-webpack-plugin": "^7.0.
|
|
64
|
+
"css-minimizer-webpack-plugin": "^7.0.3",
|
|
65
65
|
"dotenv": "^17.2.3",
|
|
66
66
|
"eslint": "^9.39.1",
|
|
67
67
|
"eslint-webpack-plugin": "^5.0.2",
|
|
68
68
|
"file-loader": "^6.2.0",
|
|
69
69
|
"html-loader": "^5.1.0",
|
|
70
|
-
"html-webpack-plugin": "^5.6.
|
|
71
|
-
"
|
|
72
|
-
"jest-environment-jsdom": "^30.2.0",
|
|
70
|
+
"html-webpack-plugin": "^5.6.5",
|
|
71
|
+
"jsdom": "^26.1.0",
|
|
73
72
|
"mini-css-extract-plugin": "^2.9.4",
|
|
74
73
|
"postcss": "^8.5.6",
|
|
75
74
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
76
75
|
"postcss-loader": "^8.2.0",
|
|
77
|
-
"postcss-preset-env": "^10.
|
|
78
|
-
"prettier": "^3.
|
|
76
|
+
"postcss-preset-env": "^10.5.0",
|
|
77
|
+
"prettier": "^3.7.4",
|
|
79
78
|
"sass-loader": "^16.0.6",
|
|
80
79
|
"style-loader": "^4.0.0",
|
|
81
|
-
"stylelint": "^16.
|
|
80
|
+
"stylelint": "^16.26.1",
|
|
82
81
|
"stylelint-webpack-plugin": "^5.0.1",
|
|
83
|
-
"ts-jest": "^29.4.5",
|
|
84
82
|
"ts-loader": "^9.5.4",
|
|
85
|
-
"ts-node": "^10.9.2",
|
|
86
83
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
87
84
|
"tslib": "^2.8.1",
|
|
85
|
+
"tsx": "^4.21.0",
|
|
88
86
|
"typescript": "^5.9.3",
|
|
89
87
|
"undici": "^7.16.0",
|
|
90
88
|
"url-loader": "^4.1.1",
|
|
91
|
-
"
|
|
92
|
-
"webpack
|
|
89
|
+
"vitest": "^4.0.16",
|
|
90
|
+
"webpack": "^5.103.0",
|
|
91
|
+
"webpack-bundle-analyzer": "^5.0.1",
|
|
93
92
|
"webpack-cli": "^6.0.1",
|
|
94
93
|
"webpack-dev-server": "^5.2.2",
|
|
95
94
|
"webpackbar": "^7.0.0"
|
|
96
95
|
},
|
|
97
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "c98290e1b374fdcffa21acd39ab8dac42d8d156d"
|
|
98
97
|
}
|
package/scripts/badge.ts
CHANGED
|
@@ -42,7 +42,7 @@ const getBadgeUrl = (
|
|
|
42
42
|
const percentage = getCoveragePercentage(summaryFilePath, coverageType);
|
|
43
43
|
const coverage = `${percentage}${encodeURI('%')}`;
|
|
44
44
|
const color = getBadgeColor(percentage);
|
|
45
|
-
const url = `https://img.shields.io/badge/${coverageType}-${coverage}-${color}?logo=
|
|
45
|
+
const url = `https://img.shields.io/badge/${coverageType}-${coverage}-${color}?logo=vitest&style=${badgeStyle}`;
|
|
46
46
|
return url;
|
|
47
47
|
};
|
|
48
48
|
|
package/src/index.css
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
1
2
|
import ExplodingParticle from '../ExplodingParticle'
|
|
2
3
|
|
|
3
4
|
describe('explodingParticle', () => {
|
|
@@ -7,12 +8,12 @@ describe('explodingParticle', () => {
|
|
|
7
8
|
|
|
8
9
|
beforeEach(() => {
|
|
9
10
|
mockContextFunctions = {
|
|
10
|
-
save:
|
|
11
|
-
restore:
|
|
12
|
-
beginPath:
|
|
13
|
-
closePath:
|
|
14
|
-
arc:
|
|
15
|
-
fill:
|
|
11
|
+
save: vi.fn(),
|
|
12
|
+
restore: vi.fn(),
|
|
13
|
+
beginPath: vi.fn(),
|
|
14
|
+
closePath: vi.fn(),
|
|
15
|
+
arc: vi.fn(),
|
|
16
|
+
fill: vi.fn(),
|
|
16
17
|
}
|
|
17
18
|
mockContextProps = {
|
|
18
19
|
fillStyle: '',
|
package/tsconfig.json
CHANGED
|
@@ -20,19 +20,12 @@
|
|
|
20
20
|
"isolatedModules": true,
|
|
21
21
|
"skipLibCheck": true
|
|
22
22
|
},
|
|
23
|
-
"include": ["./src/**/*", "index.d.ts"],
|
|
23
|
+
"include": ["./src/**/*", "index.d.ts", "vitest.config.ts", "vitest.setup.ts"],
|
|
24
24
|
"exclude": [
|
|
25
25
|
"node_modules",
|
|
26
26
|
"build",
|
|
27
27
|
"coverage",
|
|
28
28
|
"dist",
|
|
29
29
|
"typings"
|
|
30
|
-
]
|
|
31
|
-
"ts-node": {
|
|
32
|
-
"files": true,
|
|
33
|
-
"compilerOptions": {
|
|
34
|
-
"target": "es6",
|
|
35
|
-
"module": "commonjs"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
30
|
+
]
|
|
38
31
|
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { defineConfig } from 'vitest/config'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
test: {
|
|
6
|
+
environment: 'jsdom',
|
|
7
|
+
environmentOptions: {
|
|
8
|
+
url: 'http://localhost',
|
|
9
|
+
},
|
|
10
|
+
setupFiles: ['./vitest.setup.ts'],
|
|
11
|
+
coverage: {
|
|
12
|
+
provider: 'v8',
|
|
13
|
+
reportsDirectory: './coverage',
|
|
14
|
+
},
|
|
15
|
+
exclude: [
|
|
16
|
+
'node_modules',
|
|
17
|
+
'.cache',
|
|
18
|
+
'build',
|
|
19
|
+
'dist',
|
|
20
|
+
'coverage',
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
resolve: {
|
|
24
|
+
alias: {
|
|
25
|
+
'@': path.resolve(__dirname, './src'),
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
})
|
package/vitest.setup.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import process from 'node:process'
|
|
3
|
+
import dotenv from 'dotenv'
|
|
4
|
+
import { afterEach, vi } from 'vitest'
|
|
5
|
+
|
|
6
|
+
// Load environment variables
|
|
7
|
+
dotenv.config({
|
|
8
|
+
path: path.resolve(process.cwd(), '.test.env'),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
// Mock matchMedia
|
|
12
|
+
Object.defineProperty(window, 'matchMedia', {
|
|
13
|
+
writable: true,
|
|
14
|
+
value: vi.fn().mockImplementation((query: string) => ({
|
|
15
|
+
matches: false,
|
|
16
|
+
media: query,
|
|
17
|
+
onchange: null,
|
|
18
|
+
addListener: vi.fn(), // deprecated
|
|
19
|
+
removeListener: vi.fn(), // deprecated
|
|
20
|
+
addEventListener: vi.fn(),
|
|
21
|
+
removeEventListener: vi.fn(),
|
|
22
|
+
dispatchEvent: vi.fn(),
|
|
23
|
+
})),
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
// Mock requestAnimationFrame
|
|
27
|
+
window.requestAnimationFrame = function (callback: FrameRequestCallback): number {
|
|
28
|
+
return setTimeout(callback) as unknown as number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
window.cancelAnimationFrame = window.clearTimeout
|
|
32
|
+
|
|
33
|
+
// Reset mocks after each test
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
vi.restoreAllMocks()
|
|
36
|
+
})
|
|
37
|
+
|
package/jest.config.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
-
const { pathsToModuleNameMapper } = require('ts-jest');
|
|
3
|
-
const { compilerOptions } = require('./tsconfig.json');
|
|
4
|
-
|
|
5
|
-
const paths = pathsToModuleNameMapper(compilerOptions.paths, {
|
|
6
|
-
prefix: '<rootDir>/',
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
10
|
-
module.exports = {
|
|
11
|
-
collectCoverage: true,
|
|
12
|
-
coverageDirectory: 'coverage',
|
|
13
|
-
coverageReporters: ['json-summary', 'lcov', 'text', 'clover'],
|
|
14
|
-
preset: 'ts-jest',
|
|
15
|
-
moduleNameMapper: {
|
|
16
|
-
...paths,
|
|
17
|
-
},
|
|
18
|
-
testPathIgnorePatterns: [
|
|
19
|
-
'node_modules',
|
|
20
|
-
'\\.cache',
|
|
21
|
-
'<rootDir>/build',
|
|
22
|
-
'<rootDir>/dist',
|
|
23
|
-
'<rootDir>/coverage',
|
|
24
|
-
],
|
|
25
|
-
transform: {
|
|
26
|
-
'^.+\\.tsx?$': [
|
|
27
|
-
'ts-jest',
|
|
28
|
-
{
|
|
29
|
-
tsconfig: 'tsconfig.json',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
testEnvironmentOptions: {
|
|
34
|
-
url: 'http://localhost',
|
|
35
|
-
},
|
|
36
|
-
testEnvironment: 'jsdom',
|
|
37
|
-
setupFiles: ['<rootDir>/jest.env.setup.js'],
|
|
38
|
-
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
39
|
-
};
|
package/jest.env.setup.js
DELETED
package/jest.setup.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// require('@testing-library/jest-dom');
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(window, 'matchMedia', {
|
|
4
|
-
writable: true,
|
|
5
|
-
value: jest.fn().mockImplementation((query) => ({
|
|
6
|
-
matches: false,
|
|
7
|
-
media: query,
|
|
8
|
-
onchange: null,
|
|
9
|
-
addListener: jest.fn(), // deprecated
|
|
10
|
-
removeListener: jest.fn(), // deprecated
|
|
11
|
-
addEventListener: jest.fn(),
|
|
12
|
-
removeEventListener: jest.fn(),
|
|
13
|
-
dispatchEvent: jest.fn(),
|
|
14
|
-
})),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
window.requestAnimationFrame = function (callback) {
|
|
18
|
-
return setTimeout(callback);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
window.cancelAnimationFrame = window.clearTimeout;
|