@ngrok/ngrok 0.1.0 → 0.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/.prettierrc.json +3 -0
- package/CHANGELOG.md +10 -0
- package/Cargo.toml +2 -2
- package/README.md +35 -1
- package/RELEASE.md +4 -3
- package/docs/assets/style.css +4 -5
- package/docs/classes/NgrokHttpTunnel.html +9 -9
- package/docs/classes/NgrokHttpTunnelBuilder.html +21 -21
- package/docs/classes/NgrokLabeledTunnel.html +8 -8
- package/docs/classes/NgrokLabeledTunnelBuilder.html +4 -4
- package/docs/classes/NgrokSession.html +7 -7
- package/docs/classes/NgrokSessionBuilder.html +15 -15
- package/docs/classes/NgrokTcpTunnel.html +9 -9
- package/docs/classes/NgrokTcpTunnelBuilder.html +8 -8
- package/docs/classes/NgrokTlsTunnel.html +9 -9
- package/docs/classes/NgrokTlsTunnelBuilder.html +10 -10
- package/docs/classes/UpdateRequest.html +3 -3
- package/docs/functions/consoleLog.html +1 -1
- package/docs/functions/listen.html +1 -1
- package/docs/functions/listenable.html +1 -1
- package/docs/functions/loggingCallback.html +1 -1
- package/docs/index.html +40 -2
- package/examples/express/ngrok-express-quickstart.js +11 -0
- package/examples/express/ngrok-express.js +28 -0
- package/examples/express/package.json +7 -0
- package/examples/fastify/ngrok-fastify.js +26 -0
- package/examples/fastify/package.json +7 -0
- package/examples/hapi/ngrok-hapi.js +35 -0
- package/examples/hapi/package.json +7 -0
- package/examples/koa/ngrok-koa.js +12 -0
- package/examples/koa/package.json +7 -0
- package/examples/nestjs/.eslintrc.js +25 -0
- package/examples/nestjs/.prettierrc +4 -0
- package/examples/nestjs/README.md +73 -0
- package/examples/nestjs/nest-cli.json +8 -0
- package/examples/nestjs/package-lock.json +12138 -0
- package/examples/nestjs/package.json +70 -0
- package/examples/nestjs/src/app.controller.spec.ts +22 -0
- package/examples/nestjs/src/app.controller.ts +12 -0
- package/examples/nestjs/src/app.module.ts +10 -0
- package/examples/nestjs/src/app.service.ts +8 -0
- package/examples/nestjs/src/main.ts +17 -0
- package/examples/nestjs/test/app.e2e-spec.ts +24 -0
- package/examples/nestjs/test/jest-e2e.json +9 -0
- package/examples/nestjs/tsconfig.build.json +4 -0
- package/examples/nestjs/tsconfig.json +21 -0
- package/examples/nextjs/next.config.js +12 -0
- package/examples/nextjs/ngrok.config.js +23 -0
- package/examples/nextjs/package.json +6 -0
- package/examples/nextjs/pages/index.js +5 -0
- package/examples/ngrok-http-full.js +28 -20
- package/examples/ngrok-http-minimum.js +21 -13
- package/examples/ngrok-labeled.js +21 -17
- package/examples/ngrok-listen.js +5 -6
- package/examples/ngrok-tcp.js +21 -17
- package/examples/ngrok-tls.js +22 -19
- package/examples/ngrok-typescript.ts +31 -26
- package/examples/ngrok-windows-pipe.js +22 -14
- package/examples/ngrok-winston.js +9 -9
- package/examples/package.json +11 -0
- package/examples/remix/.eslintrc.js +4 -0
- package/examples/remix/README.md +53 -0
- package/examples/remix/app/entry.client.tsx +18 -0
- package/examples/remix/app/entry.server.tsx +101 -0
- package/examples/remix/app/root.tsx +20 -0
- package/examples/remix/app/routes/_index.tsx +30 -0
- package/examples/remix/ngrok.config.js +16 -0
- package/examples/remix/package.json +30 -0
- package/examples/remix/public/favicon.ico +0 -0
- package/examples/remix/remix.config.js +16 -0
- package/examples/remix/remix.env.d.ts +2 -0
- package/examples/remix/tsconfig.json +22 -0
- package/examples/svelte/README.md +38 -0
- package/examples/svelte/jsconfig.json +17 -0
- package/examples/svelte/ngrok.config.cjs +18 -0
- package/examples/svelte/package.json +22 -0
- package/examples/svelte/src/app.d.ts +12 -0
- package/examples/svelte/src/app.html +12 -0
- package/examples/svelte/src/routes/+page.svelte +2 -0
- package/examples/svelte/static/favicon.png +0 -0
- package/examples/svelte/svelte.config.js +14 -0
- package/examples/svelte/vite.config.js +6 -0
- package/examples/vue/.vscode/extensions.json +3 -0
- package/examples/vue/README.md +40 -0
- package/examples/vue/env.d.ts +1 -0
- package/examples/vue/index.html +13 -0
- package/examples/vue/ngrok.config.ts +18 -0
- package/examples/vue/package.json +25 -0
- package/examples/vue/public/favicon.ico +0 -0
- package/examples/vue/src/App.vue +47 -0
- package/examples/vue/src/assets/base.css +74 -0
- package/examples/vue/src/assets/logo.svg +1 -0
- package/examples/vue/src/assets/main.css +35 -0
- package/examples/vue/src/components/HelloWorld.vue +40 -0
- package/examples/vue/src/components/TheWelcome.vue +86 -0
- package/examples/vue/src/components/WelcomeItem.vue +86 -0
- package/examples/vue/src/components/icons/IconCommunity.vue +7 -0
- package/examples/vue/src/components/icons/IconDocumentation.vue +7 -0
- package/examples/vue/src/components/icons/IconEcosystem.vue +7 -0
- package/examples/vue/src/components/icons/IconSupport.vue +7 -0
- package/examples/vue/src/components/icons/IconTooling.vue +19 -0
- package/examples/vue/src/main.ts +6 -0
- package/examples/vue/tsconfig.json +16 -0
- package/examples/vue/tsconfig.node.json +8 -0
- package/examples/vue/vite.config.ts +15 -0
- package/flake.nix +1 -1
- package/index.d.ts +9 -4
- package/index.js +27 -26
- package/package.json +19 -20
- package/post-build.js +18 -11
- package/scripts/gc-node-drop.js +38 -31
- package/scripts/gc-rust-drop.js +44 -38
- package/src/session.rs +3 -26
- package/src/tunnel.rs +1 -0
- package/trailer.d.ts +9 -4
- package/trailer.js +27 -26
- package/examples/ngrok-express-quickstart.js +0 -11
- package/examples/ngrok-express.js +0 -26
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
// Run with 'ts-node
|
|
1
|
+
// Run with 'ts-node ngrok-typescript.ts'
|
|
2
2
|
|
|
3
3
|
import * as http from "http";
|
|
4
|
-
const httpServer = http.createServer(
|
|
5
|
-
|
|
6
|
-
res.write(
|
|
4
|
+
const httpServer = http.createServer(function (req, res) {
|
|
5
|
+
res.writeHead(200);
|
|
6
|
+
res.write("Hello");
|
|
7
7
|
res.end();
|
|
8
|
-
}
|
|
8
|
+
});
|
|
9
9
|
|
|
10
|
-
import * as ngrok from "
|
|
10
|
+
import * as ngrok from "@ngrok/ngrok";
|
|
11
11
|
ngrok.consoleLog();
|
|
12
12
|
|
|
13
13
|
const run = async (): Promise<void> => {
|
|
@@ -15,12 +15,12 @@ const run = async (): Promise<void> => {
|
|
|
15
15
|
// await listenable();
|
|
16
16
|
// await listen();
|
|
17
17
|
await standardConfig();
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
|
|
20
20
|
async function listenServer() {
|
|
21
21
|
const tunnel = await ngrok.listen(httpServer);
|
|
22
|
-
if (
|
|
23
|
-
console.log("
|
|
22
|
+
if (typeof tunnel["url"] === "function") {
|
|
23
|
+
console.log("Ingress established at: " + tunnel["url"]());
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -30,32 +30,37 @@ async function listenable() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async function listen() {
|
|
33
|
-
const sessionBuilder = new ngrok.NgrokSessionBuilder().authtokenFromEnv()
|
|
33
|
+
const sessionBuilder = new ngrok.NgrokSessionBuilder().authtokenFromEnv();
|
|
34
34
|
const session = await sessionBuilder.connect();
|
|
35
35
|
const tunnel = await session.httpEndpoint().listen();
|
|
36
|
-
httpServer.listen(tunnel);
|
|
36
|
+
httpServer.listen(tunnel);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
async function standardConfig() {
|
|
40
|
-
ngrok.loggingCallback(function(level, target, message) {
|
|
40
|
+
ngrok.loggingCallback(function (level, target, message) {
|
|
41
41
|
console.log(`${level} ${target} - ${message}`);
|
|
42
42
|
});
|
|
43
|
-
const sessionBuilder = new ngrok.NgrokSessionBuilder()
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
const sessionBuilder = new ngrok.NgrokSessionBuilder()
|
|
44
|
+
.authtokenFromEnv()
|
|
45
|
+
.handleStopCommand(() => {
|
|
46
|
+
console.log("stop command");
|
|
47
|
+
})
|
|
48
|
+
.handleRestartCommand(() => {
|
|
49
|
+
console.log("restart command");
|
|
50
|
+
})
|
|
51
|
+
.handleUpdateCommand((update) => {
|
|
52
|
+
console.log(
|
|
53
|
+
"update command, version: " +
|
|
54
|
+
update.version +
|
|
55
|
+
" permitMajorVersion: " +
|
|
56
|
+
update.permitMajorVersion
|
|
57
|
+
);
|
|
58
|
+
});
|
|
54
59
|
const session = await sessionBuilder.connect();
|
|
55
60
|
const tunnel = await session.httpEndpoint().listen();
|
|
56
|
-
console.log(
|
|
57
|
-
httpServer.listen(8081);
|
|
58
|
-
tunnel.forwardTcp(
|
|
61
|
+
console.log(`Ingress established at: ${tunnel.url()}`);
|
|
62
|
+
httpServer.listen(8081);
|
|
63
|
+
tunnel.forwardTcp("localhost:8081");
|
|
59
64
|
|
|
60
65
|
// unregister logging callback
|
|
61
66
|
ngrok.loggingCallback();
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
const PIPE =
|
|
1
|
+
const PIPE = "\\\\.\\pipe\\ngrok_pipe";
|
|
2
2
|
|
|
3
|
-
const http = require(
|
|
4
|
-
http
|
|
5
|
-
function(req,res){
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
const http = require("http");
|
|
4
|
+
http
|
|
5
|
+
.createServer(function (req, res) {
|
|
6
|
+
res.writeHead(200);
|
|
7
|
+
res.write("Hello");
|
|
8
|
+
res.end();
|
|
9
|
+
})
|
|
10
|
+
.listen(PIPE);
|
|
9
11
|
|
|
10
|
-
const ngrok = require(
|
|
12
|
+
const ngrok = require("@ngrok/ngrok");
|
|
11
13
|
ngrok.consoleLog(); // turn on debug logging
|
|
12
|
-
new ngrok.NgrokSessionBuilder()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
new ngrok.NgrokSessionBuilder()
|
|
15
|
+
.authtokenFromEnv()
|
|
16
|
+
.connect()
|
|
17
|
+
.then((session) => {
|
|
18
|
+
session
|
|
19
|
+
.httpEndpoint()
|
|
20
|
+
.listen()
|
|
21
|
+
.then((tunnel) => {
|
|
22
|
+
console.log("tunnel at: " + tunnel.url());
|
|
23
|
+
tunnel.forwardPipe(PIPE);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
// create winston logger
|
|
2
|
-
const { createLogger, format, transports } = require(
|
|
2
|
+
const { createLogger, format, transports } = require("winston");
|
|
3
3
|
const logger = createLogger({
|
|
4
4
|
format: format.combine(format.timestamp(), format.json()),
|
|
5
|
-
level:
|
|
5
|
+
level: "silly",
|
|
6
6
|
transports: [new transports.Console({})],
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
// plumb ngrok logging to winston
|
|
10
|
-
var ngrok = require(
|
|
10
|
+
var ngrok = require("@ngrok/ngrok");
|
|
11
11
|
ngrok.loggingCallback(function (level, target, message) {
|
|
12
12
|
level = level == "TRACE" ? "silly" : level.toLowerCase();
|
|
13
|
-
logger.log(level, message, {
|
|
13
|
+
logger.log(level, message, { target: target });
|
|
14
14
|
}, "TRACE");
|
|
15
15
|
|
|
16
16
|
// set up tunnel
|
|
17
|
-
const server = require(
|
|
18
|
-
|
|
19
|
-
res.write(
|
|
17
|
+
const server = require("http").createServer(function (req, res) {
|
|
18
|
+
res.writeHead(200);
|
|
19
|
+
res.write("Hello");
|
|
20
20
|
res.end();
|
|
21
21
|
});
|
|
22
|
-
ngrok.listen(server).then((
|
|
23
|
-
|
|
22
|
+
ngrok.listen(server).then((socket) => {
|
|
23
|
+
logger.info(`Ingress established at: ${socket.tunnel.url()}`);
|
|
24
24
|
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Welcome to Remix!
|
|
2
|
+
|
|
3
|
+
- [Remix Docs](https://remix.run/docs)
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
From your terminal:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This starts your app in development mode, rebuilding assets on file changes.
|
|
14
|
+
|
|
15
|
+
## Deployment
|
|
16
|
+
|
|
17
|
+
First, build your app for production:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then run the app in production mode:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm start
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Now you'll need to pick a host to deploy it to.
|
|
30
|
+
|
|
31
|
+
### DIY
|
|
32
|
+
|
|
33
|
+
If you're familiar with deploying node applications, the built-in Remix app server is production-ready.
|
|
34
|
+
|
|
35
|
+
Make sure to deploy the output of `remix build`
|
|
36
|
+
|
|
37
|
+
- `build/`
|
|
38
|
+
- `public/build/`
|
|
39
|
+
|
|
40
|
+
### Using a Template
|
|
41
|
+
|
|
42
|
+
When you ran `npx create-remix@latest` there were a few choices for hosting. You can run that again to create a new project, then copy over your `app/` folder to the new project that's pre-configured for your target server.
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
cd ..
|
|
46
|
+
# create a new project, and pick a pre-configured host
|
|
47
|
+
npx create-remix@latest
|
|
48
|
+
cd my-new-remix-app
|
|
49
|
+
# remove the new project's app (not the old one!)
|
|
50
|
+
rm -rf app
|
|
51
|
+
# copy your app over
|
|
52
|
+
cp -R ../my-old-remix-app/app app
|
|
53
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* By default, Remix will handle hydrating your app on the client for you.
|
|
3
|
+
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
|
|
4
|
+
* For more information, see https://remix.run/docs/en/main/file-conventions/entry.client
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { RemixBrowser } from "@remix-run/react";
|
|
8
|
+
import { startTransition, StrictMode } from "react";
|
|
9
|
+
import { hydrateRoot } from "react-dom/client";
|
|
10
|
+
|
|
11
|
+
startTransition(() => {
|
|
12
|
+
hydrateRoot(
|
|
13
|
+
document,
|
|
14
|
+
<StrictMode>
|
|
15
|
+
<RemixBrowser />
|
|
16
|
+
</StrictMode>
|
|
17
|
+
);
|
|
18
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* By default, Remix will handle generating the HTTP Response for you.
|
|
3
|
+
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
|
|
4
|
+
* For more information, see https://remix.run/docs/en/main/file-conventions/entry.server
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { PassThrough } from "node:stream";
|
|
8
|
+
import type { EntryContext } from "@remix-run/node";
|
|
9
|
+
import { Response } from "@remix-run/node";
|
|
10
|
+
import { RemixServer } from "@remix-run/react";
|
|
11
|
+
import isbot from "isbot";
|
|
12
|
+
import { renderToPipeableStream } from "react-dom/server";
|
|
13
|
+
|
|
14
|
+
const ABORT_DELAY = 5_000;
|
|
15
|
+
|
|
16
|
+
export default function handleRequest(
|
|
17
|
+
request: Request,
|
|
18
|
+
responseStatusCode: number,
|
|
19
|
+
responseHeaders: Headers,
|
|
20
|
+
remixContext: EntryContext
|
|
21
|
+
) {
|
|
22
|
+
return isbot(request.headers.get("user-agent"))
|
|
23
|
+
? handleBotRequest(request, responseStatusCode, responseHeaders, remixContext)
|
|
24
|
+
: handleBrowserRequest(request, responseStatusCode, responseHeaders, remixContext);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function handleBotRequest(
|
|
28
|
+
request: Request,
|
|
29
|
+
responseStatusCode: number,
|
|
30
|
+
responseHeaders: Headers,
|
|
31
|
+
remixContext: EntryContext
|
|
32
|
+
) {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const { pipe, abort } = renderToPipeableStream(
|
|
35
|
+
<RemixServer context={remixContext} url={request.url} abortDelay={ABORT_DELAY} />,
|
|
36
|
+
{
|
|
37
|
+
onAllReady() {
|
|
38
|
+
const body = new PassThrough();
|
|
39
|
+
|
|
40
|
+
responseHeaders.set("Content-Type", "text/html");
|
|
41
|
+
|
|
42
|
+
resolve(
|
|
43
|
+
new Response(body, {
|
|
44
|
+
headers: responseHeaders,
|
|
45
|
+
status: responseStatusCode,
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
pipe(body);
|
|
50
|
+
},
|
|
51
|
+
onShellError(error: unknown) {
|
|
52
|
+
reject(error);
|
|
53
|
+
},
|
|
54
|
+
onError(error: unknown) {
|
|
55
|
+
responseStatusCode = 500;
|
|
56
|
+
console.error(error);
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
setTimeout(abort, ABORT_DELAY);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function handleBrowserRequest(
|
|
66
|
+
request: Request,
|
|
67
|
+
responseStatusCode: number,
|
|
68
|
+
responseHeaders: Headers,
|
|
69
|
+
remixContext: EntryContext
|
|
70
|
+
) {
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
const { pipe, abort } = renderToPipeableStream(
|
|
73
|
+
<RemixServer context={remixContext} url={request.url} abortDelay={ABORT_DELAY} />,
|
|
74
|
+
{
|
|
75
|
+
onShellReady() {
|
|
76
|
+
const body = new PassThrough();
|
|
77
|
+
|
|
78
|
+
responseHeaders.set("Content-Type", "text/html");
|
|
79
|
+
|
|
80
|
+
resolve(
|
|
81
|
+
new Response(body, {
|
|
82
|
+
headers: responseHeaders,
|
|
83
|
+
status: responseStatusCode,
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
pipe(body);
|
|
88
|
+
},
|
|
89
|
+
onShellError(error: unknown) {
|
|
90
|
+
reject(error);
|
|
91
|
+
},
|
|
92
|
+
onError(error: unknown) {
|
|
93
|
+
console.error(error);
|
|
94
|
+
responseStatusCode = 500;
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
setTimeout(abort, ABORT_DELAY);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react";
|
|
2
|
+
|
|
3
|
+
export default function App() {
|
|
4
|
+
return (
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charSet="utf-8" />
|
|
8
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
9
|
+
<Meta />
|
|
10
|
+
<Links />
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<Outlet />
|
|
14
|
+
<ScrollRestoration />
|
|
15
|
+
<Scripts />
|
|
16
|
+
<LiveReload />
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { V2_MetaFunction } from "@remix-run/react";
|
|
2
|
+
|
|
3
|
+
export const meta: V2_MetaFunction = () => {
|
|
4
|
+
return [{ title: "New Remix App" }];
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default function Index() {
|
|
8
|
+
return (
|
|
9
|
+
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
|
|
10
|
+
<h1>Welcome to Remix</h1>
|
|
11
|
+
<ul>
|
|
12
|
+
<li>
|
|
13
|
+
<a target="_blank" href="https://remix.run/tutorials/blog" rel="noreferrer">
|
|
14
|
+
15m Quickstart Blog Tutorial
|
|
15
|
+
</a>
|
|
16
|
+
</li>
|
|
17
|
+
<li>
|
|
18
|
+
<a target="_blank" href="https://remix.run/tutorials/jokes" rel="noreferrer">
|
|
19
|
+
Deep Dive Jokes App Tutorial
|
|
20
|
+
</a>
|
|
21
|
+
</li>
|
|
22
|
+
<li>
|
|
23
|
+
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
|
|
24
|
+
Remix Docs
|
|
25
|
+
</a>
|
|
26
|
+
</li>
|
|
27
|
+
</ul>
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const ngrok = require("@ngrok/ngrok");
|
|
2
|
+
|
|
3
|
+
// setup ngrok ingress in the parent process
|
|
4
|
+
var port = process.env.PORT || "3000";
|
|
5
|
+
process.argv.forEach((item, index) => {
|
|
6
|
+
if (["--port", "-p"].includes(item)) port = process.argv[index + 1];
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
async function setup() {
|
|
10
|
+
const session = await new ngrok.NgrokSessionBuilder().authtokenFromEnv().connect();
|
|
11
|
+
const tunnel = await session.httpEndpoint().listen();
|
|
12
|
+
console.log(`Forwarding to: localhost:${port} from ingress at: ${tunnel.url()}`);
|
|
13
|
+
tunnel.forwardTcp(`localhost:${port}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
setup();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "remix build",
|
|
6
|
+
"dev": "remix dev",
|
|
7
|
+
"start": "remix-serve build",
|
|
8
|
+
"typecheck": "tsc"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@ngrok/ngrok": "^0.2.0",
|
|
12
|
+
"@remix-run/node": "^1.15.0",
|
|
13
|
+
"@remix-run/react": "^1.15.0",
|
|
14
|
+
"@remix-run/serve": "^1.15.0",
|
|
15
|
+
"isbot": "^3.6.5",
|
|
16
|
+
"react": "^18.2.0",
|
|
17
|
+
"react-dom": "^18.2.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@remix-run/dev": "^1.15.0",
|
|
21
|
+
"@remix-run/eslint-config": "^1.15.0",
|
|
22
|
+
"@types/react": "^18.0.25",
|
|
23
|
+
"@types/react-dom": "^18.0.8",
|
|
24
|
+
"eslint": "^8.27.0",
|
|
25
|
+
"typescript": "^4.8.4"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=14"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require("./ngrok.config.js");
|
|
2
|
+
|
|
3
|
+
/** @type {import('@remix-run/dev').AppConfig} */
|
|
4
|
+
module.exports = {
|
|
5
|
+
ignoredRouteFiles: ["**/.*"],
|
|
6
|
+
// appDirectory: "app",
|
|
7
|
+
// assetsBuildDirectory: "public/build",
|
|
8
|
+
// serverBuildPath: "build/index.js",
|
|
9
|
+
// publicPath: "/build/",
|
|
10
|
+
future: {
|
|
11
|
+
v2_errorBoundary: true,
|
|
12
|
+
v2_meta: true,
|
|
13
|
+
v2_normalizeFormMethod: true,
|
|
14
|
+
v2_routeConvention: true,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ES2019"],
|
|
5
|
+
"isolatedModules": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"target": "ES2019",
|
|
11
|
+
"strict": true,
|
|
12
|
+
"allowJs": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"baseUrl": ".",
|
|
15
|
+
"paths": {
|
|
16
|
+
"~/*": ["./app/*"]
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
// Remix takes care of building everything in `remix build`.
|
|
20
|
+
"noEmit": true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# create-svelte
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
|
|
4
|
+
|
|
5
|
+
## Creating a project
|
|
6
|
+
|
|
7
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# create a new project in the current directory
|
|
11
|
+
npm create svelte@latest
|
|
12
|
+
|
|
13
|
+
# create a new project in my-app
|
|
14
|
+
npm create svelte@latest my-app
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Developing
|
|
18
|
+
|
|
19
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run dev
|
|
23
|
+
|
|
24
|
+
# or start the server and open the app in a new browser tab
|
|
25
|
+
npm run dev -- --open
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Building
|
|
29
|
+
|
|
30
|
+
To create a production version of your app:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm run build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You can preview the production build with `npm run preview`.
|
|
37
|
+
|
|
38
|
+
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./.svelte-kit/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"checkJs": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"strict": true
|
|
12
|
+
}
|
|
13
|
+
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
|
|
14
|
+
//
|
|
15
|
+
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
|
16
|
+
// from the referenced tsconfig.json - TypeScript does not merge them in
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const ngrok = require("@ngrok/ngrok");
|
|
2
|
+
|
|
3
|
+
// setup ngrok ingress in the parent process
|
|
4
|
+
var host = "localhost";
|
|
5
|
+
var port = "5173";
|
|
6
|
+
process.argv.forEach((item, index) => {
|
|
7
|
+
if (item == "--host") host = process.argv[index + 1];
|
|
8
|
+
if (item == "--port") port = process.argv[index + 1];
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
async function setup() {
|
|
12
|
+
const session = await new ngrok.NgrokSessionBuilder().authtokenFromEnv().connect();
|
|
13
|
+
const tunnel = await session.httpEndpoint().listen();
|
|
14
|
+
console.log(`Forwarding to: ${host}:${port} from ingress at: ${tunnel.url()}`);
|
|
15
|
+
tunnel.forwardTcp(`${host}:${port}`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
setup();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "svelte",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite dev",
|
|
7
|
+
"build": "vite build",
|
|
8
|
+
"preview": "vite preview",
|
|
9
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
|
|
10
|
+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@ngrok/ngrok": "^0.2.0",
|
|
14
|
+
"@sveltejs/adapter-auto": "^2.0.0",
|
|
15
|
+
"@sveltejs/kit": "^1.5.0",
|
|
16
|
+
"svelte": "^3.54.0",
|
|
17
|
+
"svelte-check": "^3.0.1",
|
|
18
|
+
"typescript": "^5.0.0",
|
|
19
|
+
"vite": "^4.2.0"
|
|
20
|
+
},
|
|
21
|
+
"type": "module"
|
|
22
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
|
6
|
+
<meta name="viewport" content="width=device-width" />
|
|
7
|
+
%sveltekit.head%
|
|
8
|
+
</head>
|
|
9
|
+
<body data-sveltekit-preload-data="hover">
|
|
10
|
+
<div style="display: contents">%sveltekit.body%</div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import adapter from "@sveltejs/adapter-auto";
|
|
2
|
+
import "./ngrok.config.cjs";
|
|
3
|
+
|
|
4
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
5
|
+
const config = {
|
|
6
|
+
kit: {
|
|
7
|
+
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
|
8
|
+
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
|
9
|
+
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
|
10
|
+
adapter: adapter(),
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default config;
|