@opentf/create-afw 0.7.0 → 0.9.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/esdev/templates/app/_gitignore +0 -1
- package/esdev/templates/app/_option/language/js/index.html +1 -0
- package/esdev/templates/app/_option/language/ts/index.html +1 -0
- package/esdev/templates/app/_option/render/client/_option/server/no/esdev.json +8 -1
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/css/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/client/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/client/_option/server/yes/esdev.json +5 -4
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/css/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/mixed/_option/server/yes/esdev.json +5 -4
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/css/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/server/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/server/_option/server/yes/esdev.json +5 -4
- package/esdev/templates/app/_option/render/static/_option/server/no/esdev.json +9 -2
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/css/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/js/README.md +1 -1
- package/esdev/templates/app/_option/render/static/_option/server/yes/_option/styling/tailwind/_option/language/ts/README.md +1 -1
- package/esdev/templates/app/_option/render/static/_option/server/yes/esdev.json +5 -4
- package/esdev/templates/app/_option/server/yes/_option/language/js/app/api/hello/route.js +1 -1
- package/esdev/templates/app/_option/server/yes/_option/language/ts/app/api/hello/route.ts +1 -1
- package/esdev/templates/docs/_gitignore +0 -1
- package/esdev/templates/docs/_option/language/js/index.html +1 -0
- package/esdev/templates/docs/_option/language/ts/index.html +1 -0
- package/esdev/templates/docs/esdev.json +9 -2
- package/esdev/templates/library/_gitignore +0 -1
- package/esdev/templates/library/_option/language/js/index.html +1 -0
- package/esdev/templates/library/_option/language/ts/index.html +1 -0
- package/esdev/templates/library/esdev.json +8 -1
- package/package.json +7 -7
- package/templates.js +23 -10
- package/versions.json +4 -4
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%234f46e5'/%3E%3Cpath d='M9 23 16 8l7 15M11.6 18h8.8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
|
|
6
7
|
<title>{{name}}</title>
|
|
7
8
|
<link rel="stylesheet" href="./app/global.css" />
|
|
8
9
|
</head>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%234f46e5'/%3E%3Cpath d='M9 23 16 8l7 15M11.6 18h8.8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
|
|
6
7
|
<title>{{name}}</title>
|
|
7
8
|
<link rel="stylesheet" href="./app/global.css" />
|
|
8
9
|
</head>
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"targets": {
|
|
12
12
|
"web": {
|
|
13
13
|
"entry": "index.html",
|
|
14
|
-
"
|
|
14
|
+
"outDir": "dist"
|
|
15
15
|
},
|
|
16
16
|
"server": {
|
|
17
17
|
"entry": "server.js",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dev": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
"servers": {
|
|
24
|
+
"server": {
|
|
25
|
+
"port": 3000
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"targets": {
|
|
12
12
|
"web": {
|
|
13
13
|
"entry": "index.html",
|
|
14
|
-
"
|
|
14
|
+
"outDir": "dist"
|
|
15
15
|
},
|
|
16
16
|
"server": {
|
|
17
17
|
"entry": "server.js",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dev": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
"servers": {
|
|
24
|
+
"server": {
|
|
25
|
+
"port": 3000
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages rendered
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"targets": {
|
|
12
12
|
"web": {
|
|
13
13
|
"entry": "index.html",
|
|
14
|
-
"
|
|
14
|
+
"outDir": "dist"
|
|
15
15
|
},
|
|
16
16
|
"server": {
|
|
17
17
|
"entry": "server.js",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dev": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
"servers": {
|
|
24
|
+
"server": {
|
|
25
|
+
"port": 3000
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -20,13 +20,20 @@
|
|
|
20
20
|
"targets": {
|
|
21
21
|
"web": {
|
|
22
22
|
"entry": "index.html",
|
|
23
|
-
"
|
|
23
|
+
"outDir": "dist"
|
|
24
24
|
},
|
|
25
25
|
"site-ssg": {
|
|
26
26
|
"entry": "ssg.js",
|
|
27
|
-
"out": "
|
|
27
|
+
"out": "dist/ssg.js",
|
|
28
28
|
"then": "run"
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
},
|
|
32
|
+
"dev": {
|
|
33
|
+
"servers": {
|
|
34
|
+
"web": {
|
|
35
|
+
"port": 5173
|
|
36
|
+
}
|
|
37
|
+
}
|
|
31
38
|
}
|
|
32
39
|
}
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages prerender
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages prerender
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages prerender
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
|
|
12
12
|
- Pages live in `app/`: `app/about/page.md` is served at `/about`.
|
|
@@ -6,7 +6,7 @@ An [AFW](https://afw.opentechf.org) app on esdev and ES-Runtime: pages prerender
|
|
|
6
6
|
| --- | --- |
|
|
7
7
|
| `{{pm}} run dev` | Start the dev server |
|
|
8
8
|
| `{{pm}} run build` | Build for production |
|
|
9
|
-
| `{{pm}} run start` | Run the built server on ES-Runtime (`PORT`) |
|
|
9
|
+
| `{{pm}} run start` | Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`) |
|
|
10
10
|
| `{{pm}} run test` | Run the tests with esdev |
|
|
11
11
|
| `{{pm}} run typecheck` | Check types |
|
|
12
12
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"targets": {
|
|
12
12
|
"web": {
|
|
13
13
|
"entry": "index.html",
|
|
14
|
-
"
|
|
14
|
+
"outDir": "dist"
|
|
15
15
|
},
|
|
16
16
|
"server": {
|
|
17
17
|
"entry": "server.js",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dev": {
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
"servers": {
|
|
24
|
+
"server": {
|
|
25
|
+
"port": 3000
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GET /api/hello?name=… — API routes run on
|
|
1
|
+
// GET /api/hello?name=… — API routes run on esrun: web APIs, `runtime:` modules and npm packages that need no `node:` built-ins.
|
|
2
2
|
export function GET(request, { query, locals }) {
|
|
3
3
|
return Response.json({ message: `Hello, ${query.name ?? "world"}!`, requestId: locals.requestId });
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// GET /api/hello?name=… — API routes run on
|
|
1
|
+
// GET /api/hello?name=… — API routes run on esrun: web APIs, `runtime:` modules and npm packages that need no `node:` built-ins.
|
|
2
2
|
export function GET(request: Request, { query, locals }: { query: Record<string, string>; locals: Record<string, unknown> }) {
|
|
3
3
|
return Response.json({ message: `Hello, ${query.name ?? "world"}!`, requestId: locals.requestId });
|
|
4
4
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%234f46e5'/%3E%3Cpath d='M9 23 16 8l7 15M11.6 18h8.8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
|
|
6
7
|
<title>{{name}}</title>
|
|
7
8
|
</head>
|
|
8
9
|
<body>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%234f46e5'/%3E%3Cpath d='M9 23 16 8l7 15M11.6 18h8.8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
|
|
6
7
|
<title>{{name}}</title>
|
|
7
8
|
</head>
|
|
8
9
|
<body>
|
|
@@ -27,13 +27,20 @@
|
|
|
27
27
|
"targets": {
|
|
28
28
|
"web": {
|
|
29
29
|
"entry": "index.html",
|
|
30
|
-
"
|
|
30
|
+
"outDir": "dist"
|
|
31
31
|
},
|
|
32
32
|
"site-ssg": {
|
|
33
33
|
"entry": "ssg.js",
|
|
34
|
-
"out": "
|
|
34
|
+
"out": "dist/ssg.js",
|
|
35
35
|
"then": "run"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
},
|
|
39
|
+
"dev": {
|
|
40
|
+
"servers": {
|
|
41
|
+
"web": {
|
|
42
|
+
"port": 5173
|
|
43
|
+
}
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
46
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%234f46e5'/%3E%3Cpath d='M9 23 16 8l7 15M11.6 18h8.8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
|
|
6
7
|
<title>{{name}} preview</title>
|
|
7
8
|
<link rel="stylesheet" href="./app/global.css" />
|
|
8
9
|
</head>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%234f46e5'/%3E%3Cpath d='M9 23 16 8l7 15M11.6 18h8.8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E" />
|
|
6
7
|
<title>{{name}} preview</title>
|
|
7
8
|
<link rel="stylesheet" href="./app/global.css" />
|
|
8
9
|
</head>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentf/create-afw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Create an AFW app on Vite and Node: npm create @opentf/afw.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
],
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=24",
|
|
24
|
-
"esdev": ">=0.
|
|
24
|
+
"esdev": ">=0.30.0"
|
|
25
25
|
},
|
|
26
26
|
"esdev": {
|
|
27
27
|
"templates": "esdev/templates"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@opentf/afw": "0.
|
|
31
|
-
"@opentf/afw-docs": "0.
|
|
32
|
-
"@opentf/afw-form": "1.
|
|
33
|
-
"@opentf/afw-test": "1.
|
|
34
|
-
"@opentf/vite-plugin-afw": "0.
|
|
30
|
+
"@opentf/afw": "0.41.0",
|
|
31
|
+
"@opentf/afw-docs": "0.40.0",
|
|
32
|
+
"@opentf/afw-form": "1.36.0",
|
|
33
|
+
"@opentf/afw-test": "1.37.0",
|
|
34
|
+
"@opentf/vite-plugin-afw": "0.10.0",
|
|
35
35
|
"@tailwindcss/vite": "4.3.3",
|
|
36
36
|
"happy-dom": "21.0.4",
|
|
37
37
|
"tailwindcss": "4.3.3",
|
package/templates.js
CHANGED
|
@@ -115,21 +115,27 @@ function devDependencies(ctx, extra = {}) {
|
|
|
115
115
|
// esdev's own files: read from toolchain/esdev/ when an esdev project is generated.
|
|
116
116
|
const esdevFile = (name) => readFileSync(new URL(`./toolchain/esdev/${name}`, import.meta.url), "utf8");
|
|
117
117
|
|
|
118
|
-
/**
|
|
119
|
-
|
|
118
|
+
/**
|
|
119
|
+
* esdev.json for a project: the AFW plugin (+ `plugins`), the web target and `targets`,
|
|
120
|
+
* and what `esdev start` runs (`dev.servers`): esdev serving the web target on 5173, or,
|
|
121
|
+
* for an app with a server, that server on 3000, rendering the pages and answering /api.
|
|
122
|
+
*/
|
|
123
|
+
function esdevConfig(ctx, { plugins = [], targets = {}, dev = ESDEV_WEB_DEV, afw = { appDir: "app" } } = {}) {
|
|
120
124
|
return json({
|
|
121
125
|
plugins: [{ module: "@opentf/esdev-plugin-afw", options: afw }, ...plugins],
|
|
122
|
-
build: { targets: { web: { entry: "index.html",
|
|
123
|
-
|
|
126
|
+
build: { targets: { web: { entry: "index.html", outDir: "dist" }, ...targets } },
|
|
127
|
+
dev,
|
|
124
128
|
});
|
|
125
129
|
}
|
|
126
130
|
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
const ESDEV_WEB_DEV = { servers: { web: { port: 5173 } } };
|
|
132
|
+
|
|
133
|
+
/** The prerender step of a static esdev site: `ssg.js` run after the build (esdev removes its bundle). */
|
|
134
|
+
const ESDEV_SSG_TARGET = { "site-ssg": { entry: "ssg.js", out: "dist/ssg.js", then: "run" } };
|
|
129
135
|
const ESDEV_SITE_OUTPUT = { module: "@opentf/afw-cli/ssg", export: "siteOutputPlugin", options: { root: ".", target: "web", prerenderTarget: "site-ssg" } };
|
|
130
136
|
const ESDEV_SERVER = {
|
|
131
137
|
targets: { server: { entry: "server.js", out: "dist/server.js" } },
|
|
132
|
-
dev: {
|
|
138
|
+
dev: { servers: { server: { port: 3000 } } },
|
|
133
139
|
};
|
|
134
140
|
|
|
135
141
|
function sortKeys(object) {
|
|
@@ -181,12 +187,17 @@ function tsconfig(ctx, include, { allowJs = false } = {}) {
|
|
|
181
187
|
});
|
|
182
188
|
}
|
|
183
189
|
|
|
190
|
+
// An inline icon, so a new project's pages ask for no /favicon.ico (a 404 on every load
|
|
191
|
+
// until one is added). Replace it with your own.
|
|
192
|
+
const FAVICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%234f46e5'/%3E%3Cpath d='M9 23 16 8l7 15M11.6 18h8.8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E";
|
|
193
|
+
|
|
184
194
|
function indexHtml(ctx, { title, css = true }) {
|
|
185
195
|
return `<!doctype html>
|
|
186
196
|
<html lang="en">
|
|
187
197
|
<head>
|
|
188
198
|
<meta charset="utf-8" />
|
|
189
199
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
200
|
+
<link rel="icon" href="${FAVICON}" />
|
|
190
201
|
<title>${escapeHTML(title)}</title>${css ? `\n <link rel="stylesheet" href="${ctx.esdev ? "./" : "/"}app/global.css" />` : ""}
|
|
191
202
|
</head>
|
|
192
203
|
<body>
|
|
@@ -316,7 +327,7 @@ function commandRows(ctx, { server }) {
|
|
|
316
327
|
[`${pm} run dev`, "Start the dev server"],
|
|
317
328
|
[`${pm} run build`, "Build for production"],
|
|
318
329
|
server
|
|
319
|
-
? [`${pm} run start`, ctx.esdev ? "Run the built server on ES-Runtime (`PORT`)" : "Run the built Node server (`PORT`, `HOST`)"]
|
|
330
|
+
? [`${pm} run start`, ctx.esdev ? "Run the built server on ES-Runtime, on port 3000 (another `PORT` needs the same port in `--allow-listen`)" : "Run the built Node server (`PORT`, `HOST`)"]
|
|
320
331
|
: [`${pm} run preview`, "Preview the production build"],
|
|
321
332
|
[`${pm} run test`, `Run the tests with ${runner(ctx)}`],
|
|
322
333
|
...(ctx.ts ? [[`${pm} run typecheck`, "Check types"]] : []),
|
|
@@ -358,7 +369,7 @@ function appFiles(ctx) {
|
|
|
358
369
|
files["esdev.json"] = esdevConfig(ctx, {
|
|
359
370
|
plugins: site ? [ESDEV_SITE_OUTPUT] : [],
|
|
360
371
|
targets: { ...(server ? ESDEV_SERVER.targets : {}), ...(site ? ESDEV_SSG_TARGET : {}) },
|
|
361
|
-
dev: server ? ESDEV_SERVER.dev :
|
|
372
|
+
dev: server ? ESDEV_SERVER.dev : ESDEV_WEB_DEV,
|
|
362
373
|
});
|
|
363
374
|
if (server) files["server.js"] = esdevFile("server.js");
|
|
364
375
|
if (site) files["ssg.js"] = esdevFile("ssg.js");
|
|
@@ -481,7 +492,9 @@ test("GET /api/hello greets by name", async () => {
|
|
|
481
492
|
expect(await response.json()).toEqual({ message: "Hello, AFW!", requestId: "r1" });
|
|
482
493
|
});
|
|
483
494
|
`;
|
|
484
|
-
files[`app/api/hello/route.${js}`] = `// GET /api/hello?name=… —
|
|
495
|
+
files[`app/api/hello/route.${js}`] = `// GET /api/hello?name=… — ${ctx.esdev
|
|
496
|
+
? "API routes run on esrun: web APIs, `runtime:` modules and npm packages that need no `node:` built-ins."
|
|
497
|
+
: "API routes run on Node, so any npm package works here."}
|
|
485
498
|
export function GET(request${ts ? ": Request" : ""}, { query, locals }${ts ? ": { query: Record<string, string>; locals: Record<string, unknown> }" : ""}) {
|
|
486
499
|
return Response.json({ message: \`Hello, \${query.name ?? "world"}!\`, requestId: locals.requestId });
|
|
487
500
|
}
|
package/versions.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@opentf/afw": "^0.
|
|
3
|
-
"@opentf/afw-docs": "^0.
|
|
4
|
-
"@opentf/afw-test": "^1.
|
|
5
|
-
"@opentf/vite-plugin-afw": "^0.
|
|
2
|
+
"@opentf/afw": "^0.41.0",
|
|
3
|
+
"@opentf/afw-docs": "^0.40.0",
|
|
4
|
+
"@opentf/afw-test": "^1.37.0",
|
|
5
|
+
"@opentf/vite-plugin-afw": "^0.10.0"
|
|
6
6
|
}
|