@jterrazz/typescript 2.3.4 → 2.4.0

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-watch.sh CHANGED
@@ -1,5 +1,15 @@
1
1
  #!/bin/bash
2
2
 
3
+ # Exit on error
4
+ set -e
5
+
6
+ # Colors for output (using Vitest-like colors)
7
+ RED='\033[0;31m'
8
+ GREEN='\033[0;32m'
9
+ CYAN_BG='\033[46m' # Cyan background
10
+ BRIGHT_WHITE='\033[1;30m' # Bold black text
11
+ NC='\033[0m' # No Color
12
+
3
13
  # Get the directory where the script is being called from (caller's project root)
4
14
  # If called through bin, we need to get the directory where the command was executed
5
15
  if [ -n "$INIT_CWD" ]; then
@@ -8,40 +18,39 @@ else
8
18
  PROJECT_ROOT=$(pwd)
9
19
  fi
10
20
 
11
- echo "👀 Starting TypeScript watch mode..."
21
+ printf "${CYAN_BG}${BRIGHT_WHITE} START ${NC} Starting TypeScript watch mode\n\n"
12
22
 
13
23
  # Default paths relative to project root
14
24
  IN_PATH="$PROJECT_ROOT/src"
15
25
  OUT_PATH="$PROJECT_ROOT/dist"
16
26
 
17
- echo "📂 Input directory: $IN_PATH"
18
- echo "📂 Output directory: $OUT_PATH"
27
+ printf "Input directory: %s\n" "$IN_PATH"
28
+ printf "Output directory: %s\n" "$OUT_PATH"
19
29
 
20
30
  # Convert tsconfig.json to .swcrc
21
- echo "🔄 Converting tsconfig.json to .swcrc..."
31
+ printf "\n${CYAN_BG}${BRIGHT_WHITE} RUN ${NC} Converting tsconfig.json to .swcrc\n\n"
22
32
  TMP_SWCRC=$(mktemp -q /tmp/.swcrc.XXXXXX)
23
33
  if [ $? -ne 0 ]; then
24
- echo " Error: Can't create temporary .swcrc file"
34
+ printf "${RED}✗ Error: Can't create temporary .swcrc file${NC}\n"
25
35
  exit 1
26
36
  fi
27
37
 
28
38
  # Ensure we're in the project root directory for TypeScript configuration
29
39
  cd "$PROJECT_ROOT"
30
40
  npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
31
- echo " Successfully converted tsconfig.json to .swcrc"
41
+ printf "${GREEN}✓ Successfully converted tsconfig.json to .swcrc${NC}\n"
32
42
 
33
- echo "⚙️ Starting watch mode with nodemon..."
34
- echo "📝 Watching for changes in: $IN_PATH"
35
- echo "🚀 Changes will trigger automatic recompilation and execution"
43
+ printf "\n${CYAN_BG}${BRIGHT_WHITE} RUN ${NC} Starting watch mode with nodemon\n\n"
44
+ printf "Watching for changes in: %s\n" "$IN_PATH"
36
45
 
37
46
  # Watch for changes in the src directory, compile and run
38
47
  npx nodemon --quiet \
39
48
  --watch "$IN_PATH" \
40
49
  --ext '*' \
41
- --exec "echo '🔄 File change detected, recompiling...' && npx swc $IN_PATH \
50
+ --exec "printf 'File change detected, rebuilding\\n' && npx swc $IN_PATH \
42
51
  --source-maps \
43
52
  --copy-files \
44
53
  --config-file $TMP_SWCRC \
45
54
  --out-dir $OUT_PATH \
46
55
  --strip-leading-paths \
47
- && echo ' Compilation successful, running...' && node --enable-source-maps $OUT_PATH/index.js"
56
+ && printf '${GREEN}✓ Completed${NC}\\n\n' && node --enable-source-maps $OUT_PATH/index.js"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jterrazz/typescript",
3
3
  "author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
4
- "version": "2.3.4",
4
+ "version": "2.4.0",
5
5
  "files": [
6
6
  "tsconfig",
7
7
  "bin"
@@ -0,0 +1,30 @@
1
+ {
2
+ "display": "Next JS",
3
+ "include": [
4
+ "../../../../src/**/*.ts",
5
+ "../../../../src/**/*.tsx",
6
+ "../../../../next-env.d.ts",
7
+ "../../../../.next/types/**/*.ts"
8
+ ],
9
+
10
+ "compilerOptions": {
11
+ "lib": ["dom", "dom.iterable", "esnext"],
12
+ "allowJs": true,
13
+ "skipLibCheck": true,
14
+ "strict": true,
15
+ "noEmit": true,
16
+ "esModuleInterop": true,
17
+ "module": "esnext",
18
+ "moduleResolution": "bundler",
19
+ "resolveJsonModule": true,
20
+ "isolatedModules": true,
21
+ "jsx": "preserve",
22
+ "incremental": true,
23
+ "baseUrl": ".",
24
+ "plugins": [
25
+ {
26
+ "name": "next"
27
+ }
28
+ ]
29
+ }
30
+ }