@jterrazz/typescript 1.9.6 → 2.0.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Package Typescript
2
2
 
3
- This package provides a consistent TypeScript configuration for projects. It includes two commands: `swc-compiler` and `swc-runner`.
3
+ This package provides a consistent TypeScript configuration for projects. It includes two commands: `ts-compiler` and `ts-runner`.
4
4
 
5
5
  ## Installation
6
6
 
@@ -28,8 +28,8 @@ Use the provided `tsconfig.json` in your project:
28
28
 
29
29
  ### Commands
30
30
 
31
- - `swc-compiler`: Compile TypeScript files using SWC.
32
- - `swc-runner`: Execute TypeScript files using SWC.
31
+ - `ts-compiler`: Compile TypeScript files.
32
+ - `ts-runner`: Execute TypeScript files.
33
33
 
34
34
  ## Implementation Details
35
35
 
@@ -8,25 +8,35 @@ else
8
8
  PROJECT_ROOT=$(pwd)
9
9
  fi
10
10
 
11
+ echo "🚀 Starting TypeScript compilation process..."
12
+
11
13
  # Default paths relative to project root
12
14
  IN_PATH="$PROJECT_ROOT/src"
13
15
  OUT_PATH="$PROJECT_ROOT/dist"
14
16
 
17
+ echo "📂 Input directory: $IN_PATH"
18
+ echo "📂 Output directory: $OUT_PATH"
19
+
15
20
  # Convert tsconfig.json to .swcrc
21
+ echo "🔄 Converting tsconfig.json to .swcrc..."
16
22
  TMP_SWCRC=$(mktemp -q /tmp/.swcrc.XXXXXX)
17
23
  if [ $? -ne 0 ]; then
18
- echo "$0: Can't create temporary .swcrc file"
24
+ echo "❌ Error: Can't create temporary .swcrc file"
19
25
  exit 1
20
26
  fi
21
27
 
22
28
  # Ensure we're in the project root directory for TypeScript configuration
23
29
  cd "$PROJECT_ROOT"
24
30
  npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
31
+ echo "✅ Successfully converted tsconfig.json to .swcrc"
25
32
 
26
33
  # Create typescript declaration files
34
+ echo "📝 Generating TypeScript declaration files..."
27
35
  npx tsc --rootDir "$IN_PATH" --declaration --emitDeclarationOnly --outDir "$OUT_PATH"
36
+ echo "✅ TypeScript declaration files generated"
28
37
 
29
38
  # Create javascript ESM files with improved source maps
39
+ echo "⚙️ Compiling TypeScript to ESM with source maps..."
30
40
  npx swc "$IN_PATH" \
31
41
  --source-maps \
32
42
  --copy-files \
@@ -35,6 +45,11 @@ npx swc "$IN_PATH" \
35
45
  --strip-leading-paths \
36
46
  --log-watch-compilation \
37
47
  "$@"
48
+ echo "✅ ESM compilation completed"
38
49
 
39
50
  # Create javascript CJS files
40
- npx rollup "$OUT_PATH/index.js" --format cjs --file "$OUT_PATH/index.cjs"
51
+ echo "🔄 Creating CommonJS bundle..."
52
+ npx rollup "$OUT_PATH/index.js" --format cjs --file "$OUT_PATH/index.cjs"
53
+ echo "✅ CommonJS bundle created"
54
+
55
+ echo "✨ Compilation process completed successfully!"
@@ -8,29 +8,40 @@ else
8
8
  PROJECT_ROOT=$(pwd)
9
9
  fi
10
10
 
11
+ echo "👀 Starting TypeScript watch mode..."
12
+
11
13
  # Default paths relative to project root
12
14
  IN_PATH="$PROJECT_ROOT/src"
13
15
  OUT_PATH="$PROJECT_ROOT/dist"
14
16
 
17
+ echo "📂 Input directory: $IN_PATH"
18
+ echo "📂 Output directory: $OUT_PATH"
19
+
15
20
  # Convert tsconfig.json to .swcrc
21
+ echo "🔄 Converting tsconfig.json to .swcrc..."
16
22
  TMP_SWCRC=$(mktemp -q /tmp/.swcrc.XXXXXX)
17
23
  if [ $? -ne 0 ]; then
18
- echo "$0: Can't create temporary .swcrc file"
24
+ echo "❌ Error: Can't create temporary .swcrc file"
19
25
  exit 1
20
26
  fi
21
27
 
22
28
  # Ensure we're in the project root directory for TypeScript configuration
23
29
  cd "$PROJECT_ROOT"
24
30
  npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
31
+ echo "✅ Successfully converted tsconfig.json to .swcrc"
32
+
33
+ echo "⚙️ Starting watch mode with nodemon..."
34
+ echo "📝 Watching for changes in: $IN_PATH"
35
+ echo "🚀 Changes will trigger automatic recompilation and execution"
25
36
 
26
37
  # Watch for changes in the src directory, compile and run
27
38
  npx nodemon --quiet \
28
39
  --watch "$IN_PATH" \
29
40
  --ext '*' \
30
- --exec "npx swc $IN_PATH \
41
+ --exec "echo '🔄 File change detected, recompiling...' && npx swc $IN_PATH \
31
42
  --source-maps \
32
43
  --copy-files \
33
44
  --config-file $TMP_SWCRC \
34
45
  --out-dir $OUT_PATH \
35
46
  --strip-leading-paths \
36
- && node --enable-source-maps $OUT_PATH/index.js"
47
+ && echo '✅ Compilation successful, running...' && node --enable-source-maps $OUT_PATH/index.js"
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@jterrazz/typescript",
3
- "author": "Jean-Baptiste Terrazzoni <jterrazzoni@gmail.com>",
4
- "version": "1.9.6",
3
+ "author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
4
+ "version": "2.0.1",
5
5
  "files": [
6
6
  "tsconfig",
7
7
  "bin"
8
8
  ],
9
9
  "type": "module",
10
10
  "bin": {
11
- "swc-compile": "bin/swc-compile.sh",
12
- "swc-watch": "bin/swc-watch.sh"
11
+ "ts-compile": "bin/ts-compile.sh",
12
+ "ts-watch": "bin/ts-watch.sh"
13
13
  },
14
14
  "scripts": {},
15
15
  "devDependencies": {
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@swc/cli": "0.6.0",
20
- "@swc/core": "1.11.8",
20
+ "@swc/core": "1.11.13",
21
21
  "@types/node": "22.13.10",
22
22
  "nodemon": "3.1.9",
23
23
  "rollup": "4.35.0",