@tuqulore-inc/create-eleventy 4.1.0 → 5.0.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/package.json +7 -6
- package/templates/default/Dockerfile +6 -6
- package/templates/default/README.md +32 -20
- package/templates/default/{eslint.config.mjs → eslint.config.js} +3 -3
- package/templates/default/package.json +4 -4
- package/templates/default/src/__includes/partials/header/{desktop.hydrate.jsx → desktop.client.jsx} +4 -1
- package/templates/default/src/__includes/partials/header/{mobile.hydrate.jsx → mobile.client.jsx} +4 -1
- package/templates/default/src/__includes/partials/header.mdx +15 -21
- package/templates/default/src/{clicker.hydrate.jsx → clicker.client.jsx} +4 -1
- package/templates/default/src/index.mdx +3 -4
- /package/{index.mjs → index.js} +0 -0
- /package/templates/default/{eleventy.config.mjs → eleventy.config.js} +0 -0
- /package/templates/default/{postcss.config.mjs → postcss.config.js} +0 -0
- /package/templates/default/{prettier.config.mjs → prettier.config.js} +0 -0
- /package/templates/default/{serve.mjs → serve.js} +0 -0
- /package/templates/default/src/__data/{site.mjs → site.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuqulore-inc/create-eleventy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Create a new Eleventy project with Preact and TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create",
|
|
@@ -17,17 +17,18 @@
|
|
|
17
17
|
"author": "tuqulore inc.",
|
|
18
18
|
"type": "module",
|
|
19
19
|
"bin": {
|
|
20
|
-
"create-eleventy": "./index.
|
|
20
|
+
"create-eleventy": "./index.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
|
-
"index.
|
|
23
|
+
"index.js",
|
|
24
24
|
"templates"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"lint": "eslint --fix ."
|
|
27
|
+
"lint": "eslint --fix .",
|
|
28
|
+
"test": "node --test"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@tuqulore-inc/eslint-config": "
|
|
31
|
+
"@tuqulore-inc/eslint-config": "5.0.0",
|
|
31
32
|
"eslint": "^10.0.0"
|
|
32
33
|
},
|
|
33
34
|
"engines": {
|
|
@@ -36,5 +37,5 @@
|
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"access": "public"
|
|
38
39
|
},
|
|
39
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "155e0c2ad43c00e4611d5069362af07db71bf5f9"
|
|
40
41
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
FROM node:24-slim@sha256:
|
|
1
|
+
FROM node:24-slim@sha256:cb4e8f7c443347358b7875e717c29e27bf9befc8f5a26cf18af3c3dec80e58c5 as build
|
|
2
2
|
WORKDIR /app
|
|
3
3
|
COPY package.json pnpm-lock.yaml ./
|
|
4
4
|
RUN corepack enable
|
|
5
5
|
RUN pnpm install --frozen-lockfile
|
|
6
|
-
COPY postcss.config.
|
|
6
|
+
COPY postcss.config.js eleventy.config.js .env* ./
|
|
7
7
|
COPY src/ ./src
|
|
8
8
|
COPY lib/ ./lib
|
|
9
9
|
RUN pnpm build
|
|
10
10
|
|
|
11
|
-
FROM node:24-slim@sha256:
|
|
11
|
+
FROM node:24-slim@sha256:cb4e8f7c443347358b7875e717c29e27bf9befc8f5a26cf18af3c3dec80e58c5 as install
|
|
12
12
|
WORKDIR /app
|
|
13
13
|
COPY package.json pnpm-lock.yaml ./
|
|
14
14
|
RUN corepack enable
|
|
15
15
|
RUN pnpm install --frozen-lockfile
|
|
16
16
|
|
|
17
|
-
FROM gcr.io/distroless/
|
|
17
|
+
FROM gcr.io/distroless/nodejs24-debian13@sha256:ac0daf5d207757b275f3df0de9b296675500e773cc447c65afd66a948d5bf013
|
|
18
18
|
WORKDIR /app
|
|
19
19
|
ENV NODE_ENV=production
|
|
20
|
-
COPY serve.
|
|
20
|
+
COPY serve.js ./
|
|
21
21
|
COPY --from=build /app/dist ./dist
|
|
22
22
|
COPY --from=install /app/node_modules ./node_modules
|
|
23
23
|
|
|
24
|
-
CMD ["serve.
|
|
24
|
+
CMD ["serve.js"]
|
|
@@ -112,37 +112,49 @@ Eleventyテンプレートの参照先です。
|
|
|
112
112
|
|
|
113
113
|
## Partial Hydration
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
`.client.{js,jsx,ts,tsx}` という拡張子のファイルを `src` 配下に置くだけで、設定不要でパーシャルハイドレーションが有効になります。そのファイルは esbuild でバンドルされて `dist/**/*.client.js` に出力され、`<Island>` コンポーネントを通じて \<is-land> のクライアント側スクリプトとして読み込まれます。
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
`clientComponent()` でマークしたコンポーネントを `<Island>` に渡すと、SSR 側の描画と、クライアント側のハイドレーションの両方に同じ props が流れます。
|
|
118
118
|
|
|
119
|
-
```
|
|
120
|
-
|
|
119
|
+
```jsx
|
|
120
|
+
// src/counter.client.jsx
|
|
121
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
122
|
+
import { useState } from "preact/hooks";
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
function Counter(props) {
|
|
125
|
+
const [n, setN] = useState(props.initial ?? 0);
|
|
126
|
+
return <button onClick={() => setN(n + 1)}>{n}</button>;
|
|
127
|
+
}
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
</is-land>
|
|
129
|
+
export default clientComponent(Counter, import.meta.url);
|
|
127
130
|
```
|
|
128
131
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
\<is-land>Webコンポーネントは`land-on:*`属性のほか、次の属性を受け付けます。
|
|
134
|
-
|
|
135
|
-
### `type`属性
|
|
132
|
+
```mdx
|
|
133
|
+
// src/index.mdx
|
|
134
|
+
import { Island } from "@tuqulore-inc/eleventy-preset/island";
|
|
135
|
+
import Counter from "./counter.client.jsx";
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
<Island component={Counter} on="interaction" initial={5} />
|
|
138
|
+
```
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
上の例では、`<Island>` が次のような \<is-land> 要素を SSR 出力します。
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
```html
|
|
143
|
+
<is-land
|
|
144
|
+
land-on:interaction
|
|
145
|
+
type="preact"
|
|
146
|
+
import="/counter.client.js"
|
|
147
|
+
props='{"initial":5}'
|
|
148
|
+
>
|
|
149
|
+
<button>5</button>
|
|
150
|
+
</is-land>
|
|
151
|
+
```
|
|
142
152
|
|
|
143
|
-
|
|
153
|
+
`on` prop は \<is-land> の初期化トリガー (`interaction` / `visible` / `idle`) に対応します。
|
|
144
154
|
|
|
145
|
-
|
|
155
|
+
> [!NOTE]
|
|
156
|
+
>
|
|
157
|
+
> [\<is-land>](https://github.com/11ty/is-land?tab=readme-ov-file#usage)の初期化条件を指定する属性は、デフォルトでは `on:*` の書式で指定する必要がありますが、JSX の書式と競合するので `land-on:*` に変更しています。パラメータ付きトリガー (例: `on:media("(min-width: ...)")`) を使う場合は `<Island>` ではなく素の \<is-land> を直接書いてください。
|
|
146
158
|
|
|
147
159
|
## Docker
|
|
148
160
|
|
|
@@ -7,7 +7,7 @@ import globals from "globals";
|
|
|
7
7
|
|
|
8
8
|
export default defineConfig([
|
|
9
9
|
{
|
|
10
|
-
files: ["**/*.{cjs,
|
|
10
|
+
files: ["**/*.{cjs,js,jsx}"],
|
|
11
11
|
plugins: { js },
|
|
12
12
|
extends: ["js/recommended"],
|
|
13
13
|
},
|
|
@@ -16,11 +16,11 @@ export default defineConfig([
|
|
|
16
16
|
languageOptions: { sourceType: "commonjs" },
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
files: ["**/*.{
|
|
19
|
+
files: ["**/*.{js,jsx}"],
|
|
20
20
|
languageOptions: { sourceType: "module" },
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
files: ["**/*.cjs", "*.
|
|
23
|
+
files: ["**/*.cjs", "*.js", "src/_data/**/*.js"],
|
|
24
24
|
languageOptions: { globals: globals.node },
|
|
25
25
|
},
|
|
26
26
|
react.configs.flat.recommended,
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"@eslint/js": "^10.0.0",
|
|
19
19
|
"@iconify/json": "^2.2.90",
|
|
20
20
|
"@iconify/tailwind4": "^1.0.6",
|
|
21
|
-
"@jumpu-ui/tailwindcss": "
|
|
21
|
+
"@jumpu-ui/tailwindcss": "3.0.1",
|
|
22
22
|
"@tailwindcss/postcss": "^4.0.14",
|
|
23
|
-
"@tailwindcss/typography": "0.5.
|
|
24
|
-
"@tuqulore-inc/eleventy-preset": "^
|
|
23
|
+
"@tailwindcss/typography": "0.5.20",
|
|
24
|
+
"@tuqulore-inc/eleventy-preset": "^5.0.0",
|
|
25
25
|
"dotenv-cli": "^11.0.0",
|
|
26
26
|
"eslint": "^10.0.0",
|
|
27
27
|
"eslint-config-prettier": "^10.1.8",
|
|
28
28
|
"eslint-plugin-mdx": "^3.2.0",
|
|
29
29
|
"eslint-plugin-react": "^7.37.4",
|
|
30
30
|
"globals": "^17.0.0",
|
|
31
|
-
"npm-run-all2": "^
|
|
31
|
+
"npm-run-all2": "^9.0.0",
|
|
32
32
|
"postcss": "^8.5.6",
|
|
33
33
|
"preact": "^10.26.4",
|
|
34
34
|
"prettier": "^3.8.1",
|
package/templates/default/src/__includes/partials/header/{desktop.hydrate.jsx → desktop.client.jsx}
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
1
2
|
import { useState, useRef, useEffect } from "preact/hooks";
|
|
2
3
|
import slugify from "slugify";
|
|
3
4
|
import { twMerge } from "tailwind-merge";
|
|
@@ -47,7 +48,7 @@ function MenuList(props) {
|
|
|
47
48
|
);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
function Desktop(props) {
|
|
51
52
|
return (
|
|
52
53
|
<nav class={props.class}>
|
|
53
54
|
<ul class="flex items-center">
|
|
@@ -79,3 +80,5 @@ export default function Desktop(props) {
|
|
|
79
80
|
</nav>
|
|
80
81
|
);
|
|
81
82
|
}
|
|
83
|
+
|
|
84
|
+
export default clientComponent(Desktop, import.meta.url);
|
package/templates/default/src/__includes/partials/header/{mobile.hydrate.jsx → mobile.client.jsx}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
1
2
|
import { useState } from "preact/hooks";
|
|
2
3
|
import { twMerge } from "tailwind-merge";
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
function Mobile(props) {
|
|
5
6
|
const [open, setOpen] = useState(false);
|
|
6
7
|
return (
|
|
7
8
|
<div class={props.class}>
|
|
@@ -74,3 +75,5 @@ export default function Mobile(props) {
|
|
|
74
75
|
</div>
|
|
75
76
|
);
|
|
76
77
|
}
|
|
78
|
+
|
|
79
|
+
export default clientComponent(Mobile, import.meta.url);
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
+
import { Island } from "@tuqulore-inc/eleventy-preset/island";
|
|
1
2
|
import { eleventy } from "@tuqulore-inc/eleventy-preset/eleventy";
|
|
2
|
-
import Desktop from "./header/desktop.
|
|
3
|
-
import Mobile from "./header/mobile.
|
|
3
|
+
import Desktop from "./header/desktop.client.jsx";
|
|
4
|
+
import Mobile from "./header/mobile.client.jsx";
|
|
4
5
|
|
|
5
6
|
<header class="sticky top-0 mb-8 bg-white shadow">
|
|
6
7
|
<div class="mx-auto flex h-16 max-w-6xl items-center justify-between gap-4 px-4 md:justify-start">
|
|
7
8
|
<a class="flex-shrink-0" href="/">
|
|
8
9
|
{eleventy.site.name}
|
|
9
10
|
</a>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
props={JSON.stringify({
|
|
23
|
-
class: "ml-auto flex items-center md:hidden",
|
|
24
|
-
nav: eleventy.nav,
|
|
25
|
-
})}
|
|
26
|
-
>
|
|
27
|
-
<Mobile class="ml-auto flex items-center md:hidden" nav={eleventy.nav} />
|
|
28
|
-
</is-land>
|
|
11
|
+
<Island
|
|
12
|
+
component={Desktop}
|
|
13
|
+
on="interaction"
|
|
14
|
+
class="hidden md:block"
|
|
15
|
+
nav={eleventy.nav}
|
|
16
|
+
/>
|
|
17
|
+
<Island
|
|
18
|
+
component={Mobile}
|
|
19
|
+
on="interaction"
|
|
20
|
+
class="ml-auto flex items-center md:hidden"
|
|
21
|
+
nav={eleventy.nav}
|
|
22
|
+
/>
|
|
29
23
|
</div>
|
|
30
24
|
</header>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
1
2
|
import { useState } from "preact/hooks";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
function Clicker() {
|
|
4
5
|
const [counter, setCounter] = useState(0);
|
|
5
6
|
|
|
6
7
|
return (
|
|
@@ -12,3 +13,5 @@ export default function Clicker() {
|
|
|
12
13
|
</div>
|
|
13
14
|
);
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
export default clientComponent(Clicker, import.meta.url);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Island } from "@tuqulore-inc/eleventy-preset/island";
|
|
2
|
+
import Clicker from "./clicker.client.jsx";
|
|
2
3
|
|
|
3
4
|
export const data = {
|
|
4
5
|
layout: "post",
|
|
@@ -15,6 +16,4 @@ export const data = {
|
|
|
15
16
|
|
|
16
17
|
Hello World
|
|
17
18
|
|
|
18
|
-
<
|
|
19
|
-
<Clicker />
|
|
20
|
-
</is-land>
|
|
19
|
+
<Island component={Clicker} on="interaction" />
|
/package/{index.mjs → index.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|