Skip to content

Commit

Permalink
[choreo] adjust vite config to ignore vite html files in build deps (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bruingineer committed Sep 9, 2024
1 parent 9c49f1a commit 9961f1a
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cache-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- name: Clean up caches
run: |
## Setting this to not fail the workflow while deleting cache keys.
## Setting this to not fail the workflow while deleting cache keys.
set +e
for i in {1..20}
do
Expand Down
2 changes: 1 addition & 1 deletion src-core/src/generation/transformers/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ impl DiffyGenerationTransformer for CallbackSetter {
fn transform(&self, builder: &mut trajoptlib::DifferentialPathBuilder) {
builder.add_progress_callback(diff_status_callback);
}
}
}
2 changes: 1 addition & 1 deletion src-core/src/generation/transformers/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,4 @@ impl DiffyGenerationTransformer for ConstraintSetter {
};
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ impl DiffyGenerationTransformer for DrivetrainAndBumpersSetter {
config.bumper.left + config.bumper.right,
);
}
}
}
2 changes: 1 addition & 1 deletion src-core/src/generation/transformers/interval_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ impl DiffyGenerationTransformer for IntervalCountSetter {
fn transform(&self, builder: &mut trajoptlib::DifferentialPathBuilder) {
self.transform(builder);
}
}
}
17 changes: 12 additions & 5 deletions update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
simply run `python update_version.py <version>` to update the version in the files.
"""


from dataclasses import dataclass
from pathlib import Path
from typing import Literal
Expand All @@ -17,6 +16,7 @@
except ImportError:
raise ImportError(f"Please install the following packages: {REQUIREMENTS}")


@dataclass(frozen=True, slots=True)
class VersionLocation:
relative_path: Path
Expand All @@ -25,6 +25,7 @@ class VersionLocation:
prefix: str = ""
suffix: str = ""


LOCATIONS: list[VersionLocation] = [
VersionLocation(
relative_path=Path("package.json"),
Expand All @@ -40,7 +41,7 @@ class VersionLocation:
relative_path=Path("src-tauri/tauri.conf.json"),
version_path=["tauri", "windows", 0, "title"],
file_format="json2",
prefix="Choreo v"
prefix="Choreo v",
),
VersionLocation(
relative_path=Path("src-tauri/Cargo.toml"),
Expand All @@ -65,6 +66,7 @@ def update_version(version: str) -> None:
file_path = Path(__file__).parent / location.relative_path
if location.file_format == "json2" or location.file_format == "json4":
import json

with open(file_path, "r") as f:
data = json.load(f)
og = data
Expand All @@ -74,12 +76,15 @@ def update_version(version: str) -> None:
data = data[key]
data[location.version_path[-1]] = version_str
except KeyError as e:
print(f"Version path not found: {location.version_path} in {location.relative_path}")
print(
f"Version path not found: {location.version_path} in {location.relative_path}"
)
raise e
with open(file_path, "w") as f:
json.dump(og, f, indent=int(location.file_format[-1]))
elif location.file_format == "toml":
import tomlkit

with open(file_path, "r") as f:
data = tomlkit.load(f)
og = data
Expand All @@ -89,7 +94,9 @@ def update_version(version: str) -> None:
data = data[key]
data[location.version_path[-1]] = version_str
except KeyError as e:
print(f"Version path not found: {location.version_path} in {location.relative_path}")
print(
f"Version path not found: {location.version_path} in {location.relative_path}"
)
raise e
with open(file_path, "w") as f:
tomlkit.dump(og, f)
Expand All @@ -103,4 +110,4 @@ def update_version(version: str) -> None:
parser = argparse.ArgumentParser(description="Update version in files")
parser.add_argument("version", type=str, help="Version to set")
args = parser.parse_args()
update_version(args.version)
update_version(args.version)
5 changes: 4 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export default defineConfig(async () => ({
// tauri expects a fixed port, fail if that port is not available
server: {
port: 1420,
strictPort: true
strictPort: true,
watch: {
ignored: ["target/**"]
}
},
// to make use of `TAURI_DEBUG` and other env variables
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
Expand Down

0 comments on commit 9961f1a

Please sign in to comment.