@sablier/devkit 1.8.1 → 1.9.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.
package/just/csv.just CHANGED
@@ -6,9 +6,10 @@ import "./settings.just"
6
6
 
7
7
  # Check CSV/TSV files using qsv: https://github.com/dathere/qsv
8
8
  [group("checks"), script("python3")]
9
- _csv-check globs="data/*/*.csv" ext="csv" schema="" ignore="*.csv.invalid|*.csv.valid|*validation-errors.csv":
9
+ _csv-check glob="data/*/*.{csv,tsv}" schema="" ignore="*.invalid *.valid *validation-errors.*":
10
10
  import fnmatch
11
11
  import glob as globmod
12
+ import re
12
13
  import subprocess
13
14
  import sys
14
15
 
@@ -18,19 +19,30 @@ _csv-check globs="data/*/*.csv" ext="csv" schema="" ignore="*.csv.invalid|*.csv.
18
19
  print("Install it: https://github.com/dathere/qsv")
19
20
  sys.exit(1)
20
21
 
21
- ext = "{{ ext }}" or "csv"
22
- ignore_patterns = "{{ ignore }}".split("|") if "{{ ignore }}" else []
22
+ ignore_patterns = "{{ ignore }}".split() if "{{ ignore }}" else []
23
23
  schema = "{{ schema }}" or None
24
- globs = "{{ globs }}"
24
+ globs = "{{ glob }}"
25
+
26
+ # Infer extension label from glob pattern
27
+ ext_match = re.search(r'\.(\w+|\{[^}]+\})$', globs)
28
+ if ext_match:
29
+ ext = ext_match.group(1)
30
+ if ext.startswith('{') and ext.endswith('}'):
31
+ # Handle brace expansion like {csv,tsv}
32
+ ext_label = '.' + '/'.join(f'.{e}' for e in ext[1:-1].split(','))[1:]
33
+ else:
34
+ ext_label = f'.{ext}'
35
+ else:
36
+ ext_label = 'CSV/TSV'
25
37
 
26
- print(f"Validating {ext} files...")
38
+ print(f"Validating {ext_label} files...")
27
39
  files = globmod.glob(globs)
28
40
 
29
41
  # Filter ignored files
30
42
  files = [f for f in files if not any(fnmatch.fnmatch(f, p) for p in ignore_patterns)]
31
43
 
32
44
  if not files:
33
- print(f"ℹ️ No {ext} files found to validate")
45
+ print(f"ℹ️ No {ext_label} files found to validate")
34
46
  sys.exit(0)
35
47
 
36
48
  for file in files:
@@ -40,14 +52,14 @@ _csv-check globs="data/*/*.csv" ext="csv" schema="" ignore="*.csv.invalid|*.csv.
40
52
  result = subprocess.run(cmd, capture_output=True)
41
53
  if result.returncode != 0:
42
54
  print(f"❌ Validation failed for: {file}")
43
- subprocess.run(["just", "_csv-show-errors", file, ext])
55
+ subprocess.run(["just", "_csv-show-errors", file])
44
56
  sys.exit(1)
45
57
 
46
- print(f"✅ All {ext} files are valid")
58
+ print(f"✅ All {ext_label} files are valid")
47
59
 
48
60
  # Show validation errors for a CSV/TSV file
49
61
  [group("checks"), script("python3")]
50
- _csv-show-errors file ext="csv":
62
+ _csv-show-errors file:
51
63
  import os
52
64
  import subprocess
53
65
  import sys
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Configuration files and reusable scripts for Sablier repositories",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "1.8.1",
6
+ "version": "1.9.1",
7
7
  "author": {
8
8
  "name": "Sablier Labs Ltd",
9
9
  "url": "https://sablier.com"
package/just/tsv.just DELETED
@@ -1,15 +0,0 @@
1
- import "./csv.just"
2
-
3
- # ---------------------------------------------------------------------------- #
4
- # TSV WRAPPERS #
5
- # ---------------------------------------------------------------------------- #
6
-
7
- # Check TSV files using qsv: https://github.com/dathere/qsv
8
- [group("checks")]
9
- _tsv-check globs="data/*/*.tsv" ext="TSV" schema="" ignore="*.tsv.invalid|*.tsv.valid|*validation-errors.tsv":
10
- @just _csv-check "{{ globs }}" "{{ ext }}" "{{ schema }}" "{{ ignore }}"
11
-
12
- # Show validation errors for a TSV file
13
- [group("checks")]
14
- _tsv-show-errors file:
15
- @just _csv-show-errors "{{ file }}" "TSV"