@jterrazz/typescript 2.0.5 → 2.2.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-compile.sh +20 -15
- package/package.json +23 -19
- package/tsconfig/node-esm.json +2 -2
package/bin/ts-compile.sh
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
# Exit on error
|
|
4
4
|
set -e
|
|
5
5
|
|
|
6
|
+
# Colors for output
|
|
7
|
+
RED='\033[0;31m'
|
|
8
|
+
GREEN='\033[0;32m'
|
|
9
|
+
NC='\033[0m' # No Color
|
|
10
|
+
|
|
6
11
|
# Get the directory where the script is being called from (caller's project root)
|
|
7
12
|
# If called through bin, we need to get the directory where the command was executed
|
|
8
13
|
if [ -n "$INIT_CWD" ]; then
|
|
@@ -11,35 +16,35 @@ else
|
|
|
11
16
|
PROJECT_ROOT=$(pwd)
|
|
12
17
|
fi
|
|
13
18
|
|
|
14
|
-
echo "
|
|
19
|
+
echo "Starting TypeScript compilation process..."
|
|
15
20
|
|
|
16
21
|
# Default paths relative to project root
|
|
17
22
|
IN_PATH="$PROJECT_ROOT/src"
|
|
18
23
|
OUT_PATH="$PROJECT_ROOT/dist"
|
|
19
24
|
|
|
20
|
-
echo "
|
|
21
|
-
echo "
|
|
25
|
+
echo "Input directory: $IN_PATH"
|
|
26
|
+
echo "Output directory: $OUT_PATH"
|
|
22
27
|
|
|
23
28
|
# Convert tsconfig.json to .swcrc
|
|
24
|
-
echo "
|
|
29
|
+
echo "Converting tsconfig.json to .swcrc..."
|
|
25
30
|
TMP_SWCRC=$(mktemp -q /tmp/.swcrc.XXXXXX)
|
|
26
31
|
if [ $? -ne 0 ]; then
|
|
27
|
-
echo "❌ Error: Can't create temporary .swcrc file"
|
|
32
|
+
echo -e "${RED}❌ Error: Can't create temporary .swcrc file${NC}"
|
|
28
33
|
exit 1
|
|
29
34
|
fi
|
|
30
35
|
|
|
31
36
|
# Ensure we're in the project root directory for TypeScript configuration
|
|
32
37
|
cd "$PROJECT_ROOT"
|
|
33
38
|
npx tsconfig-to-swcconfig --output="$TMP_SWCRC"
|
|
34
|
-
echo "✅
|
|
39
|
+
echo -e "${GREEN}✅ Converted tsconfig.json to .swcrc${NC}"
|
|
35
40
|
|
|
36
41
|
# Create typescript declaration files
|
|
37
|
-
echo "
|
|
42
|
+
echo "Generating TypeScript declaration files..."
|
|
38
43
|
npx tsc --rootDir "$IN_PATH" --declaration --emitDeclarationOnly --outDir "$OUT_PATH"
|
|
39
|
-
echo "✅ TypeScript declaration files generated"
|
|
44
|
+
echo -e "${GREEN}✅ TypeScript declaration files generated${NC}"
|
|
40
45
|
|
|
41
46
|
# Create javascript ESM files with improved source maps
|
|
42
|
-
echo "
|
|
47
|
+
echo "Compiling TypeScript to ESM with source maps..."
|
|
43
48
|
if ! "$PROJECT_ROOT/node_modules/.bin/swc" "$IN_PATH" \
|
|
44
49
|
--source-maps \
|
|
45
50
|
--copy-files \
|
|
@@ -48,17 +53,17 @@ if ! "$PROJECT_ROOT/node_modules/.bin/swc" "$IN_PATH" \
|
|
|
48
53
|
--strip-leading-paths \
|
|
49
54
|
--log-watch-compilation \
|
|
50
55
|
"$@"; then
|
|
51
|
-
echo "❌ SWC compilation failed"
|
|
56
|
+
echo -e "${RED}❌ SWC compilation failed${NC}"
|
|
52
57
|
exit 1
|
|
53
58
|
fi
|
|
54
|
-
echo "✅ ESM compilation completed"
|
|
59
|
+
echo -e "${GREEN}✅ ESM compilation completed${NC}"
|
|
55
60
|
|
|
56
61
|
# Create javascript CJS files
|
|
57
|
-
echo "
|
|
62
|
+
echo "Creating CommonJS bundle..."
|
|
58
63
|
if ! npx rollup "$OUT_PATH/index.js" --format cjs --file "$OUT_PATH/index.cjs" --silent; then
|
|
59
|
-
echo "❌ Rollup bundling failed"
|
|
64
|
+
echo -e "${RED}❌ Rollup bundling failed${NC}"
|
|
60
65
|
exit 1
|
|
61
66
|
fi
|
|
62
|
-
echo "✅ CommonJS bundle created"
|
|
67
|
+
echo -e "${GREEN}✅ CommonJS bundle created${NC}"
|
|
63
68
|
|
|
64
|
-
echo "
|
|
69
|
+
echo -e "${GREEN}✅ Compilation process completed successfully!${NC}"
|
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.0
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"tsconfig",
|
|
7
7
|
"bin"
|
|
@@ -11,30 +11,34 @@
|
|
|
11
11
|
"ts-compile": "bin/ts-compile.sh",
|
|
12
12
|
"ts-watch": "bin/ts-watch.sh"
|
|
13
13
|
},
|
|
14
|
-
"scripts": {
|
|
14
|
+
"scripts": {
|
|
15
|
+
"lint": "prettier --check .",
|
|
16
|
+
"test": "echo 'no tests yet'",
|
|
17
|
+
"build": "echo 'no build yet'"
|
|
18
|
+
},
|
|
15
19
|
"devDependencies": {
|
|
16
|
-
"@jterrazz/quality": "^2.0
|
|
20
|
+
"@jterrazz/quality": "^2.2.0"
|
|
17
21
|
},
|
|
18
22
|
"dependencies": {
|
|
19
|
-
"@swc/cli": "^0.
|
|
20
|
-
"@swc/core": "1.11.
|
|
21
|
-
"@types/node": "22.
|
|
22
|
-
"nodemon": "3.1.
|
|
23
|
-
"rollup": "4.
|
|
23
|
+
"@swc/cli": "^0.7.3",
|
|
24
|
+
"@swc/core": "1.11.24",
|
|
25
|
+
"@types/node": "22.14.1",
|
|
26
|
+
"nodemon": "3.1.10",
|
|
27
|
+
"rollup": "4.40.1",
|
|
24
28
|
"tsconfig-to-swcconfig": "2.8.1",
|
|
25
|
-
"typescript": "5.8.
|
|
29
|
+
"typescript": "5.8.3"
|
|
26
30
|
},
|
|
27
31
|
"optionalDependencies": {
|
|
28
|
-
"@swc/core-linux-x64-gnu": "1.11.
|
|
29
|
-
"@swc/core-linux-x64-musl": "1.11.
|
|
30
|
-
"@swc/core-darwin-x64": "1.11.
|
|
31
|
-
"@swc/core-darwin-arm64": "1.11.
|
|
32
|
-
"@swc/core-win32-x64-msvc": "1.11.
|
|
33
|
-
"@rollup/rollup-linux-x64-gnu": "4.
|
|
34
|
-
"@rollup/rollup-linux-x64-musl": "4.
|
|
35
|
-
"@rollup/rollup-darwin-x64": "4.
|
|
36
|
-
"@rollup/rollup-darwin-arm64": "4.
|
|
37
|
-
"@rollup/rollup-win32-x64-msvc": "4.
|
|
32
|
+
"@swc/core-linux-x64-gnu": "1.11.24",
|
|
33
|
+
"@swc/core-linux-x64-musl": "1.11.24",
|
|
34
|
+
"@swc/core-darwin-x64": "1.11.24",
|
|
35
|
+
"@swc/core-darwin-arm64": "1.11.24",
|
|
36
|
+
"@swc/core-win32-x64-msvc": "1.11.24",
|
|
37
|
+
"@rollup/rollup-linux-x64-gnu": "4.40.1",
|
|
38
|
+
"@rollup/rollup-linux-x64-musl": "4.40.1",
|
|
39
|
+
"@rollup/rollup-darwin-x64": "4.40.1",
|
|
40
|
+
"@rollup/rollup-darwin-arm64": "4.40.1",
|
|
41
|
+
"@rollup/rollup-win32-x64-msvc": "4.40.1"
|
|
38
42
|
},
|
|
39
43
|
"publishConfig": {
|
|
40
44
|
"registry": "https://registry.npmjs.org/"
|
package/tsconfig/node-esm.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"display": "ESM",
|
|
2
|
+
"display": "Node ESM",
|
|
3
3
|
"include": ["../../../../src/"],
|
|
4
4
|
|
|
5
5
|
"compilerOptions": {
|
|
6
6
|
"moduleResolution": "bundler",
|
|
7
7
|
"module": "ESNext",
|
|
8
|
-
"types": ["node"
|
|
8
|
+
"types": ["node"],
|
|
9
9
|
"strict": true,
|
|
10
10
|
"experimentalDecorators": true,
|
|
11
11
|
"esModuleInterop": true,
|