@jterrazz/typescript 4.2.0 → 4.3.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/LICENSE +1 -1
- package/README.md +21 -19
- package/bin/typescript.sh +110 -0
- package/config/rolldown.build.config.js +27 -27
- package/config/rolldown.dev.config.js +11 -11
- package/package.json +26 -16
- package/bin/ts-build.sh +0 -62
- package/bin/ts-dev.sh +0 -41
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) Jean-Baptiste Terrazzoni <contact@jterrazz.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
*Hey there – I'm Jean-Baptiste, just another developer doing weird things with code. All my projects live on [jterrazz.com](https://jterrazz.com) – complete with backstories and lessons learned. Feel free to poke around – you might just find something useful!*
|
|
2
|
-
|
|
3
1
|
# @jterrazz/typescript
|
|
4
2
|
|
|
5
3
|
Drop-in TypeScript build tooling with zero configuration.
|
|
6
4
|
|
|
5
|
+
## About
|
|
6
|
+
|
|
7
|
+
_Hey there – I'm Jean-Baptiste, just another developer doing weird things with code. All my projects live on [jterrazz.com](https://jterrazz.com) – complete with backstories and lessons learned. Feel free to poke around – you might just find something useful!_
|
|
8
|
+
|
|
7
9
|
## Installation
|
|
8
10
|
|
|
9
11
|
```bash
|
|
@@ -21,12 +23,12 @@ npm install @jterrazz/typescript
|
|
|
21
23
|
{ "extends": "@jterrazz/typescript/tsconfig/expo" } // Expo/React Native
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
### 2. Use the
|
|
26
|
+
### 2. Use the CLI
|
|
25
27
|
|
|
26
28
|
```bash
|
|
27
|
-
npx
|
|
28
|
-
npx
|
|
29
|
-
npx
|
|
29
|
+
npx typescript watch # Watch mode (build + run on changes)
|
|
30
|
+
npx typescript build --app # Production build (ESM + types)
|
|
31
|
+
npx typescript build --lib # Library build (ESM + CJS + types)
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
## What you get
|
|
@@ -38,14 +40,14 @@ npx ts-build --lib # Library build (ESM + CJS + types)
|
|
|
38
40
|
|
|
39
41
|
### Build outputs
|
|
40
42
|
|
|
41
|
-
|
|
|
42
|
-
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
|
|
|
46
|
-
| `
|
|
47
|
-
|
|
|
48
|
-
|
|
|
43
|
+
| Command | Output | Description |
|
|
44
|
+
| ------------------------ | ----------------- | ------------------------------- |
|
|
45
|
+
| `typescript watch` | `dist/index.js` | ESM only, fast rebuilds (~20ms) |
|
|
46
|
+
| `typescript build --app` | `dist/index.js` | ESM bundle |
|
|
47
|
+
| | `dist/index.d.ts` | TypeScript declarations |
|
|
48
|
+
| `typescript build --lib` | `dist/index.js` | ESM bundle |
|
|
49
|
+
| | `dist/index.cjs` | CommonJS bundle |
|
|
50
|
+
| | `dist/index.d.ts` | TypeScript declarations |
|
|
49
51
|
|
|
50
52
|
If `src/instrumentation.ts` exists, it will also generate corresponding `instrumentation.*` files.
|
|
51
53
|
|
|
@@ -64,11 +66,11 @@ your-project/
|
|
|
64
66
|
|
|
65
67
|
The package uses a fully compiled toolchain — no JavaScript in the hot path:
|
|
66
68
|
|
|
67
|
-
| Step
|
|
68
|
-
|
|
69
|
-
| Transpile
|
|
70
|
-
| Bundle
|
|
71
|
-
| Declarations | [tsgo](https://github.com/nicolo-ribaudo/typescript-go) | Go
|
|
69
|
+
| Step | Tool | Language |
|
|
70
|
+
| ------------ | ------------------------------------------------------- | -------- |
|
|
71
|
+
| Transpile | [Oxc](https://oxc.rs) (via Rolldown) | Rust |
|
|
72
|
+
| Bundle | [Rolldown](https://rolldown.rs) | Rust |
|
|
73
|
+
| Declarations | [tsgo](https://github.com/nicolo-ribaudo/typescript-go) | Go |
|
|
72
74
|
|
|
73
75
|
## License
|
|
74
76
|
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Exit on error
|
|
4
|
+
set -e
|
|
5
|
+
|
|
6
|
+
# Colors for output
|
|
7
|
+
RED='\033[0;31m'
|
|
8
|
+
GREEN='\033[0;32m'
|
|
9
|
+
CYAN_BG='\033[46m'
|
|
10
|
+
BRIGHT_WHITE='\033[1;30m'
|
|
11
|
+
NC='\033[0m'
|
|
12
|
+
|
|
13
|
+
# Get the directory where the script is being called from (caller's project root)
|
|
14
|
+
if [ -n "$INIT_CWD" ]; then
|
|
15
|
+
PROJECT_ROOT="$INIT_CWD"
|
|
16
|
+
else
|
|
17
|
+
PROJECT_ROOT=$(pwd)
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Get the real directory where this script lives (resolve symlinks)
|
|
21
|
+
SCRIPT_PATH="$0"
|
|
22
|
+
while [ -L "$SCRIPT_PATH" ]; do
|
|
23
|
+
LINK_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
24
|
+
SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
|
|
25
|
+
[[ $SCRIPT_PATH != /* ]] && SCRIPT_PATH="$LINK_DIR/$SCRIPT_PATH"
|
|
26
|
+
done
|
|
27
|
+
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
28
|
+
PACKAGE_ROOT="$SCRIPT_DIR/.."
|
|
29
|
+
|
|
30
|
+
# Use binaries from the package's node_modules
|
|
31
|
+
ROLLDOWN="$PACKAGE_ROOT/node_modules/.bin/rolldown"
|
|
32
|
+
NODEMON="$PACKAGE_ROOT/node_modules/.bin/nodemon"
|
|
33
|
+
|
|
34
|
+
# Add package's node_modules/.bin to PATH so plugins can find binaries like tsgo
|
|
35
|
+
export PATH="$PACKAGE_ROOT/node_modules/.bin:$PATH"
|
|
36
|
+
|
|
37
|
+
# Parse command
|
|
38
|
+
COMMAND="$1"
|
|
39
|
+
shift 2>/dev/null || true
|
|
40
|
+
|
|
41
|
+
case "$COMMAND" in
|
|
42
|
+
build)
|
|
43
|
+
# Parse build arguments (required: --app or --lib)
|
|
44
|
+
BUILD_MODE=""
|
|
45
|
+
for arg in "$@"; do
|
|
46
|
+
case $arg in
|
|
47
|
+
--lib)
|
|
48
|
+
BUILD_MODE="lib"
|
|
49
|
+
;;
|
|
50
|
+
--app)
|
|
51
|
+
BUILD_MODE="app"
|
|
52
|
+
;;
|
|
53
|
+
esac
|
|
54
|
+
done
|
|
55
|
+
|
|
56
|
+
if [ -z "$BUILD_MODE" ]; then
|
|
57
|
+
printf "${RED}Error: Build mode required. Use --app or --lib${NC}\n\n"
|
|
58
|
+
printf " --app Build for applications (ESM + types)\n"
|
|
59
|
+
printf " --lib Build for libraries (ESM + CJS + types)\n"
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
CONFIG_PATH="$SCRIPT_DIR/../config/rolldown.build.config.js"
|
|
64
|
+
|
|
65
|
+
printf "${CYAN_BG}${BRIGHT_WHITE} TYPESCRIPT ${NC} Building with Rolldown (${BUILD_MODE} mode)...\n\n"
|
|
66
|
+
printf "Project root: %s\n" "$PROJECT_ROOT"
|
|
67
|
+
printf "Config path: %s\n\n" "$CONFIG_PATH"
|
|
68
|
+
|
|
69
|
+
cd "$PROJECT_ROOT"
|
|
70
|
+
|
|
71
|
+
if ! BUILD_MODE="$BUILD_MODE" "$ROLLDOWN" --config "$CONFIG_PATH"; then
|
|
72
|
+
printf "${RED}Error: Build failed${NC}\n"
|
|
73
|
+
exit 1
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
printf "\n${GREEN}Build completed${NC}\n"
|
|
77
|
+
;;
|
|
78
|
+
|
|
79
|
+
watch)
|
|
80
|
+
CONFIG_PATH="$SCRIPT_DIR/../config/rolldown.dev.config.js"
|
|
81
|
+
|
|
82
|
+
printf "${CYAN_BG}${BRIGHT_WHITE} TYPESCRIPT ${NC} Starting watch mode...\n\n"
|
|
83
|
+
printf "Project root: %s\n" "$PROJECT_ROOT"
|
|
84
|
+
printf "Config path: %s\n" "$CONFIG_PATH"
|
|
85
|
+
printf "Watching: %s/src\n\n" "$PROJECT_ROOT"
|
|
86
|
+
|
|
87
|
+
cd "$PROJECT_ROOT"
|
|
88
|
+
|
|
89
|
+
"$NODEMON" --quiet \
|
|
90
|
+
--watch src \
|
|
91
|
+
--ext 'ts,tsx,js,json' \
|
|
92
|
+
--exec "if OUTPUT=\$(\"$ROLLDOWN\" --config \"$CONFIG_PATH\" 2>&1); then printf '${GREEN}Rebuilt${NC}\n'; node --enable-source-maps dist/index.js; else echo \"\$OUTPUT\" | grep -v 'tsgo.*experimental' | grep -v 'PLUGIN_TIMINGS'; exit 1; fi"
|
|
93
|
+
;;
|
|
94
|
+
|
|
95
|
+
*)
|
|
96
|
+
printf "${CYAN_BG}${BRIGHT_WHITE} TYPESCRIPT ${NC} TypeScript/Node project toolkit\n\n"
|
|
97
|
+
printf "Usage: typescript <command> [options]\n\n"
|
|
98
|
+
printf "Commands:\n"
|
|
99
|
+
printf " build Build the project\n"
|
|
100
|
+
printf " watch Start watch mode (build + run on changes)\n\n"
|
|
101
|
+
printf "Build options:\n"
|
|
102
|
+
printf " --app Build for applications (ESM + types)\n"
|
|
103
|
+
printf " --lib Build for libraries (ESM + CJS + types)\n\n"
|
|
104
|
+
printf "Examples:\n"
|
|
105
|
+
printf " typescript build --lib\n"
|
|
106
|
+
printf " typescript build --app\n"
|
|
107
|
+
printf " typescript watch\n"
|
|
108
|
+
exit 1
|
|
109
|
+
;;
|
|
110
|
+
esac
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { existsSync } from
|
|
2
|
-
import { defineConfig } from
|
|
3
|
-
import { dts } from
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { defineConfig } from "rolldown";
|
|
3
|
+
import { dts } from "rolldown-plugin-dts";
|
|
4
4
|
|
|
5
5
|
// Build mode: 'lib' = ESM + CJS + types, 'app' = ESM + types only
|
|
6
|
-
const isLibrary = process.env.BUILD_MODE ===
|
|
6
|
+
const isLibrary = process.env.BUILD_MODE === "lib";
|
|
7
7
|
|
|
8
8
|
// Externalize all dependencies (node built-ins + node_modules)
|
|
9
9
|
const external = [/node_modules/, /^node:/, /^[a-z@]/];
|
|
10
10
|
|
|
11
11
|
// Build input with optional instrumentation entry point
|
|
12
12
|
const input = {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
index: "src/index.ts",
|
|
14
|
+
...(existsSync("src/instrumentation.ts") && { instrumentation: "src/instrumentation.ts" }),
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// ESM build with .d.ts generation
|
|
18
18
|
const esmBuild = defineConfig({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
input,
|
|
20
|
+
external,
|
|
21
|
+
plugins: [
|
|
22
|
+
dts({
|
|
23
|
+
// Use TypeScript Go for fastest .d.ts generation (experimental)
|
|
24
|
+
tsgo: true,
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
27
|
+
output: {
|
|
28
|
+
dir: "dist",
|
|
29
|
+
format: "esm",
|
|
30
|
+
sourcemap: true,
|
|
31
|
+
},
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// CJS build (no dts - already generated by ESM build)
|
|
35
35
|
const cjsBuild = defineConfig({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
36
|
+
input,
|
|
37
|
+
external,
|
|
38
|
+
output: {
|
|
39
|
+
dir: "dist",
|
|
40
|
+
entryFileNames: "[name].cjs",
|
|
41
|
+
format: "cjs",
|
|
42
|
+
sourcemap: true,
|
|
43
|
+
},
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export default isLibrary ? [esmBuild, cjsBuild] : [esmBuild];
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { existsSync } from
|
|
2
|
-
import { defineConfig } from
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { defineConfig } from "rolldown";
|
|
3
3
|
|
|
4
4
|
// Build input with optional instrumentation entry point
|
|
5
5
|
const input = {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
index: "src/index.ts",
|
|
7
|
+
...(existsSync("src/instrumentation.ts") && { instrumentation: "src/instrumentation.ts" }),
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
// Dev build - ESM only, no .d.ts (faster rebuilds)
|
|
11
11
|
// Externalize all dependencies for Node.js apps
|
|
12
12
|
export default defineConfig({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
input,
|
|
14
|
+
external: [/node_modules/, /^node:/, /^[a-z@]/],
|
|
15
|
+
output: {
|
|
16
|
+
dir: "dist",
|
|
17
|
+
format: "esm",
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
},
|
|
20
20
|
});
|
package/package.json
CHANGED
|
@@ -1,32 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jterrazz/typescript",
|
|
3
|
+
"version": "4.3.0",
|
|
3
4
|
"author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
|
|
4
|
-
"
|
|
5
|
+
"bin": {
|
|
6
|
+
"typescript": "bin/typescript.sh"
|
|
7
|
+
},
|
|
5
8
|
"files": [
|
|
6
|
-
"tsconfig",
|
|
7
9
|
"bin",
|
|
8
|
-
"config"
|
|
10
|
+
"config",
|
|
11
|
+
"tsconfig"
|
|
9
12
|
],
|
|
10
13
|
"type": "module",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"ts-dev": "bin/ts-dev.sh"
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"registry": "https://registry.npmjs.org/"
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
|
-
"lint": "
|
|
17
|
-
"
|
|
18
|
+
"lint": "oxfmt --check",
|
|
19
|
+
"lint:fix": "oxfmt",
|
|
20
|
+
"test": "vitest --run",
|
|
18
21
|
"build": "# no build script"
|
|
19
22
|
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@jterrazz/quality": "^5.0.1"
|
|
22
|
-
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
24
|
+
"@typescript/native-preview": "^7.0.0-dev.20260124.1",
|
|
25
25
|
"nodemon": "3.1.11",
|
|
26
|
-
"rolldown": "^1.0.0-
|
|
27
|
-
"rolldown-plugin-dts": "^0.
|
|
26
|
+
"rolldown": "^1.0.0-rc.1",
|
|
27
|
+
"rolldown-plugin-dts": "^0.21.6"
|
|
28
28
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@jterrazz/codestyle": "^1.2.6",
|
|
31
|
+
"@types/node": "^25.0.10",
|
|
32
|
+
"vitest": "^4.0.18"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@types/node": "*"
|
|
36
|
+
},
|
|
37
|
+
"peerDependenciesMeta": {
|
|
38
|
+
"@types/node": {
|
|
39
|
+
"optional": true
|
|
40
|
+
}
|
|
31
41
|
}
|
|
32
42
|
}
|
package/bin/ts-build.sh
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Exit on error
|
|
4
|
-
set -e
|
|
5
|
-
|
|
6
|
-
# Colors for output
|
|
7
|
-
RED='\033[0;31m'
|
|
8
|
-
GREEN='\033[0;32m'
|
|
9
|
-
CYAN_BG='\033[46m'
|
|
10
|
-
BRIGHT_WHITE='\033[1;30m'
|
|
11
|
-
NC='\033[0m'
|
|
12
|
-
|
|
13
|
-
# Parse arguments (required: --app or --lib)
|
|
14
|
-
BUILD_MODE=""
|
|
15
|
-
for arg in "$@"; do
|
|
16
|
-
case $arg in
|
|
17
|
-
--lib)
|
|
18
|
-
BUILD_MODE="lib"
|
|
19
|
-
;;
|
|
20
|
-
--app)
|
|
21
|
-
BUILD_MODE="app"
|
|
22
|
-
;;
|
|
23
|
-
esac
|
|
24
|
-
done
|
|
25
|
-
|
|
26
|
-
if [ -z "$BUILD_MODE" ]; then
|
|
27
|
-
printf "${RED}Error: Build mode required. Use --app or --lib${NC}\n\n"
|
|
28
|
-
printf " --app Build for applications (ESM + types)\n"
|
|
29
|
-
printf " --lib Build for libraries (ESM + CJS + types)\n"
|
|
30
|
-
exit 1
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# Get the directory where the script is being called from (caller's project root)
|
|
34
|
-
if [ -n "$INIT_CWD" ]; then
|
|
35
|
-
PROJECT_ROOT="$INIT_CWD"
|
|
36
|
-
else
|
|
37
|
-
PROJECT_ROOT=$(pwd)
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
# Get the real directory where this script lives (resolve symlinks)
|
|
41
|
-
SCRIPT_PATH="$0"
|
|
42
|
-
while [ -L "$SCRIPT_PATH" ]; do
|
|
43
|
-
LINK_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
44
|
-
SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
|
|
45
|
-
[[ $SCRIPT_PATH != /* ]] && SCRIPT_PATH="$LINK_DIR/$SCRIPT_PATH"
|
|
46
|
-
done
|
|
47
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
48
|
-
CONFIG_PATH="$SCRIPT_DIR/../config/rolldown.build.config.js"
|
|
49
|
-
|
|
50
|
-
printf "${CYAN_BG}${BRIGHT_WHITE} BUILD ${NC} Building with Rolldown (${BUILD_MODE} mode)...\n\n"
|
|
51
|
-
|
|
52
|
-
printf "Project root: %s\n" "$PROJECT_ROOT"
|
|
53
|
-
printf "Config path: %s\n\n" "$CONFIG_PATH"
|
|
54
|
-
|
|
55
|
-
cd "$PROJECT_ROOT"
|
|
56
|
-
|
|
57
|
-
if ! BUILD_MODE="$BUILD_MODE" npx rolldown --config "$CONFIG_PATH"; then
|
|
58
|
-
printf "${RED}✗ Build failed${NC}\n"
|
|
59
|
-
exit 1
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
printf "\n${GREEN}✓ Build completed${NC}\n"
|
package/bin/ts-dev.sh
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Exit on error
|
|
4
|
-
set -e
|
|
5
|
-
|
|
6
|
-
# Colors for output
|
|
7
|
-
RED='\033[0;31m'
|
|
8
|
-
GREEN='\033[0;32m'
|
|
9
|
-
CYAN_BG='\033[46m'
|
|
10
|
-
BRIGHT_WHITE='\033[1;30m'
|
|
11
|
-
NC='\033[0m'
|
|
12
|
-
|
|
13
|
-
# Get the directory where the script is being called from (caller's project root)
|
|
14
|
-
if [ -n "$INIT_CWD" ]; then
|
|
15
|
-
PROJECT_ROOT="$INIT_CWD"
|
|
16
|
-
else
|
|
17
|
-
PROJECT_ROOT=$(pwd)
|
|
18
|
-
fi
|
|
19
|
-
|
|
20
|
-
# Get the real directory where this script lives (resolve symlinks)
|
|
21
|
-
SCRIPT_PATH="$0"
|
|
22
|
-
while [ -L "$SCRIPT_PATH" ]; do
|
|
23
|
-
LINK_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
24
|
-
SCRIPT_PATH="$(readlink "$SCRIPT_PATH")"
|
|
25
|
-
[[ $SCRIPT_PATH != /* ]] && SCRIPT_PATH="$LINK_DIR/$SCRIPT_PATH"
|
|
26
|
-
done
|
|
27
|
-
SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_PATH")" && pwd)"
|
|
28
|
-
CONFIG_PATH="$SCRIPT_DIR/../config/rolldown.dev.config.js"
|
|
29
|
-
|
|
30
|
-
printf "${CYAN_BG}${BRIGHT_WHITE} DEV ${NC} Starting watch mode...\n\n"
|
|
31
|
-
|
|
32
|
-
printf "Project root: %s\n" "$PROJECT_ROOT"
|
|
33
|
-
printf "Config path: %s\n" "$CONFIG_PATH"
|
|
34
|
-
printf "Watching: %s/src\n\n" "$PROJECT_ROOT"
|
|
35
|
-
|
|
36
|
-
cd "$PROJECT_ROOT"
|
|
37
|
-
|
|
38
|
-
npx nodemon --quiet \
|
|
39
|
-
--watch src \
|
|
40
|
-
--ext 'ts,tsx,js,json' \
|
|
41
|
-
--exec "if OUTPUT=\$(npx rolldown --config \"$CONFIG_PATH\" 2>&1); then printf '${GREEN}✓ Rebuilt${NC}\n'; node --enable-source-maps dist/index.js; else echo \"\$OUTPUT\" | grep -v 'tsgo.*experimental' | grep -v 'PLUGIN_TIMINGS'; exit 1; fi"
|