automation-lib 6.6.412 → 6.6.414

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/commit.bat CHANGED
@@ -1,50 +1,75 @@
1
1
  @echo off
2
+ setlocal enabledelayedexpansion
2
3
 
3
- :: Add all changes to git
4
- git add .
5
-
6
- :: Commit changes with a message
7
- echo Committing changes...
4
+ :: 1. Nhập commit message
8
5
  set /p commit_message="Enter commit message: "
6
+
7
+ :: 2. Commit code hien tai
8
+ echo [1/7] Adding and committing changes...
9
+ git add .
9
10
  git commit -m "%commit_message%"
10
- sleep 2
11
11
 
12
- :: Push changes to the 'main' branch of the 'cp' remote
13
- git pull origin toan
12
+ :: 3. Thu pull ve
13
+ echo [2/7] Pulling from hs toan...
14
+ git pull hs toan --no-rebase --no-commit
14
15
 
15
- :: Read the current version from package.json
16
- for /f "tokens=2 delims=:, " %%i in ('findstr "version" package.json') do set currentVersion=%%i
16
+ :: Kiem tra neu co xung dot (conflict)
17
+ if %errorlevel% neq 0 (
18
+ echo.
19
+ echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
20
+ echo PHAT HIEN XUNG DOT (CONFLICT) tai cac file sau:
21
+ :: Liet ke cac file dang bi Unmerged (conflict)
22
+ git diff --name-only --diff-filter=U
23
+ echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24
+ echo.
25
+
26
+ set /p confirm="Ban co muon ghi de tat ca bang 'Incoming Changes' (theirs) khong? (y/n): "
27
+
28
+ if /i "!confirm!"=="y" (
29
+ echo Dang ghi de file bang code tu nhanh toan...
30
+ :: Lenh nay se lay phan noi dung cua 'theirs' cho cac file conflict
31
+ git checkout --theirs .
32
+ git add .
33
+ git commit -m "fix: auto resolve conflicts by taking theirs"
34
+ ) else (
35
+ echo.
36
+ echo [DUNG LAI] Hay mo VS Code de sua tay cac file tren.
37
+ echo Sau khi sua xong, hay chay lai script hoac push thu cong.
38
+ pause
39
+ exit /b
40
+ )
41
+ )
17
42
 
18
- :: Remove quotes from the version string
43
+ :: 4. Tang version trong package.json
44
+ echo [3/7] Updating version...
45
+ for /f "tokens=2 delims=:, " %%i in ('findstr "version" package.json') do set currentVersion=%%i
19
46
  set currentVersion=%currentVersion:"=%
47
+ set currentVersion=%currentVersion:,=%
20
48
 
21
- :: Split version into its components
22
49
  for /f "tokens=1,2,3 delims=." %%a in ("%currentVersion%") do (
23
50
  set major=%%a
24
51
  set minor=%%b
25
52
  set patch=%%c
26
53
  )
27
54
 
28
- :: Increment the patch version
29
55
  set /a patch+=1
30
-
31
- :: Create the new version string
32
56
  set newVersion=%major%.%minor%.%patch%
33
57
 
34
- :: Update the version in package.json
35
58
  powershell -Command "(Get-Content package.json) -replace '\"version\": \"%currentVersion%\"', '\"version\": \"%newVersion%\"' | Set-Content package.json"
36
-
37
- :: Display the new version
38
59
  echo New version: %newVersion%
39
60
 
40
- :: Run npm publish using call
61
+ :: 5. Chay npm publish
62
+ echo [4/7] Running npm publish...
41
63
  call npm run pub
42
64
 
65
+ :: 6. Commit package.json
66
+ echo [5/7] Committing version bump...
43
67
  git add .
44
- sleep 1
45
- git commit -m "%commit_message%"
46
- sleep 2
47
-
48
- git push origin toan
68
+ git commit -m "chore: bump version to %newVersion%"
49
69
 
70
+ :: 7. PUSH LEN MAIN
71
+ echo [6/7] Pushing to hs main...
72
+ git push hs main
50
73
 
74
+ echo [7/7] Hoan thanh ruc ro!
75
+ pause