Skip to content

Commit fcc2a1e

Browse files
feat: add package discovery recipes to justfile
Add three new recipes to CI/CD group for dynamic package discovery: - list-packages: Lists all package names in packages/ directory - list-packages-json: Outputs packages in JSON format for CI matrix usage - validate-package: Checks that a package has valid structure These recipes enable automated package discovery for CI workflows and monorepo tooling without hardcoding package names.
1 parent 8bddbf1 commit fcc2a1e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

justfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,33 @@ gh-cancel run_id="":
247247
gh run cancel {{run_id}} --repo $REPO
248248
fi
249249

250+
# List all packages in packages/ directory
251+
[group('CI/CD')]
252+
list-packages:
253+
@ls -1 packages/
254+
255+
# List packages in JSON format for CI matrix
256+
[group('CI/CD')]
257+
list-packages-json:
258+
#!/usr/bin/env bash
259+
cd packages
260+
packages=()
261+
for dir in */; do
262+
pkg_name="${dir%/}"
263+
if [ -f "$dir/package.json" ]; then
264+
packages+=("{\"name\":\"$pkg_name\",\"path\":\"packages/$pkg_name\"}")
265+
fi
266+
done
267+
echo "[$(IFS=,; echo "${packages[*]}")]"
268+
269+
# Validate package structure
270+
[group('CI/CD')]
271+
validate-package package:
272+
@echo "Validating package: {{ package }}"
273+
@test -d "packages/{{ package }}" || (echo "Package directory not found" && exit 1)
274+
@test -f "packages/{{ package }}/package.json" || (echo "package.json not found" && exit 1)
275+
@echo "✓ Package {{ package }} is valid"
276+
250277
## Cloudflare
251278

252279
# Preview the site locally with Cloudflare Workers

0 commit comments

Comments
 (0)