@multiplatform.one/cli 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/scripts/update.sh +27 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/cli",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "author": "BitSpur <support@bitspur.com> (https://bitspur.com)",
5
5
  "contributors": [
6
6
  {
@@ -55,7 +55,7 @@
55
55
  "typescript": "~5.3.3"
56
56
  },
57
57
  "dependencies": {
58
- "@multiplatform.one/utils": "5.0.0",
58
+ "@multiplatform.one/utils": "5.0.1",
59
59
  "commander": "^9.5.0",
60
60
  "dotenv": "^16.4.7",
61
61
  "execa": "^9.5.2",
package/scripts/update.sh CHANGED
@@ -2,32 +2,42 @@
2
2
 
3
3
  set -e
4
4
 
5
- PROJECT_DIR="$(pwd)"
6
- TEMP_DIR="$(mktemp -d)"
7
- trap 'rm -rf "$TEMP_DIR"' EXIT
8
- echo "TEMP_DIR $TEMP_DIR"
9
- cd "$TEMP_DIR"
5
+ _get_remote_name() {
6
+ _BASE_NAME="multiplatform"
7
+ _NUMBER="$(date +%s)"
8
+ _REMOTE_NAME="$_BASE_NAME.$_NUMBER"
9
+ while git remote | grep -q "^$_REMOTE_NAME$"; do
10
+ _NUMBER="$((_NUMBER + 1))"
11
+ _REMOTE_NAME="$_BASE_NAME.$_NUMBER"
12
+ done
13
+ echo "$_REMOTE_NAME"
14
+ }
15
+
16
+ _PROJECT_DIR="$(pwd)"
17
+ _STAGING_DIR="$(mktemp -d)"
18
+ trap "rm -rf \"$_STAGING_DIR\"" EXIT
19
+ echo "staging $_STAGING_DIR"
20
+ cd "$_STAGING_DIR"
10
21
  $COOKIECUTTER "$@"
11
- COOKIECUTTER_DIR="$TEMP_DIR/$(ls "$TEMP_DIR")"
12
- cd "$COOKIECUTTER_DIR"
13
- git add .
14
- git commit -m "Updated multiplatform.one"
15
- cd "$PROJECT_DIR"
22
+ cd "$_PROJECT_DIR"
16
23
  git clean -fxd
17
- INITIAL_COMMIT="$(git rev-parse HEAD)"
18
- git remote add multiplatform.one "$COOKIECUTTER_DIR"
19
- git fetch multiplatform.one
20
- git merge --allow-unrelated-histories multiplatform.one/main || true
21
- git remote remove multiplatform.one
24
+ _COOKIECUTTER_DIR="$_STAGING_DIR/$(ls "$_STAGING_DIR")"
25
+ _INITIAL_COMMIT="$(git rev-parse HEAD)"
26
+ _REMOTE_NAME="$(_get_remote_name)"
27
+ git remote add "$_REMOTE_NAME" "$_COOKIECUTTER_DIR"
28
+ git fetch "$_REMOTE_NAME"
29
+ git merge --allow-unrelated-histories "$_REMOTE_NAME/main" || true
30
+ git remote remove "$_REMOTE_NAME"
22
31
  if [ -f .updateignore ]; then
23
32
  while IFS= read -r pattern; do
24
- find . -name "$pattern" -exec git checkout "$INITIAL_COMMIT" -- '{}' +
33
+ find . -name "$pattern" -exec git checkout "$_INITIAL_COMMIT" -- '{}' +
25
34
  done < .updateignore
26
35
  fi
27
36
  while IFS= read -r pattern; do
28
- find . -name "$pattern" -exec git checkout "$INITIAL_COMMIT" -- '{}' +
37
+ find . -name "$pattern" -exec git checkout "$_INITIAL_COMMIT" -- '{}' +
29
38
  done <<EOF
30
39
  .mkpm/cache.tar.gz
31
40
  platforms/storybook/.lostpixel/baseline
32
41
  pnpm-lock.yaml
33
42
  EOF
43
+ ./mkpm check