@repokit/core 3.0.6 → 3.0.7

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/Cargo.lock CHANGED
@@ -900,7 +900,7 @@ checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
900
900
 
901
901
  [[package]]
902
902
  name = "repokit"
903
- version = "3.0.6"
903
+ version = "3.0.7"
904
904
  dependencies = [
905
905
  "alphanumeric-sort",
906
906
  "colored",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "repokit"
3
- version = "3.0.6"
3
+ version = "3.0.7"
4
4
  edition = "2024"
5
5
 
6
6
  [[bin]]
@@ -1,4 +1,4 @@
1
- CURRENT_VERSION="3.0.6"
1
+ CURRENT_VERSION="3.0.7"
2
2
  CWD=$(pwd)
3
3
 
4
4
  REPLACEMENT="/node_modules"
@@ -34,8 +34,10 @@ cd
34
34
  CACHE_FILE=".repokit";
35
35
  CACHE_DIRECTORY=".repokit_cache";
36
36
  NEW_SETTINGS_FILE=".settings"
37
+ NEW_VERSION_FILE=".version"
37
38
  REPO_CACHE_DIRECTORY="$CACHE_DIRECTORY/$ROOT_COMMIT"
38
39
  LAST_THEME_USED=""
40
+ NEW_CACHE_PATH_VERSION="$CURRENT_VERSION"
39
41
  BACK_PORTING=0
40
42
 
41
43
  if [ -n "$ROOT_COMMIT" ] && [ -f "$REPO_CACHE_DIRECTORY/$NEW_SETTINGS_FILE" ]; then
@@ -46,11 +48,15 @@ if [ -n "$ROOT_COMMIT" ] && [ -f "$REPO_CACHE_DIRECTORY/$NEW_SETTINGS_FILE" ]; t
46
48
  cd
47
49
  fi
48
50
 
51
+ if [ -f "$CACHE_DIRECTORY/$NEW_VERSION_FILE" ]; then
52
+ read -r NEW_CACHE_PATH_VERSION < "$CACHE_DIRECTORY/$NEW_VERSION_FILE"
53
+ fi
54
+
49
55
  if [ ! -f "$CACHE_FILE" ]; then
50
56
  touch "$CACHE_FILE"
51
57
  elif [ "$BACK_PORTING" == 0 ]; then
52
58
  read -r LAST_VERSION_USED < "$CACHE_FILE"
53
- if [ "$LAST_VERSION_USED" == "$CURRENT_VERSION" ]; then
59
+ if [ "$LAST_VERSION_USED" == "$CURRENT_VERSION" ] && [ "$LAST_VERSION_USED" == "$NEW_CACHE_PATH_VERSION" ]; then
54
60
  exit 0
55
61
  fi
56
62
  fi
@@ -64,6 +70,10 @@ else
64
70
  mv "$TEMP_FILE" "$CACHE_FILE"
65
71
  fi
66
72
 
73
+ if [ -f "$CACHE_DIRECTORY/$NEW_VERSION_FILE" ]; then
74
+ echo "$CURRENT_VERSION\n" > "$CACHE_DIRECTORY/$NEW_VERSION_FILE"
75
+ fi
76
+
67
77
 
68
78
  cd $CWD
69
79
 
@@ -292,17 +292,30 @@ impl InternalFileSystem {
292
292
 
293
293
  pub fn runtime_repokit_version() -> Option<String> {
294
294
  if let Some(home) = InternalFileSystem::home() {
295
- let version = Executor::exec(
296
- format!(
297
- "head -n 1 {}",
298
- home.join(".repokit").normalize().to_str().unwrap()
299
- ),
300
- |cmd| cmd,
301
- );
302
- if VERSION_REGEX.is_match(&version) {
303
- return Some(version);
295
+ let path = home.join(".repokit");
296
+ return InternalFileSystem::get_version_at_path(&path);
297
+ }
298
+ None
299
+ }
300
+
301
+ pub fn new_cache_path_version() -> Option<String> {
302
+ if let Some(home) = InternalFileSystem::home() {
303
+ let path = home.join(".repokit_cache/.version");
304
+ if (&*path).exists() && path.is_file() {
305
+ return InternalFileSystem::get_version_at_path(&path);
304
306
  }
305
307
  }
306
308
  None
307
309
  }
310
+
311
+ fn get_version_at_path(path: &PathBuf) -> Option<String> {
312
+ let version = Executor::exec(
313
+ format!("head -n 1 {}", path.normalize().to_str().unwrap()),
314
+ |cmd| cmd,
315
+ );
316
+ if VERSION_REGEX.is_match(&version) {
317
+ return Some(version);
318
+ }
319
+ None
320
+ }
308
321
  }
@@ -34,12 +34,15 @@ impl RuntimeCompiler {
34
34
  }
35
35
 
36
36
  fn with_version_mismatch(root: &str, func: impl Fn(&str, InternalFileSystem)) {
37
- let scoped_fs = InternalFileSystem::new(root);
38
- if let Some(installed_version) = scoped_fs.installed_repokit_version()
39
- && let Some(runtime_version) = InternalFileSystem::runtime_repokit_version()
40
- && runtime_version != installed_version
41
- {
42
- func(&installed_version, scoped_fs);
37
+ let scoped_fs: InternalFileSystem = InternalFileSystem::new(root);
38
+ if let Some(installed_version) = scoped_fs.installed_repokit_version() {
39
+ let runtime_version = InternalFileSystem::runtime_repokit_version();
40
+ let new_cache_path_version = InternalFileSystem::new_cache_path_version();
41
+ if runtime_version.is_some_and(|value| value != installed_version)
42
+ || new_cache_path_version.is_some_and(|value| value != installed_version)
43
+ {
44
+ func(&installed_version, scoped_fs);
45
+ }
43
46
  }
44
47
  }
45
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repokit/core",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "description": "A knowledgebase for your repository - wrapped in a CLI",
5
5
  "keywords": [
6
6
  "cli",