~starkingdoms/starkingdoms

5256afe7ac743e5ae36ff8b3974648da2026c770 — core 2 years ago 321e32f
fix the new hooks
3 files changed, 18 insertions(+), 39 deletions(-)

M .git-hooks/pre-commit
M server/src/component.rs
M starkingdoms-client/index.html
M .git-hooks/pre-commit => .git-hooks/pre-commit +11 -35
@@ 1,38 1,14 @@
#!/bin/bash

echo "Checking your formatting..."

HAS_ISSUES=0

for file in $(git diff --name-only --staged); do
    FMT_RESULT="$(rustfmt --edition 2021 --skip-children --force --write-mode diff $file 2>/dev/null || true)"
    if [ "$FMT_RESULT" != "" ]; then
        echo -n "$file (rustfmt)"
        HAS_ISSUES=1
    fi
done

FIRST_FILE=1
cd starkingdoms-client

for file in $(git diff --name-only --staged); do
  if [ $file == starkingdoms-client* ]; then
    FMT_RESULT="$(yarn prettier $file --check 2>&1 > /dev/null || true)"
    if [ "$FMT_RESULT" != "" ]; then
      if [ $FIRST_FILE -eq 0 ]; then
        echo "cd starkingdoms-client"
      fi
      echo -n "yarn prettier $file --write"
      HAS_ISSUES=1
      FIRST_FILE=0
    fi
  fi
done

if [ $HAS_ISSUES -eq 0 ]; then
    echo "Everything looks good! Proceeding with commit."
    exit 0
rustfmt server/src/*.rs --edition 2021 --check
if [ $? -ne 0 ]; then
  echo "Uh oh, looks like your formatting is off! Run 'rustfmt server/src/*.rs --edition 2021' to fix it."
  exit 1
fi

echo "!! Some files have formatting issues! Run all of the above commands, and then attempt another commit."
exit 1
cd starkingdoms-client && yarn prettier . --check
if [ $? -ne 0 ]; then
  echo "Uh oh, looks like your formatting is off! Run 'cd starkingdoms-client && yarn prettier . --write' to fix it."
  exit 1
fi
echo "Everything looks good! Proceeding with commit..."
exit 0

M server/src/component.rs => server/src/component.rs +3 -1
@@ 9,7 9,9 @@ pub enum PlanetType {
}

#[derive(Component, Clone, Copy, Serialize, Deserialize, Debug)]
pub enum PartType {   Hearty,}
pub enum PartType {
    Hearty,
}

#[derive(Component, Clone, Copy, Serialize, Deserialize, Debug, Default)]
pub struct Input {

M starkingdoms-client/index.html => starkingdoms-client/index.html +4 -3
@@ 10,10 10,11 @@
      <!-- Canvas gets added here by the game script -->
    </div>

    <div class="popup popup-center popup-max-width-300" id="server_selector"><h1>StarKingdoms</h1>
         <h2>Join Game</h2>
    <div class="popup popup-center popup-max-width-300" id="server_selector">
      <h1>StarKingdoms</h1>
      <h2>Join Game</h2>

      <form id   =   "join-fm">
      <form id="join-fm">
        <label>Choose server</label>

        <div class="fm-select">