openai/openai-node

Public

mirrored from https://github.com/openai/openai-nodeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
f606e8b43d0e3d5a3ad31cf7dab1bded0bac4d37

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

scripts/fast-format

38lines · modecode

1#!/usr/bin/env bash
2
3set -euo pipefail
4
5echo "Script started with $# arguments"
6echo "Arguments: $*"
7echo "Script location: $(dirname "$0")"
8
9cd "$(dirname "$0")/.."
10echo "Changed to directory: $(pwd)"
11
12if [ $# -eq 0 ]; then
13 echo "Usage: $0 <file-with-paths> [additional-formatter-args...]"
14 echo "The file should contain one file path per line"
15 exit 1
16fi
17
18FILE_LIST="$1"
19
20echo "Looking for file: $FILE_LIST"
21
22if [ ! -f "$FILE_LIST" ]; then
23 echo "Error: File '$FILE_LIST' not found"
24 exit 1
25fi
26
27echo "==> Running eslint --fix"
28ESLINT_FILES="$(grep '\.ts$' "$FILE_LIST" || true)"
29if ! [ -z "$ESLINT_FILES" ]; then
30 echo "$ESLINT_FILES" | xargs ./node_modules/.bin/eslint --cache --fix
31fi
32
33echo "==> Running prettier --write"
34PRETTIER_FILES="$(grep '\.\([mc]?tsx?\|[mc]?jsx?\|json\)$' "$FILE_LIST" || true)"
35if ! [ -z "$PRETTIER_FILES" ]; then
36 echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \
37 --write --cache --cache-strategy metadata --no-error-on-unmatched-pattern
38fi
39