@jterrazz/typescript 2.2.0 → 2.3.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/bin/ts-compile.sh +16 -13
- package/package.json +1 -1
package/bin/ts-compile.sh
CHANGED
|
@@ -6,6 +6,8 @@ set -e
|
|
|
6
6
|
# Colors for output
|
|
7
7
|
RED='\033[0;31m'
|
|
8
8
|
GREEN='\033[0;32m'
|
|
9
|
+
ACCENT_BG='\033[48;5;31m' # TypeScript blue
|
|
10
|
+
WHITE='\033[1;37m'
|
|
9
11
|
NC='\033[0m' # No Color
|
|
10
12
|
|
|
11
13
|
# Get the directory where the script is being called from (caller's project root)
|
|
@@ -16,7 +18,7 @@ else
|
|
|
16
18
|
PROJECT_ROOT=$(pwd)
|
|
17
19
|
fi
|
|
18
20
|
|
|
19
|
-
echo "Starting TypeScript compilation process
|
|
21
|
+
echo "${ACCENT_BG}${WHITE} START ${NC} Starting TypeScript compilation process...\n"
|
|
20
22
|
|
|
21
23
|
# Default paths relative to project root
|
|
22
24
|
IN_PATH="$PROJECT_ROOT/src"
|
|
@@ -26,25 +28,25 @@ echo "Input directory: $IN_PATH"
|
|
|
26
28
|
echo "Output directory: $OUT_PATH"
|
|
27
29
|
|
|
28
30
|
# Convert tsconfig.json to .swcrc
|
|
29
|
-
echo "Converting tsconfig.json to .swcrc
|
|
31
|
+
echo "\n${ACCENT_BG}${WHITE} STEP ${NC} Converting tsconfig.json to .swcrc\n"
|
|
30
32
|
TMP_SWCRC=$(mktemp -q /tmp/.swcrc.XXXXXX)
|
|
31
33
|
if [ $? -ne 0 ]; then
|
|
32
|
-
echo
|
|
34
|
+
echo "${RED}✗ Error: Can't create temporary .swcrc file${NC}"
|
|
33
35
|
exit 1
|
|
34
36
|
fi
|
|
35
37
|
|
|
36
38
|
# Ensure we're in the project root directory for TypeScript configuration
|
|
37
39
|
cd "$PROJECT_ROOT"
|
|
38
40
|
npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
|
|
39
|
-
echo
|
|
41
|
+
echo "${GREEN}✓ Completed${NC}"
|
|
40
42
|
|
|
41
43
|
# Create typescript declaration files
|
|
42
|
-
echo "Generating TypeScript declaration files
|
|
44
|
+
echo "\n${ACCENT_BG}${WHITE} STEP ${NC} Generating TypeScript declaration files\n"
|
|
43
45
|
npx tsc --rootDir "$IN_PATH" --declaration --emitDeclarationOnly --outDir "$OUT_PATH"
|
|
44
|
-
echo
|
|
46
|
+
echo "${GREEN}✓ Completed${NC}"
|
|
45
47
|
|
|
46
48
|
# Create javascript ESM files with improved source maps
|
|
47
|
-
echo "Compiling TypeScript to ESM with source maps
|
|
49
|
+
echo "\n${ACCENT_BG}${WHITE} STEP ${NC} Compiling TypeScript to ESM with source maps\n"
|
|
48
50
|
if ! "$PROJECT_ROOT/node_modules/.bin/swc" "$IN_PATH" \
|
|
49
51
|
--source-maps \
|
|
50
52
|
--copy-files \
|
|
@@ -53,17 +55,18 @@ if ! "$PROJECT_ROOT/node_modules/.bin/swc" "$IN_PATH" \
|
|
|
53
55
|
--strip-leading-paths \
|
|
54
56
|
--log-watch-compilation \
|
|
55
57
|
"$@"; then
|
|
56
|
-
echo
|
|
58
|
+
echo "${RED}✗ SWC compilation failed${NC}"
|
|
57
59
|
exit 1
|
|
58
60
|
fi
|
|
59
|
-
echo
|
|
61
|
+
echo "${GREEN}✓ Completed${NC}"
|
|
60
62
|
|
|
61
63
|
# Create javascript CJS files
|
|
62
|
-
echo "Creating CommonJS bundle
|
|
64
|
+
echo "\n${ACCENT_BG}${WHITE} STEP ${NC} Creating CommonJS bundle\n"
|
|
63
65
|
if ! npx rollup "$OUT_PATH/index.js" --format cjs --file "$OUT_PATH/index.cjs" --silent; then
|
|
64
|
-
echo
|
|
66
|
+
echo "${RED}✗ Rollup bundling failed${NC}"
|
|
65
67
|
exit 1
|
|
66
68
|
fi
|
|
67
|
-
echo
|
|
69
|
+
echo "${GREEN}✓ Completed${NC}"
|
|
68
70
|
|
|
69
|
-
echo
|
|
71
|
+
echo "\n${ACCENT_BG}${WHITE} END ${NC} Finalizing compilation process\n"
|
|
72
|
+
echo "${GREEN}✓ Completed${NC}"
|