eureka-init 1.0.0 → 1.0.1
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 +5 -3
- package/bin/eureka-init.js +11 -0
- package/package.json +5 -2
- package/templates/jest.config.js +10 -0
- package/templates/jest.setup.js +2 -0
package/README.md
CHANGED
|
@@ -28,9 +28,10 @@ Perintah ini akan:
|
|
|
28
28
|
1. Membuat file `commitlint.config.js`.
|
|
29
29
|
2. Membuat file `.prettierrc`.
|
|
30
30
|
3. Membuat file `.eslintrc.js`.
|
|
31
|
-
4.
|
|
32
|
-
5.
|
|
33
|
-
6.
|
|
31
|
+
4. Membuat file `jest.config.js` dan `jest.setup.js`.
|
|
32
|
+
5. Menjalankan `npx husky install`.
|
|
33
|
+
6. Membuat hook `.husky/commit-msg` dan `.husky/pre-commit`.
|
|
34
|
+
7. Menambahkan script `prepare`, `lint`, `format`, dan `test` di `package.json`.
|
|
34
35
|
|
|
35
36
|
## 🧱 Format Commit
|
|
36
37
|
Gunakan format: `<type>: <subject>`
|
|
@@ -53,3 +54,4 @@ Gunakan format: `<type>: <subject>`
|
|
|
53
54
|
Setelah instalasi, Anda bisa menggunakan:
|
|
54
55
|
- `npm run lint`: Menjalankan eslint.
|
|
55
56
|
- `npm run format`: Menjalankan prettier untuk merapikan kode.
|
|
57
|
+
- `npm run test`: Menjalankan unit test menggunakan Jest.
|
package/bin/eureka-init.js
CHANGED
|
@@ -29,6 +29,14 @@ function setup() {
|
|
|
29
29
|
path.join(templateDir, '.eslintrc.js'),
|
|
30
30
|
path.join(cwd, '.eslintrc.js')
|
|
31
31
|
);
|
|
32
|
+
copyFile(
|
|
33
|
+
path.join(templateDir, 'jest.config.js'),
|
|
34
|
+
path.join(cwd, 'jest.config.js')
|
|
35
|
+
);
|
|
36
|
+
copyFile(
|
|
37
|
+
path.join(templateDir, 'jest.setup.js'),
|
|
38
|
+
path.join(cwd, 'jest.setup.js')
|
|
39
|
+
);
|
|
32
40
|
|
|
33
41
|
// 2. Initialize Husky
|
|
34
42
|
try {
|
|
@@ -76,6 +84,9 @@ function setup() {
|
|
|
76
84
|
if (!pkg.scripts.format) {
|
|
77
85
|
pkg.scripts.format = 'prettier --write .';
|
|
78
86
|
}
|
|
87
|
+
if (!pkg.scripts.test) {
|
|
88
|
+
pkg.scripts.test = 'jest';
|
|
89
|
+
}
|
|
79
90
|
|
|
80
91
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
81
92
|
console.log('✅ Updated package.json scripts');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eureka-init",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Shared configuration for Husky, Commitlint, and
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Shared configuration for Husky, Commitlint, Prettier, ESLint, and Jest for Eureka Group",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"eureka-init": "bin/eureka-init.js"
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
"eslint-config-prettier": "^9.1.0",
|
|
25
25
|
"eslint-plugin-prettier": "^5.1.3",
|
|
26
26
|
"husky": "^9.0.11",
|
|
27
|
+
"jest": "^29.7.0",
|
|
28
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
29
|
+
"identity-obj-proxy": "^3.0.0",
|
|
27
30
|
"prettier": "^3.2.5"
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
testEnvironment: 'jsdom',
|
|
3
|
+
collectCoverage: true,
|
|
4
|
+
coverageDirectory: 'coverage',
|
|
5
|
+
moduleNameMapper: {
|
|
6
|
+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
7
|
+
},
|
|
8
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
9
|
+
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
|
|
10
|
+
};
|