tnp-helpers 18.0.19 → 18.0.21
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/browser/esm2022/lib/base/classes/base-bower-json.mjs +14 -0
- package/browser/esm2022/lib/base/classes/base-cli-worker-config.mjs +1 -4
- package/browser/esm2022/lib/base/classes/base-cli-worker-controller.mjs +1 -1
- package/browser/esm2022/lib/base/classes/base-cli-worker.mjs +14 -4
- package/browser/esm2022/lib/base/classes/base-debounce-compiler-for-project.mjs +5 -5
- package/browser/esm2022/lib/base/classes/base-feature-for-project.mjs +4 -1
- package/browser/esm2022/lib/base/classes/base-git.mjs +244 -4
- package/browser/esm2022/lib/base/classes/base-json-file-reader.mjs +114 -0
- package/browser/esm2022/lib/base/classes/base-library-build.mjs +35 -10
- package/browser/esm2022/lib/base/classes/base-linked-projects.mjs +8 -5
- package/browser/esm2022/lib/base/classes/base-node-modules.mjs +495 -0
- package/browser/esm2022/lib/base/classes/base-npm-helpers.mjs +32 -430
- package/browser/esm2022/lib/base/classes/base-package-json.mjs +340 -0
- package/browser/esm2022/lib/base/classes/base-process-manager.mjs +285 -0
- package/browser/esm2022/lib/base/classes/base-project-resolver.mjs +2 -11
- package/browser/esm2022/lib/base/classes/base-project.mjs +83 -87
- package/browser/esm2022/lib/base/classes/base-quick-fixes.mjs +44 -1
- package/browser/esm2022/lib/base/classes/base-release-process.mjs +34 -36
- package/browser/esm2022/lib/base/classes/{base-github-pages.mjs → base-static-pages.mjs} +6 -6
- package/browser/esm2022/lib/base/classes/base-vscode.mjs +31 -1
- package/browser/esm2022/lib/base/classes/index.mjs +5 -1
- package/browser/esm2022/lib/base/commit-data.mjs +21 -4
- package/browser/esm2022/lib/base/core-project.mjs +3 -3
- package/browser/esm2022/lib/base/linked-project.mjs +4 -4
- package/browser/esm2022/lib/base/tcp-udp-ports/tcp-udp-ports.context.mjs +2 -4
- package/browser/esm2022/lib/base/translate.mjs +566 -0
- package/browser/esm2022/lib/helpers/helpers-array-obj.mjs +5 -10
- package/browser/esm2022/lib/helpers/helpers.mjs +12 -6
- package/browser/esm2022/lib/index.mjs +2 -4
- package/browser/esm2022/lib/models.mjs +173 -3
- package/browser/esm2022/lib/utils.mjs +402 -41
- package/browser/fesm2022/tnp-helpers.mjs +4616 -2904
- package/browser/fesm2022/tnp-helpers.mjs.map +1 -1
- package/browser/lib/base/classes/base-bower-json.d.ts +35 -0
- package/browser/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/browser/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/browser/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/browser/lib/base/classes/base-git.d.ts +42 -5
- package/browser/lib/base/classes/base-json-file-reader.d.ts +72 -0
- package/browser/lib/base/classes/base-library-build.d.ts +8 -11
- package/browser/lib/base/classes/base-linked-projects.d.ts +1 -2
- package/browser/lib/base/classes/base-node-modules.d.ts +56 -0
- package/browser/lib/base/classes/base-npm-helpers.d.ts +29 -108
- package/browser/lib/base/classes/base-package-json.d.ts +107 -0
- package/browser/lib/base/classes/base-process-manager.d.ts +31 -0
- package/browser/lib/base/classes/base-project-resolver.d.ts +2 -2
- package/browser/lib/base/classes/base-project.d.ts +17 -18
- package/browser/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/browser/lib/base/classes/base-release-process.d.ts +15 -13
- package/browser/lib/base/classes/{base-github-pages.d.ts → base-static-pages.d.ts} +3 -3
- package/browser/lib/base/classes/base-vscode.d.ts +4 -0
- package/browser/lib/base/classes/index.d.ts +5 -1
- package/browser/lib/base/commit-data.d.ts +14 -1
- package/browser/lib/base/core-project.d.ts +1 -1
- package/browser/lib/base/linked-project.d.ts +1 -1
- package/browser/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
- package/browser/lib/base/translate.d.ts +228 -0
- package/browser/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/browser/lib/helpers/helpers.d.ts +12 -8
- package/browser/lib/index.d.ts +1 -3
- package/browser/lib/models.d.ts +68 -8
- package/browser/lib/utils.d.ts +72 -13
- package/client/README.md +24 -24
- package/client/esm2022/lib/base/classes/base-bower-json.mjs +14 -0
- package/client/esm2022/lib/base/classes/base-cli-worker-config.mjs +1 -4
- package/client/esm2022/lib/base/classes/base-cli-worker-controller.mjs +1 -1
- package/client/esm2022/lib/base/classes/base-cli-worker.mjs +14 -4
- package/client/esm2022/lib/base/classes/base-debounce-compiler-for-project.mjs +5 -5
- package/client/esm2022/lib/base/classes/base-feature-for-project.mjs +4 -1
- package/client/esm2022/lib/base/classes/base-git.mjs +244 -4
- package/client/esm2022/lib/base/classes/base-json-file-reader.mjs +114 -0
- package/client/esm2022/lib/base/classes/base-library-build.mjs +35 -10
- package/client/esm2022/lib/base/classes/base-linked-projects.mjs +8 -5
- package/client/esm2022/lib/base/classes/base-node-modules.mjs +495 -0
- package/client/esm2022/lib/base/classes/base-npm-helpers.mjs +32 -430
- package/client/esm2022/lib/base/classes/base-package-json.mjs +340 -0
- package/client/esm2022/lib/base/classes/base-process-manager.mjs +285 -0
- package/client/esm2022/lib/base/classes/base-project-resolver.mjs +2 -11
- package/client/esm2022/lib/base/classes/base-project.mjs +83 -87
- package/client/esm2022/lib/base/classes/base-quick-fixes.mjs +44 -1
- package/client/esm2022/lib/base/classes/base-release-process.mjs +34 -36
- package/client/esm2022/lib/base/classes/{base-github-pages.mjs → base-static-pages.mjs} +6 -6
- package/client/esm2022/lib/base/classes/base-vscode.mjs +31 -1
- package/client/esm2022/lib/base/classes/index.mjs +5 -1
- package/client/esm2022/lib/base/commit-data.mjs +21 -4
- package/client/esm2022/lib/base/core-project.mjs +3 -3
- package/client/esm2022/lib/base/linked-project.mjs +4 -4
- package/client/esm2022/lib/base/tcp-udp-ports/tcp-udp-ports.context.mjs +2 -4
- package/client/esm2022/lib/base/translate.mjs +566 -0
- package/client/esm2022/lib/helpers/helpers-array-obj.mjs +5 -10
- package/client/esm2022/lib/helpers/helpers.mjs +12 -6
- package/client/esm2022/lib/index.mjs +2 -4
- package/client/esm2022/lib/models.mjs +173 -3
- package/client/esm2022/lib/utils.mjs +402 -41
- package/client/fesm2022/tnp-helpers.mjs +4616 -2904
- package/client/fesm2022/tnp-helpers.mjs.map +1 -1
- package/client/lib/base/classes/base-bower-json.d.ts +35 -0
- package/client/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/client/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/client/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/client/lib/base/classes/base-git.d.ts +42 -5
- package/client/lib/base/classes/base-json-file-reader.d.ts +72 -0
- package/client/lib/base/classes/base-library-build.d.ts +8 -11
- package/client/lib/base/classes/base-linked-projects.d.ts +1 -2
- package/client/lib/base/classes/base-node-modules.d.ts +56 -0
- package/client/lib/base/classes/base-npm-helpers.d.ts +29 -108
- package/client/lib/base/classes/base-package-json.d.ts +107 -0
- package/client/lib/base/classes/base-process-manager.d.ts +31 -0
- package/client/lib/base/classes/base-project-resolver.d.ts +2 -2
- package/client/lib/base/classes/base-project.d.ts +17 -18
- package/client/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/client/lib/base/classes/base-release-process.d.ts +15 -13
- package/{websql/lib/base/classes/base-github-pages.d.ts → client/lib/base/classes/base-static-pages.d.ts} +3 -3
- package/client/lib/base/classes/base-vscode.d.ts +4 -0
- package/client/lib/base/classes/index.d.ts +5 -1
- package/client/lib/base/commit-data.d.ts +14 -1
- package/client/lib/base/core-project.d.ts +1 -1
- package/client/lib/base/linked-project.d.ts +1 -1
- package/client/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
- package/client/lib/base/translate.d.ts +228 -0
- package/client/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/client/lib/helpers/helpers.d.ts +12 -8
- package/client/lib/index.d.ts +1 -3
- package/client/lib/models.d.ts +68 -8
- package/client/lib/utils.d.ts +72 -13
- package/index.js +15 -2
- package/index.js.map +1 -1
- package/lib/base/base-cli-worker-config.d.ts +27 -0
- package/lib/base/base-cli-worker-config.js +53 -0
- package/lib/base/base-cli-worker-config.js.map +1 -0
- package/lib/base/base-cli-worker-controller.d.ts +15 -0
- package/lib/base/base-cli-worker-controller.js +154 -0
- package/lib/base/base-cli-worker-controller.js.map +1 -0
- package/lib/base/base-cli-worker.d.ts +82 -0
- package/lib/base/base-cli-worker.js +654 -0
- package/lib/base/base-cli-worker.js.map +1 -0
- package/lib/base/base-command-line.backend.d.ts +174 -0
- package/lib/base/base-command-line.backend.js +2221 -0
- package/lib/base/base-command-line.backend.js.map +1 -0
- package/lib/base/base-compiler-for-project.d.ts +7 -0
- package/lib/base/base-compiler-for-project.js +62 -0
- package/lib/base/base-compiler-for-project.js.map +1 -0
- package/lib/base/base-db.d.ts +12 -0
- package/lib/base/base-db.js +74 -0
- package/lib/base/base-db.js.map +1 -0
- package/lib/base/base-debounce-compiler-for-project.d.ts +28 -0
- package/lib/base/base-debounce-compiler-for-project.js +82 -0
- package/lib/base/base-debounce-compiler-for-project.js.map +1 -0
- package/lib/base/base-detached-service.d.ts +6 -0
- package/lib/base/base-detached-service.js +16 -0
- package/lib/base/base-detached-service.js.map +1 -0
- package/lib/base/base-feature-for-project.d.ts +5 -0
- package/lib/base/base-feature-for-project.js +11 -0
- package/lib/base/base-feature-for-project.js.map +1 -0
- package/lib/base/base-git.d.ts +148 -0
- package/lib/base/base-git.js +1202 -0
- package/lib/base/base-git.js.map +1 -0
- package/{client/lib/base/classes → lib/base}/base-github-pages.d.ts +4 -5
- package/lib/base/base-github-pages.js +173 -0
- package/lib/base/base-github-pages.js.map +1 -0
- package/lib/base/base-ignore-hide.d.ts +14 -0
- package/lib/base/base-ignore-hide.js +55 -0
- package/lib/base/base-ignore-hide.js.map +1 -0
- package/lib/base/base-library-build.d.ts +65 -0
- package/lib/base/base-library-build.js +717 -0
- package/lib/base/base-library-build.js.map +1 -0
- package/lib/base/base-linked-projects.d.ts +24 -0
- package/lib/base/base-linked-projects.js +408 -0
- package/lib/base/base-linked-projects.js.map +1 -0
- package/lib/base/base-npm-helpers.d.ts +128 -0
- package/lib/base/base-npm-helpers.js +774 -0
- package/lib/base/base-npm-helpers.js.map +1 -0
- package/lib/base/base-project-resolver.d.ts +41 -0
- package/lib/base/base-project-resolver.js +308 -0
- package/lib/base/base-project-resolver.js.map +1 -0
- package/lib/base/base-project.d.ts +244 -0
- package/lib/base/base-project.js +1223 -0
- package/lib/base/base-project.js.map +1 -0
- package/lib/base/base-quick-fixes.d.ts +6 -0
- package/lib/base/base-quick-fixes.js +31 -0
- package/lib/base/base-quick-fixes.js.map +1 -0
- package/lib/base/base-release-process.d.ts +69 -0
- package/lib/base/base-release-process.js +913 -0
- package/lib/base/base-release-process.js.map +1 -0
- package/lib/base/base-start-config.backend.d.ts +36 -0
- package/lib/base/base-start-config.backend.js +167 -0
- package/lib/base/base-start-config.backend.js.map +1 -0
- package/lib/base/base-vscode.d.ts +12 -0
- package/lib/base/base-vscode.js +139 -0
- package/lib/base/base-vscode.js.map +1 -0
- package/lib/base/classes/base-bower-json.d.ts +34 -0
- package/lib/base/classes/base-bower-json.js +19 -0
- package/lib/base/classes/base-bower-json.js.map +1 -0
- package/lib/base/classes/base-cli-worker-config.js +35 -24
- package/lib/base/classes/base-cli-worker-config.js.map +1 -1
- package/lib/base/classes/base-cli-worker-controller.js +98 -128
- package/lib/base/classes/base-cli-worker-controller.js.map +1 -1
- package/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/lib/base/classes/base-cli-worker.js +402 -606
- package/lib/base/classes/base-cli-worker.js.map +1 -1
- package/lib/base/classes/base-command-line-feature.backend.d.ts +5 -9
- package/lib/base/classes/base-command-line-feature.backend.js +73 -132
- package/lib/base/classes/base-command-line-feature.backend.js.map +1 -1
- package/lib/base/classes/base-command-line.backend.d.ts +175 -0
- package/lib/base/classes/base-command-line.backend.js +2235 -0
- package/lib/base/classes/base-command-line.backend.js.map +1 -0
- package/lib/base/classes/base-compiler-for-project.js +27 -32
- package/lib/base/classes/base-compiler-for-project.js.map +1 -1
- package/lib/base/classes/base-db.js +43 -60
- package/lib/base/classes/base-db.js.map +1 -1
- package/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/lib/base/classes/base-debounce-compiler-for-project.js +44 -70
- package/lib/base/classes/base-debounce-compiler-for-project.js.map +1 -1
- package/lib/base/classes/base-detached-service.js.map +1 -1
- package/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/lib/base/classes/base-feature-for-project.js +7 -4
- package/lib/base/classes/base-feature-for-project.js.map +1 -1
- package/lib/base/classes/base-git.d.ts +40 -3
- package/lib/base/classes/base-git.js +885 -943
- package/lib/base/classes/base-git.js.map +1 -1
- package/lib/base/classes/base-github-pages.js.map +1 -1
- package/lib/base/classes/base-global-command-line.backend.d.ts +10 -2
- package/lib/base/classes/base-global-command-line.backend.js +1058 -2011
- package/lib/base/classes/base-global-command-line.backend.js.map +1 -1
- package/lib/base/classes/base-ignore-hide.d.ts +2 -2
- package/lib/base/classes/base-ignore-hide.js +24 -28
- package/lib/base/classes/base-ignore-hide.js.map +1 -1
- package/lib/base/classes/base-json-file-reader.d.ts +71 -0
- package/lib/base/classes/base-json-file-reader.js +141 -0
- package/lib/base/classes/base-json-file-reader.js.map +1 -0
- package/lib/base/classes/base-library-build.d.ts +8 -12
- package/lib/base/classes/base-library-build.js +433 -638
- package/lib/base/classes/base-library-build.js.map +1 -1
- package/lib/base/classes/base-linked-projects.d.ts +1 -3
- package/lib/base/classes/base-linked-projects.js +200 -314
- package/lib/base/classes/base-linked-projects.js.map +1 -1
- package/lib/base/classes/base-node-modules.d.ts +55 -0
- package/lib/base/classes/base-node-modules.js +415 -0
- package/lib/base/classes/base-node-modules.js.map +1 -0
- package/lib/base/classes/base-npm-helpers.d.ts +29 -97
- package/lib/base/classes/base-npm-helpers.js +178 -729
- package/lib/base/classes/base-npm-helpers.js.map +1 -1
- package/lib/base/classes/base-package-json.d.ts +106 -0
- package/lib/base/classes/base-package-json.js +381 -0
- package/lib/base/classes/base-package-json.js.map +1 -0
- package/lib/base/classes/base-process-manager.d.ts +30 -0
- package/lib/base/classes/base-process-manager.js +269 -0
- package/lib/base/classes/base-process-manager.js.map +1 -0
- package/lib/base/classes/base-project-resolver.d.ts +2 -3
- package/lib/base/classes/base-project-resolver.js +102 -119
- package/lib/base/classes/base-project-resolver.js.map +1 -1
- package/lib/base/classes/base-project.d.ts +20 -17
- package/lib/base/classes/base-project.js +553 -760
- package/lib/base/classes/base-project.js.map +1 -1
- package/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/lib/base/classes/base-quick-fixes.js +45 -17
- package/lib/base/classes/base-quick-fixes.js.map +1 -1
- package/lib/base/classes/base-release-process.d.ts +15 -13
- package/lib/base/classes/base-release-process.js +487 -835
- package/lib/base/classes/base-release-process.js.map +1 -1
- package/lib/base/classes/base-start-config.backend.js +116 -100
- package/lib/base/classes/base-start-config.backend.js.map +1 -1
- package/lib/base/classes/base-static-pages.d.ts +14 -0
- package/lib/base/classes/base-static-pages.js +105 -0
- package/lib/base/classes/base-static-pages.js.map +1 -0
- package/lib/base/classes/base-vscode.d.ts +4 -0
- package/lib/base/classes/base-vscode.js +446 -424
- package/lib/base/classes/base-vscode.js.map +1 -1
- package/lib/base/classes/index copy.d.ts +22 -0
- package/lib/base/classes/index copy.js +28 -0
- package/lib/base/classes/index copy.js.map +1 -0
- package/lib/base/classes/index.d.ts +4 -0
- package/lib/base/classes/index.js +36 -19
- package/lib/base/classes/index.js.map +1 -1
- package/lib/base/command-line-feature.backend.d.ts +51 -0
- package/lib/base/command-line-feature.backend.js +206 -0
- package/lib/base/command-line-feature.backend.js.map +1 -0
- package/lib/base/commit-data.d.ts +14 -1
- package/lib/base/commit-data.js +411 -464
- package/lib/base/commit-data.js.map +1 -1
- package/lib/base/config-database.js +33 -61
- package/lib/base/config-database.js.map +1 -1
- package/lib/base/core-project.d.ts +1 -1
- package/lib/base/core-project.js +110 -146
- package/lib/base/core-project.js.map +1 -1
- package/lib/base/gh-temp-code.d.ts +1 -0
- package/lib/base/gh-temp-code.js +62 -104
- package/lib/base/gh-temp-code.js.map +1 -1
- package/lib/base/index-rebuilder.backend.d.ts +1 -0
- package/lib/base/index-rebuilder.backend.js.map +1 -1
- package/lib/base/index.js +20 -7
- package/lib/base/index.js.map +1 -1
- package/lib/base/linked-project.d.ts +1 -1
- package/lib/base/linked-project.js +59 -38
- package/lib/base/linked-project.js.map +1 -1
- package/lib/base/ports-worker.d.ts +32 -0
- package/lib/base/ports-worker.js +244 -0
- package/lib/base/ports-worker.js.map +1 -0
- package/lib/base/project-database.js +12 -22
- package/lib/base/project-database.js.map +1 -1
- package/lib/base/tcp-udp-ports/index.js +17 -4
- package/lib/base/tcp-udp-ports/index.js.map +1 -1
- package/lib/base/tcp-udp-ports/not-assignable-port.entity.d.ts +1 -0
- package/lib/base/tcp-udp-ports/not-assignable-port.entity.js +2 -2
- package/lib/base/tcp-udp-ports/not-assignable-port.entity.js.map +1 -1
- package/lib/base/tcp-udp-ports/port.entity.d.ts +0 -0
- package/lib/base/tcp-udp-ports/port.entity.js +5 -0
- package/lib/base/tcp-udp-ports/port.entity.js.map +1 -0
- package/lib/base/tcp-udp-ports/ports.controller.js +195 -283
- package/lib/base/tcp-udp-ports/ports.controller.js.map +1 -1
- package/lib/base/tcp-udp-ports/ports.entity.d.ts +2 -2
- package/lib/base/tcp-udp-ports/ports.entity.js +74 -62
- package/lib/base/tcp-udp-ports/ports.entity.js.map +1 -1
- package/lib/base/tcp-udp-ports/tcp-udp-ports.context.js +11 -14
- package/lib/base/tcp-udp-ports/tcp-udp-ports.context.js.map +1 -1
- package/lib/base/tcp-udp-ports/tcp-upd-ports.worker.js +244 -427
- package/lib/base/tcp-udp-ports/tcp-upd-ports.worker.js.map +1 -1
- package/lib/base/tcp-upd-ports.worker.d.ts +13 -0
- package/lib/base/tcp-upd-ports.worker.js +99 -0
- package/lib/base/tcp-upd-ports.worker.js.map +1 -0
- package/lib/base/translate.d.ts +1 -1
- package/lib/base/translate.js +90 -119
- package/lib/base/translate.js.map +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/helpers/for-backend/helpers-cli-tool.backend.js +109 -115
- package/lib/helpers/for-backend/helpers-cli-tool.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-console-gui.js +55 -102
- package/lib/helpers/for-backend/helpers-console-gui.js.map +1 -1
- package/lib/helpers/for-backend/helpers-dependencies.backend.js +28 -45
- package/lib/helpers/for-backend/helpers-dependencies.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-file-folders.backend.d.ts +2 -2
- package/lib/helpers/for-backend/helpers-file-folders.backend.js +277 -266
- package/lib/helpers/for-backend/helpers-file-folders.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-git.backend.d.ts +38 -3
- package/lib/helpers/for-backend/helpers-git.backend.js +806 -807
- package/lib/helpers/for-backend/helpers-git.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-network.backend.js +15 -18
- package/lib/helpers/for-backend/helpers-network.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-npm.backend.js +5 -8
- package/lib/helpers/for-backend/helpers-npm.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-path.backend.js +18 -26
- package/lib/helpers/for-backend/helpers-path.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-process.backend.d.ts +2 -2
- package/lib/helpers/for-backend/helpers-process.backend.js +285 -363
- package/lib/helpers/for-backend/helpers-process.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-system-terminal.backend.js +25 -42
- package/lib/helpers/for-backend/helpers-system-terminal.backend.js.map +1 -1
- package/lib/helpers/for-backend/helpers-vscode.backend.js +9 -12
- package/lib/helpers/for-backend/helpers-vscode.backend.js.map +1 -1
- package/lib/helpers/for-backend/ts-code/index.js +0 -2
- package/lib/helpers/for-backend/ts-code/index.js.map +1 -1
- package/lib/helpers/for-backend/ts-code/ts-code-extractor.d.ts +26 -0
- package/lib/helpers/for-backend/ts-code/ts-code-extractor.js +62 -0
- package/lib/helpers/for-backend/ts-code/ts-code-extractor.js.map +1 -0
- package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.d.ts +19 -0
- package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.js +81 -0
- package/lib/helpers/for-backend/ts-code/ts-code-modifier.backend.js.map +1 -0
- package/lib/helpers/for-backend/ts-code/ts-import-export-extractor.js +2 -2
- package/lib/helpers/for-backend/ts-code/ts-import-export-extractor.js.map +1 -1
- package/lib/helpers/for-browser/angular.helper.js +2 -2
- package/lib/helpers/for-browser/angular.helper.js.map +1 -1
- package/lib/helpers/for-browser/helpers-browser.js +27 -40
- package/lib/helpers/for-browser/helpers-browser.js.map +1 -1
- package/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/lib/helpers/helpers-array-obj.js +49 -61
- package/lib/helpers/helpers-array-obj.js.map +1 -1
- package/lib/helpers/helpers-json5.backend.js +44 -55
- package/lib/helpers/helpers-json5.backend.js.map +1 -1
- package/lib/helpers/helpers-numbers.js +7 -10
- package/lib/helpers/helpers-numbers.js.map +1 -1
- package/lib/helpers/helpers-strings-regexes.js +40 -47
- package/lib/helpers/helpers-strings-regexes.js.map +1 -1
- package/lib/helpers/helpers-strings.js +38 -41
- package/lib/helpers/helpers-strings.js.map +1 -1
- package/lib/helpers/helpers.d.ts +12 -8
- package/lib/helpers/helpers.js +313 -393
- package/lib/helpers/helpers.js.map +1 -1
- package/lib/index._auto-generated_.d.ts +1 -0
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.d.ts +3 -4
- package/lib/index.js +21 -10
- package/lib/index.js.map +1 -1
- package/lib/lowdb/adapters/Memory.js +14 -20
- package/lib/lowdb/adapters/Memory.js.map +1 -1
- package/lib/lowdb/adapters/browser/LocalStorage.js +5 -8
- package/lib/lowdb/adapters/browser/LocalStorage.js.map +1 -1
- package/lib/lowdb/adapters/browser/SessionStorage.js +5 -8
- package/lib/lowdb/adapters/browser/SessionStorage.js.map +1 -1
- package/lib/lowdb/adapters/browser/WebStorage.js +10 -9
- package/lib/lowdb/adapters/browser/WebStorage.js.map +1 -1
- package/lib/lowdb/adapters/node/DataFile.js +29 -38
- package/lib/lowdb/adapters/node/DataFile.js.map +1 -1
- package/lib/lowdb/adapters/node/JSONFile.js +13 -18
- package/lib/lowdb/adapters/node/JSONFile.js.map +1 -1
- package/lib/lowdb/adapters/node/TextFile.js +36 -44
- package/lib/lowdb/adapters/node/TextFile.js.map +1 -1
- package/lib/lowdb/adapters/node/steno.js +72 -122
- package/lib/lowdb/adapters/node/steno.js.map +1 -1
- package/lib/lowdb/browser.js +17 -4
- package/lib/lowdb/browser.js.map +1 -1
- package/lib/lowdb/core/Low.js +30 -60
- package/lib/lowdb/core/Low.js.map +1 -1
- package/lib/lowdb/examples/browser.js.map +1 -1
- package/lib/lowdb/examples/cli.d.ts +1 -0
- package/lib/lowdb/examples/cli.js.map +1 -1
- package/lib/lowdb/examples/in-memory.d.ts +1 -0
- package/lib/lowdb/examples/in-memory.js.map +1 -1
- package/lib/lowdb/examples/server.d.ts +1 -0
- package/lib/lowdb/examples/server.js.map +1 -1
- package/lib/lowdb/index.js +16 -3
- package/lib/lowdb/index.js.map +1 -1
- package/lib/lowdb/node.js +18 -5
- package/lib/lowdb/node.js.map +1 -1
- package/lib/lowdb/presets/browser.js +7 -7
- package/lib/lowdb/presets/browser.js.map +1 -1
- package/lib/lowdb/presets/node.js +12 -23
- package/lib/lowdb/presets/node.js.map +1 -1
- package/lib/models.d.ts +68 -8
- package/lib/models.js +197 -3
- package/lib/models.js.map +1 -1
- package/lib/old/base-component.d.ts +1 -0
- package/lib/old/base-component.js +2 -2
- package/lib/old/base-component.js.map +1 -1
- package/lib/old/base-formly-component.d.ts +1 -0
- package/lib/old/base-formly-component.js +2 -2
- package/lib/old/base-formly-component.js.map +1 -1
- package/lib/old/condition-wait.d.ts +1 -0
- package/lib/old/condition-wait.js.map +1 -1
- package/lib/old/dual-component-ctrl.d.ts +1 -0
- package/lib/old/dual-component-ctrl.js +2 -2
- package/lib/old/dual-component-ctrl.js.map +1 -1
- package/lib/old/execute-command.d.ts +11 -0
- package/lib/old/execute-command.js +564 -0
- package/lib/old/execute-command.js.map +1 -0
- package/lib/old/helpers.d.ts +62 -0
- package/lib/old/helpers.js +279 -0
- package/lib/old/helpers.js.map +1 -0
- package/lib/old/models.d.ts +80 -0
- package/lib/old/models.js +57 -0
- package/lib/old/models.js.map +1 -0
- package/lib/utils.d.ts +72 -13
- package/lib/utils.js +502 -179
- package/lib/utils.js.map +1 -1
- package/lib/validators/validators-firedev.js +5 -5
- package/lib/validators/validators-firedev.js.map +1 -1
- package/lib/validators/validators-git.js +2 -2
- package/lib/validators/validators-git.js.map +1 -1
- package/lib/validators/validators-network.js +1 -1
- package/lib/validators/validators-network.js.map +1 -1
- package/lib/validators/validators.js +2 -2
- package/lib/validators/validators.js.map +1 -1
- package/migrations/1736198527297_init.js +39 -58
- package/migrations/1736198527297_init.js.map +1 -1
- package/migrations/1736199486472_addingNotAssignablePorts.js +42 -93
- package/migrations/1736199486472_addingNotAssignablePorts.js.map +1 -1
- package/migrations/1736454437350_addFreePorts.js +48 -100
- package/migrations/1736454437350_addFreePorts.js.map +1 -1
- package/migrations/index.js +15 -2
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.js +3 -3
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +14 -61
- package/src.d.ts +1 -1
- package/taon.jsonc +34 -49
- package/tmp-environment.json +8 -389
- package/websql/README.md +24 -24
- package/websql/esm2022/lib/base/classes/base-bower-json.mjs +14 -0
- package/websql/esm2022/lib/base/classes/base-cli-worker-config.mjs +1 -4
- package/websql/esm2022/lib/base/classes/base-cli-worker-controller.mjs +1 -1
- package/websql/esm2022/lib/base/classes/base-cli-worker.mjs +14 -4
- package/websql/esm2022/lib/base/classes/base-debounce-compiler-for-project.mjs +5 -5
- package/websql/esm2022/lib/base/classes/base-feature-for-project.mjs +4 -1
- package/websql/esm2022/lib/base/classes/base-git.mjs +244 -4
- package/websql/esm2022/lib/base/classes/base-json-file-reader.mjs +114 -0
- package/websql/esm2022/lib/base/classes/base-library-build.mjs +35 -10
- package/websql/esm2022/lib/base/classes/base-linked-projects.mjs +8 -5
- package/websql/esm2022/lib/base/classes/base-node-modules.mjs +495 -0
- package/websql/esm2022/lib/base/classes/base-npm-helpers.mjs +32 -430
- package/websql/esm2022/lib/base/classes/base-package-json.mjs +340 -0
- package/websql/esm2022/lib/base/classes/base-process-manager.mjs +285 -0
- package/websql/esm2022/lib/base/classes/base-project-resolver.mjs +2 -10
- package/websql/esm2022/lib/base/classes/base-project.mjs +82 -87
- package/websql/esm2022/lib/base/classes/base-quick-fixes.mjs +44 -1
- package/websql/esm2022/lib/base/classes/base-release-process.mjs +34 -36
- package/websql/esm2022/lib/base/classes/{base-github-pages.mjs → base-static-pages.mjs} +6 -6
- package/websql/esm2022/lib/base/classes/base-vscode.mjs +31 -1
- package/websql/esm2022/lib/base/classes/index.mjs +5 -1
- package/websql/esm2022/lib/base/commit-data.mjs +21 -4
- package/websql/esm2022/lib/base/core-project.mjs +3 -3
- package/websql/esm2022/lib/base/linked-project.mjs +4 -4
- package/websql/esm2022/lib/base/tcp-udp-ports/tcp-udp-ports.context.mjs +2 -4
- package/websql/esm2022/lib/base/translate.mjs +566 -0
- package/websql/esm2022/lib/helpers/helpers-array-obj.mjs +5 -10
- package/websql/esm2022/lib/helpers/helpers.mjs +12 -6
- package/websql/esm2022/lib/index.mjs +2 -4
- package/websql/esm2022/lib/models.mjs +173 -3
- package/websql/esm2022/lib/utils.mjs +402 -41
- package/websql/fesm2022/tnp-helpers.mjs +4744 -3032
- package/websql/fesm2022/tnp-helpers.mjs.map +1 -1
- package/websql/lib/base/classes/base-bower-json.d.ts +35 -0
- package/websql/lib/base/classes/base-cli-worker.d.ts +2 -2
- package/websql/lib/base/classes/base-debounce-compiler-for-project.d.ts +5 -5
- package/websql/lib/base/classes/base-feature-for-project.d.ts +2 -1
- package/websql/lib/base/classes/base-git.d.ts +42 -5
- package/websql/lib/base/classes/base-json-file-reader.d.ts +72 -0
- package/websql/lib/base/classes/base-library-build.d.ts +8 -11
- package/websql/lib/base/classes/base-linked-projects.d.ts +1 -2
- package/websql/lib/base/classes/base-node-modules.d.ts +56 -0
- package/websql/lib/base/classes/base-npm-helpers.d.ts +29 -108
- package/websql/lib/base/classes/base-package-json.d.ts +107 -0
- package/websql/lib/base/classes/base-process-manager.d.ts +31 -0
- package/websql/lib/base/classes/base-project-resolver.d.ts +2 -2
- package/websql/lib/base/classes/base-project.d.ts +17 -18
- package/websql/lib/base/classes/base-quick-fixes.d.ts +3 -1
- package/websql/lib/base/classes/base-release-process.d.ts +15 -13
- package/websql/lib/base/classes/base-static-pages.d.ts +15 -0
- package/websql/lib/base/classes/base-vscode.d.ts +4 -0
- package/websql/lib/base/classes/index.d.ts +5 -1
- package/websql/lib/base/commit-data.d.ts +14 -1
- package/websql/lib/base/core-project.d.ts +1 -1
- package/websql/lib/base/linked-project.d.ts +1 -1
- package/websql/lib/base/tcp-udp-ports/ports.entity.d.ts +1 -1
- package/websql/lib/base/translate.d.ts +228 -0
- package/websql/lib/helpers/helpers-array-obj.d.ts +3 -0
- package/websql/lib/helpers/helpers.d.ts +12 -8
- package/websql/lib/index.d.ts +1 -3
- package/websql/lib/models.d.ts +68 -8
- package/websql/lib/utils.d.ts +72 -13
- package/browser/package.json +0 -25
- package/websql/package.json +0 -25
|
@@ -1,97 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HelpersGit = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
4
|
//#region imports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const ini = require("ini");
|
|
6
|
+
const simple_git_1 = require("simple-git");
|
|
7
|
+
const tnp_config_1 = require("tnp-config");
|
|
8
|
+
const tnp_core_1 = require("tnp-core");
|
|
9
|
+
const tnp_core_2 = require("tnp-core");
|
|
10
|
+
const index_1 = require("../../index");
|
|
12
11
|
//#endregion
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
class HelpersGit {
|
|
13
|
+
//#region getters & methods / action mess reset git hard commit
|
|
14
|
+
get ACTION_MSG_RESET_GIT_HARD_COMMIT() {
|
|
15
|
+
return '$$$ update $$$';
|
|
15
16
|
}
|
|
16
|
-
Object.defineProperty(HelpersGit.prototype, "ACTION_MSG_RESET_GIT_HARD_COMMIT", {
|
|
17
|
-
//#region getters & methods / action mess reset git hard commit
|
|
18
|
-
get: function () {
|
|
19
|
-
return '$$$ update $$$';
|
|
20
|
-
},
|
|
21
|
-
enumerable: false,
|
|
22
|
-
configurable: true
|
|
23
|
-
});
|
|
24
17
|
//#endregion
|
|
25
18
|
//#region get last commit hash
|
|
26
|
-
|
|
19
|
+
lastCommitHash(cwd) {
|
|
27
20
|
index_1.Helpers.log('[taon-helpers][lastcommithash] ' + cwd, 1);
|
|
28
21
|
try {
|
|
29
|
-
|
|
22
|
+
let hash = this.isInsideGitRepo(cwd) &&
|
|
30
23
|
tnp_core_1.child_process
|
|
31
|
-
.execSync(
|
|
24
|
+
.execSync(`git log -1 --format="%H"`, { cwd })
|
|
32
25
|
.toString()
|
|
33
26
|
.trim();
|
|
34
27
|
return hash;
|
|
35
28
|
}
|
|
36
29
|
catch (e) {
|
|
37
30
|
index_1.Helpers.log(e, 1);
|
|
38
|
-
index_1.Helpers.log(
|
|
31
|
+
index_1.Helpers.log(`[taon-helpers][lastCommitHash] Not able to get last commit hash for repository in ${cwd}`, 1);
|
|
39
32
|
return null;
|
|
40
33
|
}
|
|
41
|
-
}
|
|
34
|
+
}
|
|
42
35
|
//#endregion
|
|
43
36
|
//#region get penultimate commit hash
|
|
44
|
-
|
|
37
|
+
penultimateCommitHash(cwd) {
|
|
45
38
|
index_1.Helpers.log('[penultimateCommitHash] ' + cwd, 1);
|
|
46
39
|
try {
|
|
47
|
-
|
|
40
|
+
let hash = this.isInsideGitRepo(cwd) &&
|
|
48
41
|
tnp_core_1.child_process
|
|
49
|
-
.execSync(
|
|
42
|
+
.execSync(`git log -2 --format="%H"`, { cwd })
|
|
50
43
|
.toString()
|
|
51
44
|
.trim();
|
|
52
45
|
return hash;
|
|
53
46
|
}
|
|
54
47
|
catch (e) {
|
|
55
48
|
index_1.Helpers.log(e, 1);
|
|
56
|
-
index_1.Helpers.log(
|
|
49
|
+
index_1.Helpers.log(`[lastCommitHash] Not able to get last commit hash for repository in ${cwd}`, 1);
|
|
57
50
|
return null;
|
|
58
51
|
}
|
|
59
|
-
}
|
|
52
|
+
}
|
|
60
53
|
//#endregion
|
|
61
54
|
//#region check tag exists
|
|
62
|
-
|
|
63
|
-
if (cwd === void 0) { cwd = process.cwd(); }
|
|
55
|
+
checkTagExists(tag, cwd = process.cwd()) {
|
|
64
56
|
index_1.Helpers.log('[checkTagExists] ' + cwd, 1);
|
|
65
57
|
if (!index_1.Helpers.git.hasAnyCommits(cwd)) {
|
|
66
58
|
return false;
|
|
67
59
|
}
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
const command = `git show-ref --tags ${tag}`.trim();
|
|
61
|
+
const result = (index_1.Helpers.commnadOutputAsString(command, cwd) || '') !== '';
|
|
70
62
|
return result;
|
|
71
|
-
}
|
|
63
|
+
}
|
|
72
64
|
//#endregion
|
|
73
65
|
//#region get last tag version name
|
|
74
|
-
|
|
66
|
+
lastTagVersionName(cwd) {
|
|
75
67
|
index_1.Helpers.log('[lastTagVersionName] ' + cwd, 1);
|
|
76
68
|
if (!index_1.Helpers.git.hasAnyCommits(cwd)) {
|
|
77
69
|
return void 0;
|
|
78
70
|
}
|
|
79
71
|
try {
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
command = 'git
|
|
72
|
+
let command = `git describe --tags $(git rev-list --tags --max-count=1)`;
|
|
73
|
+
if (tnp_core_2.UtilsOs.isRunningInWindowsCmd()) {
|
|
74
|
+
command = `for /f %i in ('git rev-list --tags --max-count=1') do @git describe --tags %i`;
|
|
83
75
|
}
|
|
84
|
-
|
|
76
|
+
const tag = index_1.Helpers.commnadOutputAsString(command, cwd);
|
|
85
77
|
if (!tag) {
|
|
86
78
|
return void 0;
|
|
87
79
|
}
|
|
88
80
|
return tag;
|
|
89
81
|
}
|
|
90
82
|
catch (e) {
|
|
91
|
-
index_1.Helpers.warn(
|
|
83
|
+
index_1.Helpers.warn(`[lastCommitHash] Not able to get last commit version name for repository in ${cwd}`, false);
|
|
92
84
|
return void 0;
|
|
93
85
|
}
|
|
94
|
-
}
|
|
86
|
+
}
|
|
95
87
|
//#endregion
|
|
96
88
|
//#region get last tag hash
|
|
97
89
|
/**
|
|
@@ -100,34 +92,34 @@ var HelpersGit = /** @class */ (function () {
|
|
|
100
92
|
* @param majorVersion example v1, or v2
|
|
101
93
|
* @returns name of trag
|
|
102
94
|
*/
|
|
103
|
-
|
|
95
|
+
lastTagNameForMajorVersion(cwd, majorVersion) {
|
|
104
96
|
index_1.Helpers.log('[taon-helpers][lastTagNameForMajorVersion] ' +
|
|
105
97
|
cwd +
|
|
106
98
|
' major ver:' +
|
|
107
99
|
majorVersion);
|
|
108
|
-
|
|
100
|
+
const tag = index_1.Helpers.git.lastTagVersionName(cwd);
|
|
109
101
|
if (!tag) {
|
|
110
102
|
return void 0;
|
|
111
103
|
}
|
|
112
104
|
// git describe --match "v1.1.*" --abbrev=0 --tags $(git rev-list --tags --max-count=1)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
let tagName = void 0;
|
|
106
|
+
const cm1 = `git describe --match "v${majorVersion.toString().replace('v', '')}.*" ` +
|
|
107
|
+
`--abbrev=0 `;
|
|
108
|
+
const cm2 = `git describe --match "v${majorVersion.toString().replace('v', '')}.*" ` +
|
|
109
|
+
`--abbrev=0 --tags $(git rev-list --tags --max-count=1)`;
|
|
110
|
+
const cm3 = `git describe --match "${majorVersion.toString().replace('v', '')}.*" ` +
|
|
111
|
+
`--abbrev=0`;
|
|
112
|
+
const cm4 = `git describe --match "${majorVersion.toString().replace('v', '')}.*" ` +
|
|
113
|
+
`--abbrev=0 --tags $(git rev-list --tags --max-count=1)`;
|
|
122
114
|
// console.log({
|
|
123
115
|
// cm1, cm2, cm3, cm4
|
|
124
116
|
// })
|
|
125
117
|
try {
|
|
126
118
|
if (process.platform === 'win32') {
|
|
127
|
-
tagName = tnp_core_1.child_process.execSync(cm1, { cwd
|
|
119
|
+
tagName = tnp_core_1.child_process.execSync(cm1, { cwd }).toString().trim();
|
|
128
120
|
}
|
|
129
121
|
else {
|
|
130
|
-
tagName = tnp_core_1.child_process.execSync(cm2, { cwd
|
|
122
|
+
tagName = tnp_core_1.child_process.execSync(cm2, { cwd }).toString().trim();
|
|
131
123
|
}
|
|
132
124
|
if (tagName) {
|
|
133
125
|
return tagName;
|
|
@@ -136,10 +128,10 @@ var HelpersGit = /** @class */ (function () {
|
|
|
136
128
|
catch (e) { }
|
|
137
129
|
try {
|
|
138
130
|
if (process.platform === 'win32') {
|
|
139
|
-
tagName = tnp_core_1.child_process.execSync(cm3, { cwd
|
|
131
|
+
tagName = tnp_core_1.child_process.execSync(cm3, { cwd }).toString().trim();
|
|
140
132
|
}
|
|
141
133
|
else {
|
|
142
|
-
tagName = tnp_core_1.child_process.execSync(cm4, { cwd
|
|
134
|
+
tagName = tnp_core_1.child_process.execSync(cm4, { cwd }).toString().trim();
|
|
143
135
|
}
|
|
144
136
|
if (tagName) {
|
|
145
137
|
return tagName;
|
|
@@ -147,139 +139,128 @@ var HelpersGit = /** @class */ (function () {
|
|
|
147
139
|
}
|
|
148
140
|
catch (e) { }
|
|
149
141
|
return void 0;
|
|
150
|
-
}
|
|
142
|
+
}
|
|
151
143
|
//#endregion
|
|
152
144
|
//#region get list of current git changes
|
|
153
|
-
|
|
145
|
+
getListOfCurrentGitChanges(cwd) {
|
|
154
146
|
//#region @backendFunc
|
|
155
147
|
try {
|
|
156
148
|
// Execute git status command to get the list of changes
|
|
157
|
-
|
|
149
|
+
const output = index_1.Helpers.commnadOutputAsString('git status --porcelain', cwd, {
|
|
158
150
|
biggerBuffer: true,
|
|
159
151
|
});
|
|
160
152
|
// Split the output into lines
|
|
161
|
-
|
|
153
|
+
const lines = output.trim().split('\n');
|
|
162
154
|
// Initialize arrays to hold modified, deleted, and untracked files
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
155
|
+
let modifiedFiles = [];
|
|
156
|
+
let deletedFiles = [];
|
|
157
|
+
let createdFiles = [];
|
|
166
158
|
// Process each line to determine the type of change
|
|
167
|
-
lines.forEach(
|
|
168
|
-
|
|
159
|
+
lines.forEach(line => {
|
|
160
|
+
const [changeType, filePath] = line.trim().split(/\s+/);
|
|
169
161
|
switch (changeType) {
|
|
170
162
|
case 'M': // Modified
|
|
171
|
-
|
|
163
|
+
modifiedFiles.push(filePath);
|
|
172
164
|
break;
|
|
173
165
|
case 'A': // Created (goes to added)
|
|
174
|
-
|
|
166
|
+
modifiedFiles.push(filePath);
|
|
175
167
|
break;
|
|
176
168
|
case 'D': // Deleted
|
|
177
|
-
|
|
169
|
+
deletedFiles.push(filePath);
|
|
178
170
|
break;
|
|
179
171
|
case '??': // Untracked (newly created)
|
|
180
|
-
|
|
172
|
+
createdFiles.push(filePath);
|
|
181
173
|
break;
|
|
182
174
|
default:
|
|
183
175
|
// Ignore other types of changes
|
|
184
176
|
break;
|
|
185
177
|
}
|
|
186
178
|
});
|
|
187
|
-
|
|
188
|
-
files = files.reduce(
|
|
189
|
-
|
|
190
|
-
|
|
179
|
+
const fixFolders = (files) => {
|
|
180
|
+
files = files.reduce((acc, curr) => {
|
|
181
|
+
const newFiles = [curr];
|
|
182
|
+
const fullPath = (0, tnp_core_1.crossPlatformPath)([cwd, curr]);
|
|
191
183
|
if (index_1.Helpers.isFolder(fullPath)) {
|
|
192
|
-
newFiles.push
|
|
193
|
-
return f.replace(cwd + '/', '');
|
|
194
|
-
})), false));
|
|
184
|
+
newFiles.push(...index_1.Helpers.filesFrom(fullPath, true).map(f => f.replace(cwd + '/', '')));
|
|
195
185
|
}
|
|
196
|
-
return
|
|
186
|
+
return [...acc, ...newFiles];
|
|
197
187
|
}, []);
|
|
198
188
|
return files;
|
|
199
189
|
};
|
|
200
|
-
|
|
201
|
-
|
|
190
|
+
modifiedFiles = fixFolders(modifiedFiles);
|
|
191
|
+
createdFiles = fixFolders(createdFiles);
|
|
202
192
|
return {
|
|
203
|
-
modified:
|
|
204
|
-
deleted:
|
|
205
|
-
created:
|
|
193
|
+
modified: modifiedFiles,
|
|
194
|
+
deleted: deletedFiles,
|
|
195
|
+
created: createdFiles,
|
|
206
196
|
};
|
|
207
197
|
}
|
|
208
198
|
catch (error) {
|
|
209
199
|
index_1.Helpers.error('[taon-helpers][git] Error:' + error.message, false, true);
|
|
210
200
|
}
|
|
211
201
|
//#endregion
|
|
212
|
-
}
|
|
202
|
+
}
|
|
213
203
|
//#endregion
|
|
214
204
|
//#region get last tag hash
|
|
215
|
-
|
|
205
|
+
lastTagHash(cwd) {
|
|
216
206
|
index_1.Helpers.log('[taon-helpers][lastTagHash] ' + cwd, 1);
|
|
217
207
|
try {
|
|
218
|
-
|
|
208
|
+
const tag = index_1.Helpers.git.lastTagVersionName(cwd);
|
|
219
209
|
if (!tag) {
|
|
220
210
|
return null;
|
|
221
211
|
}
|
|
222
|
-
|
|
223
|
-
.execSync(
|
|
212
|
+
let hash = tnp_core_1.child_process
|
|
213
|
+
.execSync(`git log -1 --format=format:"%H" ${tag}`, { cwd })
|
|
224
214
|
.toString()
|
|
225
215
|
.trim();
|
|
226
216
|
return hash;
|
|
227
217
|
}
|
|
228
218
|
catch (e) {
|
|
229
219
|
index_1.Helpers.log(e, 1);
|
|
230
|
-
index_1.Helpers.log(
|
|
220
|
+
index_1.Helpers.log(`[taon-helpers][lastCommitHash] Not able to get last commit hash for repository in ${cwd}`, 1);
|
|
231
221
|
return null;
|
|
232
222
|
}
|
|
233
|
-
}
|
|
223
|
+
}
|
|
234
224
|
//#endregion
|
|
235
225
|
//#region get last commit date
|
|
236
|
-
|
|
226
|
+
lastCommitDate(cwd) {
|
|
237
227
|
index_1.Helpers.log('[taon-helpers][lastCommitDate] ' + cwd, 1);
|
|
238
228
|
try {
|
|
239
|
-
|
|
229
|
+
let unixTimestamp = this.isInsideGitRepo(cwd) &&
|
|
240
230
|
tnp_core_1.child_process
|
|
241
|
-
.execSync(
|
|
231
|
+
.execSync(`git log -1 --pretty=format:%ct`, { cwd })
|
|
242
232
|
.toString()
|
|
243
233
|
.trim();
|
|
244
234
|
return new Date(Number(unixTimestamp) * 1000);
|
|
245
235
|
}
|
|
246
236
|
catch (e) {
|
|
247
237
|
index_1.Helpers.log(e, 1);
|
|
248
|
-
index_1.Helpers.log(
|
|
238
|
+
index_1.Helpers.log(`[taon-helpers][lastCommitDate] Cannot counts commits in branch in: ${cwd}`, 1);
|
|
249
239
|
return null;
|
|
250
240
|
}
|
|
251
|
-
}
|
|
241
|
+
}
|
|
252
242
|
//#endregion
|
|
253
243
|
//#region get commit message by hash
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
_b.trys.push([0, 2, , 3]);
|
|
262
|
-
git = (0, simple_git_1.default)(cwd);
|
|
263
|
-
return [4 /*yield*/, git.log({
|
|
264
|
-
// from: hash.trim(), TODO this is not working with "to" ... very weird
|
|
265
|
-
// to: hash.trim(), // TODO this is not working with "from" ... very weird
|
|
266
|
-
})];
|
|
267
|
-
case 1:
|
|
268
|
-
log = _b.sent();
|
|
269
|
-
if (log.total === 0) {
|
|
270
|
-
console.warn("[taon-helpers][getCommitMessageByHash] No commit found with hash \"".concat(hash, "\""));
|
|
271
|
-
return [2 /*return*/, ''];
|
|
272
|
-
}
|
|
273
|
-
return [2 /*return*/, ((_a = log.all.find(function (f) { return f.hash === hash; })) === null || _a === void 0 ? void 0 : _a.message) || ''];
|
|
274
|
-
case 2:
|
|
275
|
-
error_1 = _b.sent();
|
|
276
|
-
console.error('Error getting commit message by hash:', error_1);
|
|
277
|
-
throw error_1;
|
|
278
|
-
case 3: return [2 /*return*/];
|
|
279
|
-
}
|
|
244
|
+
async getCommitMessageByHash(cwd, hash) {
|
|
245
|
+
//#region @backendFunc
|
|
246
|
+
try {
|
|
247
|
+
const git = (0, simple_git_1.default)(cwd);
|
|
248
|
+
const log = await git.log({
|
|
249
|
+
// from: hash.trim(), TODO this is not working with "to" ... very weird
|
|
250
|
+
// to: hash.trim(), // TODO this is not working with "from" ... very weird
|
|
280
251
|
});
|
|
281
|
-
|
|
282
|
-
|
|
252
|
+
if (log.total === 0) {
|
|
253
|
+
console.warn(`[taon-helpers][getCommitMessageByHash] No commit found with hash "${hash}"`);
|
|
254
|
+
return '';
|
|
255
|
+
}
|
|
256
|
+
return log.all.find(f => f.hash === hash)?.message || '';
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
console.error('Error getting commit message by hash:', error);
|
|
260
|
+
throw error;
|
|
261
|
+
}
|
|
262
|
+
//#endregion
|
|
263
|
+
}
|
|
283
264
|
//#endregion
|
|
284
265
|
//#region get commit message by index
|
|
285
266
|
/**
|
|
@@ -287,33 +268,27 @@ var HelpersGit = /** @class */ (function () {
|
|
|
287
268
|
* @param cwd string
|
|
288
269
|
* @param index zero means last commit
|
|
289
270
|
*/
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
return [2 /*return*/, ''];
|
|
312
|
-
case 3: return [2 /*return*/];
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
});
|
|
316
|
-
};
|
|
271
|
+
async getCommitMessageByIndex(cwd, index) {
|
|
272
|
+
//#region @backendFunc
|
|
273
|
+
try {
|
|
274
|
+
const git = (0, simple_git_1.default)(cwd);
|
|
275
|
+
// Get the list of commits with their messages
|
|
276
|
+
const log = await git.log();
|
|
277
|
+
// Reverse the array to handle zero-based index from the last commit
|
|
278
|
+
const commitMessages = log.all;
|
|
279
|
+
if (index < 0 || index >= commitMessages.length) {
|
|
280
|
+
console.warn(`[taon-helpers][getCommitMessageByIndex] Index (${index}) out of bounds`);
|
|
281
|
+
return '';
|
|
282
|
+
}
|
|
283
|
+
// Return the commit message by index
|
|
284
|
+
return commitMessages[index].message;
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
console.error('Error:', error);
|
|
288
|
+
return '';
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
}
|
|
317
292
|
//#endregion
|
|
318
293
|
//#region get commit hash by index
|
|
319
294
|
/**
|
|
@@ -321,65 +296,52 @@ var HelpersGit = /** @class */ (function () {
|
|
|
321
296
|
* @param cwd string
|
|
322
297
|
* @param index zero means last commit
|
|
323
298
|
*/
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return [2 /*return*/, ''];
|
|
346
|
-
case 3: return [2 /*return*/];
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
};
|
|
299
|
+
async getCommitHashByIndex(cwd, index) {
|
|
300
|
+
//#region @backendFunc
|
|
301
|
+
try {
|
|
302
|
+
const git = (0, simple_git_1.default)(cwd);
|
|
303
|
+
// Get the list of commits with their messages
|
|
304
|
+
const log = await git.log();
|
|
305
|
+
// Reverse the array to handle zero-based index from the last commit
|
|
306
|
+
const commits = log.all;
|
|
307
|
+
if (index < 0 || index >= commits.length) {
|
|
308
|
+
console.warn(`[taon-helpers][getCommitMessageByIndex] Index (${index}) out of bounds`);
|
|
309
|
+
return '';
|
|
310
|
+
}
|
|
311
|
+
// Return the commit message by index
|
|
312
|
+
return commits[index].hash;
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
console.error('Error:', error);
|
|
316
|
+
return '';
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
319
|
+
}
|
|
351
320
|
//#endregion
|
|
352
321
|
//#region get last commit date
|
|
353
|
-
|
|
322
|
+
lastCommitMessage(cwd) {
|
|
354
323
|
index_1.Helpers.log('[taon-helpers][lastCommitMessage] ' + cwd, 1);
|
|
355
324
|
try {
|
|
356
|
-
|
|
357
|
-
.execSync(
|
|
325
|
+
let unixTimestamp = tnp_core_1.child_process
|
|
326
|
+
.execSync(`git log -1 --pretty=%B`, { cwd })
|
|
358
327
|
.toString()
|
|
359
328
|
.trim();
|
|
360
329
|
return unixTimestamp;
|
|
361
330
|
}
|
|
362
331
|
catch (e) {
|
|
363
332
|
index_1.Helpers.log(e, 1);
|
|
364
|
-
index_1.Helpers.log(
|
|
333
|
+
index_1.Helpers.log(`[taon-helpers]lastCommitMessage] Cannot display last commit message in branch in: ${cwd}`, 1);
|
|
365
334
|
return null;
|
|
366
335
|
}
|
|
367
|
-
}
|
|
336
|
+
}
|
|
368
337
|
//#endregion
|
|
369
338
|
//#region get penultimate commit message
|
|
370
|
-
|
|
371
|
-
return
|
|
372
|
-
|
|
373
|
-
switch (_a.label) {
|
|
374
|
-
case 0: return [4 /*yield*/, this.getCommitMessageByIndex(cwd, 1)];
|
|
375
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
};
|
|
339
|
+
async penultimateCommitMessage(cwd) {
|
|
340
|
+
return await this.getCommitMessageByIndex(cwd, 1);
|
|
341
|
+
}
|
|
380
342
|
//#endregion
|
|
381
343
|
//#region get number of commit in repository
|
|
382
|
-
|
|
344
|
+
countCommits(cwd) {
|
|
383
345
|
index_1.Helpers.log('[taon-helpers][countCommits] ' + cwd, 1);
|
|
384
346
|
if (!index_1.Helpers.git.hasAnyCommits(cwd)) {
|
|
385
347
|
return 0;
|
|
@@ -387,25 +349,25 @@ var HelpersGit = /** @class */ (function () {
|
|
|
387
349
|
try {
|
|
388
350
|
index_1.Helpers.log('[taon-helpers] RUNNING COUNT COMMITS');
|
|
389
351
|
// git rev-parse HEAD &> /dev/null check if any commits
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
index_1.Helpers.commnadOutputAsString(
|
|
352
|
+
let currentLocalBranch = this.currentBranchName(cwd);
|
|
353
|
+
let value = Number(this.isInsideGitRepo(cwd) &&
|
|
354
|
+
index_1.Helpers.commnadOutputAsString(`git rev-list --count ${currentLocalBranch}`, cwd).trim());
|
|
393
355
|
return !isNaN(value) ? value : 0;
|
|
394
356
|
}
|
|
395
357
|
catch (e) {
|
|
396
358
|
index_1.Helpers.log(e, 1);
|
|
397
|
-
index_1.Helpers.log(
|
|
359
|
+
index_1.Helpers.log(`[taon-helpers][countCommits] Cannot counts commits in branch in: ${cwd}`, 1);
|
|
398
360
|
return 0;
|
|
399
361
|
}
|
|
400
|
-
}
|
|
362
|
+
}
|
|
401
363
|
//#endregion
|
|
402
364
|
//#region get number of commit in repository
|
|
403
|
-
|
|
365
|
+
hasAnyCommits(cwd) {
|
|
404
366
|
// con.log('[taon-helpers][hasAnyCommits] ' + cwd, 1)
|
|
405
367
|
try {
|
|
406
368
|
if (process.platform === 'win32') {
|
|
407
369
|
index_1.Helpers.run('git rev-parse HEAD', {
|
|
408
|
-
cwd
|
|
370
|
+
cwd,
|
|
409
371
|
silence: true,
|
|
410
372
|
output: false,
|
|
411
373
|
}).sync();
|
|
@@ -413,7 +375,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
413
375
|
}
|
|
414
376
|
else {
|
|
415
377
|
tnp_core_1.child_process
|
|
416
|
-
.execSync('git rev-parse HEAD &> /dev/null', { cwd
|
|
378
|
+
.execSync('git rev-parse HEAD &> /dev/null', { cwd })
|
|
417
379
|
.toString()
|
|
418
380
|
.trim();
|
|
419
381
|
}
|
|
@@ -422,13 +384,13 @@ var HelpersGit = /** @class */ (function () {
|
|
|
422
384
|
catch (e) {
|
|
423
385
|
return false;
|
|
424
386
|
}
|
|
425
|
-
}
|
|
387
|
+
}
|
|
426
388
|
//#endregion
|
|
427
389
|
//#region get number of commit in repository
|
|
428
|
-
|
|
390
|
+
isInMergeProcess(cwd) {
|
|
429
391
|
index_1.Helpers.log('[taon-helpers][hasAnyCommits] ' + cwd, 1);
|
|
430
392
|
try {
|
|
431
|
-
|
|
393
|
+
const message = (tnp_core_1.child_process.execSync(`git status`, { cwd }) || '')
|
|
432
394
|
.toString()
|
|
433
395
|
.trim();
|
|
434
396
|
return message.search('Unmerged paths:') !== -1;
|
|
@@ -436,34 +398,34 @@ var HelpersGit = /** @class */ (function () {
|
|
|
436
398
|
catch (e) {
|
|
437
399
|
return false;
|
|
438
400
|
}
|
|
439
|
-
}
|
|
401
|
+
}
|
|
440
402
|
//#endregion
|
|
441
403
|
//#region get branches names
|
|
442
|
-
|
|
404
|
+
getBranchesNames(cwd, pattern) {
|
|
443
405
|
index_1.Helpers.log('[taon-helpers][getBranchesNames] ' + cwd, 1);
|
|
444
406
|
try {
|
|
445
|
-
|
|
407
|
+
let branchPattern = pattern;
|
|
446
408
|
if (tnp_core_1._.isString(pattern)) {
|
|
447
|
-
|
|
409
|
+
branchPattern = new RegExp(pattern.replace(/[^a-zA-Z0-9]+/g, '.*'));
|
|
448
410
|
}
|
|
449
|
-
|
|
411
|
+
const command = `git branch -a`;
|
|
450
412
|
// console.log({ command, cwd })
|
|
451
|
-
|
|
413
|
+
const branchNamesFromStdout = index_1.Helpers.commnadOutputAsString(command, cwd, {
|
|
452
414
|
biggerBuffer: true,
|
|
453
415
|
});
|
|
454
416
|
// console.log({ branchPattern, branchNamesFromStdout });
|
|
455
|
-
|
|
417
|
+
const branchNamesFiltered = branchNamesFromStdout
|
|
456
418
|
.toString()
|
|
457
419
|
.trim()
|
|
458
420
|
.split('\n')
|
|
459
|
-
.map(
|
|
460
|
-
.filter(
|
|
421
|
+
.map(l => l.replace('*', '').replace(`remotes/origin/`, '').trim())
|
|
422
|
+
.filter(l => {
|
|
461
423
|
if (l.includes('->')) {
|
|
462
424
|
return false;
|
|
463
425
|
}
|
|
464
426
|
// console.log('testing: ' + l)
|
|
465
|
-
if (tnp_core_1._.isRegExp(
|
|
466
|
-
|
|
427
|
+
if (tnp_core_1._.isRegExp(branchPattern)) {
|
|
428
|
+
const match = branchPattern.test(l);
|
|
467
429
|
return match;
|
|
468
430
|
}
|
|
469
431
|
// if (_.isString(pattern)) {
|
|
@@ -479,37 +441,37 @@ var HelpersGit = /** @class */ (function () {
|
|
|
479
441
|
index_1.Helpers.log('[taon-helpers][getBranchesNames] not able to get branches names');
|
|
480
442
|
return [];
|
|
481
443
|
}
|
|
482
|
-
}
|
|
444
|
+
}
|
|
483
445
|
//#endregion
|
|
484
446
|
//#region get all origins
|
|
485
|
-
|
|
447
|
+
allOrigins(cwd) {
|
|
486
448
|
// Determine the path to the .git/config file
|
|
487
|
-
|
|
449
|
+
const gitConfigPath = (0, tnp_core_1.crossPlatformPath)([cwd, '.git', 'config']);
|
|
488
450
|
// Read the contents of the .git/config file synchronously
|
|
489
451
|
try {
|
|
490
|
-
|
|
491
|
-
|
|
452
|
+
const configFile = tnp_core_1.fse.readFileSync(gitConfigPath, 'utf-8');
|
|
453
|
+
const config = ini.parse(configFile);
|
|
492
454
|
// Extract remotes from the config object
|
|
493
|
-
|
|
494
|
-
.filter(
|
|
495
|
-
.map(
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return { origin: name, url
|
|
455
|
+
const remotes = Object.keys(config)
|
|
456
|
+
.filter(key => key.startsWith('remote '))
|
|
457
|
+
.map(remoteKey => {
|
|
458
|
+
const name = remoteKey.split('"')[1]; // Parse out the name from the section key
|
|
459
|
+
const url = config[remoteKey].url;
|
|
460
|
+
return { origin: name, url };
|
|
499
461
|
});
|
|
500
462
|
return remotes;
|
|
501
463
|
}
|
|
502
464
|
catch (error) {
|
|
503
465
|
return [];
|
|
504
466
|
}
|
|
505
|
-
}
|
|
467
|
+
}
|
|
506
468
|
//#endregion
|
|
507
469
|
//#region get current branch name
|
|
508
|
-
|
|
470
|
+
currentBranchName(cwd) {
|
|
509
471
|
index_1.Helpers.log('[taon-helpers][currentBranchName] ' + cwd, 1);
|
|
510
472
|
try {
|
|
511
|
-
|
|
512
|
-
.execSync(
|
|
473
|
+
const branchName = tnp_core_1.child_process
|
|
474
|
+
.execSync(`git branch | sed -n '/\* /s///p'`, { cwd })
|
|
513
475
|
.toString()
|
|
514
476
|
.trim();
|
|
515
477
|
return branchName;
|
|
@@ -517,54 +479,57 @@ var HelpersGit = /** @class */ (function () {
|
|
|
517
479
|
catch (e) {
|
|
518
480
|
index_1.Helpers.error(e);
|
|
519
481
|
}
|
|
520
|
-
}
|
|
482
|
+
}
|
|
521
483
|
//#endregion
|
|
522
484
|
//#region commit "what is"
|
|
523
|
-
|
|
485
|
+
stageAllAndCommit(cwd, commitMessage) {
|
|
524
486
|
this.stageAllFiles(cwd);
|
|
525
487
|
this.commit(cwd, commitMessage);
|
|
526
|
-
}
|
|
488
|
+
}
|
|
527
489
|
//#endregion
|
|
528
490
|
//#region commit
|
|
529
|
-
|
|
491
|
+
commit(cwd, commitMessage) {
|
|
530
492
|
index_1.Helpers.log('[taon-helpers][commit] ' + cwd, 1);
|
|
531
493
|
if (!tnp_core_1._.isString(commitMessage)) {
|
|
532
494
|
commitMessage = 'update';
|
|
533
495
|
}
|
|
534
496
|
if (commitMessage.search('-m') === -1 &&
|
|
535
497
|
commitMessage.search('-msg') === -1) {
|
|
536
|
-
|
|
498
|
+
const addBrackets = !((commitMessage.startsWith("'") || commitMessage.startsWith('"')) &&
|
|
537
499
|
(commitMessage.endsWith("'") || commitMessage.endsWith('"')));
|
|
538
500
|
commitMessage =
|
|
539
|
-
|
|
501
|
+
`${addBrackets ? `"${commitMessage}"` : commitMessage}`.replace(/\"\"/g, '"');
|
|
540
502
|
}
|
|
541
503
|
if (process.platform === 'win32') {
|
|
542
504
|
commitMessage = commitMessage
|
|
543
505
|
.split('\n')
|
|
544
|
-
.filter(
|
|
545
|
-
.map(
|
|
506
|
+
.filter(f => !!f.trim())
|
|
507
|
+
.map(l => ` -m "${l}" `)
|
|
546
508
|
.join(' ');
|
|
547
509
|
}
|
|
548
510
|
else {
|
|
549
|
-
commitMessage =
|
|
511
|
+
commitMessage = `-m ${commitMessage}`;
|
|
550
512
|
}
|
|
551
513
|
if (process.platform !== 'win32') {
|
|
552
|
-
commitMessage = commitMessage.replace(/\"/g,
|
|
514
|
+
commitMessage = commitMessage.replace(/\"/g, `'`);
|
|
553
515
|
}
|
|
554
|
-
commitMessage = commitMessage.replace(/\"\"/g, "
|
|
555
|
-
commitMessage = commitMessage.replace(/\'\'/g,
|
|
516
|
+
commitMessage = commitMessage.replace(/\"\"/g, `"`);
|
|
517
|
+
commitMessage = commitMessage.replace(/\'\'/g, `'`);
|
|
556
518
|
try {
|
|
557
|
-
index_1.Helpers.info(
|
|
558
|
-
|
|
519
|
+
index_1.Helpers.info(`[taon-helpers][git][commit] trying to commit what it with argument:
|
|
520
|
+
"${commitMessage}"
|
|
521
|
+
location: ${cwd}
|
|
522
|
+
`);
|
|
523
|
+
var commandToExecute = `git commit --no-verify ${commitMessage}`;
|
|
559
524
|
// Helpers.info(`COMMITING WITH COMMAND: ${commandToExecute}`);
|
|
560
525
|
// process.exit(0)
|
|
561
|
-
index_1.Helpers.run(commandToExecute, { cwd
|
|
526
|
+
index_1.Helpers.run(commandToExecute, { cwd }).sync();
|
|
562
527
|
}
|
|
563
528
|
catch (error) {
|
|
564
529
|
index_1.Helpers.log(error);
|
|
565
|
-
index_1.Helpers.log(
|
|
530
|
+
index_1.Helpers.log(`[taon-helpers][git][commit] not able to commit with command: ${commandToExecute}`);
|
|
566
531
|
}
|
|
567
|
-
}
|
|
532
|
+
}
|
|
568
533
|
//#endregion
|
|
569
534
|
//#region get remote origin
|
|
570
535
|
/**
|
|
@@ -573,16 +538,15 @@ var HelpersGit = /** @class */ (function () {
|
|
|
573
538
|
* Note: address ends with .git always
|
|
574
539
|
*
|
|
575
540
|
*/
|
|
576
|
-
|
|
577
|
-
if (differentOriginName === void 0) { differentOriginName = ''; }
|
|
541
|
+
getOriginURL(cwd, differentOriginName = '') {
|
|
578
542
|
index_1.Helpers.log('[taon-helpers][getOriginURL] ' + cwd, 1);
|
|
579
543
|
if (!this.isInsideGitRepo(cwd)) {
|
|
580
544
|
return;
|
|
581
545
|
}
|
|
582
|
-
|
|
546
|
+
let url = '';
|
|
583
547
|
try {
|
|
584
548
|
// git config --get remote.origin.url
|
|
585
|
-
url = index_1.Helpers.run(
|
|
549
|
+
url = index_1.Helpers.run(`git config --get remote.${differentOriginName ? differentOriginName : 'origin'}.url`, { output: false, cwd })
|
|
586
550
|
.sync()
|
|
587
551
|
.toString()
|
|
588
552
|
.trim();
|
|
@@ -592,18 +556,18 @@ var HelpersGit = /** @class */ (function () {
|
|
|
592
556
|
return void 0;
|
|
593
557
|
}
|
|
594
558
|
if (!url.endsWith('.git')) {
|
|
595
|
-
return
|
|
559
|
+
return `${url}.git`;
|
|
596
560
|
}
|
|
597
561
|
return url;
|
|
598
|
-
}
|
|
562
|
+
}
|
|
599
563
|
//#endregion
|
|
600
564
|
//#region find git root
|
|
601
|
-
|
|
565
|
+
findGitRoot(cwd) {
|
|
602
566
|
if (this.isGitRoot(cwd)) {
|
|
603
567
|
return cwd;
|
|
604
568
|
}
|
|
605
|
-
|
|
606
|
-
|
|
569
|
+
let absoluteLocation = (0, tnp_core_1.crossPlatformPath)(cwd);
|
|
570
|
+
let previousLocation;
|
|
607
571
|
if (tnp_core_1.fse.existsSync(absoluteLocation)) {
|
|
608
572
|
absoluteLocation = tnp_core_1.fse.realpathSync(absoluteLocation);
|
|
609
573
|
}
|
|
@@ -620,7 +584,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
620
584
|
break;
|
|
621
585
|
}
|
|
622
586
|
previousLocation = absoluteLocation;
|
|
623
|
-
|
|
587
|
+
const newAbsLocation = tnp_core_1.path.join(absoluteLocation, '..');
|
|
624
588
|
if (!tnp_core_1.path.isAbsolute(newAbsLocation)) {
|
|
625
589
|
return;
|
|
626
590
|
}
|
|
@@ -634,23 +598,24 @@ var HelpersGit = /** @class */ (function () {
|
|
|
634
598
|
}
|
|
635
599
|
}
|
|
636
600
|
return absoluteLocation;
|
|
637
|
-
}
|
|
601
|
+
}
|
|
638
602
|
//#endregion
|
|
639
603
|
//#region is git root
|
|
640
|
-
|
|
641
|
-
var _a, _b;
|
|
604
|
+
isGitRoot(cwd) {
|
|
642
605
|
index_1.Helpers.log('[taon-helpers][isGitRoot] ' + cwd, 1);
|
|
643
606
|
if (!tnp_core_1.fse.existsSync((0, tnp_core_1.crossPlatformPath)([cwd, '.git']))) {
|
|
644
607
|
return false;
|
|
645
608
|
}
|
|
646
609
|
index_1.Helpers.log('[taon-helpers][isGitRepo] ' + cwd, 1);
|
|
647
610
|
try {
|
|
648
|
-
var rootGitCwd =
|
|
611
|
+
var rootGitCwd = index_1.Helpers.run('git rev-parse --show-toplevel', {
|
|
649
612
|
biggerBuffer: false,
|
|
650
|
-
cwd
|
|
613
|
+
cwd,
|
|
651
614
|
output: false,
|
|
652
615
|
})
|
|
653
|
-
.sync()
|
|
616
|
+
.sync()
|
|
617
|
+
?.toString()
|
|
618
|
+
?.trim();
|
|
654
619
|
// console.log({
|
|
655
620
|
// rootGitCwd,
|
|
656
621
|
// cwd
|
|
@@ -660,10 +625,10 @@ var HelpersGit = /** @class */ (function () {
|
|
|
660
625
|
catch (e) {
|
|
661
626
|
return false;
|
|
662
627
|
}
|
|
663
|
-
}
|
|
628
|
+
}
|
|
664
629
|
//#endregion
|
|
665
630
|
//#region is git repo
|
|
666
|
-
|
|
631
|
+
isInsideGitRepo(cwd) {
|
|
667
632
|
index_1.Helpers.log('[taon-helpers][isGitRepo] ' + cwd, 1);
|
|
668
633
|
if (!index_1.Helpers.git.hasAnyCommits(cwd)) {
|
|
669
634
|
return false;
|
|
@@ -671,7 +636,7 @@ var HelpersGit = /** @class */ (function () {
|
|
|
671
636
|
try {
|
|
672
637
|
var test = index_1.Helpers.run('git rev-parse --is-inside-work-tree', {
|
|
673
638
|
biggerBuffer: false,
|
|
674
|
-
cwd
|
|
639
|
+
cwd,
|
|
675
640
|
output: false,
|
|
676
641
|
}).sync();
|
|
677
642
|
}
|
|
@@ -679,149 +644,137 @@ var HelpersGit = /** @class */ (function () {
|
|
|
679
644
|
return false;
|
|
680
645
|
}
|
|
681
646
|
return !!test;
|
|
682
|
-
}
|
|
647
|
+
}
|
|
683
648
|
//#endregion
|
|
684
649
|
//#region reset soft HEAD
|
|
685
|
-
|
|
686
|
-
if (HEAD === void 0) { HEAD = 1; }
|
|
650
|
+
resetSoftHEAD(cwd, HEAD = 1) {
|
|
687
651
|
try {
|
|
688
|
-
tnp_core_1.child_process.execSync(
|
|
652
|
+
tnp_core_1.child_process.execSync(`git reset --soft HEAD~${HEAD}`, { cwd });
|
|
689
653
|
}
|
|
690
654
|
catch (error) {
|
|
691
|
-
index_1.Helpers.error(
|
|
655
|
+
index_1.Helpers.error(`[${tnp_config_1.config.frameworkName}] not able to soft repository in ${self.location}`);
|
|
692
656
|
}
|
|
693
|
-
}
|
|
657
|
+
}
|
|
694
658
|
//#endregion
|
|
695
659
|
//#region reset hard
|
|
696
|
-
|
|
660
|
+
resetHard(cwd, options) {
|
|
697
661
|
//#region @backendFunc
|
|
698
|
-
|
|
699
|
-
index_1.Helpers.info(
|
|
700
|
-
|
|
662
|
+
const { HEAD } = options || {};
|
|
663
|
+
index_1.Helpers.info(`[taon-helpers] [resetHard] ` +
|
|
664
|
+
`${tnp_core_1._.isNumber(HEAD) ? `HEAD~${HEAD}` : ''} ${cwd}`);
|
|
701
665
|
try {
|
|
702
|
-
tnp_core_1.child_process.execSync(
|
|
666
|
+
tnp_core_1.child_process.execSync(`git reset --hard ${tnp_core_1._.isNumber(HEAD) ? `HEAD~${HEAD}` : ''}`, { cwd });
|
|
703
667
|
}
|
|
704
668
|
catch (error) {
|
|
705
|
-
index_1.Helpers.error(
|
|
669
|
+
index_1.Helpers.error(`[${tnp_config_1.config.frameworkName}] not able to reset repository in ${self.location}`);
|
|
706
670
|
}
|
|
707
671
|
//#endregion
|
|
708
|
-
}
|
|
672
|
+
}
|
|
709
673
|
//#endregion
|
|
710
674
|
//#region pull
|
|
711
|
-
|
|
712
|
-
|
|
675
|
+
_pull(cwd, options) {
|
|
676
|
+
let { branchName, defaultHardResetCommits } = options || {};
|
|
713
677
|
if (tnp_core_1._.isNumber(defaultHardResetCommits)) {
|
|
714
678
|
this.resetHard(cwd, { HEAD: defaultHardResetCommits });
|
|
715
679
|
}
|
|
716
680
|
else {
|
|
717
681
|
this.resetHard(cwd);
|
|
718
682
|
}
|
|
719
|
-
tnp_core_1.child_process.execSync(
|
|
720
|
-
cwd
|
|
683
|
+
tnp_core_1.child_process.execSync(`git pull --tags --rebase origin ${branchName}`, {
|
|
684
|
+
cwd,
|
|
721
685
|
});
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
})];
|
|
785
|
-
case 4:
|
|
786
|
-
whatToDo = _a.sent();
|
|
787
|
-
acknowledgeBeforePull = whatToDo === 'openInVscode';
|
|
788
|
-
if (whatToDo === 'resetHardLast5Commits') {
|
|
789
|
-
try {
|
|
790
|
-
index_1.Helpers.git.resetHard(cwd, { HEAD: 5 });
|
|
791
|
-
}
|
|
792
|
-
catch (error) { }
|
|
793
|
-
return [3 /*break*/, 1];
|
|
794
|
-
}
|
|
795
|
-
if (whatToDo === 'openInVscode') {
|
|
796
|
-
try {
|
|
797
|
-
index_1.Helpers.run("code .", { cwd: cwd }).sync();
|
|
798
|
-
}
|
|
799
|
-
catch (error) { }
|
|
800
|
-
return [3 /*break*/, 1];
|
|
801
|
-
}
|
|
802
|
-
if (whatToDo === 'skip') {
|
|
803
|
-
return [3 /*break*/, 7];
|
|
686
|
+
}
|
|
687
|
+
async pullCurrentBranch(cwd, options) {
|
|
688
|
+
options = options || {};
|
|
689
|
+
let { askToRetry } = options || {};
|
|
690
|
+
index_1.Helpers.log('[taon-helpers][pullCurrentBranch] ' + cwd, 1);
|
|
691
|
+
if (global['tnpNonInteractive']) {
|
|
692
|
+
askToRetry = false;
|
|
693
|
+
}
|
|
694
|
+
index_1.Helpers.log(`askToRetry: ${askToRetry}`);
|
|
695
|
+
if (this.getOriginURL(cwd) === '') {
|
|
696
|
+
index_1.Helpers.warn(`Not pulling branch without ` +
|
|
697
|
+
`remote origin url.... in folder ${tnp_core_1.path.basename(cwd)}`);
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
index_1.Helpers.info(`[taon-helpers][${(0, tnp_core_1.dateformat)(new Date(), 'dd-mm-yyyy HH:MM:ss')}] Pulling git changes in "${cwd}", origin=${index_1.Helpers.git.getOriginURL(cwd)} `);
|
|
701
|
+
let acknowledgeBeforePull = false;
|
|
702
|
+
while (true) {
|
|
703
|
+
try {
|
|
704
|
+
if (acknowledgeBeforePull) {
|
|
705
|
+
index_1.Helpers.pressKeyAndContinue('Press any key to continue pulling...');
|
|
706
|
+
}
|
|
707
|
+
let currentLocalBranch = tnp_core_1.child_process
|
|
708
|
+
.execSync(`git branch | sed -n '/\* /s///p'`, { cwd })
|
|
709
|
+
.toString()
|
|
710
|
+
.trim();
|
|
711
|
+
index_1.Helpers.git._pull(cwd, {
|
|
712
|
+
...options,
|
|
713
|
+
branchName: currentLocalBranch,
|
|
714
|
+
});
|
|
715
|
+
index_1.Helpers.info(`[taon-helpers] Branch "${currentLocalBranch}" updated successfully in ${tnp_core_1.path.basename(cwd)}`);
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
catch (e) {
|
|
719
|
+
// console.log(e)
|
|
720
|
+
index_1.Helpers.error(`[taon-helpers] Cannot update current branch in: ${cwd}`, askToRetry, true);
|
|
721
|
+
if (askToRetry) {
|
|
722
|
+
//#region ask to retry question
|
|
723
|
+
const pullOptions = {
|
|
724
|
+
again: {
|
|
725
|
+
name: 'Try pull again',
|
|
726
|
+
},
|
|
727
|
+
skip: {
|
|
728
|
+
name: 'Skip pulling',
|
|
729
|
+
},
|
|
730
|
+
resetHardLast5Commits: {
|
|
731
|
+
name: 'Reset hard last 5 commits and pull again',
|
|
732
|
+
},
|
|
733
|
+
openInVscode: {
|
|
734
|
+
name: 'Open project in VSCode',
|
|
735
|
+
},
|
|
736
|
+
exit: {
|
|
737
|
+
name: 'Exit process',
|
|
738
|
+
},
|
|
739
|
+
};
|
|
740
|
+
const whatToDo = await tnp_core_2.UtilsTerminal.select({
|
|
741
|
+
question: 'What to do ?',
|
|
742
|
+
choices: pullOptions,
|
|
743
|
+
});
|
|
744
|
+
acknowledgeBeforePull = whatToDo === 'openInVscode';
|
|
745
|
+
if (whatToDo === 'resetHardLast5Commits') {
|
|
746
|
+
try {
|
|
747
|
+
index_1.Helpers.git.resetHard(cwd, { HEAD: 5 });
|
|
804
748
|
}
|
|
805
|
-
|
|
806
|
-
|
|
749
|
+
catch (error) { }
|
|
750
|
+
continue;
|
|
751
|
+
}
|
|
752
|
+
if (whatToDo === 'openInVscode') {
|
|
753
|
+
try {
|
|
754
|
+
index_1.Helpers.run(`code .`, { cwd }).sync();
|
|
807
755
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
756
|
+
catch (error) { }
|
|
757
|
+
continue;
|
|
758
|
+
}
|
|
759
|
+
if (whatToDo === 'skip') {
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
762
|
+
if (whatToDo === 'exit') {
|
|
763
|
+
process.exit(0);
|
|
764
|
+
}
|
|
765
|
+
//#endregion
|
|
814
766
|
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
index_1.Helpers.info(`[${(0, tnp_core_1.dateformat)(new Date(), 'dd-mm-yyyy HH:MM:ss')}] DONE PULLING`);
|
|
770
|
+
}
|
|
818
771
|
//#endregion
|
|
819
772
|
//#region melts action commits
|
|
820
773
|
/**
|
|
821
774
|
* Return number of melted action commits
|
|
822
775
|
*/
|
|
823
|
-
|
|
824
|
-
|
|
776
|
+
meltActionCommits(cwd) {
|
|
777
|
+
let i = 0;
|
|
825
778
|
while (true) {
|
|
826
779
|
if (this.lastCommitMessage(cwd) ===
|
|
827
780
|
index_1.Helpers.git.ACTION_MSG_RESET_GIT_HARD_COMMIT) {
|
|
@@ -832,118 +785,117 @@ var HelpersGit = /** @class */ (function () {
|
|
|
832
785
|
return i;
|
|
833
786
|
}
|
|
834
787
|
}
|
|
835
|
-
}
|
|
788
|
+
}
|
|
836
789
|
//#endregion
|
|
837
790
|
//#region push current branch
|
|
838
791
|
/**
|
|
839
792
|
* TODO issue 2: Updates were rejected because the tag already exists in the remote
|
|
840
793
|
* @returns info if process succeed
|
|
841
794
|
*/
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
index_1.Helpers.error("[taon-helpers] Not able to push branch ".concat(currentBranchName, " in (origin=").concat(origin, "):\n ").concat(cwd), true, true);
|
|
880
|
-
if (!askToRetry) {
|
|
881
|
-
return [2 /*return*/];
|
|
882
|
-
}
|
|
883
|
-
pushOptions = {
|
|
884
|
-
normal: {
|
|
885
|
-
name: 'Try normal push again ?',
|
|
886
|
-
},
|
|
887
|
-
force: {
|
|
888
|
-
name: 'Try again with force push ?',
|
|
889
|
-
},
|
|
890
|
-
openInVscode: {
|
|
891
|
-
name: 'Open in vscode window',
|
|
892
|
-
},
|
|
893
|
-
exit: {
|
|
894
|
-
name: 'Exit process',
|
|
895
|
-
},
|
|
896
|
-
};
|
|
897
|
-
return [4 /*yield*/, tnp_core_2.UtilsTerminal.select({
|
|
898
|
-
question: 'What to do ?',
|
|
899
|
-
choices: pushOptions,
|
|
900
|
-
})];
|
|
901
|
-
case 6:
|
|
902
|
-
whatToDo = _b.sent();
|
|
903
|
-
if (whatToDo === 'openInVscode') {
|
|
904
|
-
try {
|
|
905
|
-
index_1.Helpers.run("code .", { cwd: cwd }).sync();
|
|
906
|
-
}
|
|
907
|
-
catch (error) { }
|
|
908
|
-
return [3 /*break*/, 3];
|
|
909
|
-
}
|
|
910
|
-
if (whatToDo === 'exit') {
|
|
911
|
-
process.exit(0);
|
|
912
|
-
}
|
|
913
|
-
force = whatToDo === 'force';
|
|
914
|
-
return [3 /*break*/, 3];
|
|
915
|
-
case 7: return [3 /*break*/, 3];
|
|
916
|
-
case 8: return [2 /*return*/, true];
|
|
795
|
+
async pushCurrentBranch(cwd, options) {
|
|
796
|
+
options = options || {};
|
|
797
|
+
options.origin = options.origin ? options.origin : 'origin';
|
|
798
|
+
const { askToRetry, origin, forcePushNoQuestion = false } = options;
|
|
799
|
+
let { force } = options;
|
|
800
|
+
if (force && !forcePushNoQuestion) {
|
|
801
|
+
index_1.Helpers.info(`
|
|
802
|
+
Pushing force branch ${this.currentBranchName(cwd)} in location
|
|
803
|
+
|
|
804
|
+
${cwd}
|
|
805
|
+
|
|
806
|
+
`);
|
|
807
|
+
if (!(await index_1.Helpers.consoleGui.question.yesNo(`Are you sure ? `))) {
|
|
808
|
+
process.exit(0);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
index_1.Helpers.log('[taon-helpers][pushCurrentBranch] ' + cwd, 1);
|
|
812
|
+
const currentBranchName = index_1.Helpers.git.currentBranchName(cwd);
|
|
813
|
+
while (true) {
|
|
814
|
+
try {
|
|
815
|
+
const taskName = `
|
|
816
|
+
[${(0, tnp_core_1.dateformat)(new Date(), 'dd-mm-yyyy HH:MM:ss')}]
|
|
817
|
+
Pushing ${force ? 'FORCE' : 'NORMALLY'} current branch (remote=${origin}): ${currentBranchName}
|
|
818
|
+
`;
|
|
819
|
+
index_1.Helpers.info(taskName);
|
|
820
|
+
const command = `git push ${force ? '-f' : ''} ${origin} ${currentBranchName} --tags`;
|
|
821
|
+
index_1.Helpers.info(`[git][push] [${(0, tnp_core_1.dateformat)(new Date(), 'dd-mm-yyyy HH:MM:ss')}] ${force ? 'force' : 'normal'} pushing current branch ${currentBranchName} ,` +
|
|
822
|
+
` origin=${index_1.Helpers.git.getOriginURL(cwd, origin)}`);
|
|
823
|
+
index_1.Helpers.run(command, { cwd }).sync();
|
|
824
|
+
index_1.Helpers.info(taskName);
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
catch (err) {
|
|
828
|
+
index_1.Helpers.error(`[taon-helpers] Not able to push branch ${currentBranchName} in (origin=${origin}):
|
|
829
|
+
${cwd}`, true, true);
|
|
830
|
+
if (!askToRetry) {
|
|
831
|
+
return false;
|
|
917
832
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
833
|
+
const pushOptions = {
|
|
834
|
+
normal: {
|
|
835
|
+
name: 'Try normal push again ?',
|
|
836
|
+
},
|
|
837
|
+
force: {
|
|
838
|
+
name: 'Try again with force push ?',
|
|
839
|
+
},
|
|
840
|
+
skip: {
|
|
841
|
+
name: 'Skip pushing',
|
|
842
|
+
},
|
|
843
|
+
openInVscode: {
|
|
844
|
+
name: 'Open in vscode window',
|
|
845
|
+
},
|
|
846
|
+
exit: {
|
|
847
|
+
name: 'Exit process',
|
|
848
|
+
},
|
|
849
|
+
};
|
|
850
|
+
const whatToDo = await tnp_core_2.UtilsTerminal.select({
|
|
851
|
+
question: 'What to do ?',
|
|
852
|
+
choices: pushOptions,
|
|
853
|
+
});
|
|
854
|
+
if (whatToDo === 'openInVscode') {
|
|
855
|
+
try {
|
|
856
|
+
index_1.Helpers.run(`code .`, { cwd }).sync();
|
|
857
|
+
}
|
|
858
|
+
catch (error) { }
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
if (whatToDo === 'skip') {
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
if (whatToDo === 'exit') {
|
|
865
|
+
process.exit(0);
|
|
866
|
+
}
|
|
867
|
+
force = whatToDo === 'force';
|
|
868
|
+
continue;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return true;
|
|
872
|
+
}
|
|
921
873
|
//#endregion
|
|
922
874
|
//#region get default branch for repo
|
|
923
|
-
|
|
875
|
+
defaultRepoBranch(cwd) {
|
|
924
876
|
index_1.Helpers.log('[defaultRepoBranch] ' + cwd, 1);
|
|
925
877
|
try {
|
|
926
|
-
|
|
927
|
-
.execSync(
|
|
878
|
+
const defaultBranch = tnp_core_1.child_process
|
|
879
|
+
.execSync(`git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'`, { cwd })
|
|
928
880
|
.toString()
|
|
929
881
|
.trim();
|
|
930
882
|
return defaultBranch;
|
|
931
883
|
}
|
|
932
884
|
catch (e) {
|
|
933
885
|
index_1.Helpers.log(e);
|
|
934
|
-
index_1.Helpers.error(
|
|
886
|
+
index_1.Helpers.error(`Cannot find default branch for repo in : ${cwd}`);
|
|
935
887
|
}
|
|
936
|
-
}
|
|
888
|
+
}
|
|
937
889
|
//#endregion
|
|
938
890
|
//#region checkout default branch
|
|
939
|
-
|
|
891
|
+
checkoutDefaultBranch(cwd) {
|
|
940
892
|
index_1.Helpers.log('[checkoutDefaultBranch] ' + cwd, 1);
|
|
941
|
-
|
|
942
|
-
.execSync(
|
|
893
|
+
const defaultBranch = tnp_core_1.child_process
|
|
894
|
+
.execSync(`git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'`, { cwd })
|
|
943
895
|
.toString()
|
|
944
896
|
.trim();
|
|
945
|
-
tnp_core_1.child_process.execSync(
|
|
946
|
-
}
|
|
897
|
+
tnp_core_1.child_process.execSync(`git checkout ${defaultBranch}`, { cwd });
|
|
898
|
+
}
|
|
947
899
|
//#endregion
|
|
948
900
|
//#region add
|
|
949
901
|
/**
|
|
@@ -951,12 +903,25 @@ var HelpersGit = /** @class */ (function () {
|
|
|
951
903
|
* @param cwd
|
|
952
904
|
* @param optinos
|
|
953
905
|
*/
|
|
954
|
-
|
|
906
|
+
stageAllFiles(cwd) {
|
|
955
907
|
try {
|
|
956
|
-
tnp_core_1.child_process.execSync(
|
|
908
|
+
tnp_core_1.child_process.execSync(`git add --all .`, { cwd });
|
|
957
909
|
}
|
|
958
910
|
catch (error) { }
|
|
959
|
-
}
|
|
911
|
+
}
|
|
912
|
+
//#endregion
|
|
913
|
+
//#region add
|
|
914
|
+
/**
|
|
915
|
+
*
|
|
916
|
+
* @param cwd
|
|
917
|
+
* @param optinos
|
|
918
|
+
*/
|
|
919
|
+
stageFile(cwd, fileRelativePath) {
|
|
920
|
+
try {
|
|
921
|
+
tnp_core_1.child_process.execSync(`git add ${fileRelativePath}`, { cwd });
|
|
922
|
+
}
|
|
923
|
+
catch (error) { }
|
|
924
|
+
}
|
|
960
925
|
//#endregion
|
|
961
926
|
//#region stash
|
|
962
927
|
/**
|
|
@@ -964,47 +929,63 @@ var HelpersGit = /** @class */ (function () {
|
|
|
964
929
|
* @param cwd
|
|
965
930
|
* @param optinos
|
|
966
931
|
*/
|
|
967
|
-
|
|
968
|
-
|
|
932
|
+
stash(cwd, optinos) {
|
|
933
|
+
const { onlyStaged } = optinos || {};
|
|
969
934
|
// console.log({ onlyStaged, cwd });
|
|
970
935
|
try {
|
|
971
936
|
if (onlyStaged) {
|
|
972
|
-
tnp_core_1.child_process.execSync(
|
|
937
|
+
tnp_core_1.child_process.execSync(`git stash push --staged`, { cwd });
|
|
973
938
|
}
|
|
974
939
|
else {
|
|
975
|
-
tnp_core_1.child_process.execSync(
|
|
940
|
+
tnp_core_1.child_process.execSync(`git stash -u`, { cwd });
|
|
976
941
|
}
|
|
977
942
|
}
|
|
978
943
|
catch (error) {
|
|
979
944
|
index_1.Helpers.info('Not able to stash changes');
|
|
980
945
|
console.error(error);
|
|
981
946
|
}
|
|
982
|
-
}
|
|
947
|
+
}
|
|
948
|
+
//#endregion
|
|
949
|
+
//#region rebase
|
|
950
|
+
/**
|
|
951
|
+
*
|
|
952
|
+
* @param cwd
|
|
953
|
+
* @param optinos
|
|
954
|
+
*/
|
|
955
|
+
rebase(cwd, toBranch) {
|
|
956
|
+
// console.log({ onlyStaged, cwd });
|
|
957
|
+
try {
|
|
958
|
+
tnp_core_1.child_process.execSync(`git rebase ${toBranch}`, { cwd });
|
|
959
|
+
}
|
|
960
|
+
catch (error) {
|
|
961
|
+
index_1.Helpers.info('Not able to rebase');
|
|
962
|
+
console.error(error);
|
|
963
|
+
}
|
|
964
|
+
}
|
|
983
965
|
//#endregion
|
|
984
966
|
//#region stash apply
|
|
985
|
-
|
|
967
|
+
stashApply(cwd) {
|
|
986
968
|
try {
|
|
987
|
-
tnp_core_1.child_process.execSync(
|
|
969
|
+
tnp_core_1.child_process.execSync(`git stash apply`, { cwd });
|
|
988
970
|
}
|
|
989
971
|
catch (error) { }
|
|
990
|
-
}
|
|
972
|
+
}
|
|
991
973
|
//#endregion
|
|
992
974
|
//#region fetch
|
|
993
|
-
|
|
994
|
-
if (all === void 0) { all = false; }
|
|
975
|
+
fetch(cwd, all = false) {
|
|
995
976
|
index_1.Helpers.taskStarted('Fetching git changes');
|
|
996
977
|
try {
|
|
997
|
-
tnp_core_1.child_process.execSync(
|
|
978
|
+
tnp_core_1.child_process.execSync(`git fetch ${all ? '--all' : ''}`, { cwd });
|
|
998
979
|
}
|
|
999
980
|
catch (error) {
|
|
1000
981
|
index_1.Helpers.error('Not able to git fetch.', false, true);
|
|
1001
982
|
}
|
|
1002
983
|
index_1.Helpers.taskDone('Fetching git changes');
|
|
1003
|
-
}
|
|
984
|
+
}
|
|
1004
985
|
//#endregion
|
|
1005
986
|
//#region checkout
|
|
1006
|
-
|
|
1007
|
-
|
|
987
|
+
checkout(cwd, branchName, options) {
|
|
988
|
+
let { createBranchIfNotExists, fetchBeforeCheckout, switchBranchWhenExists, } = options || {};
|
|
1008
989
|
if (fetchBeforeCheckout) {
|
|
1009
990
|
this.fetch(cwd);
|
|
1010
991
|
}
|
|
@@ -1013,185 +994,227 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1013
994
|
createBranchIfNotExists = false;
|
|
1014
995
|
}
|
|
1015
996
|
try {
|
|
1016
|
-
tnp_core_1.child_process.execSync(
|
|
997
|
+
tnp_core_1.child_process.execSync(`git checkout ${createBranchIfNotExists ? '-b' : ''} ${branchName}`, { cwd });
|
|
1017
998
|
}
|
|
1018
999
|
catch (error) {
|
|
1019
|
-
index_1.Helpers.error(
|
|
1000
|
+
index_1.Helpers.error(`Not able to checkout branch: ${branchName}`, false, true);
|
|
1020
1001
|
}
|
|
1021
|
-
}
|
|
1002
|
+
}
|
|
1022
1003
|
//#endregion
|
|
1023
1004
|
//#region checkout from to
|
|
1024
|
-
|
|
1025
|
-
if (origin === void 0) { origin = 'origin'; }
|
|
1005
|
+
checkoutFromTo(checkoutFromBranch, targetBranch, origin = 'origin', cwd) {
|
|
1026
1006
|
index_1.Helpers.log('[checkout] ' + cwd, 1);
|
|
1027
|
-
tnp_core_1.child_process.execSync(
|
|
1028
|
-
|
|
1007
|
+
tnp_core_1.child_process.execSync(`git fetch`, { cwd });
|
|
1008
|
+
const currentBranchName = this.currentBranchName(cwd);
|
|
1029
1009
|
if (currentBranchName === targetBranch) {
|
|
1030
1010
|
index_1.Helpers.info('Already on proper branch.. just pulling');
|
|
1031
|
-
tnp_core_1.child_process.execSync(
|
|
1032
|
-
tnp_core_1.child_process.execSync(
|
|
1033
|
-
cwd
|
|
1011
|
+
tnp_core_1.child_process.execSync(`git reset --hard`, { cwd });
|
|
1012
|
+
tnp_core_1.child_process.execSync(`git pull ${origin} ${checkoutFromBranch}`, {
|
|
1013
|
+
cwd,
|
|
1034
1014
|
});
|
|
1035
1015
|
}
|
|
1036
1016
|
else {
|
|
1037
|
-
|
|
1038
|
-
tnp_core_1.child_process.execSync(
|
|
1017
|
+
const targetBranchExists = this.getBranchesNames(cwd).filter(f => targetBranch === f).length > 0;
|
|
1018
|
+
tnp_core_1.child_process.execSync(`git reset --hard`, { cwd });
|
|
1039
1019
|
if (currentBranchName !== checkoutFromBranch) {
|
|
1040
|
-
tnp_core_1.child_process.execSync(
|
|
1020
|
+
tnp_core_1.child_process.execSync(`git checkout ${checkoutFromBranch}`, { cwd });
|
|
1041
1021
|
}
|
|
1042
|
-
tnp_core_1.child_process.execSync(
|
|
1043
|
-
cwd
|
|
1022
|
+
tnp_core_1.child_process.execSync(`git pull ${origin} ${checkoutFromBranch}`, {
|
|
1023
|
+
cwd,
|
|
1044
1024
|
});
|
|
1045
1025
|
if (targetBranchExists) {
|
|
1046
|
-
tnp_core_1.child_process.execSync(
|
|
1047
|
-
tnp_core_1.child_process.execSync(
|
|
1026
|
+
tnp_core_1.child_process.execSync(`git checkout ${targetBranch}`, { cwd });
|
|
1027
|
+
tnp_core_1.child_process.execSync(`git rebase ${checkoutFromBranch}`, { cwd });
|
|
1048
1028
|
}
|
|
1049
1029
|
else {
|
|
1050
|
-
tnp_core_1.child_process.execSync(
|
|
1030
|
+
tnp_core_1.child_process.execSync(`git checkout -b ${targetBranch}`, { cwd });
|
|
1051
1031
|
}
|
|
1052
1032
|
}
|
|
1053
|
-
}
|
|
1033
|
+
}
|
|
1054
1034
|
//#endregion
|
|
1055
1035
|
//#region revert file changes
|
|
1056
|
-
|
|
1036
|
+
revertFileChanges(cwd, fileReletivePath) {
|
|
1057
1037
|
try {
|
|
1058
|
-
index_1.Helpers.run(
|
|
1038
|
+
index_1.Helpers.run(`git checkout ${fileReletivePath}`, { cwd }).sync();
|
|
1059
1039
|
}
|
|
1060
1040
|
catch (error) { }
|
|
1061
|
-
}
|
|
1041
|
+
}
|
|
1042
|
+
//#endregion
|
|
1043
|
+
//#region get remote provider
|
|
1044
|
+
/**
|
|
1045
|
+
* Extract the provider (github.com, gitlab.com etc.)
|
|
1046
|
+
* from a remote URL
|
|
1047
|
+
* @param cwd The current working directory
|
|
1048
|
+
*
|
|
1049
|
+
*/
|
|
1050
|
+
getRemoteProvider(cwd) {
|
|
1051
|
+
//#region @backendFunc
|
|
1052
|
+
const remoteUrl = this.getOriginURL(cwd);
|
|
1053
|
+
if (!remoteUrl) {
|
|
1054
|
+
return null;
|
|
1055
|
+
}
|
|
1056
|
+
try {
|
|
1057
|
+
// Handle SSH URLs like git@github.com:user/repo.git
|
|
1058
|
+
const sshMatch = remoteUrl.match(/^git@([^:]+):/);
|
|
1059
|
+
if (sshMatch) {
|
|
1060
|
+
return sshMatch[1];
|
|
1061
|
+
}
|
|
1062
|
+
// Handle HTTP/HTTPS URLs like https://github.com/user/repo.git
|
|
1063
|
+
const httpMatch = remoteUrl.match(/^https?:\/\/([^/]+)\//);
|
|
1064
|
+
if (httpMatch) {
|
|
1065
|
+
return httpMatch[1];
|
|
1066
|
+
}
|
|
1067
|
+
// Handle SSH URLs with ssh:// format
|
|
1068
|
+
const sshAltMatch = remoteUrl.match(/^ssh:\/\/(?:[^@]+@)?([^/]+)/);
|
|
1069
|
+
if (sshAltMatch) {
|
|
1070
|
+
return sshAltMatch[1];
|
|
1071
|
+
}
|
|
1072
|
+
return null;
|
|
1073
|
+
}
|
|
1074
|
+
catch (e) {
|
|
1075
|
+
// console.error("Failed to extract provider from remote URL:", e);
|
|
1076
|
+
return null;
|
|
1077
|
+
}
|
|
1078
|
+
//#endregion
|
|
1079
|
+
}
|
|
1062
1080
|
//#endregion
|
|
1063
1081
|
//#region clone
|
|
1064
1082
|
/**
|
|
1065
1083
|
* @returns absolute path to cloned folder
|
|
1066
1084
|
*/
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
if (((_e = (_d = error_4 === null || error_4 === void 0 ? void 0 : error_4.stderr) === null || _d === void 0 ? void 0 : _d.toString()) === null || _e === void 0 ? void 0 : _e.search('remote: Not Found')) !== -1) {
|
|
1139
|
-
index_1.Helpers.error("[taon-helpers][git] Project not found :".concat(url), true, true);
|
|
1140
|
-
}
|
|
1141
|
-
else {
|
|
1142
|
-
index_1.Helpers.error("[taon-helpers] Can't clone from url: ".concat(tnp_core_2.CLI.chalk.bold(url), ".."), true, true);
|
|
1143
|
-
}
|
|
1144
|
-
cloneLinkOpt = {
|
|
1145
|
-
again: {
|
|
1146
|
-
name: 'Try again',
|
|
1147
|
-
},
|
|
1148
|
-
skip: {
|
|
1149
|
-
name: 'Skip cloning this repository',
|
|
1150
|
-
},
|
|
1151
|
-
exit: {
|
|
1152
|
-
name: 'Exit process',
|
|
1153
|
-
},
|
|
1154
|
-
};
|
|
1155
|
-
return [4 /*yield*/, index_1.Helpers.consoleGui.select('What to do?', cloneLinkOpt)];
|
|
1156
|
-
case 4:
|
|
1157
|
-
res = _g.sent();
|
|
1158
|
-
if (res === 'again') {
|
|
1159
|
-
return [3 /*break*/, 1];
|
|
1160
|
-
}
|
|
1161
|
-
if (res === 'exit') {
|
|
1162
|
-
process.exit(0);
|
|
1163
|
-
}
|
|
1164
|
-
if (res === 'skip') {
|
|
1165
|
-
return [3 /*break*/, 6];
|
|
1166
|
-
}
|
|
1167
|
-
return [3 /*break*/, 5];
|
|
1168
|
-
case 5: return [3 /*break*/, 1];
|
|
1169
|
-
case 6: return [2 /*return*/, cloneFolderPath];
|
|
1085
|
+
async clone({ cwd, url, destinationFolderName = '', throwErrors, override, }) {
|
|
1086
|
+
cwd = (0, tnp_core_1.crossPlatformPath)(cwd);
|
|
1087
|
+
if (!index_1.Helpers.exists(cwd)) {
|
|
1088
|
+
try {
|
|
1089
|
+
index_1.Helpers.mkdirp(cwd);
|
|
1090
|
+
}
|
|
1091
|
+
catch (error) {
|
|
1092
|
+
index_1.Helpers.warn(`Not able to recreate path ${cwd}`);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
index_1.Helpers.log('[clone] ' + cwd, 1);
|
|
1096
|
+
// const ALWAYS_HTTPS = true;
|
|
1097
|
+
if (!url) {
|
|
1098
|
+
index_1.Helpers.error(`[taon-helpers] no url provided for cloning`);
|
|
1099
|
+
}
|
|
1100
|
+
if (url.split(' ').length > 2) {
|
|
1101
|
+
// const [rUrl, rDest] = url.split(' ');
|
|
1102
|
+
index_1.Helpers.error(`[taon-helpers]incorrect clone url "${url}"`);
|
|
1103
|
+
}
|
|
1104
|
+
if (url.split(' ').length === 2) {
|
|
1105
|
+
const [rUrl, rDest] = url.split(' ');
|
|
1106
|
+
if (destinationFolderName) {
|
|
1107
|
+
index_1.Helpers.error(`[taon-helpers] wrong cloning argument
|
|
1108
|
+
|
|
1109
|
+
url = "${url}"
|
|
1110
|
+
destinationFolderName = "${destinationFolderName}"
|
|
1111
|
+
|
|
1112
|
+
cant use both at the same time
|
|
1113
|
+
`);
|
|
1114
|
+
}
|
|
1115
|
+
else {
|
|
1116
|
+
destinationFolderName = rDest;
|
|
1117
|
+
url = rUrl;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
if (!url.endsWith('.git')) {
|
|
1121
|
+
url = url + '.git';
|
|
1122
|
+
}
|
|
1123
|
+
const cloneFolderPath = (0, tnp_core_1.crossPlatformPath)(tnp_core_1.path
|
|
1124
|
+
.join(cwd, !!destinationFolderName && destinationFolderName.trim() !== ''
|
|
1125
|
+
? destinationFolderName
|
|
1126
|
+
: tnp_core_1.path.basename(url))
|
|
1127
|
+
.trim()
|
|
1128
|
+
.replace('.git', ''));
|
|
1129
|
+
// console.log({ cloneFolderPath })
|
|
1130
|
+
if (override) {
|
|
1131
|
+
index_1.Helpers.tryRemoveDir(cloneFolderPath);
|
|
1132
|
+
}
|
|
1133
|
+
else if (index_1.Helpers.exists(cloneFolderPath) &&
|
|
1134
|
+
index_1.Helpers.exists(tnp_core_1.path.join(cloneFolderPath, '.git'))) {
|
|
1135
|
+
index_1.Helpers.warn(`[taon-helpers] Already cloned ${tnp_core_1.path.basename(cloneFolderPath)}...`);
|
|
1136
|
+
return cloneFolderPath;
|
|
1137
|
+
}
|
|
1138
|
+
const commnad = url.startsWith(`https://`) || url.startsWith(`http://`)
|
|
1139
|
+
? `git -c http.sslVerify=false clone ${url} ${tnp_core_1.path.basename(cloneFolderPath)}`
|
|
1140
|
+
: `git clone ${url} ${tnp_core_1.path.basename(cloneFolderPath)}`;
|
|
1141
|
+
index_1.Helpers.info(`
|
|
1142
|
+
|
|
1143
|
+
Cloning:
|
|
1144
|
+
${commnad}
|
|
1145
|
+
|
|
1146
|
+
`);
|
|
1147
|
+
if (throwErrors) {
|
|
1148
|
+
index_1.Helpers.run(commnad, { cwd }).sync();
|
|
1149
|
+
}
|
|
1150
|
+
else {
|
|
1151
|
+
while (true) {
|
|
1152
|
+
index_1.Helpers.info(`Cloning from url: ${tnp_core_2.CLI.chalk.bold(url)}..`);
|
|
1153
|
+
try {
|
|
1154
|
+
index_1.Helpers.run(commnad, { cwd, output: false }).sync();
|
|
1155
|
+
break;
|
|
1170
1156
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1157
|
+
catch (error) {
|
|
1158
|
+
if (error?.stderr?.toString()?.search('remote: Not Found') !== -1) {
|
|
1159
|
+
index_1.Helpers.error(`[taon-helpers][git] Project not found :${url}`, true, true);
|
|
1160
|
+
}
|
|
1161
|
+
else {
|
|
1162
|
+
index_1.Helpers.error(`[taon-helpers] Can't clone from url: ${tnp_core_2.CLI.chalk.bold(url)}..`, true, true);
|
|
1163
|
+
}
|
|
1164
|
+
const cloneLinkOpt = {
|
|
1165
|
+
again: {
|
|
1166
|
+
name: 'Try again',
|
|
1167
|
+
},
|
|
1168
|
+
skip: {
|
|
1169
|
+
name: 'Skip cloning this repository',
|
|
1170
|
+
},
|
|
1171
|
+
exit: {
|
|
1172
|
+
name: 'Exit process',
|
|
1173
|
+
},
|
|
1174
|
+
};
|
|
1175
|
+
const res = await index_1.Helpers.consoleGui.select('What to do?', cloneLinkOpt);
|
|
1176
|
+
if (res === 'again') {
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1179
|
+
if (res === 'exit') {
|
|
1180
|
+
process.exit(0);
|
|
1181
|
+
}
|
|
1182
|
+
if (res === 'skip') {
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
return cloneFolderPath;
|
|
1189
|
+
// const packageJson = path.join(cloneFolderPath, config.file.package_json);
|
|
1190
|
+
// Helpers.info(packageJson)
|
|
1191
|
+
// if (!Helpers.exists(packageJson) && Helpers.exists(cloneFolderPath)) {
|
|
1192
|
+
// Helpers.info(`[taon-helpers] Recreating unexited package.json for project ${path.basename(cloneFolderPath)}..`);
|
|
1193
|
+
// try {
|
|
1194
|
+
// Helpers.run(`npm init -y`, { cwd: cloneFolderPath, output: false }).sync();
|
|
1195
|
+
// } catch (error) { }
|
|
1196
|
+
// }
|
|
1197
|
+
}
|
|
1174
1198
|
//#endregion
|
|
1175
1199
|
//#region check if there are some uncommited changes
|
|
1176
|
-
|
|
1200
|
+
checkIfthereAreSomeUncommitedChange(cwd) {
|
|
1177
1201
|
index_1.Helpers.log('[taon-helpers][checkIfthereAreSomeUncommitedChange] ' + cwd, 1);
|
|
1178
1202
|
return index_1.Helpers.git.thereAreSomeUncommitedChangeExcept([], cwd);
|
|
1179
|
-
}
|
|
1203
|
+
}
|
|
1180
1204
|
//#endregion
|
|
1181
1205
|
//#region check if there are some uncommited changes except
|
|
1182
|
-
|
|
1183
|
-
if (filesList === void 0) { filesList = []; }
|
|
1206
|
+
thereAreSomeUncommitedChangeExcept(filesList = [], cwd) {
|
|
1184
1207
|
index_1.Helpers.log('[taon-helpers][thereAreSomeUncommitedChangeExcept] ' + cwd, 1);
|
|
1185
|
-
filesList = filesList.map(
|
|
1208
|
+
filesList = filesList.map(f => (0, tnp_core_1.crossPlatformPath)(f));
|
|
1186
1209
|
try {
|
|
1187
|
-
|
|
1210
|
+
const res = index_1.Helpers.run(`git ls-files --deleted --modified --others --exclude-standard`, { output: false, cwd })
|
|
1188
1211
|
.sync()
|
|
1189
1212
|
.toString()
|
|
1190
1213
|
.trim();
|
|
1191
|
-
|
|
1214
|
+
const list = !res
|
|
1192
1215
|
? []
|
|
1193
|
-
: res.split(/\r\n|\n|\r/).filter(
|
|
1194
|
-
f = f
|
|
1216
|
+
: res.split(/\r\n|\n|\r/).filter(f => {
|
|
1217
|
+
f = f?.trim();
|
|
1195
1218
|
return !!f && !filesList.includes((0, tnp_core_1.crossPlatformPath)(f));
|
|
1196
1219
|
});
|
|
1197
1220
|
return list.length > 0;
|
|
@@ -1199,20 +1222,25 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1199
1222
|
catch (error) {
|
|
1200
1223
|
return false;
|
|
1201
1224
|
}
|
|
1202
|
-
}
|
|
1225
|
+
}
|
|
1203
1226
|
//#endregion
|
|
1204
1227
|
//#region check if there are some uncommited changes except
|
|
1205
|
-
|
|
1228
|
+
/**
|
|
1229
|
+
*
|
|
1230
|
+
* @param cwd get current working directory
|
|
1231
|
+
* @returns relative pathes to uncommited files
|
|
1232
|
+
*/
|
|
1233
|
+
uncommitedFiles(cwd) {
|
|
1206
1234
|
index_1.Helpers.log('[taon-helpers][thereAreSomeUncommitedChangeExcept] ' + cwd, 1);
|
|
1207
1235
|
try {
|
|
1208
|
-
|
|
1236
|
+
const res = index_1.Helpers.run(`git ls-files --deleted --modified --others --exclude-standard`, { output: false, cwd })
|
|
1209
1237
|
.sync()
|
|
1210
1238
|
.toString()
|
|
1211
1239
|
.trim();
|
|
1212
|
-
|
|
1240
|
+
const list = !res
|
|
1213
1241
|
? []
|
|
1214
|
-
: res.split(/\r\n|\n|\r/).filter(
|
|
1215
|
-
f = f
|
|
1242
|
+
: res.split(/\r\n|\n|\r/).filter(f => {
|
|
1243
|
+
f = f?.trim();
|
|
1216
1244
|
return !!f;
|
|
1217
1245
|
});
|
|
1218
1246
|
return list;
|
|
@@ -1220,76 +1248,66 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1220
1248
|
catch (error) {
|
|
1221
1249
|
return [];
|
|
1222
1250
|
}
|
|
1223
|
-
}
|
|
1251
|
+
}
|
|
1224
1252
|
//#endregion
|
|
1225
1253
|
//#region restore last version
|
|
1226
|
-
|
|
1254
|
+
restoreLastVersion(cwd, relativeFilePath) {
|
|
1227
1255
|
index_1.Helpers.log('[taon-helpers][restoreLastVersion] ' + cwd, 1);
|
|
1228
1256
|
if (!index_1.Helpers.exists([cwd, relativeFilePath])) {
|
|
1229
1257
|
return;
|
|
1230
1258
|
}
|
|
1231
1259
|
try {
|
|
1232
|
-
index_1.Helpers.log(
|
|
1233
|
-
index_1.Helpers.run(
|
|
1260
|
+
index_1.Helpers.log(`[taon-helpers][git] restoring last verion of file ${tnp_core_1.path.basename(cwd)}/${relativeFilePath}`);
|
|
1261
|
+
index_1.Helpers.run(`git checkout -- ${relativeFilePath}`, { cwd }).sync();
|
|
1234
1262
|
}
|
|
1235
1263
|
catch (error) {
|
|
1236
|
-
index_1.Helpers.warn(
|
|
1264
|
+
index_1.Helpers.warn(`[taon-helpers][git] Not able to resotre last version of file ${relativeFilePath}`);
|
|
1237
1265
|
}
|
|
1238
|
-
}
|
|
1266
|
+
}
|
|
1239
1267
|
//#endregion
|
|
1240
1268
|
//#region reset files
|
|
1241
|
-
|
|
1242
|
-
var relativePathes = [];
|
|
1243
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1244
|
-
relativePathes[_i - 1] = arguments[_i];
|
|
1245
|
-
}
|
|
1269
|
+
resetFiles(cwd, ...relativePathes) {
|
|
1246
1270
|
index_1.Helpers.log('[taon-helpers][resetFiles] ' + cwd, 1);
|
|
1247
|
-
relativePathes.forEach(
|
|
1271
|
+
relativePathes.forEach(p => {
|
|
1248
1272
|
try {
|
|
1249
|
-
index_1.Helpers.run(
|
|
1273
|
+
index_1.Helpers.run(`git checkout HEAD -- ${p}`, { cwd }).sync();
|
|
1250
1274
|
}
|
|
1251
1275
|
catch (err) {
|
|
1252
|
-
index_1.Helpers.error(
|
|
1276
|
+
index_1.Helpers.error(`[taon-helpers][git] Not able to reset files: ${p} inside project ${tnp_core_1.path.basename(cwd)}.`, true, true);
|
|
1253
1277
|
}
|
|
1254
1278
|
});
|
|
1255
|
-
}
|
|
1279
|
+
}
|
|
1256
1280
|
//#endregion
|
|
1257
1281
|
//#region get list of staged files
|
|
1258
1282
|
/**
|
|
1283
|
+
* By default return Absolute pathes to staged files
|
|
1259
1284
|
*
|
|
1260
1285
|
* @param cwd
|
|
1261
|
-
* @returns absolute pathes to stages files
|
|
1286
|
+
* @returns (absolute pathes to stages files
|
|
1262
1287
|
*/
|
|
1263
|
-
|
|
1288
|
+
stagedFiles(cwd, outputRelatieve = false) {
|
|
1264
1289
|
cwd = (0, tnp_core_1.crossPlatformPath)(cwd).replace(/\/$/, '');
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
return (result ? result.split('\n') : []).map(
|
|
1290
|
+
const command = `git diff --name-only --cached`.trim();
|
|
1291
|
+
const result = index_1.Helpers.commnadOutputAsString(command, cwd, {}) || '';
|
|
1292
|
+
return (result ? result.split('\n') : []).map(relative => {
|
|
1293
|
+
if (outputRelatieve) {
|
|
1294
|
+
return (0, tnp_core_1.crossPlatformPath)(relative);
|
|
1295
|
+
}
|
|
1268
1296
|
return (0, tnp_core_1.crossPlatformPath)([cwd, relative]);
|
|
1269
1297
|
});
|
|
1270
|
-
}
|
|
1298
|
+
}
|
|
1271
1299
|
//#endregion
|
|
1272
1300
|
//#region get list of changes files from commit
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
case 0: return [4 /*yield*/, index_1.Helpers.commnadOutputAsStringAsync('git diff-tree --no-commit-id --name-only -r ${commitHash}', cwd)];
|
|
1279
|
-
case 1:
|
|
1280
|
-
output = _a.sent();
|
|
1281
|
-
changedFiles = output.trim().split('\n');
|
|
1282
|
-
return [2 /*return*/, changedFiles];
|
|
1283
|
-
}
|
|
1284
|
-
});
|
|
1285
|
-
});
|
|
1286
|
-
};
|
|
1301
|
+
async getChangedFiles(cwd, commitHash) {
|
|
1302
|
+
const output = await index_1.Helpers.commnadOutputAsStringAsync('git diff-tree --no-commit-id --name-only -r ${commitHash}', cwd);
|
|
1303
|
+
const changedFiles = output.trim().split('\n');
|
|
1304
|
+
return changedFiles;
|
|
1305
|
+
}
|
|
1287
1306
|
//#endregion
|
|
1288
1307
|
//#region get orign ssh from origin http
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
var match = originHttp.match(httpsPattern);
|
|
1308
|
+
originHttpToSsh(originHttp, verbose = false) {
|
|
1309
|
+
const httpsPattern = /^https:\/\/(.+?)\/(.+?\/.+?)(\.git)?$/;
|
|
1310
|
+
const match = originHttp.match(httpsPattern);
|
|
1293
1311
|
if (originHttp === 'undefined' || tnp_core_1._.isNil(originHttp)) {
|
|
1294
1312
|
index_1.Helpers.error('[taon-helpers][originHttpToSsh] Origin URL is not defined');
|
|
1295
1313
|
return originHttp;
|
|
@@ -1299,47 +1317,31 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1299
1317
|
index_1.Helpers.warn('The current remote URL is not in HTTPS format:' + originHttp);
|
|
1300
1318
|
return originHttp;
|
|
1301
1319
|
}
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1320
|
+
const host = match[1];
|
|
1321
|
+
const repoPath = match[2];
|
|
1322
|
+
const sshUrl = `git@${host}:${repoPath}.git`;
|
|
1305
1323
|
return sshUrl;
|
|
1306
|
-
}
|
|
1324
|
+
}
|
|
1307
1325
|
//#endregion
|
|
1308
1326
|
//#region change remote from https to ssh
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
cwd: cwd,
|
|
1323
|
-
}).sync()];
|
|
1324
|
-
case 2:
|
|
1325
|
-
_a.sent();
|
|
1326
|
-
console.log('Remote URL has been changed to:', sshUrl);
|
|
1327
|
-
return [3 /*break*/, 4];
|
|
1328
|
-
case 3:
|
|
1329
|
-
error_5 = _a.sent();
|
|
1330
|
-
console.error('Failed to change remote URL:', error_5);
|
|
1331
|
-
return [3 /*break*/, 4];
|
|
1332
|
-
case 4: return [2 /*return*/];
|
|
1333
|
-
}
|
|
1334
|
-
});
|
|
1335
|
-
});
|
|
1336
|
-
};
|
|
1327
|
+
async changeRemoteFromHttpsToSSh(cwd, diffrentOriginName = 'origin') {
|
|
1328
|
+
try {
|
|
1329
|
+
const currentUrl = (await this.getOriginURL(cwd, diffrentOriginName)) || '';
|
|
1330
|
+
const sshUrl = this.originHttpToSsh(currentUrl);
|
|
1331
|
+
await index_1.Helpers.run(`git remote set-url ${diffrentOriginName} ${sshUrl}`, {
|
|
1332
|
+
cwd,
|
|
1333
|
+
}).sync();
|
|
1334
|
+
console.log('Remote URL has been changed to:', sshUrl);
|
|
1335
|
+
}
|
|
1336
|
+
catch (error) {
|
|
1337
|
+
console.error('Failed to change remote URL:', error);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1337
1340
|
//#endregion
|
|
1338
1341
|
//#region get http origin from ssh origin
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
var match = originSsh.match(sshPattern);
|
|
1342
|
+
originSshToHttp(originSsh, verbose = false) {
|
|
1343
|
+
const sshPattern = /^git@(.+?):(.+?\/.+?)(\.git)?$/;
|
|
1344
|
+
const match = originSsh.match(sshPattern);
|
|
1343
1345
|
if (originSsh === 'undefined' || tnp_core_1._.isNil(originSsh)) {
|
|
1344
1346
|
index_1.Helpers.error('[taon-helpers][originSshToHttp] Origin URL is not defined');
|
|
1345
1347
|
return originSsh;
|
|
@@ -1349,49 +1351,34 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1349
1351
|
index_1.Helpers.warn('The current remote URL is not in SSH format:' + originSsh);
|
|
1350
1352
|
return originSsh;
|
|
1351
1353
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1354
|
+
const host = match[1];
|
|
1355
|
+
const repoPath = match[2];
|
|
1356
|
+
const httpsUrl = `https://${host}/${repoPath}.git`;
|
|
1355
1357
|
return httpsUrl;
|
|
1356
|
-
}
|
|
1358
|
+
}
|
|
1357
1359
|
//#endregion
|
|
1358
1360
|
//#region change remote from ssh to https
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
cwd: cwd,
|
|
1373
|
-
}).sync()];
|
|
1374
|
-
case 2:
|
|
1375
|
-
_a.sent();
|
|
1376
|
-
console.log('Remote URL has been changed to:', httpsUrl);
|
|
1377
|
-
return [3 /*break*/, 4];
|
|
1378
|
-
case 3:
|
|
1379
|
-
error_6 = _a.sent();
|
|
1380
|
-
console.error('Failed to change remote URL:', error_6);
|
|
1381
|
-
return [3 /*break*/, 4];
|
|
1382
|
-
case 4: return [2 /*return*/];
|
|
1383
|
-
}
|
|
1384
|
-
});
|
|
1385
|
-
});
|
|
1386
|
-
};
|
|
1361
|
+
async changeRemoveFromSshToHttps(cwd, diffrentOriginName = 'origin') {
|
|
1362
|
+
try {
|
|
1363
|
+
const currentUrl = (await this.getOriginURL(cwd, diffrentOriginName)) || '';
|
|
1364
|
+
const httpsUrl = this.originSshToHttp(currentUrl);
|
|
1365
|
+
await index_1.Helpers.run(`git remote set-url origin ${httpsUrl}`, {
|
|
1366
|
+
cwd,
|
|
1367
|
+
}).sync();
|
|
1368
|
+
console.log('Remote URL has been changed to:', httpsUrl);
|
|
1369
|
+
}
|
|
1370
|
+
catch (error) {
|
|
1371
|
+
console.error('Failed to change remote URL:', error);
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1387
1374
|
//#endregion
|
|
1388
1375
|
//#region unstage all files
|
|
1389
|
-
|
|
1376
|
+
unstageAllFiles(cwd) {
|
|
1390
1377
|
try {
|
|
1391
|
-
index_1.Helpers.run(
|
|
1378
|
+
index_1.Helpers.run(`git reset HEAD -- .`, { cwd }).sync();
|
|
1392
1379
|
}
|
|
1393
1380
|
catch (error) { }
|
|
1394
|
-
}
|
|
1381
|
+
}
|
|
1395
1382
|
//#endregion
|
|
1396
1383
|
//#region get fils change in commit by hash
|
|
1397
1384
|
/**
|
|
@@ -1399,27 +1386,19 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1399
1386
|
* @param {string} hash - The hash of the commit.
|
|
1400
1387
|
* @returns {Promise<string[]>} - A promise that resolves to an array of file paths.
|
|
1401
1388
|
*/
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
error_7 = _a.sent();
|
|
1416
|
-
console.error('Error getting changed files by hash:', error_7);
|
|
1417
|
-
throw error_7;
|
|
1418
|
-
case 3: return [2 /*return*/];
|
|
1419
|
-
}
|
|
1420
|
-
});
|
|
1421
|
-
});
|
|
1422
|
-
};
|
|
1389
|
+
async getChangedFilesInCommitByHash(cwd, hash) {
|
|
1390
|
+
//#region @backendFunc
|
|
1391
|
+
try {
|
|
1392
|
+
const git = (0, simple_git_1.default)(cwd);
|
|
1393
|
+
const diffSummary = await git.diffSummary([`${hash}^!`]);
|
|
1394
|
+
return diffSummary.files.map(file => file.file);
|
|
1395
|
+
}
|
|
1396
|
+
catch (error) {
|
|
1397
|
+
console.error('Error getting changed files by hash:', error);
|
|
1398
|
+
throw error;
|
|
1399
|
+
}
|
|
1400
|
+
//#endregion
|
|
1401
|
+
}
|
|
1423
1402
|
//#endregion
|
|
1424
1403
|
//#region get fils change in commit by index
|
|
1425
1404
|
/**
|
|
@@ -1428,59 +1407,79 @@ var HelpersGit = /** @class */ (function () {
|
|
|
1428
1407
|
* @param {number} index - The index of the commit.
|
|
1429
1408
|
* @returns {Promise<string[]>} - A promise that resolves to an array of file paths.
|
|
1430
1409
|
*/
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
error_8 = _a.sent();
|
|
1450
|
-
console.error('Error getting changed files by index:', error_8);
|
|
1451
|
-
throw error_8;
|
|
1452
|
-
case 3: return [2 /*return*/];
|
|
1453
|
-
}
|
|
1454
|
-
});
|
|
1455
|
-
});
|
|
1456
|
-
};
|
|
1410
|
+
async getChangedFilesInCommitByIndex(cwd, index) {
|
|
1411
|
+
//#region @backendFunc
|
|
1412
|
+
try {
|
|
1413
|
+
const git = (0, simple_git_1.default)(cwd);
|
|
1414
|
+
const log = await git.log();
|
|
1415
|
+
if (index >= log.total) {
|
|
1416
|
+
console.warn('[taon-helpers][getChangedFilesInCommitByIndex] Index out of range');
|
|
1417
|
+
return [];
|
|
1418
|
+
}
|
|
1419
|
+
const hash = log.all[index].hash;
|
|
1420
|
+
return this.getChangedFilesInCommitByHash(cwd, hash);
|
|
1421
|
+
}
|
|
1422
|
+
catch (error) {
|
|
1423
|
+
console.error('Error getting changed files by index:', error);
|
|
1424
|
+
throw error;
|
|
1425
|
+
}
|
|
1426
|
+
//#endregion
|
|
1427
|
+
}
|
|
1457
1428
|
//#endregion
|
|
1458
1429
|
//#region get changes summary
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1430
|
+
async changesSummary(cwd, prefix = '') {
|
|
1431
|
+
//#region @backendFunc
|
|
1432
|
+
try {
|
|
1433
|
+
const git = (0, simple_git_1.default)(cwd);
|
|
1434
|
+
const changesSummary = (await git.status()).files.map(c => c.path);
|
|
1435
|
+
return (changesSummary.length === 0 ? [` --- no changes --- `] : changesSummary)
|
|
1436
|
+
.map(f => `\n${prefix}${f}`)
|
|
1437
|
+
.join('');
|
|
1438
|
+
}
|
|
1439
|
+
catch (error) {
|
|
1440
|
+
console.error('Error getting changes summary:', error);
|
|
1441
|
+
return ' --- No changes ---';
|
|
1442
|
+
}
|
|
1443
|
+
//#endregion
|
|
1444
|
+
}
|
|
1445
|
+
//#endregion
|
|
1446
|
+
//#region get user info
|
|
1447
|
+
async getUserInfo(cwd, global = false) {
|
|
1448
|
+
try {
|
|
1449
|
+
const name = tnp_core_1.child_process
|
|
1450
|
+
.execSync(`git config ${global ? '--global' : ''} user.name`, {
|
|
1451
|
+
encoding: 'utf-8',
|
|
1452
|
+
cwd: cwd || process.cwd(),
|
|
1453
|
+
})
|
|
1454
|
+
.trim();
|
|
1455
|
+
const email = tnp_core_1.child_process
|
|
1456
|
+
.execSync(`git config ${global ? '--global' : ''} user.email`, {
|
|
1457
|
+
encoding: 'utf-8',
|
|
1458
|
+
cwd: cwd || process.cwd(),
|
|
1459
|
+
})
|
|
1460
|
+
.trim();
|
|
1461
|
+
return { name, email };
|
|
1462
|
+
}
|
|
1463
|
+
catch (error) {
|
|
1464
|
+
console.error('Error fetching Git user info:', error.message);
|
|
1465
|
+
return {};
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
async setUserInfos(optinos) {
|
|
1469
|
+
const { cwd, name, email, global } = optinos;
|
|
1470
|
+
if (!global && !this.isInsideGitRepo(cwd)) {
|
|
1471
|
+
console.error('Not a Git repository:', cwd);
|
|
1472
|
+
return;
|
|
1473
|
+
}
|
|
1474
|
+
try {
|
|
1475
|
+
tnp_core_1.child_process.execSync(`git config ${global ? '--global' : ''} user.name "${name}"`, { cwd });
|
|
1476
|
+
tnp_core_1.child_process.execSync(`git config ${global ? '--global' : ''} user.email "${email}"`, { cwd });
|
|
1477
|
+
}
|
|
1478
|
+
catch (error) {
|
|
1479
|
+
console.error('Error setting Git user info:', error.message);
|
|
1480
|
+
await tnp_core_2.UtilsTerminal.pressAnyKeyToContinueAsync();
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1485
1484
|
exports.HelpersGit = HelpersGit;
|
|
1486
1485
|
//# sourceMappingURL=helpers-git.backend.js.map
|