@openstax/ts-utils 1.48.0 → 1.48.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openstax/ts-utils",
3
- "version": "1.48.0",
3
+ "version": "1.48.2",
4
4
  "bin": {
5
5
  "ts-utils": "./script/bin-entry.bash"
6
6
  },
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env bash
2
+ # spell-checker: ignore pipefail mktemp
3
+ set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
+
5
+ temp_dir="$(dirname "$(mktemp -u)")/service-template"
6
+
7
+ if [ -d "$temp_dir" ]; then
8
+ (cd "$temp_dir" && git pull) >&2
9
+ else
10
+ git clone git@github.com:openstax/typescript-service-template.git "$temp_dir" >&2
11
+ fi
12
+
13
+ echo "$temp_dir"
@@ -3,17 +3,11 @@
3
3
  set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
4
 
5
5
  project_dir=$(pwd)
6
+ dest_sha=${1:-HEAD}
6
7
 
7
- temp_dir="$(dirname "$(mktemp -u)")/service-template"
8
8
  patch_file=$(mktemp -t tst-patch.XXX)
9
-
10
- if [ -d "$temp_dir" ]; then
11
- cd "$temp_dir"
12
- git pull
13
- else
14
- git clone git@github.com:openstax/typescript-service-template.git "$temp_dir"
15
- cd "$temp_dir"
16
- fi
9
+ temp_dir=$(ts-utils clone-template-temp)
10
+ cd "$temp_dir"
17
11
 
18
12
  # handle mac vs linux differences in read command
19
13
  if [[ "$(uname)" == "Linux" ]]; then
@@ -27,8 +21,9 @@ if [ -f "$project_dir/.lastsync" ]; then
27
21
  sync_from=$(< "$project_dir/.lastsync")
28
22
  fi
29
23
 
30
- git rev-parse HEAD > "$project_dir/.lastsync"
31
- git --no-pager diff --binary "$sync_from" "${sync_ignore[@]}" > "$patch_file"
24
+ dest_sha=$(git rev-parse "$dest_sha")
25
+ echo "$dest_sha" > "$project_dir/.lastsync"
26
+ git --no-pager diff --binary "$sync_from" "$dest_sha" "${sync_ignore[@]}" > "$patch_file"
32
27
 
33
28
  cd "$project_dir"
34
29
 
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env bash
2
+ # spell-checker: ignore pipefail lastsync
3
+ set -euo pipefail; if [ -n "${DEBUG-}" ]; then set -x; fi
4
+
5
+ project_dir=$(pwd)
6
+
7
+ temp_dir=$(ts-utils clone-template-temp)
8
+ cd "$temp_dir"
9
+
10
+ if [ -f "$project_dir/.lastsync" ]; then
11
+ range="$(< "$project_dir/.lastsync")..HEAD"
12
+ else
13
+ range="HEAD"
14
+ fi
15
+
16
+ git --no-pager log "$@" "$range"