-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathextract-gutenberg-types
executable file
·29 lines (21 loc) · 1.54 KB
/
extract-gutenberg-types
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
set -euo pipefail
source "$(dirname "$0")/.common"
BASEDIR="$(dirname "${BASH_SOURCE[0]}")"
CMS_PATH="$BASEDIR/../services/cms/"
RELATIVE_CMS_PATH=$(realpath --relative-to="$(pwd)" "$CMS_PATH")
run_command cd "$RELATIVE_CMS_PATH" || exit
run_command npx tsx scripts/extractGutenbergAttributeTypes.ts
# Format the generated files with prettier instead of eslint
run_command npx prettier --write ../course-material/types/GutenbergBlockAttributes.ts ../course-material/types/DeprecatedGutenbergBlockAttributes.ts
run_command cd ../..
if [ -f "./services/course-material/types/GutenbergBlockAttributes.guard.ts" ]; then
run_command rm ./services/course-material/types/GutenbergBlockAttributes.guard.ts
fi
if [ -f "./services/course-material/types/DepreactedGutenbergBlockAttributes.guard.ts" ]; then
run_command rm ./services/course-material/types/DeprecatedGutenbergBlockAttributes.guard.ts
fi
run_command npx ts-auto-guard --export-all --paths services/course-material/types/GutenbergBlockAttributes.ts --project services/course-material/tsconfig.json
run_command npx prettier --write services/course-material/types/GutenbergBlockAttributes.ts services/course-material/types/GutenbergBlockAttributes.guard.ts
run_command npx ts-auto-guard --export-all --paths services/course-material/types/DeprecatedGutenbergBlockAttributes.ts --project services/course-material/tsconfig.json
run_command npx prettier --write services/course-material/types/DeprecatedGutenbergBlockAttributes.ts services/course-material/types/DeprecatedGutenbergBlockAttributes.guard.ts