@jterrazz/typescript 1.9.2 → 1.9.4

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.
@@ -1,6 +1,16 @@
1
1
  #!/bin/bash
2
- IN_PATH=src
3
- OUT_PATH=dist
2
+
3
+ # Get the directory where the script is being called from (caller's project root)
4
+ # If called through bin, we need to get the directory where the command was executed
5
+ if [ -n "$INIT_CWD" ]; then
6
+ PROJECT_ROOT="$INIT_CWD"
7
+ else
8
+ PROJECT_ROOT=$(pwd)
9
+ fi
10
+
11
+ # Default paths relative to project root
12
+ IN_PATH="$PROJECT_ROOT/src"
13
+ OUT_PATH="$PROJECT_ROOT/dist"
4
14
 
5
15
  # Convert tsconfig.json to .swcrc
6
16
  TMP_SWCRC=$(mktemp -q /tmp/.swcrc.XXXXXX)
@@ -8,13 +18,20 @@ if [ $? -ne 0 ]; then
8
18
  echo "$0: Can't create temporary .swcrc file"
9
19
  exit 1
10
20
  fi
11
- tsconfig-to-swcconfig --output="$TMP_SWCRC"
21
+ npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
12
22
 
13
23
  # Create typescript declaration files
14
- tsc --declaration --emitDeclarationOnly --outDir "$OUT_PATH"
24
+ npx tsc --rootDir "$IN_PATH" --declaration --emitDeclarationOnly --outDir "$OUT_PATH"
15
25
 
16
- # Create javascript ESM files
17
- npx swc "$IN_PATH" --source-maps --copy-files --config-file "$TMP_SWCRC" --out-dir "$OUT_PATH" --strip-leading-paths "$@"
26
+ # Create javascript ESM files with improved source maps
27
+ npx swc "$IN_PATH" \
28
+ --source-maps \
29
+ --copy-files \
30
+ --config-file "$TMP_SWCRC" \
31
+ --out-dir "$OUT_PATH" \
32
+ --strip-leading-paths \
33
+ --log-watch-compilation \
34
+ "$@"
18
35
 
19
36
  # Create javascript CJS files
20
- rollup $OUT_PATH/index.js --format cjs --name --file $OUT_PATH/index.cjs
37
+ npx rollup "$OUT_PATH/index.js" --format cjs --file "$OUT_PATH/index.cjs"
package/bin/swc-watch.sh CHANGED
@@ -1,6 +1,16 @@
1
1
  #!/bin/bash
2
- IN_PATH=src
3
- OUT_PATH=dist
2
+
3
+ # Get the directory where the script is being called from (caller's project root)
4
+ # If called through bin, we need to get the directory where the command was executed
5
+ if [ -n "$INIT_CWD" ]; then
6
+ PROJECT_ROOT="$INIT_CWD"
7
+ else
8
+ PROJECT_ROOT=$(pwd)
9
+ fi
10
+
11
+ # Default paths relative to project root
12
+ IN_PATH="$PROJECT_ROOT/src"
13
+ OUT_PATH="$PROJECT_ROOT/dist"
4
14
 
5
15
  # Convert tsconfig.json to .swcrc
6
16
  TMP_SWCRC=$(mktemp -q /tmp/.swcrc.XXXXXX)
@@ -8,7 +18,16 @@ if [ $? -ne 0 ]; then
8
18
  echo "$0: Can't create temporary .swcrc file"
9
19
  exit 1
10
20
  fi
11
- tsconfig-to-swcconfig --output="$TMP_SWCRC"
21
+ npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
12
22
 
13
23
  # Watch for changes in the src directory, compile and run
14
- nodemon --quiet --watch src --ext '*' --exec "npx swc $IN_PATH --source-maps --quiet --copy-files --config-file $TMP_SWCRC --out-dir $OUT_PATH --strip-leading-paths && node --enable-source-maps $OUT_PATH/index.js"
24
+ npx nodemon --quiet \
25
+ --watch "$IN_PATH" \
26
+ --ext '*' \
27
+ --exec "npx swc $IN_PATH \
28
+ --source-maps \
29
+ --copy-files \
30
+ --config-file $TMP_SWCRC \
31
+ --out-dir $OUT_PATH \
32
+ --strip-leading-paths \
33
+ && 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 <jterrazzoni@gmail.com>",
4
- "version": "1.9.2",
4
+ "version": "1.9.4",
5
5
  "files": [
6
6
  "tsconfig",
7
7
  "bin"
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "scripts": {},
15
15
  "devDependencies": {
16
- "@jterrazz/quality": "^1.6.0"
16
+ "@jterrazz/quality": "^1.6.1"
17
17
  },
18
18
  "dependencies": {
19
19
  "@swc/cli": "0.6.0",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "display": "Expo",
3
+ "include": ["./src/"],
3
4
 
4
5
  "compilerOptions": {
5
6
  "allowJs": true,
@@ -13,5 +14,10 @@
13
14
  "target": "ESNext"
14
15
  },
15
16
 
16
- "exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
17
+ "exclude": [
18
+ "node_modules",
19
+ "babel.config.js",
20
+ "metro.config.js",
21
+ "jest.config.js"
22
+ ]
17
23
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "display": "ESM",
3
+ "include": ["./src/"],
3
4
 
4
5
  "compilerOptions": {
5
6
  "moduleResolution": "bundler",