@tnldotdev/tnl 0.1.0-rc.27 → 0.1.0-rc.28
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/package.json +6 -6
- package/readme.md +15 -167
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tnldotdev/tnl",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.28",
|
|
4
4
|
"bin": {
|
|
5
5
|
"tnl": "dist/bin/tnl.js"
|
|
6
6
|
},
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
"node": ">=22.18"
|
|
71
71
|
},
|
|
72
72
|
"optionalDependencies": {
|
|
73
|
-
"@tnldotdev/tnl-darwin-arm64": "0.1.0-rc.
|
|
74
|
-
"@tnldotdev/tnl-darwin-x64": "0.1.0-rc.
|
|
75
|
-
"@tnldotdev/tnl-linux-arm64": "0.1.0-rc.
|
|
76
|
-
"@tnldotdev/tnl-linux-x64": "0.1.0-rc.
|
|
73
|
+
"@tnldotdev/tnl-darwin-arm64": "0.1.0-rc.28",
|
|
74
|
+
"@tnldotdev/tnl-darwin-x64": "0.1.0-rc.28",
|
|
75
|
+
"@tnldotdev/tnl-linux-arm64": "0.1.0-rc.28",
|
|
76
|
+
"@tnldotdev/tnl-linux-x64": "0.1.0-rc.28"
|
|
77
77
|
},
|
|
78
78
|
"tnl": {
|
|
79
|
-
"commit": "
|
|
79
|
+
"commit": "48180dc541348df42a0730cdaf749a2d507b05f6"
|
|
80
80
|
}
|
|
81
81
|
}
|
package/readme.md
CHANGED
|
@@ -1,177 +1,25 @@
|
|
|
1
1
|
# `@tnldotdev/tnl`
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## install
|
|
8
|
-
|
|
9
|
-
```console
|
|
10
|
-
pnpm add --save-dev @tnldotdev/tnl@next
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
The package selects an exact-version native dependency for macOS or Linux on
|
|
14
|
-
arm64 or x64. It does not run an install script or download executable code from
|
|
15
|
-
another host. Node.js 22.18 or newer is required.
|
|
16
|
-
|
|
17
|
-
The native client enables pseudonymous telemetry by default. Disable it with
|
|
18
|
-
`TNL_NO_TELEMETRY=true` or `--no-telemetry`; see the
|
|
19
|
-
[telemetry disclosure](../../docs/cli-reference.md#telemetry).
|
|
20
|
-
|
|
21
|
-
## initialize a project
|
|
22
|
-
|
|
23
|
-
Run the initializer from your project root:
|
|
3
|
+
The tnl client, plus official Next.js and Vite integrations for project-local
|
|
4
|
+
development. Available for macOS and Linux on arm64 and x64 with Node.js 22.18
|
|
5
|
+
or newer. The package selects a native binary through optional dependencies;
|
|
6
|
+
it does not install the `tnld` server.
|
|
24
7
|
|
|
25
8
|
```console
|
|
9
|
+
pnpm add -D @tnldotdev/tnl@next
|
|
26
10
|
pnpm exec tnl init
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
The initializer detects supported package managers and frameworks. It creates
|
|
30
|
-
missing tnl and framework configuration, preserves existing configuration, and
|
|
31
|
-
lists any changes you need to make yourself.
|
|
32
|
-
|
|
33
|
-
Once you've completed those steps, start your app:
|
|
34
|
-
|
|
35
|
-
```console
|
|
36
11
|
pnpm exec tnl dev
|
|
37
12
|
```
|
|
38
13
|
|
|
39
|
-
tnl
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Live reload works through the URL.
|
|
43
|
-
|
|
44
|
-
Each Git worktree gets its own URL by default. Restarting the same worktree
|
|
45
|
-
with the same local tnl state reuses the URL. See the integration examples for
|
|
46
|
-
[Next.js](#integrate-nextjs) and [Vite](#integrate-vite).
|
|
47
|
-
|
|
48
|
-
Keep service names, commands, targets, route policy, and team selection in
|
|
49
|
-
[project configuration](../../docs/project-configuration.md). Framework
|
|
50
|
-
integrations do not accept separate route options.
|
|
51
|
-
|
|
52
|
-
## generate project metadata
|
|
53
|
-
|
|
54
|
-
Sign in, then generate project metadata:
|
|
55
|
-
|
|
56
|
-
```console
|
|
57
|
-
tnl login
|
|
58
|
-
tnl config generate
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
The command writes:
|
|
62
|
-
|
|
63
|
-
```text
|
|
64
|
-
.tnl/project.json browser-safe project and service addresses
|
|
65
|
-
.tnl/project.d.ts exact TypeScript service and hostname types
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Add `.tnl/` to `.gitignore`. Regenerate after changing services, servers, teams,
|
|
69
|
-
or domains. `tnl dev` also regenerates metadata when the project has a
|
|
70
|
-
configuration file.
|
|
71
|
-
|
|
72
|
-
Include the declaration in the application's existing TypeScript inputs. For a
|
|
73
|
-
service in `apps/web`, for example:
|
|
74
|
-
|
|
75
|
-
```json
|
|
76
|
-
{
|
|
77
|
-
"include": ["**/*.ts", "**/*.tsx", "../../.tnl/project.d.ts"]
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Keep every other entry required by the framework.
|
|
14
|
+
`tnl init` sets up missing project and framework configuration and lists any
|
|
15
|
+
actions required for existing files. Sign in when prompted; hosted tnl.dev is
|
|
16
|
+
the default server. Each Git worktree gets its own HTTPS URL.
|
|
82
17
|
|
|
83
|
-
|
|
18
|
+
Read the [quickstart](https://tnl.dev/docs),
|
|
19
|
+
[Next.js and Vite setup](https://tnl.dev/docs/frameworks),
|
|
20
|
+
[project configuration](https://tnl.dev/docs/configuration), and
|
|
21
|
+
[CLI commands](https://tnl.dev/docs/cli) on tnl.dev.
|
|
84
22
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
import { tnl } from "@tnldotdev/tnl";
|
|
90
|
-
|
|
91
|
-
if (tnl) {
|
|
92
|
-
tnl.memberNamespace;
|
|
93
|
-
tnl.services.api.hostname;
|
|
94
|
-
tnl.services.api.url;
|
|
95
|
-
tnl.runningUnderTnlDev;
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
The value describes assigned addresses. It does not prove that a route or local
|
|
100
|
-
service is currently healthy.
|
|
101
|
-
|
|
102
|
-
| Development context | Result |
|
|
103
|
-
| ---------------------------------------------- | -------------------------------------------------------- |
|
|
104
|
-
| No metadata and no `tnl dev` environment | `tnl` is undefined. |
|
|
105
|
-
| Metadata without a matching development socket | Metadata is available and `runningUnderTnlDev` is false. |
|
|
106
|
-
| A matching `tnl dev` environment or socket | Metadata is available and `runningUnderTnlDev` is true. |
|
|
107
|
-
| Build, preview, or production | `tnl` is undefined. |
|
|
108
|
-
|
|
109
|
-
The values are read-only. Malformed metadata causes an error. No control access
|
|
110
|
-
token or saved login is included.
|
|
111
|
-
|
|
112
|
-
## integrate next.js
|
|
113
|
-
|
|
114
|
-
Next.js 16.3.4 or newer is supported.
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
// next.config.ts
|
|
118
|
-
import { withTnl } from "@tnldotdev/tnl/next";
|
|
119
|
-
|
|
120
|
-
export default withTnl({
|
|
121
|
-
reactStrictMode: true,
|
|
122
|
-
});
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
`withTnl` accepts a configuration object, promise, or synchronous or asynchronous
|
|
126
|
-
configuration function. During `tnl dev`, it:
|
|
127
|
-
|
|
128
|
-
- adds the assigned hostname to `allowedDevOrigins`;
|
|
129
|
-
- injects project metadata;
|
|
130
|
-
- reports the actual listener after Next.js binds.
|
|
131
|
-
|
|
132
|
-
The integration preserves existing host and port settings. Without
|
|
133
|
-
`tnl dev --port`, Next.js can choose another port when its preferred port is
|
|
134
|
-
occupied. With `--port`, the reported port must match exactly.
|
|
135
|
-
|
|
136
|
-
## integrate vite
|
|
137
|
-
|
|
138
|
-
Vite 6.0.9 or newer is supported.
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
// vite.config.ts
|
|
142
|
-
import { defineConfig } from "vite";
|
|
143
|
-
import tnl from "@tnldotdev/tnl/vite";
|
|
144
|
-
|
|
145
|
-
export default defineConfig({
|
|
146
|
-
plugins: [tnl()],
|
|
147
|
-
});
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
During `tnl dev`, the plugin:
|
|
151
|
-
|
|
152
|
-
- adds the assigned hostname to Vite's allowed hosts;
|
|
153
|
-
- injects project metadata;
|
|
154
|
-
- reports the actual listener after Vite binds.
|
|
155
|
-
|
|
156
|
-
Vite keeps its normal host and port behavior, including next-port fallback. A
|
|
157
|
-
port set by `tnl dev --port` must match exactly. Middleware mode is not
|
|
158
|
-
supported because it does not provide a listener to register.
|
|
159
|
-
|
|
160
|
-
## run the framework separately
|
|
161
|
-
|
|
162
|
-
The framework does not have to be a child of `tnl dev`. You can start
|
|
163
|
-
`tnl dev web` in one terminal and start the framework from the service directory
|
|
164
|
-
in another.
|
|
165
|
-
|
|
166
|
-
The integration looks for the matching private development socket when the
|
|
167
|
-
framework configuration loads. It does not keep searching afterward. Start
|
|
168
|
-
`tnl dev` first when you use this workflow.
|
|
169
|
-
|
|
170
|
-
## listener requirements
|
|
171
|
-
|
|
172
|
-
The listener must accept HTTP on localhost. A wildcard binding such as
|
|
173
|
-
`0.0.0.0` or `::` is allowed because it includes localhost. Binding only to a
|
|
174
|
-
specific LAN address is not supported.
|
|
175
|
-
|
|
176
|
-
Host settings remain independent. Your framework can still listen on the LAN,
|
|
177
|
-
but tnl does not require or enable that exposure.
|
|
23
|
+
The client enables pseudonymous telemetry by default. Disable it with
|
|
24
|
+
`TNL_NO_TELEMETRY=true` or `--no-telemetry`; see the
|
|
25
|
+
[telemetry disclosure](https://tnl.dev/docs/cli#telemetry).
|