@jterrazz/typescript 5.2.0 → 5.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/bin/generate-docs.sh +89 -0
- package/bin/typescript.sh +11 -1
- package/package.json +35 -33
- package/presets/tsconfig/expo.json +18 -18
- package/presets/tsconfig/next.json +22 -22
- package/presets/tsconfig/node.json +14 -14
- package/presets/tsdown/build.js +10 -10
- package/presets/tsdown/bundle.js +10 -10
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Generate API reference + llms.txt from TypeScript source.
|
|
3
|
+
# Called by: typescript docs
|
|
4
|
+
#
|
|
5
|
+
# Runs typedoc with sensible defaults (no typedoc.json needed),
|
|
6
|
+
# then generates llms.txt (index) and llms-full.txt (full reference).
|
|
7
|
+
|
|
8
|
+
set -e
|
|
9
|
+
|
|
10
|
+
PROJECT_ROOT="$1"
|
|
11
|
+
PACKAGE_ROOT="$2"
|
|
12
|
+
OUT_DIR="$PROJECT_ROOT/.docs"
|
|
13
|
+
|
|
14
|
+
TYPEDOC=$(
|
|
15
|
+
if [ -x "$PACKAGE_ROOT/node_modules/.bin/typedoc" ]; then
|
|
16
|
+
echo "$PACKAGE_ROOT/node_modules/.bin/typedoc"
|
|
17
|
+
elif [ -x "$PROJECT_ROOT/node_modules/.bin/typedoc" ]; then
|
|
18
|
+
echo "$PROJECT_ROOT/node_modules/.bin/typedoc"
|
|
19
|
+
else
|
|
20
|
+
echo "typedoc"
|
|
21
|
+
fi
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# ── Step 1: Run typedoc ──
|
|
25
|
+
|
|
26
|
+
"$TYPEDOC" \
|
|
27
|
+
--entryPoints "$PROJECT_ROOT/src/index.ts" \
|
|
28
|
+
--plugin typedoc-plugin-markdown \
|
|
29
|
+
--out "$OUT_DIR" \
|
|
30
|
+
--readme none \
|
|
31
|
+
--entryFileName index.md \
|
|
32
|
+
--hideBreadcrumbs true \
|
|
33
|
+
--hidePageHeader true \
|
|
34
|
+
--outputFileStrategy members \
|
|
35
|
+
--useCodeBlocks true \
|
|
36
|
+
--excludeInternal true \
|
|
37
|
+
--excludePrivate true \
|
|
38
|
+
--excludeProtected true \
|
|
39
|
+
--githubPages false \
|
|
40
|
+
--indexFormat table \
|
|
41
|
+
--parametersFormat table \
|
|
42
|
+
--enumMembersFormat table \
|
|
43
|
+
--typeDeclarationFormat table \
|
|
44
|
+
--tsconfig "$PROJECT_ROOT/tsconfig.json"
|
|
45
|
+
|
|
46
|
+
# ── Step 2: Read package name ──
|
|
47
|
+
|
|
48
|
+
PKG_NAME=$(node -e "console.log(require('$PROJECT_ROOT/package.json').name)")
|
|
49
|
+
PKG_DESC=$(node -e "console.log(require('$PROJECT_ROOT/package.json').description || '')")
|
|
50
|
+
|
|
51
|
+
# ── Step 3: Generate llms.txt ──
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
echo "# $PKG_NAME"
|
|
55
|
+
echo ""
|
|
56
|
+
if [ -n "$PKG_DESC" ]; then
|
|
57
|
+
echo "> $PKG_DESC"
|
|
58
|
+
echo ""
|
|
59
|
+
fi
|
|
60
|
+
echo "## API Reference"
|
|
61
|
+
echo ""
|
|
62
|
+
sed -n '/^## /,$ p' "$OUT_DIR/index.md"
|
|
63
|
+
} > "$OUT_DIR/llms.txt"
|
|
64
|
+
|
|
65
|
+
# ── Step 4: Generate llms-full.txt ──
|
|
66
|
+
|
|
67
|
+
{
|
|
68
|
+
echo "# $PKG_NAME — Full API Reference"
|
|
69
|
+
echo ""
|
|
70
|
+
if [ -n "$PKG_DESC" ]; then
|
|
71
|
+
echo "> $PKG_DESC"
|
|
72
|
+
echo ""
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
for f in "$OUT_DIR"/index.md \
|
|
76
|
+
"$OUT_DIR"/functions/*.md \
|
|
77
|
+
"$OUT_DIR"/classes/*.md \
|
|
78
|
+
"$OUT_DIR"/interfaces/*.md \
|
|
79
|
+
"$OUT_DIR"/type-aliases/*.md \
|
|
80
|
+
"$OUT_DIR"/variables/*.md; do
|
|
81
|
+
[ -f "$f" ] || continue
|
|
82
|
+
echo "---"
|
|
83
|
+
echo ""
|
|
84
|
+
cat "$f"
|
|
85
|
+
echo ""
|
|
86
|
+
done
|
|
87
|
+
} > "$OUT_DIR/llms-full.txt"
|
|
88
|
+
|
|
89
|
+
echo "Generated $OUT_DIR/llms.txt and $OUT_DIR/llms-full.txt"
|
package/bin/typescript.sh
CHANGED
|
@@ -87,6 +87,14 @@ case "$COMMAND" in
|
|
|
87
87
|
--on-success "node --enable-source-maps dist/index.js"
|
|
88
88
|
;;
|
|
89
89
|
|
|
90
|
+
docs)
|
|
91
|
+
printf "${CYAN_BG}${BRIGHT_WHITE} TYPESCRIPT ${NC} Generating API docs...\n\n"
|
|
92
|
+
|
|
93
|
+
bash "$SCRIPT_DIR/generate-docs.sh" "$PROJECT_ROOT" "$PACKAGE_ROOT"
|
|
94
|
+
|
|
95
|
+
printf "\n${GREEN}Docs generated at .docs/${NC}\n"
|
|
96
|
+
;;
|
|
97
|
+
|
|
90
98
|
*)
|
|
91
99
|
printf "${CYAN_BG}${BRIGHT_WHITE} TYPESCRIPT ${NC} TypeScript/Node project toolkit\n\n"
|
|
92
100
|
printf "Usage: typescript <command>\n\n"
|
|
@@ -94,12 +102,14 @@ case "$COMMAND" in
|
|
|
94
102
|
printf " build Build application (ESM + types)\n"
|
|
95
103
|
printf " bundle Bundle library (ESM + CJS + types)\n"
|
|
96
104
|
printf " start Run the built application\n"
|
|
97
|
-
printf " dev Build, run, and rebuild on changes\n
|
|
105
|
+
printf " dev Build, run, and rebuild on changes\n"
|
|
106
|
+
printf " docs Generate API reference + llms.txt from TSDoc\n\n"
|
|
98
107
|
printf "Examples:\n"
|
|
99
108
|
printf " typescript build\n"
|
|
100
109
|
printf " typescript bundle\n"
|
|
101
110
|
printf " typescript start\n"
|
|
102
111
|
printf " typescript dev\n"
|
|
112
|
+
printf " typescript docs\n"
|
|
103
113
|
exit 1
|
|
104
114
|
;;
|
|
105
115
|
esac
|
package/package.json
CHANGED
|
@@ -1,35 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
"name": "@jterrazz/typescript",
|
|
3
|
+
"version": "5.3.0",
|
|
4
|
+
"author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/jterrazz/package-typescript"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"typescript": "bin/typescript.sh"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"bin",
|
|
14
|
+
"presets"
|
|
15
|
+
],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"registry": "https://registry.npmjs.org/"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"lint": "codestyle check",
|
|
22
|
+
"lint:fix": "codestyle fix",
|
|
23
|
+
"test": "vitest --run",
|
|
24
|
+
"build": "# no build script"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"tsdown": "^0.21.5",
|
|
28
|
+
"typedoc": "^0.28.19",
|
|
29
|
+
"typedoc-plugin-markdown": "^4.11.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@jterrazz/codestyle": "^3.0.9",
|
|
33
|
+
"@jterrazz/test": "^5.3.2",
|
|
34
|
+
"@types/node": "^25.5.0",
|
|
35
|
+
"vitest": "^4.1.2"
|
|
36
|
+
}
|
|
35
37
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"display": "Expo",
|
|
3
|
+
"include": ["../../../../**/*.ts", "../../../../**/*.tsx"],
|
|
4
|
+
"exclude": ["../../../../node_modules"],
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"baseUrl": ".",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"jsx": "react-native",
|
|
11
|
+
"lib": ["DOM", "ESNext"],
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"paths": {
|
|
15
|
+
"@/*": ["src/*"]
|
|
16
|
+
},
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"skipLibCheck": true,
|
|
19
|
+
"target": "ESNext"
|
|
20
|
+
}
|
|
21
21
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": false,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"incremental": true,
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"resolveJsonModule": true,
|
|
14
|
+
"isolatedModules": true,
|
|
15
|
+
"jsx": "preserve",
|
|
16
|
+
"plugins": [
|
|
17
|
+
{
|
|
18
|
+
"name": "next"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
|
|
23
|
+
"exclude": ["node_modules"]
|
|
24
24
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
"display": "Node ESM",
|
|
3
|
+
"include": ["../../../../**/*.ts"],
|
|
4
|
+
"exclude": ["../../../../node_modules"],
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
"compilerOptions": {
|
|
7
|
+
"moduleResolution": "Bundler",
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"types": ["node"],
|
|
11
|
+
"strict": true,
|
|
12
|
+
"experimentalDecorators": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"skipLibCheck": true
|
|
16
|
+
}
|
|
17
17
|
}
|
package/presets/tsdown/build.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['esm'],
|
|
6
|
+
dts: true,
|
|
7
|
+
sourcemap: true,
|
|
8
|
+
clean: true,
|
|
9
|
+
hash: false,
|
|
10
|
+
outExtensions: () => ({
|
|
11
|
+
js: '.js',
|
|
12
|
+
}),
|
|
13
13
|
});
|
package/presets/tsdown/bundle.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
1
|
+
import { defineConfig } from 'tsdown';
|
|
2
2
|
|
|
3
3
|
export default defineConfig({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
entry: ['src/index.ts'],
|
|
5
|
+
format: ['esm', 'cjs'],
|
|
6
|
+
dts: true,
|
|
7
|
+
sourcemap: true,
|
|
8
|
+
clean: true,
|
|
9
|
+
hash: false,
|
|
10
|
+
outExtensions: ({ format }) => ({
|
|
11
|
+
js: format === 'cjs' ? '.cjs' : '.js',
|
|
12
|
+
}),
|
|
13
13
|
});
|