@emulsify/cli 1.9.0 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -13
- package/dist/node_modules/.package-lock.json +38 -25
- package/dist/node_modules/@types/node/README.md +5 -6
- package/dist/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/dist/node_modules/@types/node/assert.d.ts +955 -45
- package/dist/node_modules/@types/node/async_hooks.d.ts +391 -87
- package/dist/node_modules/@types/node/buffer.d.ts +2210 -17
- package/dist/node_modules/@types/node/child_process.d.ts +1051 -189
- package/dist/node_modules/@types/node/cluster.d.ts +421 -143
- package/dist/node_modules/@types/node/console.d.ts +359 -49
- package/dist/node_modules/@types/node/constants.d.ts +3 -3
- package/dist/node_modules/@types/node/crypto.d.ts +3528 -291
- package/dist/node_modules/@types/node/dgram.d.ts +446 -30
- package/dist/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/dist/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/dist/node_modules/@types/node/dns.d.ts +588 -240
- package/dist/node_modules/@types/node/dom-events.d.ts +124 -0
- package/dist/node_modules/@types/node/domain.d.ts +159 -16
- package/dist/node_modules/@types/node/events.d.ts +890 -41
- package/dist/node_modules/@types/node/fs/promises.d.ts +980 -369
- package/dist/node_modules/@types/node/fs.d.ts +2599 -869
- package/dist/node_modules/@types/node/globals.d.ts +374 -727
- package/dist/node_modules/@types/node/globals.global.d.ts +1 -1
- package/dist/node_modules/@types/node/http.d.ts +1459 -132
- package/dist/node_modules/@types/node/http2.d.ts +1333 -123
- package/dist/node_modules/@types/node/https.d.ts +289 -13
- package/dist/node_modules/@types/node/index.d.ts +37 -46
- package/dist/node_modules/@types/node/inspector.d.ts +367 -671
- package/dist/node_modules/@types/node/module.d.ts +273 -14
- package/dist/node_modules/@types/node/net.d.ts +741 -66
- package/dist/node_modules/@types/node/os.d.ts +275 -23
- package/dist/node_modules/@types/node/package.json +95 -110
- package/dist/node_modules/@types/node/path.d.ts +27 -4
- package/dist/node_modules/@types/node/perf_hooks.d.ts +756 -125
- package/dist/node_modules/@types/node/process.d.ts +1429 -127
- package/dist/node_modules/@types/node/punycode.d.ts +65 -26
- package/dist/node_modules/@types/node/querystring.d.ts +121 -9
- package/dist/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/dist/node_modules/@types/node/readline.d.ts +405 -49
- package/dist/node_modules/@types/node/repl.d.ts +99 -73
- package/dist/node_modules/@types/node/sea.d.ts +153 -0
- package/dist/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/dist/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/dist/node_modules/@types/node/stream/web.d.ts +367 -0
- package/dist/node_modules/@types/node/stream.d.ts +1462 -273
- package/dist/node_modules/@types/node/string_decoder.d.ts +59 -2
- package/dist/node_modules/@types/node/test.d.ts +1719 -0
- package/dist/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/dist/node_modules/@types/node/timers.d.ts +233 -12
- package/dist/node_modules/@types/node/tls.d.ts +540 -189
- package/dist/node_modules/@types/node/trace_events.d.ts +143 -10
- package/dist/node_modules/@types/node/tty.d.ts +156 -17
- package/dist/node_modules/@types/node/url.d.ts +812 -47
- package/dist/node_modules/@types/node/util.d.ts +2159 -145
- package/dist/node_modules/@types/node/v8.d.ts +693 -74
- package/dist/node_modules/@types/node/vm.d.ts +813 -44
- package/dist/node_modules/@types/node/wasi.d.ts +121 -28
- package/dist/node_modules/@types/node/worker_threads.d.ts +514 -61
- package/dist/node_modules/@types/node/zlib.d.ts +220 -54
- package/dist/node_modules/ajv-formats/node_modules/ajv/README.md +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js +1 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.d.ts +2 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.d.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/index.d.ts +3 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.d.ts +10 -10
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js +5 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/code.ts +1 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/index.ts +2 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/resolve.ts +2 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/runtime/uri.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/index.ts +3 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/json-schema.ts +10 -10
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts +4 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/package.json +5 -5
- package/dist/node_modules/commander/Readme.md +10 -8
- package/dist/node_modules/commander/esm.mjs +1 -1
- package/dist/node_modules/commander/lib/argument.js +9 -5
- package/dist/node_modules/commander/lib/command.js +406 -196
- package/dist/node_modules/commander/lib/error.js +0 -4
- package/dist/node_modules/commander/lib/help.js +101 -38
- package/dist/node_modules/commander/lib/option.js +11 -8
- package/dist/node_modules/commander/lib/suggestSimilar.js +5 -4
- package/dist/node_modules/commander/package.json +23 -19
- package/dist/node_modules/commander/typings/index.d.ts +110 -40
- package/dist/node_modules/debug/package.json +4 -3
- package/dist/node_modules/debug/src/browser.js +3 -1
- package/dist/node_modules/debug/src/node.js +2 -2
- package/dist/node_modules/fast-uri/.gitattributes +2 -0
- package/dist/node_modules/fast-uri/.github/.stale.yml +21 -0
- package/dist/node_modules/fast-uri/.github/dependabot.yml +13 -0
- package/dist/node_modules/fast-uri/.github/tests_checker.yml +8 -0
- package/dist/node_modules/fast-uri/.github/workflows/ci.yml +23 -0
- package/dist/node_modules/fast-uri/.github/workflows/package-manager-ci.yml +20 -0
- package/dist/node_modules/fast-uri/.taprc +3 -0
- package/dist/node_modules/fast-uri/LICENSE +30 -0
- package/dist/node_modules/fast-uri/README.md +125 -0
- package/dist/node_modules/fast-uri/benchmark.js +105 -0
- package/dist/node_modules/fast-uri/index.js +309 -0
- package/dist/node_modules/fast-uri/lib/schemes.js +188 -0
- package/dist/node_modules/fast-uri/lib/scopedChars.js +30 -0
- package/dist/node_modules/fast-uri/lib/utils.js +242 -0
- package/dist/node_modules/fast-uri/package.json +39 -0
- package/dist/node_modules/fast-uri/test/.gitkeep +0 -0
- package/dist/node_modules/fast-uri/test/ajv.test.js +39 -0
- package/dist/node_modules/fast-uri/test/compatibility.test.js +130 -0
- package/dist/node_modules/fast-uri/test/equal.test.js +104 -0
- package/dist/node_modules/fast-uri/test/parse.test.js +319 -0
- package/dist/node_modules/fast-uri/test/resolve.test.js +76 -0
- package/dist/node_modules/fast-uri/test/serialize.test.js +144 -0
- package/dist/node_modules/fast-uri/test/uri-js.test.js +940 -0
- package/dist/node_modules/fast-uri/test/util.test.js +24 -0
- package/dist/node_modules/fast-uri/types/index.d.ts +53 -0
- package/dist/node_modules/fast-uri/types/index.test-d.ts +17 -0
- package/dist/node_modules/fs-extra/README.md +32 -2
- package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +3 -11
- package/dist/node_modules/fs-extra/lib/copy/copy.js +120 -178
- package/dist/node_modules/fs-extra/lib/copy/index.js +1 -1
- package/dist/node_modules/fs-extra/lib/ensure/file.js +31 -34
- package/dist/node_modules/fs-extra/lib/ensure/link.js +27 -27
- package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +57 -55
- package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +16 -13
- package/dist/node_modules/fs-extra/lib/ensure/symlink.js +29 -44
- package/dist/node_modules/fs-extra/lib/esm.mjs +68 -0
- package/dist/node_modules/fs-extra/lib/fs/index.js +29 -17
- package/dist/node_modules/fs-extra/lib/move/index.js +1 -1
- package/dist/node_modules/fs-extra/lib/move/move-sync.js +2 -1
- package/dist/node_modules/fs-extra/lib/move/move.js +38 -54
- package/dist/node_modules/fs-extra/lib/output-file/index.js +10 -19
- package/dist/node_modules/fs-extra/lib/remove/index.js +2 -7
- package/dist/node_modules/fs-extra/lib/util/stat.js +46 -42
- package/dist/node_modules/fs-extra/lib/util/utimes.js +21 -11
- package/dist/node_modules/fs-extra/package.json +11 -7
- package/dist/node_modules/simple-git/dist/cjs/index.js +4958 -0
- package/dist/node_modules/simple-git/dist/cjs/index.js.map +7 -0
- package/dist/node_modules/simple-git/dist/esm/index.js +4813 -0
- package/dist/node_modules/simple-git/dist/esm/index.js.map +7 -0
- package/dist/node_modules/simple-git/dist/esm/package.json +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/api.d.ts +3 -13
- package/dist/node_modules/simple-git/dist/src/lib/args/log-format.d.ts +9 -0
- package/dist/node_modules/simple-git/dist/src/lib/args/pathspec.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/git-error.d.ts +3 -2
- package/dist/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts +7 -0
- package/dist/node_modules/simple-git/dist/src/lib/git-factory.d.ts +15 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-branch.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-list-log-summary.d.ts +2 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-pull.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/completion-detection.plugin.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/index.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts +11 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/progress-monitor-plugin.d.ts +1 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/simple-git-plugin.d.ts +10 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/plugins/timout-plugin.d.ts +3 -0
- package/dist/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts +14 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/FileStatusSummary.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts +25 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/StatusSummary.d.ts +2 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/git-executor-chain.d.ts +1 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/git-executor.d.ts +3 -4
- package/dist/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts +2 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/clone.d.ts +3 -2
- package/dist/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts +4 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/config.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts +12 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts +5 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/fetch.d.ts +2 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts +2 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/log.d.ts +3 -3
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/remote.d.ts +3 -3
- package/dist/node_modules/simple-git/dist/src/lib/tasks/show.d.ts +2 -0
- package/dist/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +4 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/task.d.ts +1 -1
- package/dist/node_modules/simple-git/dist/src/lib/tasks/version.d.ts +9 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/types/index.d.ts +64 -5
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/exit-codes.d.ts +1 -0
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/line-parser.d.ts +1 -1
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/task-parser.d.ts +2 -2
- package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/util.d.ts +3 -1
- package/dist/node_modules/simple-git/{typings → dist/typings}/errors.d.ts +0 -1
- package/dist/node_modules/simple-git/{typings → dist/typings}/index.d.ts +2 -1
- package/dist/node_modules/simple-git/{typings → dist/typings}/response.d.ts +68 -25
- package/dist/node_modules/simple-git/{typings → dist/typings}/simple-git.d.ts +493 -110
- package/dist/node_modules/simple-git/dist/typings/types.d.ts +23 -0
- package/dist/node_modules/simple-git/package.json +32 -35
- package/dist/node_modules/simple-git/promise.js +14 -4
- package/dist/node_modules/simple-git/readme.md +372 -389
- package/dist/node_modules/undici-types/README.md +6 -0
- package/dist/node_modules/undici-types/agent.d.ts +31 -0
- package/dist/node_modules/undici-types/api.d.ts +43 -0
- package/dist/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/dist/node_modules/undici-types/cache.d.ts +36 -0
- package/dist/node_modules/undici-types/client.d.ts +97 -0
- package/dist/node_modules/undici-types/connector.d.ts +34 -0
- package/dist/node_modules/undici-types/content-type.d.ts +21 -0
- package/dist/node_modules/undici-types/cookies.d.ts +28 -0
- package/dist/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/dist/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/dist/node_modules/undici-types/errors.d.ts +128 -0
- package/dist/node_modules/undici-types/fetch.d.ts +209 -0
- package/dist/node_modules/undici-types/file.d.ts +39 -0
- package/dist/node_modules/undici-types/filereader.d.ts +54 -0
- package/dist/node_modules/undici-types/formdata.d.ts +108 -0
- package/dist/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/dist/node_modules/undici-types/global-origin.d.ts +7 -0
- package/dist/node_modules/undici-types/handlers.d.ts +9 -0
- package/dist/node_modules/undici-types/header.d.ts +4 -0
- package/dist/node_modules/undici-types/index.d.ts +63 -0
- package/dist/node_modules/undici-types/interceptors.d.ts +5 -0
- package/dist/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/dist/node_modules/undici-types/mock-client.d.ts +25 -0
- package/dist/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/dist/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/dist/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/dist/node_modules/undici-types/package.json +55 -0
- package/dist/node_modules/undici-types/patch.d.ts +71 -0
- package/dist/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/dist/node_modules/undici-types/pool.d.ts +28 -0
- package/dist/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/dist/node_modules/undici-types/readable.d.ts +61 -0
- package/dist/node_modules/undici-types/webidl.d.ts +220 -0
- package/dist/node_modules/undici-types/websocket.d.ts +131 -0
- package/dist/package-lock.json +10146 -0
- package/dist/package.json +24 -24
- package/dist/schemas/variant.json +5 -21
- package/package.json +24 -24
- package/dist/node_modules/@types/node/ts4.8/assert.d.ts +0 -130
- package/dist/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -237
- package/dist/node_modules/@types/node/ts4.8/buffer.d.ts +0 -89
- package/dist/node_modules/@types/node/ts4.8/child_process.d.ts +0 -682
- package/dist/node_modules/@types/node/ts4.8/cluster.d.ts +0 -300
- package/dist/node_modules/@types/node/ts4.8/console.d.ts +0 -142
- package/dist/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
- package/dist/node_modules/@types/node/ts4.8/crypto.d.ts +0 -1287
- package/dist/node_modules/@types/node/ts4.8/dgram.d.ts +0 -180
- package/dist/node_modules/@types/node/ts4.8/dns.d.ts +0 -516
- package/dist/node_modules/@types/node/ts4.8/domain.d.ts +0 -27
- package/dist/node_modules/@types/node/ts4.8/events.d.ts +0 -82
- package/dist/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -634
- package/dist/node_modules/@types/node/ts4.8/fs.d.ts +0 -2587
- package/dist/node_modules/@types/node/ts4.8/globals.d.ts +0 -763
- package/dist/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
- package/dist/node_modules/@types/node/ts4.8/http.d.ts +0 -580
- package/dist/node_modules/@types/node/ts4.8/http2.d.ts +0 -1208
- package/dist/node_modules/@types/node/ts4.8/https.d.ts +0 -274
- package/dist/node_modules/@types/node/ts4.8/index.d.ts +0 -53
- package/dist/node_modules/@types/node/ts4.8/inspector.d.ts +0 -3050
- package/dist/node_modules/@types/node/ts4.8/module.d.ts +0 -56
- package/dist/node_modules/@types/node/ts4.8/net.d.ts +0 -324
- package/dist/node_modules/@types/node/ts4.8/os.d.ts +0 -243
- package/dist/node_modules/@types/node/ts4.8/path.d.ts +0 -168
- package/dist/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -274
- package/dist/node_modules/@types/node/ts4.8/process.d.ts +0 -452
- package/dist/node_modules/@types/node/ts4.8/punycode.d.ts +0 -78
- package/dist/node_modules/@types/node/ts4.8/querystring.d.ts +0 -41
- package/dist/node_modules/@types/node/ts4.8/readline.d.ts +0 -184
- package/dist/node_modules/@types/node/ts4.8/repl.d.ts +0 -404
- package/dist/node_modules/@types/node/ts4.8/stream.d.ts +0 -518
- package/dist/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -10
- package/dist/node_modules/@types/node/ts4.8/timers.d.ts +0 -19
- package/dist/node_modules/@types/node/ts4.8/tls.d.ts +0 -866
- package/dist/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -64
- package/dist/node_modules/@types/node/ts4.8/tty.d.ts +0 -69
- package/dist/node_modules/@types/node/ts4.8/url.d.ts +0 -187
- package/dist/node_modules/@types/node/ts4.8/util.d.ts +0 -278
- package/dist/node_modules/@types/node/ts4.8/v8.d.ts +0 -189
- package/dist/node_modules/@types/node/ts4.8/vm.d.ts +0 -155
- package/dist/node_modules/@types/node/ts4.8/wasi.d.ts +0 -88
- package/dist/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -241
- package/dist/node_modules/@types/node/ts4.8/zlib.d.ts +0 -364
- package/dist/node_modules/fs-extra/lib/remove/rimraf.js +0 -302
- package/dist/node_modules/simple-git/CHANGELOG.md +0 -529
- package/dist/node_modules/simple-git/LICENSE +0 -20
- package/dist/node_modules/simple-git/promise.d.ts +0 -46
- package/dist/node_modules/simple-git/src/git.js +0 -700
- package/dist/node_modules/simple-git/src/index.js +0 -7
- package/dist/node_modules/simple-git/src/lib/api.js +0 -26
- package/dist/node_modules/simple-git/src/lib/api.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-construct-error.js +0 -21
- package/dist/node_modules/simple-git/src/lib/errors/git-construct-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-error.js +0 -37
- package/dist/node_modules/simple-git/src/lib/errors/git-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-plugin-error.d.ts +0 -6
- package/dist/node_modules/simple-git/src/lib/errors/git-plugin-error.js +0 -14
- package/dist/node_modules/simple-git/src/lib/errors/git-plugin-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/git-response-error.js +0 -36
- package/dist/node_modules/simple-git/src/lib/errors/git-response-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/errors/task-configuration-error.js +0 -19
- package/dist/node_modules/simple-git/src/lib/errors/task-configuration-error.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/git-factory.d.ts +0 -25
- package/dist/node_modules/simple-git/src/lib/git-factory.js +0 -45
- package/dist/node_modules/simple-git/src/lib/git-factory.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/git-logger.js +0 -101
- package/dist/node_modules/simple-git/src/lib/git-logger.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch-delete.js +0 -29
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch-delete.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch.js +0 -18
- package/dist/node_modules/simple-git/src/lib/parsers/parse-branch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-commit.js +0 -53
- package/dist/node_modules/simple-git/src/lib/parsers/parse-commit.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-diff-summary.d.ts +0 -2
- package/dist/node_modules/simple-git/src/lib/parsers/parse-diff-summary.js +0 -74
- package/dist/node_modules/simple-git/src/lib/parsers/parse-diff-summary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-fetch.js +0 -32
- package/dist/node_modules/simple-git/src/lib/parsers/parse-fetch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-list-log-summary.js +0 -35
- package/dist/node_modules/simple-git/src/lib/parsers/parse-list-log-summary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-merge.js +0 -39
- package/dist/node_modules/simple-git/src/lib/parsers/parse-merge.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-move.js +0 -14
- package/dist/node_modules/simple-git/src/lib/parsers/parse-move.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-pull.js +0 -42
- package/dist/node_modules/simple-git/src/lib/parsers/parse-pull.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-push.js +0 -58
- package/dist/node_modules/simple-git/src/lib/parsers/parse-push.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-messages.js +0 -33
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-messages.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-objects.js +0 -41
- package/dist/node_modules/simple-git/src/lib/parsers/parse-remote-objects.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/command-config-prefixing-plugin.js +0 -15
- package/dist/node_modules/simple-git/src/lib/plugins/command-config-prefixing-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/completion-detection.plugin.js +0 -80
- package/dist/node_modules/simple-git/src/lib/plugins/completion-detection.plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/error-detection.plugin.js +0 -39
- package/dist/node_modules/simple-git/src/lib/plugins/error-detection.plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/index.js +0 -21
- package/dist/node_modules/simple-git/src/lib/plugins/index.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/plugin-store.d.ts +0 -6
- package/dist/node_modules/simple-git/src/lib/plugins/plugin-store.js +0 -28
- package/dist/node_modules/simple-git/src/lib/plugins/plugin-store.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/progress-monitor-plugin.js +0 -45
- package/dist/node_modules/simple-git/src/lib/plugins/progress-monitor-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/simple-git-plugin.js +0 -3
- package/dist/node_modules/simple-git/src/lib/plugins/simple-git-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/spawn-options-plugin.js +0 -15
- package/dist/node_modules/simple-git/src/lib/plugins/spawn-options-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/plugins/timout-plugin.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/plugins/timout-plugin.js +0 -37
- package/dist/node_modules/simple-git/src/lib/plugins/timout-plugin.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/BranchDeleteSummary.js +0 -31
- package/dist/node_modules/simple-git/src/lib/responses/BranchDeleteSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/BranchSummary.d.ts +0 -10
- package/dist/node_modules/simple-git/src/lib/responses/BranchSummary.js +0 -26
- package/dist/node_modules/simple-git/src/lib/responses/BranchSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/CheckIgnore.js +0 -13
- package/dist/node_modules/simple-git/src/lib/responses/CheckIgnore.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/CleanSummary.js +0 -28
- package/dist/node_modules/simple-git/src/lib/responses/CleanSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/ConfigList.js +0 -89
- package/dist/node_modules/simple-git/src/lib/responses/ConfigList.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/DiffSummary.js +0 -16
- package/dist/node_modules/simple-git/src/lib/responses/DiffSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/FileStatusSummary.js +0 -18
- package/dist/node_modules/simple-git/src/lib/responses/FileStatusSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/GetRemoteSummary.js +0 -30
- package/dist/node_modules/simple-git/src/lib/responses/GetRemoteSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/InitSummary.js +0 -36
- package/dist/node_modules/simple-git/src/lib/responses/InitSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/MergeSummary.js +0 -35
- package/dist/node_modules/simple-git/src/lib/responses/MergeSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/PullSummary.d.ts +0 -12
- package/dist/node_modules/simple-git/src/lib/responses/PullSummary.js +0 -22
- package/dist/node_modules/simple-git/src/lib/responses/PullSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/StatusSummary.js +0 -128
- package/dist/node_modules/simple-git/src/lib/responses/StatusSummary.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/responses/TagList.js +0 -56
- package/dist/node_modules/simple-git/src/lib/responses/TagList.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/git-executor-chain.js +0 -173
- package/dist/node_modules/simple-git/src/lib/runners/git-executor-chain.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/git-executor.js +0 -21
- package/dist/node_modules/simple-git/src/lib/runners/git-executor.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/promise-wrapped.js +0 -133
- package/dist/node_modules/simple-git/src/lib/runners/promise-wrapped.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/scheduler.js +0 -48
- package/dist/node_modules/simple-git/src/lib/runners/scheduler.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/runners/tasks-pending-queue.js +0 -64
- package/dist/node_modules/simple-git/src/lib/runners/tasks-pending-queue.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/simple-git-api.js +0 -80
- package/dist/node_modules/simple-git/src/lib/simple-git-api.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/task-callback.js +0 -39
- package/dist/node_modules/simple-git/src/lib/task-callback.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/apply-patch.js +0 -9
- package/dist/node_modules/simple-git/src/lib/tasks/apply-patch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/branch.js +0 -76
- package/dist/node_modules/simple-git/src/lib/tasks/branch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/change-working-directory.js +0 -15
- package/dist/node_modules/simple-git/src/lib/tasks/change-working-directory.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/check-ignore.js +0 -13
- package/dist/node_modules/simple-git/src/lib/tasks/check-ignore.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/check-is-repo.js +0 -61
- package/dist/node_modules/simple-git/src/lib/tasks/check-is-repo.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/clean.js +0 -85
- package/dist/node_modules/simple-git/src/lib/tasks/clean.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/clone.js +0 -22
- package/dist/node_modules/simple-git/src/lib/tasks/clone.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/commit.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/tasks/commit.js +0 -16
- package/dist/node_modules/simple-git/src/lib/tasks/commit.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/config.js +0 -73
- package/dist/node_modules/simple-git/src/lib/tasks/config.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/diff.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/tasks/diff.js +0 -15
- package/dist/node_modules/simple-git/src/lib/tasks/diff.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/fetch.js +0 -17
- package/dist/node_modules/simple-git/src/lib/tasks/fetch.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/grep.js +0 -76
- package/dist/node_modules/simple-git/src/lib/tasks/grep.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/hash-object.js +0 -16
- package/dist/node_modules/simple-git/src/lib/tasks/hash-object.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/init.js +0 -23
- package/dist/node_modules/simple-git/src/lib/tasks/init.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/log.js +0 -109
- package/dist/node_modules/simple-git/src/lib/tasks/log.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/merge.js +0 -24
- package/dist/node_modules/simple-git/src/lib/tasks/merge.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/move.js +0 -14
- package/dist/node_modules/simple-git/src/lib/tasks/move.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/pull.js +0 -19
- package/dist/node_modules/simple-git/src/lib/tasks/pull.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/push.js +0 -29
- package/dist/node_modules/simple-git/src/lib/tasks/push.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/remote.js +0 -42
- package/dist/node_modules/simple-git/src/lib/tasks/remote.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/reset.js +0 -38
- package/dist/node_modules/simple-git/src/lib/tasks/reset.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/stash-list.d.ts +0 -3
- package/dist/node_modules/simple-git/src/lib/tasks/stash-list.js +0 -16
- package/dist/node_modules/simple-git/src/lib/tasks/stash-list.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/status.js +0 -15
- package/dist/node_modules/simple-git/src/lib/tasks/status.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/sub-module.js +0 -25
- package/dist/node_modules/simple-git/src/lib/tasks/sub-module.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/tag.js +0 -45
- package/dist/node_modules/simple-git/src/lib/tasks/tag.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/tasks/task.js +0 -52
- package/dist/node_modules/simple-git/src/lib/tasks/task.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/types/handlers.js +0 -3
- package/dist/node_modules/simple-git/src/lib/types/handlers.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/types/index.js +0 -15
- package/dist/node_modules/simple-git/src/lib/types/index.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/types/tasks.js +0 -3
- package/dist/node_modules/simple-git/src/lib/types/tasks.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/argument-filters.js +0 -47
- package/dist/node_modules/simple-git/src/lib/utils/argument-filters.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/exit-codes.js +0 -14
- package/dist/node_modules/simple-git/src/lib/utils/exit-codes.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/git-output-streams.js +0 -14
- package/dist/node_modules/simple-git/src/lib/utils/git-output-streams.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/index.js +0 -21
- package/dist/node_modules/simple-git/src/lib/utils/index.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/line-parser.js +0 -52
- package/dist/node_modules/simple-git/src/lib/utils/line-parser.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/simple-git-options.js +0 -16
- package/dist/node_modules/simple-git/src/lib/utils/simple-git-options.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/task-options.js +0 -58
- package/dist/node_modules/simple-git/src/lib/utils/task-options.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/task-parser.js +0 -24
- package/dist/node_modules/simple-git/src/lib/utils/task-parser.js.map +0 -1
- package/dist/node_modules/simple-git/src/lib/utils/util.js +0 -146
- package/dist/node_modules/simple-git/src/lib/utils/util.js.map +0 -1
- package/dist/node_modules/simple-git/typings/types.d.ts +0 -14
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/git-construct-error.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/git-response-error.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/errors/task-configuration-error.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/git-logger.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-branch-delete.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-commit.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-fetch.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-merge.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-move.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-push.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-remote-messages.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/parsers/parse-remote-objects.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/command-config-prefixing-plugin.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/error-detection.plugin.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/plugins/spawn-options-plugin.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/BranchDeleteSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/CheckIgnore.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/CleanSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/ConfigList.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/DiffSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/GetRemoteSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/InitSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/MergeSummary.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/responses/TagList.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/promise-wrapped.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/scheduler.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/runners/tasks-pending-queue.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/simple-git-api.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/task-callback.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/apply-patch.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/branch.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/change-working-directory.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/check-ignore.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/check-is-repo.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/clean.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/grep.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/hash-object.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/init.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/merge.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/move.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/pull.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/push.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/reset.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/status.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/sub-module.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/tasks/tag.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/types/handlers.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/types/tasks.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/argument-filters.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/git-output-streams.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/index.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/simple-git-options.d.ts +0 -0
- /package/dist/node_modules/simple-git/{src → dist/src}/lib/utils/task-options.d.ts +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Simple Git
|
|
2
|
+
|
|
2
3
|
[](https://www.npmjs.com/package/simple-git)
|
|
3
4
|
|
|
4
5
|
A lightweight interface for running `git` commands in any [node.js](https://nodejs.org) application.
|
|
@@ -7,8 +8,8 @@ A lightweight interface for running `git` commands in any [node.js](https://node
|
|
|
7
8
|
|
|
8
9
|
Use your favourite package manager:
|
|
9
10
|
|
|
10
|
-
-
|
|
11
|
-
-
|
|
11
|
+
- [npm](https://npmjs.org): `npm install simple-git`
|
|
12
|
+
- [yarn](https://yarnpkg.com/): `yarn add simple-git`
|
|
12
13
|
|
|
13
14
|
# System Dependencies
|
|
14
15
|
|
|
@@ -16,25 +17,32 @@ Requires [git](https://git-scm.com/downloads) to be installed and that it can be
|
|
|
16
17
|
|
|
17
18
|
# Usage
|
|
18
19
|
|
|
19
|
-
Include into your JavaScript app using:
|
|
20
|
+
Include into your JavaScript app using common js:
|
|
20
21
|
|
|
21
|
-
```
|
|
22
|
+
```javascript
|
|
22
23
|
// require the library, main export is a function
|
|
23
24
|
const simpleGit = require('simple-git');
|
|
24
|
-
|
|
25
|
+
simpleGit().clean(simpleGit.CleanOptions.FORCE);
|
|
26
|
+
|
|
27
|
+
// or use named properties
|
|
28
|
+
const { simpleGit, CleanOptions } = require('simple-git');
|
|
29
|
+
simpleGit().clean(CleanOptions.FORCE);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Include into your JavaScript app as an ES Module:
|
|
33
|
+
|
|
34
|
+
```javascript
|
|
35
|
+
import { simpleGit, CleanOptions } from 'simple-git';
|
|
36
|
+
|
|
37
|
+
simpleGit().clean(CleanOptions.FORCE);
|
|
25
38
|
```
|
|
26
39
|
|
|
27
|
-
Include in a TypeScript app using:
|
|
40
|
+
Include in a TypeScript app using the bundled type definitions:
|
|
28
41
|
|
|
29
42
|
```typescript
|
|
30
|
-
|
|
31
|
-
import simpleGit, {SimpleGit} from 'simple-git';
|
|
32
|
-
const git: SimpleGit = simpleGit();
|
|
43
|
+
import { simpleGit, SimpleGit, CleanOptions } from 'simple-git';
|
|
33
44
|
|
|
34
|
-
|
|
35
|
-
// this import is still available but is now deprecated
|
|
36
|
-
import gitP, {SimpleGit} from 'simple-git/promise';
|
|
37
|
-
const git: SimpleGit = gitP();
|
|
45
|
+
const git: SimpleGit = simpleGit().clean(CleanOptions.FORCE);
|
|
38
46
|
```
|
|
39
47
|
|
|
40
48
|
## Configuration
|
|
@@ -42,12 +50,13 @@ const git: SimpleGit = gitP();
|
|
|
42
50
|
Configure each `simple-git` instance with a properties object passed to the main `simpleGit` function:
|
|
43
51
|
|
|
44
52
|
```typescript
|
|
45
|
-
import simpleGit,
|
|
53
|
+
import { simpleGit, SimpleGit, SimpleGitOptions } from 'simple-git';
|
|
46
54
|
|
|
47
55
|
const options: Partial<SimpleGitOptions> = {
|
|
48
56
|
baseDir: process.cwd(),
|
|
49
57
|
binary: 'git',
|
|
50
58
|
maxConcurrentProcesses: 6,
|
|
59
|
+
trimmed: false,
|
|
51
60
|
};
|
|
52
61
|
|
|
53
62
|
// when setting all options in a single object
|
|
@@ -78,29 +87,37 @@ await git.pull();
|
|
|
78
87
|
|
|
79
88
|
## Configuring Plugins
|
|
80
89
|
|
|
81
|
-
- [
|
|
82
|
-
|
|
90
|
+
- [AbortController](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-ABORT-CONTROLLER.md)
|
|
91
|
+
Terminate pending and future tasks in a `simple-git` instance (requires node >= 16).
|
|
92
|
+
|
|
93
|
+
- [Custom Binary](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-CUSTOM-BINARY.md)
|
|
94
|
+
Customise the `git` binary `simple-git` uses when spawning `git` child processes.
|
|
95
|
+
|
|
96
|
+
- [Completion Detection](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-COMPLETION-DETECTION.md)
|
|
97
|
+
Customise how `simple-git` detects the end of a `git` process.
|
|
83
98
|
|
|
84
|
-
- [Error Detection](
|
|
85
|
-
|
|
99
|
+
- [Error Detection](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-ERRORS.md)
|
|
100
|
+
Customise the detection of errors from the underlying `git` process.
|
|
86
101
|
|
|
87
|
-
- [Progress Events](
|
|
88
|
-
|
|
102
|
+
- [Progress Events](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-PROGRESS-EVENTS.md)
|
|
103
|
+
Receive progress events as `git` works through long-running processes.
|
|
89
104
|
|
|
90
|
-
- [Spawned Process Ownership](
|
|
91
|
-
|
|
105
|
+
- [Spawned Process Ownership](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-SPAWN-OPTIONS.md)
|
|
106
|
+
Configure the system `uid` / `gid` to use for spawned `git` processes.
|
|
92
107
|
|
|
93
|
-
- [Timeout](
|
|
94
|
-
|
|
108
|
+
- [Timeout](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-TIMEOUT.md)
|
|
109
|
+
Automatically kill the wrapped `git` process after a rolling timeout.
|
|
95
110
|
|
|
96
|
-
|
|
111
|
+
- [Unsafe](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-UNSAFE-ACTIONS.md)
|
|
112
|
+
Selectively opt out of `simple-git` safety precautions - for advanced users and use cases.
|
|
113
|
+
|
|
114
|
+
## Using Task Promises
|
|
97
115
|
|
|
98
116
|
Each task in the API returns the `simpleGit` instance for chaining together multiple tasks, and each
|
|
99
117
|
step in the chain is also a `Promise` that can be `await` ed in an `async` function or returned in a
|
|
100
118
|
`Promise` chain.
|
|
101
119
|
|
|
102
120
|
```javascript
|
|
103
|
-
const simpleGit = require('simple-git');
|
|
104
121
|
const git = simpleGit();
|
|
105
122
|
|
|
106
123
|
// chain together tasks to await final result
|
|
@@ -108,338 +125,345 @@ await git.init().addRemote('origin', '...remote.git');
|
|
|
108
125
|
|
|
109
126
|
// or await each step individually
|
|
110
127
|
await git.init();
|
|
111
|
-
await git.addRemote('origin', '...remote.git')
|
|
112
|
-
```
|
|
128
|
+
await git.addRemote('origin', '...remote.git');
|
|
129
|
+
```
|
|
113
130
|
|
|
114
|
-
|
|
131
|
+
### Catching errors in async code
|
|
115
132
|
|
|
116
133
|
To catch errors in async code, either wrap the whole chain in a try/catch:
|
|
117
134
|
|
|
118
135
|
```javascript
|
|
119
|
-
const git = simpleGit()
|
|
136
|
+
const git = simpleGit();
|
|
120
137
|
try {
|
|
121
|
-
|
|
122
|
-
|
|
138
|
+
await git.init();
|
|
139
|
+
await git.addRemote(name, repoUrl);
|
|
140
|
+
} catch (e) {
|
|
141
|
+
/* handle all errors here */
|
|
123
142
|
}
|
|
124
|
-
catch (e) { /* handle all errors here */ }
|
|
125
143
|
```
|
|
126
144
|
|
|
127
145
|
or catch individual steps to permit the main chain to carry on executing rather than
|
|
128
146
|
jumping to the final `catch` on the first error:
|
|
129
147
|
|
|
130
148
|
```javascript
|
|
131
|
-
const git = simpleGit()
|
|
149
|
+
const git = simpleGit();
|
|
132
150
|
try {
|
|
133
|
-
|
|
134
|
-
|
|
151
|
+
await git.init().catch(ignoreError);
|
|
152
|
+
await git.addRemote(name, repoUrl);
|
|
153
|
+
} catch (e) {
|
|
154
|
+
/* handle all errors here */
|
|
135
155
|
}
|
|
136
|
-
catch (e) { /* handle all errors here */ }
|
|
137
156
|
|
|
138
|
-
function ignoreError
|
|
157
|
+
function ignoreError() {}
|
|
139
158
|
```
|
|
140
159
|
|
|
141
|
-
## Using
|
|
160
|
+
## Using Task Callbacks
|
|
142
161
|
|
|
143
|
-
In addition to returning promise method can be called with a trailing callback argument
|
|
162
|
+
In addition to returning a promise, each method can also be called with a trailing callback argument
|
|
163
|
+
to handle the result of the task.
|
|
144
164
|
|
|
145
165
|
```javascript
|
|
146
|
-
const simpleGit = require('simple-git');
|
|
147
166
|
const git = simpleGit();
|
|
148
167
|
git.init(onInit).addRemote('origin', 'git@github.com:steveukx/git-js.git', onRemoteAdd);
|
|
149
168
|
|
|
150
|
-
function onInit
|
|
151
|
-
function onRemoteAdd
|
|
152
|
-
```
|
|
169
|
+
function onInit(err, initResult) {}
|
|
170
|
+
function onRemoteAdd(err, addRemoteResult) {}
|
|
171
|
+
```
|
|
153
172
|
|
|
154
173
|
If any of the steps in the chain result in an error, all pending steps will be cancelled, see the
|
|
155
|
-
[parallel tasks]((#concurrent--parallel-requests)) section for more information on how to run tasks in parallel rather than in series .
|
|
174
|
+
[parallel tasks](<(#concurrent--parallel-requests)>) section for more information on how to run tasks in parallel rather than in series .
|
|
156
175
|
|
|
157
176
|
## Task Responses
|
|
158
177
|
|
|
159
178
|
Whether using a trailing callback or a Promise, tasks either return the raw `string` or `Buffer` response from the
|
|
160
179
|
`git` binary, or where possible a parsed interpretation of the response.
|
|
161
180
|
|
|
162
|
-
For type details of the response for each of the tasks, please see the [TypeScript definitions](
|
|
181
|
+
For type details of the response for each of the tasks, please see the [TypeScript definitions](https://github.com/steveukx/git-js/blob/main/simple-git/typings/simple-git.d.ts).
|
|
163
182
|
|
|
183
|
+
# Upgrading from Version 2
|
|
184
|
+
|
|
185
|
+
From v3 of `simple-git` you can now import as an ES module, Common JS module or as TypeScript with bundled type
|
|
186
|
+
definitions. Upgrading from v2 will be seamless for any application not relying on APIs that were marked as deprecated
|
|
187
|
+
in v2 (deprecation notices were logged to `stdout` as `console.warn` in v2).
|
|
164
188
|
|
|
165
189
|
# API
|
|
166
190
|
|
|
167
|
-
| API
|
|
168
|
-
|
|
169
|
-
| `.add([fileA, ...], handlerFn)`
|
|
170
|
-
| `.addAnnotatedTag(tagName, tagMessage, handlerFn)`
|
|
171
|
-
| `.addTag(name, handlerFn)`
|
|
172
|
-
| `.catFile(options
|
|
173
|
-
| `.checkIgnore([filepath, ...], handlerFn)`
|
|
174
|
-
| `.clearQueue()`
|
|
175
|
-
| `.commit(message, handlerFn)`
|
|
191
|
+
| API | What it does |
|
|
192
|
+
| ---------------------------------------------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
193
|
+
| `.add([fileA, ...], handlerFn)` | adds one or more files to be under source control |
|
|
194
|
+
| `.addAnnotatedTag(tagName, tagMessage, handlerFn)` | adds an annotated tag to the head of the current branch |
|
|
195
|
+
| `.addTag(name, handlerFn)` | adds a lightweight tag to the head of the current branch |
|
|
196
|
+
| `.catFile(options, [handlerFn])` | generate `cat-file` detail, `options` should be an array of strings as supported arguments to the [cat-file](https://git-scm.com/docs/git-cat-file) command |
|
|
197
|
+
| `.checkIgnore([filepath, ...], handlerFn)` | checks if filepath excluded by .gitignore rules |
|
|
198
|
+
| `.clearQueue()` | immediately clears the queue of pending tasks (note: any command currently in progress will still call its completion callback) |
|
|
199
|
+
| `.commit(message, handlerFn)` | commits changes in the current working directory with the supplied message where the message can be either a single string or array of strings to be passed as separate arguments (the `git` command line interface converts these to be separated by double line breaks) |
|
|
176
200
|
| `.commit(message, [fileA, ...], options, handlerFn)` | commits changes on the named files with the supplied message, when supplied, the optional options object can contain any other parameters to pass to the commit command, setting the value of the property to be a string will add `name=value` to the command string, setting any other type of value will result in just the key from the object being passed (ie: just `name`), an example of setting the author is below |
|
|
177
|
-
| `.customBinary(gitPath)`
|
|
178
|
-
| `.
|
|
179
|
-
| `.
|
|
180
|
-
| `.
|
|
181
|
-
| `.
|
|
182
|
-
| `.
|
|
183
|
-
| `.
|
|
184
|
-
| `.
|
|
185
|
-
| `.
|
|
186
|
-
| `.
|
|
187
|
-
| `.
|
|
188
|
-
| `.
|
|
189
|
-
| `.
|
|
190
|
-
| `.
|
|
191
|
-
| `.rm([fileA, ...], handlerFn)` | removes any number of files from source control |
|
|
192
|
-
| `.rmKeepLocal([fileA, ...], handlerFn)` | removes files from source control but leaves them on disk |
|
|
193
|
-
| `.stash([options, ][ handlerFn])` | Stash the working directory, optional first argument can be an array of string arguments or [options](#how-to-specify-options) object to pass to the [git stash](https://git-scm.com/docs/git-stash) command. |
|
|
194
|
-
| `.stashList([options, ][handlerFn])` | Retrieves the stash list, optional first argument can be an object specifying `options.splitter` to override the default value of `;;;;`, alternatively options can be a set of arguments as supported by the `git stash list` command. |
|
|
195
|
-
| `.tag(args[], handlerFn)` | Runs any supported [git tag](https://git-scm.com/docs/git-tag) commands with arguments passed as an array of strings . |
|
|
196
|
-
| `.tags([options, ] handlerFn)` | list all tags, use the optional [options](#how-to-specify-options) object to set any options allows by the [git tag](https://git-scm.com/docs/git-tag) command. Tags will be sorted by semantic version number by default, for git versions 2.7 and above, use the `--sort` option to set a custom sort. |
|
|
197
|
-
| `.show([options], handlerFn)` | Show various types of objects, for example the file content at a certain commit. `options` is the single value string or array of string commands you want to run |
|
|
201
|
+
| `.customBinary(gitPath)` | sets the command to use to reference git, allows for using a git binary not available on the path environment variable [docs](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-CUSTOM-BINARY.md) |
|
|
202
|
+
| `.env(name, value)` | Set environment variables to be passed to the spawned child processes, [see usage in detail below](#environment-variables). |
|
|
203
|
+
| `.exec(handlerFn)` | calls a simple function in the current step |
|
|
204
|
+
| `.fetch([options, ] handlerFn)` | update the local working copy database with changes from the default remote repo and branch, when supplied the options argument can be a standard [options object](#how-to-specify-options) either an array of string commands as supported by the [git fetch](https://git-scm.com/docs/git-fetch). |
|
|
205
|
+
| `.fetch(remote, branch, handlerFn)` | update the local working copy database with changes from a remote repo |
|
|
206
|
+
| `.fetch(handlerFn)` | update the local working copy database with changes from the default remote repo and branch |
|
|
207
|
+
| `.outputHandler(handlerFn)` | attaches a handler that will be called with the name of the command being run and the `stdout` and `stderr` [readable streams](https://nodejs.org/api/stream.html#stream_class_stream_readable) created by the [child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess) running that command, see [examples](https://github.com/steveukx/git-js/blob/main/examples/git-output-handler.md) |
|
|
208
|
+
| `.raw(args, [handlerFn])` | Execute any arbitrary array of commands supported by the underlying git binary. When the git process returns a non-zero signal on exit and it printed something to `stderr`, the command will be treated as an error, otherwise treated as a success. |
|
|
209
|
+
| `.rebase([options,] handlerFn)` | Rebases the repo, `options` should be supplied as an array of string parameters supported by the [git rebase](https://git-scm.com/docs/git-rebase) command, or an object of options (see details below for option formats). |
|
|
210
|
+
| `.revert(commit , [options , [handlerFn]])` | reverts one or more commits in the working copy. The commit can be any regular commit-ish value (hash, name or offset such as `HEAD~2`) or a range of commits (eg: `master~5..master~2`). When supplied the [options](#how-to-specify-options) argument contain any options accepted by [git-revert](https://git-scm.com/docs/git-revert). |
|
|
211
|
+
| `.rm([fileA, ...], handlerFn)` | removes any number of files from source control |
|
|
212
|
+
| `.rmKeepLocal([fileA, ...], handlerFn)` | removes files from source control but leaves them on disk |
|
|
213
|
+
| `.tag(args[], handlerFn)` | Runs any supported [git tag](https://git-scm.com/docs/git-tag) commands with arguments passed as an array of strings . |
|
|
214
|
+
| `.tags([options, ] handlerFn)` | list all tags, use the optional [options](#how-to-specify-options) object to set any options allows by the [git tag](https://git-scm.com/docs/git-tag) command. Tags will be sorted by semantic version number by default, for git versions 2.7 and above, use the `--sort` option to set a custom sort. |
|
|
198
215
|
|
|
199
216
|
## git apply
|
|
200
217
|
|
|
201
|
-
-
|
|
202
|
-
-
|
|
218
|
+
- `.applyPatch(patch, [options])` applies a single string patch (as generated by `git diff`), optionally configured with the supplied [options](#how-to-specify-options) to set any arguments supported by the [apply](https://git-scm.com/docs/git-apply) command. Returns the unmodified string response from `stdout` of the `git` binary.
|
|
219
|
+
- `.applyPatch(patches, [options])` applies an array of string patches (as generated by `git diff`), optionally configured with the supplied [options](#how-to-specify-options) to set any arguments supported by the [apply](https://git-scm.com/docs/git-apply) command. Returns the unmodified string response from `stdout` of the `git` binary.
|
|
203
220
|
|
|
204
221
|
## git branch
|
|
205
222
|
|
|
206
|
-
-
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
-
|
|
223
|
+
- `.branch([options])` uses the supplied [options](#how-to-specify-options) to run any arguments supported by the [branch](https://git-scm.com/docs/git-branch) command. Either returns a [BranchSummaryResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/BranchSummary.ts) instance when listing branches, or a [BranchSingleDeleteResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts) type object when the options included `-d`, `-D` or `--delete` which cause it to delete a named branch rather than list existing branches.
|
|
224
|
+
- `.branchLocal()` gets a list of local branches as a [BranchSummaryResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/BranchSummary.ts) instance
|
|
225
|
+
- `.deleteLocalBranch(branchName)` deletes a local branch - treats a failed attempt as an error
|
|
226
|
+
- `.deleteLocalBranch(branchName, forceDelete)` deletes a local branch, optionally explicitly setting forceDelete to true - treats a failed attempt as an error
|
|
227
|
+
- `.deleteLocalBranches(branchNames)` deletes multiple local branches
|
|
228
|
+
- `.deleteLocalBranches(branchNames, forceDelete)` deletes multiple local branches, optionally explicitly setting forceDelete to true
|
|
212
229
|
|
|
213
230
|
## git clean
|
|
214
231
|
|
|
215
|
-
-
|
|
216
|
-
-
|
|
232
|
+
- `.clean(mode)` clean the working tree. Mode should be "n" - dry run or "f" - force
|
|
233
|
+
- `.clean(cleanSwitches [,options])` set `cleanSwitches` to a string containing any number of the supported single character options, optionally with a standard [options](#how-to-specify-options) object
|
|
217
234
|
|
|
218
235
|
## git checkout
|
|
219
236
|
|
|
220
|
-
-
|
|
237
|
+
- `.checkout(checkoutWhat , [options])` - checks out the supplied tag, revision or branch when supplied as a string,
|
|
221
238
|
additional arguments supported by [git checkout](https://git-scm.com/docs/git-checkout) can be supplied as an
|
|
222
239
|
[options](#how-to-specify-options) object/array.
|
|
223
240
|
|
|
224
|
-
-
|
|
241
|
+
- `.checkout(options)` - check out a tag or revision using the supplied [options](#how-to-specify-options)
|
|
225
242
|
|
|
226
|
-
-
|
|
243
|
+
- `.checkoutBranch(branchName, startPoint)` - checks out a new branch from the supplied start point.
|
|
227
244
|
|
|
228
|
-
-
|
|
245
|
+
- `.checkoutLocalBranch(branchName)` - checks out a new local branch
|
|
229
246
|
|
|
230
247
|
## git clone
|
|
231
248
|
|
|
232
|
-
-
|
|
233
|
-
-
|
|
234
|
-
|
|
235
|
-
- `mirror(repoPath, [localPath, [options]])` behaves the same as the `.clone` interface with the [`--mirror` flag](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror) enabled.
|
|
249
|
+
- `.clone(repoPath, [localPath, [options]])` clone a remote repo at `repoPath` to a local directory at `localPath`, optionally with a standard [options](#how-to-specify-options) object of additional arguments to include between `git clone` and the trailing `repo local` arguments
|
|
250
|
+
- `.clone(repoPath, [options])` clone a remote repo at `repoPath` to a directory in the current working directory with the same name as the repo
|
|
236
251
|
|
|
252
|
+
- `mirror(repoPath, [localPath, [options]])` behaves the same as the `.clone` interface with the [`--mirror` flag](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror) enabled.
|
|
237
253
|
|
|
238
254
|
## git config
|
|
239
255
|
|
|
240
|
-
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
256
|
+
- `.addConfig(key, value, append = false, scope = 'local')` add a local configuration property, when `append` is set to
|
|
257
|
+
`true` the configuration setting is appended to rather than overwritten in the local config. Use the `scope` argument
|
|
258
|
+
to pick where to save the new configuration setting (use the exported `GitConfigScope` enum, or equivalent string
|
|
259
|
+
values - `worktree | local | global | system`).
|
|
260
|
+
- `.getConfig(key)` get the value(s) for a named key as a [ConfigGetResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts)
|
|
261
|
+
- `.getConfig(key, scope)` get the value(s) for a named key as a [ConfigGetResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts) but limit the
|
|
262
|
+
scope of the properties searched to a single specified scope (use the exported `GitConfigScope` enum, or equivalent
|
|
263
|
+
string values - `worktree | local | global | system`)
|
|
264
|
+
|
|
265
|
+
- `.listConfig()` reads the current configuration and returns a [ConfigListSummary](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/ConfigList.ts)
|
|
266
|
+
- `.listConfig(scope: GitConfigScope)` as with `listConfig` but returns only those items in a specified scope (note that configuration values are overlaid on top of each other to build the config `git` will actually use - to resolve the configuration you are using use `(await listConfig()).all` without the scope argument)
|
|
249
267
|
|
|
250
|
-
|
|
251
|
-
- `.listConfig(scope: GitConfigScope)` as with `listConfig` but returns only those items in a specified scope (note that configuration values are overlaid on top of each other to build the config `git` will actually use - to resolve the configuration you are using use `(await listConfig()).all` without the scope argument)
|
|
268
|
+
## git count-objects
|
|
252
269
|
|
|
253
|
-
|
|
270
|
+
- `.countObjects()` queries the pack and disk usage properties of the local repository and returns a [CountObjectsResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/tasks/count-objects.ts). All disk sizes are reported in Kb, see https://git-scm.com/docs/git-count-objects for full description of properties.
|
|
254
271
|
|
|
255
|
-
|
|
256
|
-
|
|
272
|
+
## git diff
|
|
273
|
+
|
|
274
|
+
- `.diff([ options ])` get the diff of the current repo compared to the last commit, optionally including
|
|
275
|
+
any number of other arguments supported by [git diff](https://git-scm.com/docs/git-diff) supplied as an
|
|
276
|
+
[options](#how-to-specify-options) object/array. Returns the raw `diff` output as a string.
|
|
277
|
+
|
|
278
|
+
- `.diffSummary([ options ])` creates a [DiffResult](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/DiffSummary.ts)
|
|
279
|
+
to summarise the diff for files in the repo. Uses the `--stat` format by default which can be overridden
|
|
280
|
+
by passing in any of the log format commands (eg: `--numstat` or `--name-stat`) as part of the optional
|
|
281
|
+
[options](#how-to-specify-options) object/array.
|
|
282
|
+
|
|
283
|
+
## git grep [examples](https://github.com/steveukx/git-js/blob/main/examples/git-grep.md)
|
|
284
|
+
|
|
285
|
+
- `.grep(searchTerm)` searches for a single search term across all files in the working tree, optionally passing a standard [options](#how-to-specify-options) object of additional arguments
|
|
286
|
+
- `.grep(grepQueryBuilder(...))` use the `grepQueryBuilder` to create a complex query to search for, optionally passing a standard [options](#how-to-specify-options) object of additional arguments
|
|
257
287
|
|
|
258
288
|
## git hash-object
|
|
259
289
|
|
|
260
|
-
-
|
|
261
|
-
|
|
290
|
+
- `.hashObject(filePath, write = false)` computes the object ID value for the contents of the named file (which can be
|
|
291
|
+
outside of the work tree), optionally writing the resulting value to the object database.
|
|
262
292
|
|
|
263
293
|
## git init
|
|
264
294
|
|
|
265
|
-
-
|
|
295
|
+
- `.init(bare , [options])` initialize a repository using the boolean `bare` parameter to intialise a bare repository.
|
|
266
296
|
Any number of other arguments supported by [git init](https://git-scm.com/docs/git-init) can be supplied as an
|
|
267
297
|
[options](#how-to-specify-options) object/array.
|
|
268
298
|
|
|
269
|
-
-
|
|
299
|
+
- `.init([options])` initialize a repository using any arguments supported by
|
|
270
300
|
[git init](https://git-scm.com/docs/git-init) supplied as an [options](#how-to-specify-options) object/array.
|
|
271
301
|
|
|
272
302
|
## git log
|
|
273
303
|
|
|
274
|
-
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
304
|
+
- `.log([options])` list commits between `options.from` and `options.to` tags or branch (if not specified will
|
|
305
|
+
show all history). Use the `options` object to set any [options](#how-to-specify-options) supported by the
|
|
306
|
+
[git log](https://git-scm.com/docs/git-log) command or any of the following:
|
|
307
|
+
|
|
308
|
+
- `options.file` - the path to a file in your repository to only consider this path.
|
|
309
|
+
- `options.format` - custom log format object, keys are the property names used on the returned object, values are the format string from [pretty formats](https://git-scm.com/docs/pretty-formats#Documentation/pretty-formats.txt)
|
|
310
|
+
- `options.from` - sets the oldest commit in the range to return, use along with `options.to` to set a bounded range
|
|
311
|
+
- `options.mailMap` - defaults to true, enables the use of [mail map](https://git-scm.com/docs/gitmailmap) in returned values for email and name from the default format
|
|
312
|
+
- `options.maxCount` - equivalent to setting the `--max-count` option
|
|
313
|
+
- `options.multiLine` - enables multiline body values in the default format (disabled by default)
|
|
314
|
+
- `options.splitter` - the character sequence to use as a delimiter between fields in the log, should be a value that doesn't appear in any log message (defaults to `ò`)
|
|
315
|
+
- `options.strictDate` - switches the authored date value from an ISO 8601-like format to be strict ISO 8601 format
|
|
316
|
+
- `options.symmetric` - defaults to true, enables [symmetric revision range](https://git-scm.com/docs/gitrevisions#_dotted_range_notations) rather than a two-dot range
|
|
317
|
+
- `options.to` - sets the newset commit in the range to return, use along with `options.from` to set a bounded range
|
|
318
|
+
|
|
319
|
+
When only one of `options.from` and `options.to` is supplied, the default value of the omitted option is equivalent to `HEAD`. For any other commit, explicitly supply both from and to commits (for example use `await git.firstCommit()` as the default value of `from` to log since the first commit of the repo).
|
|
288
320
|
|
|
289
321
|
## git merge
|
|
290
322
|
|
|
291
|
-
-
|
|
323
|
+
- `.merge(options)` runs a merge using any configuration [options](#how-to-specify-options) supported
|
|
292
324
|
by [git merge](https://git-scm.com/docs/git-merge).
|
|
293
325
|
Conflicts during the merge result in an error response, the response is an instance of
|
|
294
|
-
[MergeSummary](src/lib/responses/MergeSummary.ts) whether it was an error or success.
|
|
295
|
-
When successful, the MergeSummary has all detail from a the [PullSummary](src/lib/responses/PullSummary.ts)
|
|
326
|
+
[MergeSummary](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/MergeSummary.ts) whether it was an error or success.
|
|
327
|
+
When successful, the MergeSummary has all detail from a the [PullSummary](https://github.com/steveukx/git-js/blob/main/simple-git/src/lib/responses/PullSummary.ts)
|
|
296
328
|
along with summary detail for the merge.
|
|
297
329
|
When the merge failed, the MergeSummary contains summary detail for why the merge failed and which files
|
|
298
330
|
prevented the merge.
|
|
299
331
|
|
|
300
|
-
-
|
|
301
|
-
|
|
332
|
+
- `.mergeFromTo(remote, branch , [options])` - merge from the specified branch into the currently checked out branch,
|
|
333
|
+
similar to `.merge` but with the `remote` and `branch` supplied as strings separately to any additional
|
|
302
334
|
[options](#how-to-specify-options).
|
|
303
335
|
|
|
304
336
|
## git mv
|
|
305
337
|
|
|
306
|
-
-
|
|
338
|
+
- `.mv(from, to)` rename or move a single file at `from` to `to`
|
|
307
339
|
|
|
308
|
-
-
|
|
340
|
+
- `.mv(from, to)` move all files in the `from` array to the `to` directory
|
|
309
341
|
|
|
310
342
|
## git pull
|
|
311
343
|
|
|
312
|
-
-
|
|
344
|
+
- `.pull([options])` pulls all updates from the default tracked remote, any arguments supported by
|
|
313
345
|
[git pull](https://git-scm.com/docs/git-pull) can be supplied as an [options](#how-to-specify-options) object/array.
|
|
314
346
|
|
|
315
|
-
-
|
|
347
|
+
- `.pull(remote, branch, [options])` pulls all updates from the specified remote branch (eg 'origin'/'master') along
|
|
316
348
|
with any custom [options](#how-to-specify-options) object/array
|
|
317
349
|
|
|
318
350
|
## git push
|
|
319
351
|
|
|
320
|
-
-
|
|
352
|
+
- `.push([options])` pushes to a named remote/branch using any supported [options](#how-to-specify-options)
|
|
321
353
|
from the [git push](https://git-scm.com/docs/git-push) command. Note that `simple-git` enforces the use of
|
|
322
354
|
`--verbose --porcelain` options in order to parse the response. You don't need to supply these options.
|
|
323
355
|
|
|
324
|
-
-
|
|
356
|
+
- `.push(remote, branch, [options])` pushes to a named remote/branch, supports additional
|
|
325
357
|
[options](#how-to-specify-options) from the [git push](https://git-scm.com/docs/git-push) command.
|
|
326
358
|
|
|
327
|
-
-
|
|
359
|
+
- `.pushTags(remote, [options])` pushes local tags to a named remote (equivalent to using `.push([remote, '--tags'])`)
|
|
328
360
|
|
|
329
361
|
## git remote
|
|
330
362
|
|
|
331
|
-
-
|
|
332
|
-
-
|
|
333
|
-
-
|
|
334
|
-
-
|
|
335
|
-
-
|
|
363
|
+
- `.addRemote(name, repo, [options])` adds a new named remote to be tracked as `name` at the path `repo`, optionally with any supported [options](#how-to-specify-options) for the [git add](https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emaddem) call.
|
|
364
|
+
- `.getRemotes([verbose])` gets a list of the named remotes, supply the optional `verbose` option as `true` to include the URLs and purpose of each ref
|
|
365
|
+
- `.listRemote([options])` lists remote repositories - there are so many optional arguments in the underlying `git ls-remote` call, just supply any you want to use as the optional [options](#how-to-specify-options) eg: `git.listRemote(['--heads', '--tags'], console.log)`
|
|
366
|
+
- `.remote([options])` runs a `git remote` command with any number of [options](#how-to-specify-options)
|
|
367
|
+
- `.removeRemote(name)` removes the named remote
|
|
336
368
|
|
|
337
369
|
## git reset
|
|
338
370
|
|
|
339
|
-
-
|
|
340
|
-
|
|
341
|
-
|
|
371
|
+
- `.reset(resetMode, [resetOptions])` resets the repository, sets the reset mode to one of the supported types (use a constant from
|
|
372
|
+
the exported `ResetMode` enum, or a string equivalent: `mixed`, `soft`, `hard`, `merge`, `keep`). Any number of other arguments
|
|
373
|
+
supported by [git reset](https://git-scm.com/docs/git-reset) can be supplied as an [options](#how-to-specify-options) object/array.
|
|
342
374
|
|
|
343
|
-
-
|
|
375
|
+
- `.reset(resetOptions)` resets the repository with the supplied [options](#how-to-specify-options)
|
|
344
376
|
|
|
345
|
-
-
|
|
377
|
+
- `.reset()` resets the repository in `soft` mode.
|
|
346
378
|
|
|
347
379
|
## git rev-parse / repo properties
|
|
348
380
|
|
|
349
|
-
-
|
|
381
|
+
- `.revparse([options])` sends the supplied [options](#how-to-specify-options) to [git rev-parse](https://git-scm.com/docs/git-rev-parse) and returns the string response from `git`.
|
|
350
382
|
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
383
|
+
- `.checkIsRepo()` gets whether the current working directory is a descendent of a git repository.
|
|
384
|
+
- `.checkIsRepo('bare')` gets whether the current working directory is within a bare git repo (see either [git clone --bare](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---bare) or [git init --bare](https://git-scm.com/docs/git-init#Documentation/git-init.txt---bare)).
|
|
385
|
+
- `.checkIsRepo('root')` gets whether the current working directory is the root directory for a repo (sub-directories will return false).
|
|
386
|
+
|
|
387
|
+
- `.firstCommit()` gets the commit hash of the first commit made to the current repo.
|
|
388
|
+
|
|
389
|
+
## git show
|
|
390
|
+
|
|
391
|
+
- `.show(options)` show various types of objects for example the file content at a certain commit. `options` is the single value string or any [options](#how-to-specify-options) supported by the [git show](https://git-scm.com/docs/git-show) command.
|
|
392
|
+
- `.showBuffer(options)` same as the `.show` API, but returns the Buffer content directly to allow for showing binary file content.
|
|
354
393
|
|
|
355
394
|
## git status
|
|
356
395
|
|
|
357
|
-
-
|
|
358
|
-
|
|
396
|
+
- `.status([options])` gets the status of the current repo, resulting in a [StatusResult](https://github.com/steveukx/git-js/blob/main/simple-git/typings/response.d.ts). Additional arguments
|
|
397
|
+
supported by [git status](https://git-scm.com/docs/git-status) can be supplied as an [options](#how-to-specify-options) object/array.
|
|
359
398
|
|
|
360
399
|
## git submodule
|
|
361
400
|
|
|
362
|
-
-
|
|
363
|
-
-
|
|
364
|
-
-
|
|
365
|
-
-
|
|
401
|
+
- `.subModule(options)` Run a `git submodule` command with on or more arguments passed in as an [options](#how-to-specify-options) array or object
|
|
402
|
+
- `.submoduleAdd(repo, path)` Adds a new sub module
|
|
403
|
+
- `.submoduleInit([options]` Initialises sub modules, the optional [options](#how-to-specify-options) argument can be used to pass extra options to the `git submodule init` command.
|
|
404
|
+
- `.submoduleUpdate(subModuleName, [options])` Updates sub modules, can be called with a sub module name and [options](#how-to-specify-options), just the options or with no arguments
|
|
405
|
+
|
|
406
|
+
## git stash
|
|
407
|
+
|
|
408
|
+
- `.stash([ options ])` Stash the working directory, optional first argument can be an array of string arguments or [options](#how-to-specify-options) object to pass to the [git stash](https://git-scm.com/docs/git-stash) command.
|
|
409
|
+
|
|
410
|
+
- `.stashList([ options ])` Retrieves the stash list, optional first argument can be an object in the same format as used in [git log](#git-log).
|
|
411
|
+
|
|
412
|
+
## git version [examples](https://github.com/steveukx/git-js/blob/main/examples/git-version.md)
|
|
366
413
|
|
|
367
|
-
|
|
414
|
+
- `.version()` retrieve the major, minor and patch for the currently installed `git`. Use the `.installed` property of the result to determine whether `git` is accessible on the path.
|
|
368
415
|
|
|
369
|
-
|
|
370
|
-
- `.cwd({ path, root = false })` Sets the working directory for all future commands either in the current chain of commands (where `root` is omitted or set to `false`) or in the main instance (where `root` is `true`).
|
|
416
|
+
## changing the working directory [examples](https://github.com/steveukx/git-js/blob/main/examples/git-change-working-directory.md)
|
|
371
417
|
|
|
372
|
-
|
|
418
|
+
- `.cwd(workingDirectory)` Sets the working directory for all future commands - note, this will change the working for the root instance, any chain created from the root will also be changed.
|
|
419
|
+
- `.cwd({ path, root = false })` Sets the working directory for all future commands either in the current chain of commands (where `root` is omitted or set to `false`) or in the main instance (where `root` is `true`).
|
|
420
|
+
|
|
421
|
+
## How to Specify Options
|
|
373
422
|
|
|
374
423
|
Where the task accepts custom options (eg: `pull` or `commit`), these can be supplied as an object, the keys of which
|
|
375
424
|
will all be merged as trailing arguments in the command string, or as a simple array of strings.
|
|
376
425
|
|
|
377
|
-
|
|
426
|
+
### Options as an Object
|
|
378
427
|
|
|
379
428
|
When the value of the property in the options object is a `string`, that name value
|
|
380
429
|
pair will be included in the command string as `name=value`. For example:
|
|
381
430
|
|
|
382
431
|
```javascript
|
|
383
432
|
// results in 'git pull origin master --no-rebase'
|
|
384
|
-
git
|
|
433
|
+
git.pull('origin', 'master', { '--no-rebase': null });
|
|
385
434
|
|
|
386
435
|
// results in 'git pull origin master --rebase=true'
|
|
387
|
-
git
|
|
436
|
+
git.pull('origin', 'master', { '--rebase': 'true' });
|
|
388
437
|
```
|
|
389
438
|
|
|
390
|
-
|
|
439
|
+
### Options as an Array
|
|
391
440
|
|
|
392
441
|
Options can also be supplied as an array of strings to be merged into the task's commands
|
|
393
442
|
in the same way as when an object is used:
|
|
394
443
|
|
|
395
444
|
```javascript
|
|
396
|
-
//
|
|
397
|
-
git.pull('origin', 'master', ['--no-rebase'])
|
|
445
|
+
// results in 'git pull origin master --no-rebase'
|
|
446
|
+
git.pull('origin', 'master', ['--no-rebase']);
|
|
398
447
|
```
|
|
399
448
|
|
|
400
449
|
# Release History
|
|
401
450
|
|
|
402
|
-
Major release
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
TypeScript is used by default for all new code, allowing for auto-generated type definitions and a phased
|
|
406
|
-
re-write of the library rather than a big-bang.
|
|
407
|
-
|
|
408
|
-
For a per-release overview of changes, see the [changelog](./CHANGELOG.md).
|
|
409
|
-
|
|
410
|
-
## 2.x Upgrade Notes
|
|
411
|
-
|
|
412
|
-
When upgrading to release 2.x from 1.x, see the [changelog](./CHANGELOG.md) for the release 2.0.0
|
|
413
|
-
|
|
414
|
-
# Recently Deprecated / Altered APIs
|
|
451
|
+
Major release 3.x changes the packaging of the library, making it consumable as a CommonJS module, ES module as well as
|
|
452
|
+
with TypeScript (see [usage](#usage) above). The library is now published as a single file, so please ensure your
|
|
453
|
+
application hasn't been making use of non-documented APIs by importing from a sub-directory path.
|
|
415
454
|
|
|
416
|
-
|
|
417
|
-
importing the necessary polyfills from `core-js`, see [Legacy Node Versions](./docs/LEGACY_NODE_VERSIONS.md)~~
|
|
418
|
-
_this change has been reverted in 2.30.0 and will be postponed until version 3.x_.
|
|
455
|
+
See also:
|
|
419
456
|
|
|
420
|
-
-
|
|
421
|
-
|
|
422
|
-
- 2.11.0 treats tasks chained together as atomic, where any failure in the chain prevents later tasks from
|
|
423
|
-
executing and tasks called from the root `git` instance as the origin of a new chain, and able to be
|
|
424
|
-
[run in parallel](#concurrent--parallel-requests) without failures impacting one anther. Prior to this
|
|
425
|
-
version, tasks called on the root `git` instance would be cancelled when another one failed.
|
|
426
|
-
|
|
427
|
-
- 2.7.0 deprecates use of `.silent()` in favour of using the `debug` library - see the
|
|
428
|
-
[debug logging guide](docs/DEBUG-LOGGING-GUIDE.md) for further details.
|
|
429
|
-
|
|
430
|
-
- 2.6.0 introduced `.then` and `.catch` as a way to chain a promise onto the current step of the chain.
|
|
431
|
-
Importing from `simple-git/promise` instead of just `simple-git` is no longer required and is actively discouraged.
|
|
432
|
-
|
|
433
|
-
For the full history see the [changelog](./CHANGELOG.md);
|
|
457
|
+
- [release notes v3](https://github.com/steveukx/git-js/blob/main/simple-git/CHANGELOG.md)
|
|
458
|
+
- [release notes v2](https://github.com/steveukx/git-js/blob/main/docs/RELEASE-NOTES-V2.md)
|
|
434
459
|
|
|
435
460
|
# Concurrent / Parallel Requests
|
|
436
461
|
|
|
437
|
-
When the methods of `simple-git` are chained together, they create an execution chain that will run in series,
|
|
438
|
-
|
|
462
|
+
When the methods of `simple-git` are chained together, they create an execution chain that will run in series, useful
|
|
463
|
+
for when the tasks themselves are order-dependent, eg:
|
|
439
464
|
|
|
440
465
|
```typescript
|
|
441
|
-
|
|
442
|
-
git.init().addRemote('origin', 'https://some-repo.git').fetch();
|
|
466
|
+
simpleGit().init().addRemote('origin', 'https://some-repo.git').fetch();
|
|
443
467
|
```
|
|
444
468
|
|
|
445
469
|
Each task requires that the one before it has been run successfully before it is called, any errors in a
|
|
@@ -452,10 +476,12 @@ for when the tasks are independent of each other, eg:
|
|
|
452
476
|
```typescript
|
|
453
477
|
const git = simpleGit();
|
|
454
478
|
const results = await Promise.all([
|
|
455
|
-
|
|
456
|
-
|
|
479
|
+
git.raw('rev-parse', '--show-cdup').catch(swallow),
|
|
480
|
+
git.raw('rev-parse', '--show-prefix').catch(swallow),
|
|
457
481
|
]);
|
|
458
|
-
function swallow
|
|
482
|
+
function swallow(err) {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
459
485
|
```
|
|
460
486
|
|
|
461
487
|
Each `simple-git` instance limits the number of spawned child processes that can be run simultaneously and
|
|
@@ -464,115 +490,82 @@ manages the queue of pending tasks for you. Configure this value by passing an o
|
|
|
464
490
|
|
|
465
491
|
```typescript
|
|
466
492
|
const git = simpleGit({ maxConcurrentProcesses: 10 });
|
|
467
|
-
```
|
|
493
|
+
```
|
|
468
494
|
|
|
469
495
|
Treating tasks called on the root instance as the start of separate chains is a change to the behaviour of
|
|
470
|
-
|
|
496
|
+
`simple-git` and was added in version `2.11.0`.
|
|
471
497
|
|
|
472
498
|
# Complex Requests
|
|
473
499
|
|
|
474
|
-
When no suitable wrapper exists in the interface for creating a request,
|
|
500
|
+
When no suitable wrapper exists in the interface for creating a request, run the command directly
|
|
475
501
|
using `git.raw([...], handler)`. The array of commands are passed directly to the `git` binary:
|
|
476
502
|
|
|
477
|
-
```
|
|
478
|
-
const git = require('simple-git');
|
|
503
|
+
```javascript
|
|
479
504
|
const path = '/path/to/repo';
|
|
480
|
-
const commands = [
|
|
481
|
-
|
|
482
|
-
// using an array of commands
|
|
483
|
-
git(path).raw(commands, (err, result) => {
|
|
484
|
-
|
|
485
|
-
// err is null unless this command failed
|
|
486
|
-
// result is the raw output of this command
|
|
505
|
+
const commands = ['config', '--global', 'advice.pushNonFastForward', 'false'];
|
|
487
506
|
|
|
507
|
+
// using an array of commands and node-style callback
|
|
508
|
+
simpleGit(path).raw(commands, (err, result) => {
|
|
509
|
+
// err is null unless this command failed
|
|
510
|
+
// result is the raw output of this command
|
|
488
511
|
});
|
|
489
512
|
|
|
490
513
|
// using a var-args of strings and awaiting rather than using the callback
|
|
491
|
-
const result = await
|
|
514
|
+
const result = await simpleGit(path).raw(...commands);
|
|
515
|
+
|
|
516
|
+
// automatically trim trailing white-space in responses
|
|
517
|
+
const result = await simpleGit(path, { trimmed: true }).raw(...commands);
|
|
492
518
|
```
|
|
493
519
|
|
|
494
520
|
# Authentication
|
|
495
521
|
|
|
496
522
|
The easiest way to supply a username / password to the remote host is to include it in the URL, for example:
|
|
497
523
|
|
|
498
|
-
```
|
|
524
|
+
```javascript
|
|
499
525
|
const USER = 'something';
|
|
500
526
|
const PASS = 'somewhere';
|
|
501
527
|
const REPO = 'github.com/username/private-repo';
|
|
502
528
|
|
|
503
|
-
const git = require('simple-git');
|
|
504
529
|
const remote = `https://${USER}:${PASS}@${REPO}`;
|
|
505
530
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
531
|
+
simpleGit()
|
|
532
|
+
.clone(remote)
|
|
533
|
+
.then(() => console.log('finished'))
|
|
534
|
+
.catch((err) => console.error('failed: ', err));
|
|
511
535
|
```
|
|
512
536
|
|
|
513
|
-
Be sure to enable
|
|
537
|
+
Be sure to not enable debug logging when using this mechanism for authentication
|
|
538
|
+
to ensure passwords aren't logged to stdout.
|
|
514
539
|
|
|
515
540
|
# Environment Variables
|
|
516
541
|
|
|
517
542
|
Pass one or more environment variables to the child processes spawned by `simple-git` with the `.env` method which
|
|
518
543
|
supports passing either an object of name=value pairs or setting a single variable at a time:
|
|
519
544
|
|
|
520
|
-
```
|
|
521
|
-
const GIT_SSH_COMMAND =
|
|
522
|
-
|
|
523
|
-
const git = require('simple-git');
|
|
545
|
+
```javascript
|
|
546
|
+
const GIT_SSH_COMMAND = 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no';
|
|
524
547
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
548
|
+
simpleGit()
|
|
549
|
+
.env('GIT_SSH_COMMAND', GIT_SSH_COMMAND)
|
|
550
|
+
.status((err, status) => {
|
|
551
|
+
/* */
|
|
552
|
+
});
|
|
528
553
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
554
|
+
simpleGit()
|
|
555
|
+
.env({ ...process.env, GIT_SSH_COMMAND })
|
|
556
|
+
.status()
|
|
557
|
+
.then((status) => {})
|
|
558
|
+
.catch((err) => {});
|
|
534
559
|
```
|
|
535
560
|
|
|
536
561
|
Note - when passing environment variables into the child process, these will replace the standard `process.env`
|
|
537
|
-
variables, the example above creates a new object based on `process.env` but with the `GIT_SSH_COMMAND` property
|
|
538
|
-
added.
|
|
539
|
-
|
|
540
|
-
# TypeScript
|
|
541
|
-
|
|
542
|
-
To import with TypeScript:
|
|
543
|
-
|
|
544
|
-
```typescript
|
|
545
|
-
import simpleGit, { SimpleGit, StatusResult } from 'simple-git';
|
|
546
|
-
|
|
547
|
-
const git: SimpleGit = simpleGit();
|
|
548
|
-
const status: StatusResult = await git.status();
|
|
549
|
-
```
|
|
550
|
-
|
|
551
|
-
# Promise and async compatible
|
|
552
|
-
|
|
553
|
-
For each task run, the return is the same `SimpleGit` instance for ease of building
|
|
554
|
-
a series of tasks that all run sequentially and are treated as atomic (ie: if any
|
|
555
|
-
step fails, the later tasks are not attempted).
|
|
556
|
-
|
|
557
|
-
To work with promises (either directly or as part of async/await), simply call the
|
|
558
|
-
function as before:
|
|
559
|
-
|
|
560
|
-
```js
|
|
561
|
-
const simpleGit = require('simple-git');
|
|
562
|
-
const git = simpleGit();
|
|
563
|
-
|
|
564
|
-
// async / await
|
|
565
|
-
const status = await git.status();
|
|
566
|
-
|
|
567
|
-
// promise
|
|
568
|
-
git.status().then(result => {...});
|
|
569
|
-
```
|
|
562
|
+
variables, the example above creates a new object based on `process.env` but with the `GIT_SSH_COMMAND` property added.
|
|
570
563
|
|
|
571
564
|
# Exception Handling
|
|
572
565
|
|
|
573
|
-
When the `git` process exits with a non-zero status (or in some cases like `merge` the git
|
|
574
|
-
|
|
575
|
-
|
|
566
|
+
When the `git` process exits with a non-zero status (or in some cases like `merge` the git process exits with a
|
|
567
|
+
successful zero code but there are conflicts in the merge) the task will reject with a `GitError` when there is no
|
|
568
|
+
available parser to handle the error or a
|
|
576
569
|
`GitResponseError` for when there is.
|
|
577
570
|
|
|
578
571
|
See the `err` property of the callback:
|
|
@@ -582,55 +575,54 @@ git.merge((err, mergeSummary) => {
|
|
|
582
575
|
if (err.git) {
|
|
583
576
|
mergeSummary = err.git; // the failed mergeSummary
|
|
584
577
|
}
|
|
585
|
-
})
|
|
578
|
+
});
|
|
586
579
|
```
|
|
587
580
|
|
|
588
581
|
Catch errors with try/catch in async code:
|
|
589
582
|
|
|
590
583
|
```javascript
|
|
591
584
|
try {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
console.error(`Merge resulted in ${ err.git.conflicts.length } conflicts`);
|
|
585
|
+
const mergeSummary = await git.merge();
|
|
586
|
+
console.log(`Merged ${mergeSummary.merges.length} files`);
|
|
587
|
+
} catch (err) {
|
|
588
|
+
// err.message - the string summary of the error
|
|
589
|
+
// err.stack - some stack trace detail
|
|
590
|
+
// err.git - where a parser was able to run, this is the parsed content
|
|
591
|
+
|
|
592
|
+
console.error(`Merge resulted in ${err.git.conflicts.length} conflicts`);
|
|
601
593
|
}
|
|
602
594
|
```
|
|
603
595
|
|
|
604
596
|
Catch errors with a `.catch` on the promise:
|
|
605
597
|
|
|
606
598
|
```javascript
|
|
607
|
-
const mergeSummary = await git.merge()
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
599
|
+
const mergeSummary = await git.merge().catch((err) => {
|
|
600
|
+
if (err.git) {
|
|
601
|
+
return err.git;
|
|
602
|
+
} // the unsuccessful mergeSummary
|
|
603
|
+
throw err; // some other error, so throw
|
|
604
|
+
});
|
|
612
605
|
|
|
613
606
|
if (mergeSummary.failed) {
|
|
614
|
-
console.error(`Merge resulted in ${
|
|
607
|
+
console.error(`Merge resulted in ${mergeSummary.conflicts.length} conflicts`);
|
|
615
608
|
}
|
|
616
609
|
```
|
|
617
610
|
|
|
618
611
|
With typed errors available in TypeScript
|
|
619
612
|
|
|
620
613
|
```typescript
|
|
621
|
-
import simpleGit,
|
|
614
|
+
import { simpleGit, MergeSummary, GitResponseError } from 'simple-git';
|
|
622
615
|
try {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
console.error(`Merge resulted in ${ conflicts.length } conflicts`);
|
|
616
|
+
const mergeSummary = await simpleGit().merge();
|
|
617
|
+
console.log(`Merged ${mergeSummary.merges.length} files`);
|
|
618
|
+
} catch (err) {
|
|
619
|
+
// err.message - the string summary of the error
|
|
620
|
+
// err.stack - some stack trace detail
|
|
621
|
+
// err.git - where a parser was able to run, this is the parsed content
|
|
622
|
+
const mergeSummary: MergeSummary = (err as GitResponseError<MergeSummary>).git;
|
|
623
|
+
const conflicts = mergeSummary?.conflicts || [];
|
|
624
|
+
|
|
625
|
+
console.error(`Merge resulted in ${conflicts.length} conflicts`);
|
|
634
626
|
}
|
|
635
627
|
```
|
|
636
628
|
|
|
@@ -638,13 +630,13 @@ catch (err) {
|
|
|
638
630
|
|
|
639
631
|
### Enable logging
|
|
640
632
|
|
|
641
|
-
See the [debug logging guide](docs/DEBUG-LOGGING-GUIDE.md) for logging examples and how to
|
|
633
|
+
See the [debug logging guide](https://github.com/steveukx/git-js/blob/main/docs/DEBUG-LOGGING-GUIDE.md) for logging examples and how to
|
|
642
634
|
make use of the [debug](https://www.npmjs.com/package/debug) library's programmatic interface
|
|
643
635
|
in your application.
|
|
644
636
|
|
|
645
637
|
### Enable Verbose Logging
|
|
646
638
|
|
|
647
|
-
See the [debug logging guide](docs/DEBUG-LOGGING-GUIDE.md#verbose-logging-options) for
|
|
639
|
+
See the [debug logging guide](https://github.com/steveukx/git-js/blob/main/docs/DEBUG-LOGGING-GUIDE.md#verbose-logging-options) for
|
|
648
640
|
the full list of verbose logging options to use with the
|
|
649
641
|
[debug](https://www.npmjs.com/package/debug) library.
|
|
650
642
|
|
|
@@ -652,15 +644,15 @@ the full list of verbose logging options to use with the
|
|
|
652
644
|
|
|
653
645
|
There are a few potential reasons:
|
|
654
646
|
|
|
655
|
-
-
|
|
656
|
-
|
|
647
|
+
- `git` isn't available as a binary for the user running the main `node` process, custom paths to the binary can be used
|
|
648
|
+
with the `.customBinary(...)` API option.
|
|
649
|
+
|
|
650
|
+
- the working directory passed in to the main `simple-git` function isn't accessible, check it is read/write accessible
|
|
651
|
+
by the user running the `node` process. This library uses
|
|
652
|
+
[@kwsites/file-exists](https://www.npmjs.com/package/@kwsites/file-exists) to validate the working directory exists,
|
|
653
|
+
to output its logs add `@kwsites/file-exists` to your `DEBUG` environment variable. eg:
|
|
657
654
|
|
|
658
|
-
-
|
|
659
|
-
by the user running the `node` process. This library uses
|
|
660
|
-
[@kwsites/file-exists](https://www.npmjs.com/package/@kwsites/file-exists) to validate the working directory exists,
|
|
661
|
-
to output its logs add `@kwsites/file-exists` to your `DEBUG` environment variable. eg:
|
|
662
|
-
|
|
663
|
-
`DEBUG=@kwsites/file-exists,simple-git node ./your-app.js`
|
|
655
|
+
`DEBUG=@kwsites/file-exists,simple-git node ./your-app.js`
|
|
664
656
|
|
|
665
657
|
### Log format fails
|
|
666
658
|
|
|
@@ -670,190 +662,181 @@ before that please ensure you are supplying your own format object with properti
|
|
|
670
662
|
are using.
|
|
671
663
|
|
|
672
664
|
For more details of the supported tokens, please see the
|
|
673
|
-
[official `git log` documentation](https://git-scm.com/docs/git-log#_pretty_formats)
|
|
665
|
+
[official `git log` documentation](https://git-scm.com/docs/git-log#_pretty_formats)
|
|
674
666
|
|
|
675
667
|
### Log response properties are out of order
|
|
676
668
|
|
|
677
|
-
The properties of `git.log` are fetched using the character sequence
|
|
669
|
+
The properties of `git.log` are fetched using the character sequence `ò` as a delimiter. If your commit messages
|
|
678
670
|
use this sequence, supply a custom `splitter` in the options, for example: `git.log({ splitter: '💻' })`
|
|
679
671
|
|
|
680
672
|
### Pull / Diff / Merge summary responses don't recognise any files
|
|
681
673
|
|
|
682
|
-
-
|
|
683
|
-
-
|
|
684
|
-
-
|
|
685
|
-
-
|
|
674
|
+
- Enable verbose logs with the environment variable `DEBUG=simple-git:task:*,simple-git:output:*`
|
|
675
|
+
- Check the output (for example: `simple-git:output:diff:1 [stdOut] 1 file changed, 1 insertion(+)`)
|
|
676
|
+
- Check the `stdOut` output is the same as you would expect to see when running the command directly in terminal
|
|
677
|
+
- Check the language used in the response is english locale
|
|
686
678
|
|
|
687
679
|
In some cases `git` will show progress messages or additional detail on error states in the output for
|
|
688
|
-
`stdErr` that will help debug your issue, these messages are also included in the verbose log.
|
|
680
|
+
`stdErr` that will help debug your issue, these messages are also included in the verbose log.
|
|
689
681
|
|
|
690
682
|
### Legacy Node Versions
|
|
691
683
|
|
|
692
|
-
From `v3.x`, `simple-git` will drop support for `node.js` version 10 or below, to use in a lower version of
|
|
693
|
-
|
|
684
|
+
From `v3.x`, `simple-git` will drop support for `node.js` version 10 or below, to use in a lower version of node will
|
|
685
|
+
result in errors such as:
|
|
694
686
|
|
|
695
|
-
-
|
|
696
|
-
-
|
|
697
|
-
-
|
|
687
|
+
- `Object.fromEntries is not a function`
|
|
688
|
+
- `Object.entries is not a function`
|
|
689
|
+
- `message.flatMap is not a function`
|
|
698
690
|
|
|
699
|
-
To resolve these issues, either upgrade to a newer version of node.js or ensure you are using the necessary
|
|
700
|
-
|
|
691
|
+
To resolve these issues, either upgrade to a newer version of node.js or ensure you are using the necessary polyfills
|
|
692
|
+
from `core-js` - see [Legacy Node Versions](https://github.com/steveukx/git-js/blob/main/docs/LEGACY_NODE_VERSIONS.md).
|
|
701
693
|
|
|
702
694
|
# Examples
|
|
703
695
|
|
|
704
|
-
|
|
705
696
|
### using a pathspec to limit the scope of the task
|
|
706
697
|
|
|
707
|
-
If the `simple-git`
|
|
698
|
+
If the `simple-git` API doesn't explicitly limit the scope of the task being run (ie: `git.add()` requires the files to
|
|
708
699
|
be added, but `git.status()` will run against the entire repo), add a `pathspec` to the command using trailing options:
|
|
709
700
|
|
|
710
701
|
```typescript
|
|
702
|
+
import { simpleGit, pathspec } from "simple-git";
|
|
703
|
+
|
|
711
704
|
const git = simpleGit();
|
|
712
705
|
const wholeRepoStatus = await git.status();
|
|
713
|
-
const subDirStatusUsingOptArray = await git.status(['
|
|
714
|
-
const subDirStatusUsingOptObject = await git.status({'
|
|
715
|
-
```
|
|
706
|
+
const subDirStatusUsingOptArray = await git.status([pathspec('sub-dir')]);
|
|
707
|
+
const subDirStatusUsingOptObject = await git.status({ 'sub-dir': pathspec('sub-dir') });
|
|
708
|
+
```
|
|
716
709
|
|
|
717
710
|
### async await
|
|
718
711
|
|
|
719
712
|
```javascript
|
|
720
|
-
async function status
|
|
721
|
-
const git = require('simple-git');
|
|
722
|
-
|
|
713
|
+
async function status(workingDir) {
|
|
723
714
|
let statusSummary = null;
|
|
724
715
|
try {
|
|
725
|
-
statusSummary = await
|
|
726
|
-
}
|
|
727
|
-
catch (e) {
|
|
716
|
+
statusSummary = await simpleGit(workingDir).status();
|
|
717
|
+
} catch (e) {
|
|
728
718
|
// handle the error
|
|
729
719
|
}
|
|
730
|
-
|
|
720
|
+
|
|
731
721
|
return statusSummary;
|
|
732
722
|
}
|
|
733
723
|
|
|
734
724
|
// using the async function
|
|
735
|
-
status(__dirname + '/some-repo').then(status => console.log(status));
|
|
725
|
+
status(__dirname + '/some-repo').then((status) => console.log(status));
|
|
736
726
|
```
|
|
737
727
|
|
|
738
728
|
### Initialise a git repo if necessary
|
|
739
729
|
|
|
740
730
|
```javascript
|
|
741
|
-
const simpleGit = require('simple-git');
|
|
742
731
|
const git = simpleGit(__dirname);
|
|
743
732
|
|
|
744
733
|
git.checkIsRepo()
|
|
745
|
-
.then(isRepo => !isRepo && initialiseRepo(git))
|
|
734
|
+
.then((isRepo) => !isRepo && initialiseRepo(git))
|
|
746
735
|
.then(() => git.fetch());
|
|
747
736
|
|
|
748
|
-
function initialiseRepo
|
|
749
|
-
return git.init()
|
|
750
|
-
.then(() => git.addRemote('origin', 'https://some.git.repo'))
|
|
737
|
+
function initialiseRepo(git) {
|
|
738
|
+
return git.init().then(() => git.addRemote('origin', 'https://some.git.repo'));
|
|
751
739
|
}
|
|
752
740
|
```
|
|
753
741
|
|
|
754
742
|
### Update repo and get a list of tags
|
|
755
743
|
|
|
756
744
|
```javascript
|
|
757
|
-
|
|
745
|
+
simpleGit(__dirname + '/some-repo')
|
|
758
746
|
.pull()
|
|
759
|
-
.tags((err, tags) => console.log(
|
|
747
|
+
.tags((err, tags) => console.log('Latest available tag: %s', tags.latest));
|
|
760
748
|
|
|
761
749
|
// update repo and when there are changes, restart the app
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
});
|
|
750
|
+
simpleGit().pull((err, update) => {
|
|
751
|
+
if (update && update.summary.changes) {
|
|
752
|
+
require('child_process').exec('npm restart');
|
|
753
|
+
}
|
|
754
|
+
});
|
|
768
755
|
```
|
|
769
756
|
|
|
770
757
|
### Starting a new repo
|
|
771
758
|
|
|
772
759
|
```javascript
|
|
773
|
-
|
|
760
|
+
simpleGit()
|
|
774
761
|
.init()
|
|
775
762
|
.add('./*')
|
|
776
|
-
.commit(
|
|
763
|
+
.commit('first commit!')
|
|
777
764
|
.addRemote('origin', 'https://github.com/user/repo.git')
|
|
778
765
|
.push('origin', 'master');
|
|
779
766
|
```
|
|
780
767
|
|
|
781
768
|
### push with `-u`
|
|
782
769
|
|
|
783
|
-
```
|
|
784
|
-
|
|
770
|
+
```javascript
|
|
771
|
+
simpleGit()
|
|
785
772
|
.add('./*')
|
|
786
|
-
.commit(
|
|
773
|
+
.commit('first commit!')
|
|
787
774
|
.addRemote('origin', 'some-repo-url')
|
|
788
775
|
.push(['-u', 'origin', 'master'], () => console.log('done'));
|
|
789
776
|
```
|
|
790
777
|
|
|
791
778
|
### Piping to the console for long-running tasks
|
|
792
779
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
assert.deepEqual(args, ['checkout', 'https://github.com/user/repo.git']);
|
|
804
|
-
})
|
|
805
|
-
.checkout('https://github.com/user/repo.git');
|
|
780
|
+
See [progress events](https://github.com/steveukx/git-js/blob/main/docs/PLUGIN-PROGRESS-EVENTS.md) for more details on
|
|
781
|
+
logging progress updates.
|
|
782
|
+
|
|
783
|
+
```javascript
|
|
784
|
+
const git = simpleGit({
|
|
785
|
+
progress({ method, stage, progress }) {
|
|
786
|
+
console.log(`git.${method} ${stage} stage ${progress}% complete`);
|
|
787
|
+
},
|
|
788
|
+
});
|
|
789
|
+
git.checkout('https://github.com/user/repo.git');
|
|
806
790
|
```
|
|
807
791
|
|
|
808
792
|
### Update repo and print messages when there are changes, restart the app
|
|
809
793
|
|
|
810
794
|
```javascript
|
|
811
795
|
// when using a chain
|
|
812
|
-
|
|
796
|
+
simpleGit()
|
|
813
797
|
.exec(() => console.log('Starting pull...'))
|
|
814
798
|
.pull((err, update) => {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
799
|
+
if (update && update.summary.changes) {
|
|
800
|
+
require('child_process').exec('npm restart');
|
|
801
|
+
}
|
|
818
802
|
})
|
|
819
803
|
.exec(() => console.log('pull done.'));
|
|
820
804
|
|
|
821
805
|
// when using async and optional chaining
|
|
822
|
-
const git =
|
|
823
|
-
console.log('Starting pull...')
|
|
806
|
+
const git = simpleGit();
|
|
807
|
+
console.log('Starting pull...');
|
|
824
808
|
if ((await git.pull())?.summary.changes) {
|
|
825
809
|
require('child_process').exec('npm restart');
|
|
826
810
|
}
|
|
827
811
|
console.log('pull done.');
|
|
828
|
-
|
|
829
812
|
```
|
|
830
813
|
|
|
831
814
|
### Get a full commits list, and then only between 0.11.0 and 0.12.0 tags
|
|
832
815
|
|
|
833
816
|
```javascript
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
.log('0.11.0', '0.12.0', (err, log) => console.log(log));
|
|
817
|
+
console.log(await simpleGit().log());
|
|
818
|
+
console.log(await simpleGit().log('0.11.0', '0.12.0'));
|
|
837
819
|
```
|
|
838
820
|
|
|
839
821
|
### Set the local configuration for author, then author for an individual commit
|
|
840
822
|
|
|
841
823
|
```javascript
|
|
842
|
-
|
|
824
|
+
simpleGit()
|
|
843
825
|
.addConfig('user.name', 'Some One')
|
|
844
826
|
.addConfig('user.email', 'some@one.com')
|
|
845
827
|
.commit('committed as "Some One"', 'file-one')
|
|
846
|
-
.commit('committed as "Another Person"', 'file-two', {
|
|
828
|
+
.commit('committed as "Another Person"', 'file-two', {
|
|
829
|
+
'--author': '"Another Person <another@person.com>"',
|
|
830
|
+
});
|
|
847
831
|
```
|
|
848
832
|
|
|
849
833
|
### Get remote repositories
|
|
850
834
|
|
|
851
835
|
```javascript
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
});
|
|
836
|
+
simpleGit().listRemote(['--get-url'], (err, data) => {
|
|
837
|
+
if (!err) {
|
|
838
|
+
console.log('Remote url for repository at ' + __dirname + ':');
|
|
839
|
+
console.log(data);
|
|
840
|
+
}
|
|
841
|
+
});
|
|
859
842
|
```
|