@batijs/cli 0.0.68 → 0.0.70

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.
Files changed (55) hide show
  1. package/dist/boilerplates/@batijs/edgedb/files/$package.json.js +1 -1
  2. package/dist/boilerplates/@batijs/edgedb/{package-L4CKHED3.js → package-562PRDA5.js} +1 -1
  3. package/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
  4. package/dist/boilerplates/@batijs/express/{package-UQPOUGGJ.js → package-Y3HBW6TZ.js} +3 -3
  5. package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
  6. package/dist/boilerplates/@batijs/hattip/{package-XCTEYYSA.js → package-OHT2RKHN.js} +3 -3
  7. package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
  8. package/dist/boilerplates/@batijs/prisma/{package-N3MK6V5C.js → package-C3YKOB7I.js} +1 -1
  9. package/dist/boilerplates/@batijs/react/files/$package.json.js +1 -1
  10. package/dist/boilerplates/@batijs/react/files/layouts/HeadDefault.tsx +1 -1
  11. package/dist/boilerplates/@batijs/react/files/layouts/style.css +1 -1
  12. package/dist/boilerplates/@batijs/react/files/pages/+config.h.ts +1 -1
  13. package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+onBeforeRender.ts +2 -2
  14. package/dist/boilerplates/@batijs/react/{package-RFIKC4FK.js → package-7OPRREQL.js} +1 -1
  15. package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -1
  16. package/dist/boilerplates/@batijs/solid/files/layouts/HeadDefault.tsx +1 -1
  17. package/dist/boilerplates/@batijs/solid/files/layouts/style.css +1 -1
  18. package/dist/boilerplates/@batijs/solid/files/pages/+config.h.ts +1 -1
  19. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+onBeforeRender.ts +2 -2
  20. package/dist/boilerplates/@batijs/solid/{package-23WGUST6.js → package-XS4RS3KO.js} +1 -1
  21. package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
  22. package/dist/boilerplates/@batijs/tailwindcss/files/tailwind.config.js +1 -1
  23. package/dist/boilerplates/@batijs/tailwindcss/{package-VXHJSEO4.js → package-TCXHQCAL.js} +1 -1
  24. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
  25. package/dist/boilerplates/@batijs/telefunc/{package-AL7NTGTZ.js → package-VO4UYQPG.js} +2 -2
  26. package/dist/boilerplates/@batijs/vue/files/$package.json.js +21 -0
  27. package/dist/boilerplates/@batijs/vue/files/$tsconfig.json.js +12 -0
  28. package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +25 -0
  29. package/dist/boilerplates/@batijs/vue/files/assets/logo.svg +36 -0
  30. package/dist/boilerplates/@batijs/vue/files/components/Content.vue +35 -0
  31. package/dist/boilerplates/@batijs/vue/files/components/Counter.vue +25 -0
  32. package/dist/boilerplates/@batijs/vue/files/components/Link.vue +25 -0
  33. package/dist/boilerplates/@batijs/vue/files/components/Logo.vue +18 -0
  34. package/dist/boilerplates/@batijs/vue/files/components/Sidebar.vue +21 -0
  35. package/dist/boilerplates/@batijs/vue/files/layouts/HeadDefault.vue +12 -0
  36. package/dist/boilerplates/@batijs/vue/files/layouts/LayoutDefault.vue +60 -0
  37. package/dist/boilerplates/@batijs/vue/files/pages/+config.h.ts +18 -0
  38. package/dist/boilerplates/@batijs/vue/files/pages/_error/+Page.vue +15 -0
  39. package/dist/boilerplates/@batijs/vue/files/pages/index/+Page.vue +24 -0
  40. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+Page.vue +12 -0
  41. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+onBeforeRender.ts +27 -0
  42. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/filterMovieData.ts +11 -0
  43. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/index/+Page.vue +13 -0
  44. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/index/+onBeforeRender.ts +80 -0
  45. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/types.ts +13 -0
  46. package/dist/boilerplates/@batijs/vue/files/vue-shim.d.ts +11 -0
  47. package/dist/boilerplates/@batijs/vue/package-5EXMRHUV.js +70 -0
  48. package/dist/boilerplates/@batijs/vue-telefunc/files/components/TodoList.telefunc.ts +8 -0
  49. package/dist/boilerplates/@batijs/vue-telefunc/files/components/TodoList.vue +28 -0
  50. package/dist/boilerplates/@batijs/vue-telefunc/files/database/todoItems.ts +12 -0
  51. package/dist/boilerplates/@batijs/vue-telefunc/files/pages/todo/+Page.vue +19 -0
  52. package/dist/boilerplates/@batijs/vue-telefunc/files/pages/todo/+onBeforeRender.ts +15 -0
  53. package/dist/boilerplates/boilerplates.json +25 -0
  54. package/dist/index.js +55 -31
  55. package/package.json +6 -6
@@ -4,7 +4,7 @@ async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
5
  packageJson.scripts["edgedb:generate-queries"] = "@edgedb/generate queries";
6
6
  packageJson.scripts["edgedb:generate-edgeql-js"] = "@edgedb/generate edgeql-js";
7
- return addDependency(packageJson, await import("../package-L4CKHED3.js"), {
7
+ return addDependency(packageJson, await import("../package-562PRDA5.js"), {
8
8
  devDependencies: ["@edgedb/generate"],
9
9
  dependencies: ["edgedb"]
10
10
  });
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/edgedb";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -4,7 +4,7 @@ async function getPackageJson(currentContent, meta) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
5
  packageJson.scripts.dev = "tsx ./express-entry.ts";
6
6
  packageJson.scripts.build = "vite build";
7
- return addDependency(packageJson, await import("../package-UQPOUGGJ.js"), {
7
+ return addDependency(packageJson, await import("../package-Y3HBW6TZ.js"), {
8
8
  devDependencies: ["@types/express"],
9
9
  dependencies: [
10
10
  "@hattip/adapter-node",
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/express";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -11,13 +11,13 @@ var keywords = [];
11
11
  var author = "";
12
12
  var license = "MIT";
13
13
  var devDependencies = {
14
- "@auth/core": "^0.13.0",
14
+ "@auth/core": "^0.14.0",
15
15
  "@batijs/tsup": "workspace:*",
16
16
  "@hattip/adapter-node": "^0.0.34",
17
17
  "@types/express": "^4.17.17",
18
18
  "@types/node": "^16.18.40",
19
19
  express: "^4.18.2",
20
- telefunc: "^0.1.58",
20
+ telefunc: "^0.1.59",
21
21
  tsup: "^7.2.0",
22
22
  tsx: "^3.12.8",
23
23
  "vike-authjs": "^0.0.2",
@@ -7,7 +7,7 @@ async function getPackageJson(currentContent, meta) {
7
7
  if (packageJson.scripts.preview) {
8
8
  delete packageJson.scripts.preview;
9
9
  }
10
- return addDependency(packageJson, await import("../package-XCTEYYSA.js"), {
10
+ return addDependency(packageJson, await import("../package-OHT2RKHN.js"), {
11
11
  devDependencies: ["@hattip/vite", "@hattip/adapter-node"],
12
12
  dependencies: [
13
13
  "@hattip/router",
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/hattip";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -11,14 +11,14 @@ var keywords = [];
11
11
  var author = "";
12
12
  var license = "MIT";
13
13
  var devDependencies = {
14
- "@auth/core": "^0.13.0",
14
+ "@auth/core": "^0.14.0",
15
15
  "@batijs/tsup": "workspace:*",
16
16
  "@hattip/adapter-node": "^0.0.34",
17
17
  "@hattip/router": "^0.0.34",
18
18
  "@hattip/vite": "^0.0.34",
19
19
  "@types/node": "^16.18.40",
20
20
  hattip: "^0.0.33",
21
- telefunc: "^0.1.58",
21
+ telefunc: "^0.1.59",
22
22
  tsup: "^7.2.0",
23
23
  "vike-authjs": "^0.0.2",
24
24
  vite: "^4.4.9",
@@ -4,7 +4,7 @@ async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
5
  packageJson.scripts["prisma:studio"] = "prisma studio";
6
6
  packageJson.scripts["prisma:generate"] = "prisma generate";
7
- return addDependency(packageJson, await import("../package-N3MK6V5C.js"), {
7
+ return addDependency(packageJson, await import("../package-C3YKOB7I.js"), {
8
8
  devDependencies: ["prisma"],
9
9
  dependencies: ["@prisma/client"]
10
10
  });
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/prisma";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -2,7 +2,7 @@
2
2
  import { addDependency, loadAsJson } from "@batijs/core";
3
3
  async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
- return addDependency(packageJson, await import("../package-RFIKC4FK.js"), {
5
+ return addDependency(packageJson, await import("../package-7OPRREQL.js"), {
6
6
  devDependencies: ["vite", "@types/react", "@types/react-dom"],
7
7
  dependencies: ["@vitejs/plugin-react", "cross-fetch", "react", "react-dom", "vite-plugin-ssr", "vike-react"]
8
8
  });
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- // Default <head> (can be overriden by pages)
3
+ // Default <head> (can be overridden by pages)
4
4
 
5
5
  export default function HeadDefault() {
6
6
  if (import.meta.BATI_MODULES?.includes("analytics:plausible.io")) {
@@ -19,7 +19,7 @@ body {
19
19
  box-sizing: border-box;
20
20
  }
21
21
 
22
- /* Page Transition Anmiation */
22
+ /* Page Transition Animation */
23
23
  #page-content {
24
24
  opacity: 1;
25
25
  transition: opacity 0.3s ease-in-out;
@@ -4,7 +4,7 @@ import Head from "../layouts/HeadDefault";
4
4
  import logoUrl from "../assets/logo.svg";
5
5
  import vikeReact from "vike-react";
6
6
 
7
- // Default config (can be overriden by pages)
7
+ // Default config (can be overridden by pages)
8
8
  export default {
9
9
  Layout,
10
10
  Head,
@@ -2,10 +2,10 @@ export default onBeforeRender;
2
2
 
3
3
  import fetch from "cross-fetch";
4
4
  import { filterMovieData } from "../filterMovieData";
5
- import type { PageContextBuiltIn } from "vike-react/types";
5
+ import type { PageContextBuiltInServer } from "vite-plugin-ssr/types";
6
6
  import type { MovieDetails } from "../types";
7
7
 
8
- async function onBeforeRender(pageContext: PageContextBuiltIn) {
8
+ async function onBeforeRender(pageContext: PageContextBuiltInServer) {
9
9
  const response = await fetch(`https://star-wars.brillout.com/api/films/${pageContext.routeParams.id}.json`);
10
10
  let movie = (await response.json()) as MovieDetails;
11
11
 
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/react";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -2,7 +2,7 @@
2
2
  import { addDependency, loadAsJson } from "@batijs/core";
3
3
  async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
- return addDependency(packageJson, await import("../package-23WGUST6.js"), {
5
+ return addDependency(packageJson, await import("../package-XS4RS3KO.js"), {
6
6
  devDependencies: ["vite"],
7
7
  dependencies: ["cross-fetch", "solid-js", "vike-solid", "vite-plugin-ssr"]
8
8
  });
@@ -1,4 +1,4 @@
1
- // Default <head> (can be overriden by pages)
1
+ // Default <head> (can be overridden by pages)
2
2
 
3
3
  import logoUrl from "../assets/logo.svg";
4
4
 
@@ -19,7 +19,7 @@ body {
19
19
  box-sizing: border-box;
20
20
  }
21
21
 
22
- /* Page Transition Anmiation */
22
+ /* Page Transition Animation */
23
23
  #page-content {
24
24
  opacity: 1;
25
25
  transition: opacity 0.3s ease-in-out;
@@ -2,7 +2,7 @@ import vikeSolid, { type UserConfig } from "vike-solid";
2
2
  import Layout from "../layouts/LayoutDefault";
3
3
  import Head from "../layouts/HeadDefault";
4
4
 
5
- // Default config (can be overriden by pages)
5
+ // Default config (can be overridden by pages)
6
6
  export default {
7
7
  Layout,
8
8
  Head,
@@ -1,11 +1,11 @@
1
1
  export default onBeforeRender;
2
2
 
3
3
  import fetch from "cross-fetch";
4
- import type { PageContextBuiltIn } from "vite-plugin-ssr/types";
4
+ import type { PageContextBuiltInServer } from "vite-plugin-ssr/types";
5
5
  import { filterMovieData } from "../filterMovieData";
6
6
  import type { MovieDetails } from "../types";
7
7
 
8
- async function onBeforeRender(pageContext: PageContextBuiltIn) {
8
+ async function onBeforeRender(pageContext: PageContextBuiltInServer) {
9
9
  const response = await fetch(`https://star-wars.brillout.com/api/films/${pageContext.routeParams.id}.json`);
10
10
  let movie = (await response.json()) as MovieDetails;
11
11
 
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/solid";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -2,7 +2,7 @@
2
2
  import { addDependency, loadAsJson } from "@batijs/core";
3
3
  async function getPackageJson(currentContent, meta) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
- return addDependency(packageJson, await import("../package-VXHJSEO4.js"), {
5
+ return addDependency(packageJson, await import("../package-TCXHQCAL.js"), {
6
6
  devDependencies: ["tailwindcss", "postcss", "autoprefixer"]
7
7
  });
8
8
  }
@@ -1,6 +1,6 @@
1
1
  /** @type {import('tailwindcss').Config} */
2
2
  module.exports = {
3
- content: ["./{pages,layouts,components,src}/**/*.{html,js,jsx,ts,tsx}"],
3
+ content: ["./{pages,layouts,components,src}/**/*.{html,js,jsx,ts,tsx,vue}"],
4
4
  theme: {
5
5
  extend: {},
6
6
  },
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/tailwindcss";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -2,7 +2,7 @@
2
2
  import { addDependency, loadAsJson } from "@batijs/core";
3
3
  async function getPackageJson(currentContent) {
4
4
  const packageJson = await loadAsJson(currentContent);
5
- return addDependency(packageJson, await import("../package-AL7NTGTZ.js"), {
5
+ return addDependency(packageJson, await import("../package-VO4UYQPG.js"), {
6
6
  dependencies: ["telefunc"]
7
7
  });
8
8
  }
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/telefunc";
3
3
  var private2 = true;
4
- var version = "0.0.68";
4
+ var version = "0.0.70";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
@@ -13,7 +13,7 @@ var license = "MIT";
13
13
  var devDependencies = {
14
14
  "@batijs/tsup": "workspace:*",
15
15
  "@types/node": "^16.18.40",
16
- telefunc: "^0.1.58",
16
+ telefunc: "^0.1.59",
17
17
  tsup: "^7.2.0",
18
18
  vite: "^4.4.9",
19
19
  "vite-plugin-ssr": "^0.4.140"
@@ -0,0 +1,21 @@
1
+ // files/$package.json.ts
2
+ import { addDependency, loadAsJson } from "@batijs/core";
3
+ async function getPackageJson(currentContent) {
4
+ const packageJson = await loadAsJson(currentContent);
5
+ return addDependency(packageJson, await import("../package-5EXMRHUV.js"), {
6
+ devDependencies: ["vite"],
7
+ dependencies: [
8
+ "@vitejs/plugin-vue",
9
+ "@vue/compiler-sfc",
10
+ "@vue/server-renderer",
11
+ "cross-fetch",
12
+ "unplugin-vue-markdown",
13
+ "vike-vue",
14
+ "vite-plugin-ssr",
15
+ "vue"
16
+ ]
17
+ });
18
+ }
19
+ export {
20
+ getPackageJson as default
21
+ };
@@ -0,0 +1,12 @@
1
+ // files/$tsconfig.json.ts
2
+ import { loadAsJson } from "@batijs/core";
3
+ async function getTsConfig(currentContent) {
4
+ const tsConfig = await loadAsJson(currentContent);
5
+ tsConfig.compilerOptions.jsx = "preserve";
6
+ tsConfig.compilerOptions.jsxImportSource = "vue";
7
+ tsConfig.compilerOptions.types = [...tsConfig.compilerOptions.types ?? [], "vike-vue"];
8
+ return tsConfig;
9
+ }
10
+ export {
11
+ getTsConfig as default
12
+ };
@@ -0,0 +1,25 @@
1
+ // files/$vite.config.ts.ts
2
+ import { addVitePlugin, loadAsMagicast } from "@batijs/core";
3
+ async function getViteConfig(currentContent) {
4
+ const mod = await loadAsMagicast(currentContent);
5
+ addVitePlugin(mod, {
6
+ from: "vite-plugin-ssr/plugin",
7
+ constructor: "ssr"
8
+ });
9
+ addVitePlugin(mod, {
10
+ from: "@vitejs/plugin-vue",
11
+ constructor: "vue",
12
+ options: {
13
+ include: [/\.vue$/, /\.md$/]
14
+ }
15
+ });
16
+ addVitePlugin(mod, {
17
+ from: "unplugin-vue-markdown/vite",
18
+ constructor: "md",
19
+ options: {}
20
+ });
21
+ return mod.generate().code;
22
+ }
23
+ export {
24
+ getViteConfig as default
25
+ };
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <svg width="175" height="175" fill="none" version="1.1" viewBox="0 0 175 175" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3
+ <metadata>
4
+ <rdf:RDF>
5
+ <cc:Work rdf:about="">
6
+ <dc:format>image/svg+xml</dc:format>
7
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
8
+ <dc:title/>
9
+ </cc:Work>
10
+ </rdf:RDF>
11
+ </metadata>
12
+ <defs>
13
+ <linearGradient id="linearGradient880" x1="108.64" x2="115.51" y1="88.726" y2="136.2" gradientTransform="matrix(1.0498 0 0 1.0498 -2.9171 -2.9658)" gradientUnits="userSpaceOnUse">
14
+ <stop stop-color="#ffea83" offset="0"/>
15
+ <stop stop-color="#FFDD35" offset=".083333"/>
16
+ <stop stop-color="#FFA800" offset="1"/>
17
+ </linearGradient>
18
+ <linearGradient id="paint2_linear" x1="48.975" x2="61.299" y1="3.9232" y2="158.04" gradientTransform="translate(-2.832e-5)" gradientUnits="userSpaceOnUse">
19
+ <stop stop-color="#FFEA83" offset="0"/>
20
+ <stop stop-color="#FFDD35" offset=".083333"/>
21
+ <stop stop-color="#FFA800" offset="1"/>
22
+ </linearGradient>
23
+ <linearGradient id="paint0_linear-6" x1="-1.4492" x2="116.62" y1="-5.8123" y2="137.08" gradientTransform="translate(-2.832e-5)" gradientUnits="userSpaceOnUse">
24
+ <stop stop-color="#41D1FF" offset="0"/>
25
+ <stop stop-color="#BD34FE" offset="1"/>
26
+ </linearGradient>
27
+ </defs>
28
+ <circle cx="87.5" cy="87.5" r="87.5" fill="#c4c4c4"/>
29
+ <circle cx="87.5" cy="87.5" r="87.5" fill="url(#paint0_linear-6)"/>
30
+ <g transform="translate(632.92 54.355)" fill="#d38787" stroke-width="1.0614">
31
+ <path d="m-549.75 68.457c-5.7533-3.1217-6.1166-5.2295-6.1166-35.489 0-30.458 0.35464-32.448 6.3339-35.54 3.9943-2.0655 24.279-2.2805 26.735-0.28333 0.89718 0.72974 6.7203 6.6637 12.94 13.187l11.309 11.86v19.575c0 18.473-0.12956 19.74-2.3011 22.5-4.0223 5.1136-7.558 5.8565-27.65 5.8099-14.15-0.03287-19.008-0.40294-21.25-1.6191zm42.473-6.3594c2.27-1.59 2.359-2.2909 2.359-18.575v-16.923h-6.9521c-12.443 0-16.4-4.0845-16.4-16.93v-7.4828h-8.9464c-6.7178 0-9.3619 0.41549-10.614 1.668-2.5031 2.5031-2.5031 55.724 0 58.228 2.4502 2.4502 37.058 2.4636 40.553 0.01609zm-1.8867-42.165c0-0.16422-2.8659-3.1346-6.3686-6.6008l-6.3686-6.3022v4.9328c0 6.3185 1.8955 8.2687 8.0366 8.2687 2.5854 0 4.7007-0.13434 4.7007-0.29859zm-57.57 44.279c-5.6185-3.0486-6.1166-5.593-6.1166-31.243 0-18.891 0.31331-24.063 1.6101-26.571 1.809-3.4981 6.5048-6.3339 10.489-6.3339 2.4847 0 2.5814 0.19984 1.541 3.1843-0.61054 1.7514-1.7457 3.1843-2.5226 3.1843-0.77686 0-2.1631 0.75059-3.0805 1.668-2.4923 2.4923-2.4923 47.244 0 49.736 0.91739 0.9174 2.3036 1.668 3.0805 1.668 0.77688 0 1.912 1.4329 2.5226 3.1843 1.0562 3.0298 0.97108 3.1822-1.7537 3.1418-1.575-0.02331-4.1713-0.75194-5.7694-1.6191zm-16.983-4.2458c-5.4392-2.9512-6.1166-5.9415-6.1166-26.997 0-15.096 0.345-19.878 1.6101-22.325 1.7476-3.3796 6.4758-6.3339 10.137-6.3339 1.8666 0 2.1789 0.44955 1.6594 2.3882-0.35184 1.3135-0.64655 2.7465-0.65453 3.1843-8e-3 0.43784-0.69682 0.79608-1.5308 0.79608-0.83399 0-2.2669 0.75059-3.1843 1.668-2.4767 2.4767-2.4767 38.768 0 41.244 0.91741 0.91739 2.2946 1.668 3.0605 1.668 1.196 0 2.6402 2.995 2.6871 5.5726 0.0241 1.3294-4.5804 0.80962-7.6676-0.8655z" style="mix-blend-mode:lighten"/>
32
+ <path d="m-552.2 68.911c-5.7533-3.1217-6.1166-5.2295-6.1166-35.489 0-30.458 0.35463-32.448 6.3339-35.54 3.9943-2.0655 24.279-2.2805 26.735-0.28333 0.89718 0.72974 6.7203 6.6637 12.94 13.187l11.309 11.86v19.575c0 18.473-0.12957 19.74-2.3011 22.5-4.0223 5.1136-7.558 5.8565-27.65 5.8099-14.15-0.03287-19.008-0.40294-21.25-1.6191zm42.473-6.3594c2.27-1.59 2.359-2.2909 2.359-18.575v-16.923h-6.952c-12.443 0-16.4-4.0845-16.4-16.93v-7.4828h-8.9464c-6.7179 0-9.3619 0.41549-10.614 1.668-2.5031 2.5031-2.5031 55.724 0 58.228 2.4502 2.4502 37.058 2.4636 40.553 0.01609zm-1.8867-42.165c0-0.16422-2.8659-3.1346-6.3686-6.6008l-6.3686-6.3022v4.9328c0 6.3185 1.8955 8.2688 8.0366 8.2688 2.5854 0 4.7007-0.13434 4.7007-0.29859zm-57.57 44.279c-5.6185-3.0486-6.1166-5.593-6.1166-31.243 0-18.891 0.31331-24.063 1.6101-26.571 1.809-3.4981 6.5048-6.3339 10.489-6.3339 2.4847 0 2.5814 0.19984 1.541 3.1843-0.61054 1.7514-1.7457 3.1843-2.5226 3.1843-0.77687 0-2.1631 0.75059-3.0805 1.668-2.4923 2.4923-2.4923 47.244 0 49.736 0.91741 0.91739 2.3036 1.668 3.0805 1.668 0.77686 0 1.912 1.4329 2.5226 3.1843 1.0562 3.0298 0.97107 3.1822-1.7537 3.1418-1.575-0.02331-4.1713-0.75194-5.7694-1.6191zm-16.983-4.2458c-5.4392-2.9512-6.1166-5.9415-6.1166-26.997 0-15.096 0.34502-19.878 1.6101-22.325 1.7476-3.3796 6.4758-6.3339 10.137-6.3339 1.8666 0 2.1789 0.44955 1.6594 2.3882-0.35182 1.3135-0.64653 2.7465-0.65452 3.1843-8e-3 0.43784-0.69683 0.79608-1.5308 0.79608-0.83397 0-2.2669 0.75059-3.1843 1.668-2.4767 2.4767-2.4767 38.768 0 41.245 0.9174 0.91739 2.2946 1.668 3.0605 1.668 1.196 0 2.6402 2.995 2.6871 5.5726 0.0241 1.3294-4.5804 0.80962-7.6676-0.8655z" fill-opacity=".47466" style="mix-blend-mode:lighten"/>
33
+ </g>
34
+ <path d="m128.48 88.913-24.027 4.6784c-0.39475 0.07685-0.68766 0.40944-0.71076 0.80849l-1.4782 24.805c-0.0347 0.58371 0.50497 1.0372 1.0792 0.90602l6.6886-1.5338c0.62676-0.14383 1.1916 0.40419 1.0635 1.0299l-1.9874 9.6702c-0.13438 0.65091 0.48084 1.2073 1.1202 1.0142l4.1322-1.2472c0.64041-0.19317 1.2556 0.36535 1.1202 1.0162l-3.158 15.191c-0.19842 0.95011 1.074 1.4677 1.6042 0.653l0.35485-0.54382 19.578-38.827c0.32755-0.64985-0.23727-1.391-0.95641-1.2535l-6.8849 1.3207c-0.6467 0.12389-1.1979-0.47453-1.0152-1.1034l4.4944-15.482c0.18266-0.63012-0.36955-1.2295-1.0173-1.1034z" fill="url(#linearGradient880)" stroke-width="1.0498"/>
35
+ <rect x="3" y="3" width="169" height="169" rx="84.5" stroke="url(#paint2_linear)" stroke-width="6" style="mix-blend-mode:soft-light"/>
36
+ </svg>
@@ -0,0 +1,35 @@
1
+ {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
+
3
+ <template>
4
+ <div id="page-container">
5
+ <div
6
+ id="page-content"
7
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("uikit:tailwindcss")) }}}
8
+ class="p-5 pb-12 min-h-screen"
9
+ {{{ #else }}}
10
+ style="
11
+ padding: 20px;
12
+ padding-bottom: 50px;
13
+ min-height: 100vh;
14
+ "
15
+ {{{ /if }}}
16
+ >
17
+ <slot />
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <style>
23
+ /* Page Transition Animation */
24
+ body.page-is-transitioning #page-content {
25
+ opacity: 0;
26
+ }
27
+ </style>
28
+
29
+ <style scoped>
30
+ /* Page Transition Animation */
31
+ #page-content {
32
+ opacity: 1;
33
+ transition: opacity 0.3s ease-in-out;
34
+ }
35
+ </style>
@@ -0,0 +1,25 @@
1
+ {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
+
3
+ <template>
4
+ <button
5
+ type="button"
6
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("uikit:tailwindcss")) }}}
7
+ class="inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
8
+ {{{ /if }}}
9
+ @click="state.count++"
10
+ >
11
+ Counter {{ state.count }}
12
+ </button>
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ import { reactive } from 'vue'
17
+ export default {
18
+ setup(props) {
19
+ const state = reactive({ count: 0 })
20
+ return {
21
+ state
22
+ }
23
+ }
24
+ }
25
+ </script>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <a :class="{ active: isActive }">
3
+ <slot />
4
+ </a>
5
+ </template>
6
+ <style scoped>
7
+ a {
8
+ padding: 2px 10px;
9
+ margin-left: -10px;
10
+ }
11
+ a.active {
12
+ background-color: #eee;
13
+ }
14
+ </style>
15
+ <script lang="ts" setup>
16
+ import { useAttrs, computed } from 'vue'
17
+ import { usePageContext } from 'vike-vue/usePageContext'
18
+
19
+ const pageContext = usePageContext()
20
+ const { href } = useAttrs()
21
+ const isActive = computed(() => {
22
+ const { urlPathname } = pageContext
23
+ return href === '/' ? urlPathname === href : urlPathname.startsWith(href)
24
+ })
25
+ </script>
@@ -0,0 +1,18 @@
1
+ {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
+
3
+ <template>
4
+ <div
5
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("uikit:tailwindcss")) }}}
6
+ class="p-5 mb-2"
7
+ {{{ #else }}}
8
+ style="
9
+ margin-top: 20px;
10
+ margin-bottom: 10px;
11
+ "
12
+ {{{ /if }}}
13
+ >
14
+ <a href="/">
15
+ <img src="../assets/logo.svg" height="64" width="64" />
16
+ </a>
17
+ </div>
18
+ </template>
@@ -0,0 +1,21 @@
1
+ {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
+
3
+ <template>
4
+ <div
5
+ id="sidebar"
6
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("uikit:tailwindcss")) }}}
7
+ class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
8
+ {{{ #else }}}
9
+ style="
10
+ padding: 20px;
11
+ flex-shrink: 0;
12
+ display: flex;
13
+ flex-direction: column;
14
+ line-height: 1.8em;
15
+ border-right: 2px solid #eee;
16
+ "
17
+ {{{ /if }}}
18
+ >
19
+ <slot />
20
+ </div>
21
+ </template>
@@ -0,0 +1,12 @@
1
+ {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
+
3
+ <!-- Default <head> (can be overridden by pages) -->
4
+
5
+ <template>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("analytics:plausible.io")) }}}
8
+ <!-- See https://plausible.io/docs/plausible-script -->
9
+ <!-- TODO: update data-domain -->
10
+ <script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
11
+ {{{ /if }}}
12
+ </template>
@@ -0,0 +1,60 @@
1
+
2
+ {{{! /* We are using the SquirrellyJS template syntax */ _}}}
3
+
4
+ <template>
5
+ <div class="layout">
6
+ <Sidebar>
7
+ <Logo />
8
+ <Link href="/">Welcome</Link>
9
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("rpc:telefunc")) }}}
10
+ <Link href="/todo">Todo</Link>
11
+ {{{ /if }}}
12
+ <Link href="/star-wars">Data Fetching</Link>
13
+ </Sidebar>
14
+ <Content><slot /></Content>
15
+ </div>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import Sidebar from "../components/Sidebar.vue";
20
+ import Logo from "../components/Logo.vue";
21
+ import Link from "../components/Link.vue";
22
+ import Content from "../components/Content.vue";
23
+ </script>
24
+
25
+ <style>
26
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("uikit:tailwindcss")) }}}
27
+ @import "./tailwind.css"; /* see https://stackoverflow.com/questions/55206901/how-to-import-css-files-in-vue-3-child-components */
28
+
29
+ {{{ /if }}}
30
+ body {
31
+ margin: 0;
32
+ font-family: sans-serif;
33
+ }
34
+ * {
35
+ box-sizing: border-box;
36
+ }
37
+ a {
38
+ text-decoration: none;
39
+ }
40
+ </style>
41
+
42
+ <style scoped>
43
+ .layout {
44
+ display: flex;
45
+ max-width: 900px;
46
+ margin: auto;
47
+ }
48
+ .content {
49
+ padding: 20px;
50
+ padding-bottom: 50px;
51
+ min-height: 100vh;
52
+ flex-grow: 1;
53
+ }
54
+ .content {
55
+ transition: opacity 0.1s ease-in;
56
+ }
57
+ .content.page-transition {
58
+ opacity: 0;
59
+ }
60
+ </style>
@@ -0,0 +1,18 @@
1
+ import type { Config } from "vike-vue/types";
2
+ import Layout from "../layouts/LayoutDefault.vue";
3
+ import Head from "../layouts/HeadDefault.vue";
4
+ import logoUrl from "../assets/logo.svg";
5
+ import vikeVue from "vike-vue";
6
+
7
+ // Default config (can be overridden by pages)
8
+ export default {
9
+ Layout,
10
+ Head,
11
+ // <title>
12
+ title: "My Vike App",
13
+ // <meta name="description">
14
+ description: "Demo showcasing Vike",
15
+ // <link rel="icon" href="${favicon}" />
16
+ favicon: logoUrl,
17
+ extends: vikeVue,
18
+ } satisfies Config;
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <h1>{{ heading }}</h1>
3
+ <p>{{ abortReason }}</p>
4
+ </template>
5
+
6
+ <script lang="ts" setup>
7
+ import { usePageContext } from 'vike-vue/usePageContext'
8
+
9
+ const ctx = usePageContext()
10
+ let { is404, abortReason } = ctx
11
+ if (!abortReason) {
12
+ abortReason = is404 ? 'This page could not be found.' : 'Something went wrong.'
13
+ }
14
+ const heading = is404 ? '404 Page Not Found' : '500 Internal Server Error'
15
+ </script>
@@ -0,0 +1,24 @@
1
+ {{{! /* We are using the SquirrellyJS template syntax */ _}}}
2
+
3
+ <template>
4
+ {{{ @if (it.import.meta.BATI_MODULES?.includes("uikit:tailwindcss")) }}}
5
+ <h1 class="font-bold text-3xl pb-4">
6
+ {{{ #else }}}
7
+ <h1>
8
+ {{{ /if }}}
9
+ My Vike app
10
+ </h1>
11
+ This page is:
12
+ <ul>
13
+ <li>Rendered to HTML.</li>
14
+ <li>
15
+ Interactive. <Counter />
16
+ </li>
17
+ </ul>
18
+ </template>
19
+
20
+ <script lang="ts">
21
+ import Counter from '../../components/Counter.vue'
22
+ const components = { Counter }
23
+ export default { components }
24
+ </script>
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <h1>{{ movie.title }}</h1>
3
+ Release Date: {{ movie.release_date }}
4
+ <br />
5
+ Director: {{ movie.director }}
6
+ <br />
7
+ Producer: {{ movie.producer }}
8
+ </template>
9
+
10
+ <script lang="ts" setup>
11
+ defineProps(['movie'])
12
+ </script>
@@ -0,0 +1,27 @@
1
+ export default onBeforeRender;
2
+
3
+ import fetch from "cross-fetch";
4
+ import { filterMovieData } from "../filterMovieData";
5
+ import type { PageContextBuiltInServer } from "vite-plugin-ssr/types";
6
+ import type { MovieDetails } from "../types";
7
+
8
+ async function onBeforeRender(pageContext: PageContextBuiltInServer) {
9
+ const response = await fetch(`https://star-wars.brillout.com/api/films/${pageContext.routeParams.id}.json`);
10
+ let movie = (await response.json()) as MovieDetails;
11
+
12
+ // We remove data we don't need because we pass `pageContext.movie` to
13
+ // the client; we want to minimize what is sent over the network.
14
+ movie = filterMovieData(movie);
15
+
16
+ const { title } = movie;
17
+
18
+ return {
19
+ pageContext: {
20
+ pageProps: {
21
+ movie,
22
+ },
23
+ // The page's <title>
24
+ title,
25
+ },
26
+ };
27
+ }
@@ -0,0 +1,11 @@
1
+ import type { MovieDetails } from "./types";
2
+
3
+ export { filterMovieData };
4
+
5
+ function filterMovieData(
6
+ movie: MovieDetails & Record<string, unknown>
7
+ ): MovieDetails {
8
+ const { id, title, release_date, director, producer } = movie;
9
+ movie = { id, title, release_date, director, producer };
10
+ return movie;
11
+ }
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <h1>Star Wars Movies</h1>
3
+ <ol>
4
+ <li v-for="item in movies" :key="item.id">
5
+ <a :href="'/star-wars/' + item.id">{{ item.title }}</a> ({{ item.release_date }})
6
+ </li>
7
+ </ol>
8
+ <p>Source: <a href="https://star-wars.brillout.com">star-wars.brillout.com</a>.</p>
9
+ </template>
10
+
11
+ <script lang="ts" setup>
12
+ defineProps(['movies'])
13
+ </script>
@@ -0,0 +1,80 @@
1
+ export default onBeforeRender;
2
+
3
+ import fetch from "cross-fetch";
4
+ //import { filterMovieData } from '../filterMovieData'
5
+ import type { Movie, MovieDetails } from "../types";
6
+
7
+ // export { prerender }
8
+
9
+ async function onBeforeRender() {
10
+ const movies = await getStarWarsMovies();
11
+ return {
12
+ pageContext: {
13
+ pageProps: {
14
+ // We remove data we don't need because we pass `pageContext.movies` to
15
+ // the client; we want to minimize what is sent over the network.
16
+ movies: filterMoviesData(movies),
17
+ },
18
+ // The page's <title>
19
+ title: getTitle(movies),
20
+ },
21
+ };
22
+ }
23
+
24
+ async function getStarWarsMovies(): Promise<MovieDetails[]> {
25
+ const response = await fetch("https://star-wars.brillout.com/api/films.json");
26
+ let movies: MovieDetails[] = ((await response.json()) as any).results;
27
+ movies = movies.map((movie: MovieDetails, i: number) => ({
28
+ ...movie,
29
+ id: String(i + 1),
30
+ }));
31
+ return movies;
32
+ }
33
+
34
+ function filterMoviesData(movies: MovieDetails[]): Movie[] {
35
+ return movies.map((movie: MovieDetails) => {
36
+ const { title, release_date, id } = movie;
37
+ return { title, release_date, id };
38
+ });
39
+ }
40
+
41
+ /*
42
+ async function prerender() {
43
+ const movies = await getStarWarsMovies()
44
+ return [
45
+ {
46
+ url: '/star-wars',
47
+ // We already provide `pageContext` here so that Vike
48
+ // will *not* have to call the `onBeforeRender()` hook defined
49
+ // above in this file.
50
+ pageContext: {
51
+ pageProps: {
52
+ movies: filterMoviesData(movies)
53
+ },
54
+ documentProps: { title: getTitle(movies) }
55
+ }
56
+ },
57
+ ...movies.map((movie) => {
58
+ const url = `/star-wars/${movie.id}`
59
+ return {
60
+ url,
61
+ // Note that we can also provide the `pageContext` of other pages.
62
+ // This means that Vike will not call any
63
+ // `onBeforeRender()` hook and the Star Wars API will be called
64
+ // only once (in this `prerender()` hook).
65
+ pageContext: {
66
+ pageProps: {
67
+ movie: filterMovieData(movie)
68
+ },
69
+ documentProps: { title: movie.title }
70
+ }
71
+ }
72
+ })
73
+ ]
74
+ }
75
+ */
76
+
77
+ function getTitle(movies: Movie[] | MovieDetails[]): string {
78
+ const title = `${movies.length} Star Wars Movies`;
79
+ return title;
80
+ }
@@ -0,0 +1,13 @@
1
+ export type Movie = {
2
+ id: string;
3
+ title: string;
4
+ release_date: string;
5
+ };
6
+
7
+ export type MovieDetails = {
8
+ id: string;
9
+ title: string;
10
+ release_date: string;
11
+ director: string;
12
+ producer: string;
13
+ };
@@ -0,0 +1,11 @@
1
+ // Without this file, `tsc` will fail with such errors:
2
+ // pages/+config.h.ts:2:20 - error TS2307: Cannot find module '../layouts/LayoutDefault.vue' or its corresponding type declarations.
3
+ // import Layout from "../layouts/LayoutDefault.vue";
4
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5
+ //
6
+ // See https://stackoverflow.com/questions/71477277/typescript-cannot-find-module-in-vue-project
7
+
8
+ declare module "*.vue" {
9
+ import Vue from "vue";
10
+ export default Vue;
11
+ }
@@ -0,0 +1,70 @@
1
+ // package.json
2
+ var name = "@batijs/vue";
3
+ var private2 = true;
4
+ var version = "0.0.70";
5
+ var description = "";
6
+ var type = "module";
7
+ var scripts = {
8
+ build: "tsup"
9
+ };
10
+ var keywords = [];
11
+ var author = "";
12
+ var license = "MIT";
13
+ var devDependencies = {
14
+ "@batijs/tsup": "workspace:*",
15
+ "@types/node": "^16.18.40",
16
+ "@vitejs/plugin-vue": "^4.3.4",
17
+ "@vue/compiler-sfc": "^3.3.4",
18
+ "@vue/server-renderer": "^3.3.4",
19
+ "cross-fetch": "^4.0.0",
20
+ tailwindcss: "^3.3.3",
21
+ tsup: "^7.2.0",
22
+ typescript: "^5.2.2",
23
+ "unplugin-vue-markdown": "^0.24.3",
24
+ "vike-vue": "^0.2.3",
25
+ vite: "^4.4.9",
26
+ "vite-plugin-ssr": "^0.4.140",
27
+ vue: "^3.3.4"
28
+ };
29
+ var dependencies = {
30
+ "@batijs/core": "workspace:*"
31
+ };
32
+ var files = [
33
+ "dist/"
34
+ ];
35
+ var bati = {
36
+ flag: "vue",
37
+ name: "VueJS",
38
+ homepage: "https://vuejs.org"
39
+ };
40
+ var package_default = {
41
+ name,
42
+ private: private2,
43
+ version,
44
+ description,
45
+ type,
46
+ scripts,
47
+ keywords,
48
+ author,
49
+ license,
50
+ devDependencies,
51
+ dependencies,
52
+ files,
53
+ bati
54
+ };
55
+ export {
56
+ author,
57
+ bati,
58
+ package_default as default,
59
+ dependencies,
60
+ description,
61
+ devDependencies,
62
+ files,
63
+ keywords,
64
+ license,
65
+ name,
66
+ private2 as private,
67
+ scripts,
68
+ type,
69
+ version
70
+ };
@@ -0,0 +1,8 @@
1
+ export { onNewTodo };
2
+
3
+ import { type TodoItem, todoItems } from "../database/todoItems";
4
+
5
+ async function onNewTodo({ text }: TodoItem) {
6
+ todoItems.push({ text });
7
+ return { todoItems };
8
+ }
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <ul>
3
+ <li v-for="item in todoItems">{{ item.text }}</li>
4
+ <li>
5
+ <form @submit.prevent="submitDraft()">
6
+ <input type="text" v-model="draft" />{{ " " }}
7
+ <button type="submit">Add to-do</button>
8
+ </form>
9
+ </li>
10
+ </ul>
11
+ </template>
12
+
13
+ <script lang="ts" setup>
14
+ import { onNewTodo } from "./TodoList.telefunc.js";
15
+ import { ref, useAttrs } from 'vue';
16
+ const { todoItemsInitial } = useAttrs();
17
+
18
+ const todoItems = ref(todoItemsInitial);
19
+ const draft = ref("");
20
+
21
+ const submitDraft = async () => {
22
+ const result = await onNewTodo({
23
+ text: draft.value,
24
+ });
25
+ draft.value = "";
26
+ todoItems.value = result.todoItems;
27
+ };
28
+ </script>
@@ -0,0 +1,12 @@
1
+ export { todoItems };
2
+ export type { TodoItem };
3
+
4
+ type TodoItem = { text: string };
5
+ const todoItems: TodoItem[] = [];
6
+ init();
7
+
8
+ // Initial data
9
+ function init() {
10
+ todoItems.push({ text: "Buy milk" });
11
+ todoItems.push({ text: "Buy strawberries" });
12
+ }
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div>
3
+ <h1>To-do List</h1>
4
+ <TodoList :todoItemsInitial="todoItemsInitial" />
5
+ <Counter />
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { useAttrs } from 'vue';
11
+ const { todoItemsInitial } = useAttrs();
12
+ </script>
13
+
14
+ <script lang="ts">
15
+ import Counter from "../../components/Counter.vue";
16
+ import TodoList from "../../components/TodoList.vue";
17
+ const components = { Counter, TodoList };
18
+ export default { components };
19
+ </script>
@@ -0,0 +1,15 @@
1
+ // https://vite-plugin-ssr.com/onBeforeRender
2
+ export default onBeforeRender;
3
+
4
+ import { todoItems } from "../../database/todoItems";
5
+
6
+ function onBeforeRender() {
7
+ const todoItemsInitial = todoItems;
8
+ return {
9
+ pageContext: {
10
+ pageProps: {
11
+ todoItemsInitial,
12
+ },
13
+ },
14
+ };
15
+ }
@@ -150,5 +150,30 @@
150
150
  "subfolders": [
151
151
  "files"
152
152
  ]
153
+ },
154
+ {
155
+ "config": {
156
+ "flag": "vue",
157
+ "name": "VueJS",
158
+ "homepage": "https://vuejs.org"
159
+ },
160
+ "folder": "@batijs/vue",
161
+ "description": "",
162
+ "subfolders": [
163
+ "files"
164
+ ]
165
+ },
166
+ {
167
+ "config": {
168
+ "includeIf": [
169
+ "vue",
170
+ "telefunc"
171
+ ]
172
+ },
173
+ "folder": "@batijs/vue-telefunc",
174
+ "description": "",
175
+ "subfolders": [
176
+ "files"
177
+ ]
153
178
  }
154
179
  ]
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  consola
5
5
  } from "./chunk-chunk-HOVHXSZ5.js";
6
6
 
7
- // ../../node_modules/.pnpm/citty@0.1.3/node_modules/citty/dist/index.mjs
7
+ // ../../node_modules/.pnpm/citty@0.1.4/node_modules/citty/dist/index.mjs
8
8
  function toArray(val) {
9
9
  if (Array.isArray(val)) {
10
10
  return val;
@@ -287,30 +287,37 @@ async function runCommand(cmd, opts) {
287
287
  if (typeof cmd.setup === "function") {
288
288
  await cmd.setup(context);
289
289
  }
290
- const subCommands = await resolveValue(cmd.subCommands);
291
- if (subCommands && Object.keys(subCommands).length > 0) {
292
- const subCommandArgIndex = opts.rawArgs.findIndex(
293
- (arg) => !arg.startsWith("-")
294
- );
295
- const subCommandName = opts.rawArgs[subCommandArgIndex];
296
- if (!subCommandName && !cmd.run) {
297
- throw new CLIError(`No command specified.`, "E_NO_COMMAND");
298
- }
299
- if (!subCommands[subCommandName]) {
300
- throw new CLIError(
301
- `Unknown command \`${subCommandName}\``,
302
- "E_UNKNOWN_COMMAND"
290
+ try {
291
+ const subCommands = await resolveValue(cmd.subCommands);
292
+ if (subCommands && Object.keys(subCommands).length > 0) {
293
+ const subCommandArgIndex = opts.rawArgs.findIndex(
294
+ (arg) => !arg.startsWith("-")
303
295
  );
296
+ const subCommandName = opts.rawArgs[subCommandArgIndex];
297
+ if (subCommandName) {
298
+ if (!subCommands[subCommandName]) {
299
+ throw new CLIError(
300
+ `Unknown command \`${subCommandName}\``,
301
+ "E_UNKNOWN_COMMAND"
302
+ );
303
+ }
304
+ const subCommand = await resolveValue(subCommands[subCommandName]);
305
+ if (subCommand) {
306
+ await runCommand(subCommand, {
307
+ rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
308
+ });
309
+ }
310
+ } else if (!cmd.run) {
311
+ throw new CLIError(`No command specified.`, "E_NO_COMMAND");
312
+ }
304
313
  }
305
- const subCommand = await resolveValue(subCommands[subCommandName]);
306
- if (subCommand) {
307
- await runCommand(subCommand, {
308
- rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1)
309
- });
314
+ if (typeof cmd.run === "function") {
315
+ await cmd.run(context);
316
+ }
317
+ } finally {
318
+ if (typeof cmd.cleanup === "function") {
319
+ await cmd.cleanup(context);
310
320
  }
311
- }
312
- if (typeof cmd.run === "function") {
313
- await cmd.run(context);
314
321
  }
315
322
  }
316
323
  async function resolveSubCommand(cmd, rawArgs, parent) {
@@ -419,6 +426,12 @@ async function runMain(cmd, opts = {}) {
419
426
  if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
420
427
  await showUsage(...await resolveSubCommand(cmd, rawArgs));
421
428
  process.exit(0);
429
+ } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
430
+ const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
431
+ if (!meta?.version) {
432
+ throw new CLIError("No version specified", "E_NO_VERSION");
433
+ }
434
+ consola.log(meta.version);
422
435
  } else {
423
436
  await runCommand(cmd, { rawArgs });
424
437
  }
@@ -436,7 +449,7 @@ async function runMain(cmd, opts = {}) {
436
449
  }
437
450
 
438
451
  // ../build/dist/exec.js
439
- import { loadFile, transformAndGenerate } from "@batijs/core";
452
+ import { loadFile, renderSquirrelly, transformAstAndGenerate } from "@batijs/core";
440
453
  import { copyFile, mkdir, opendir, readFile, writeFile } from "fs/promises";
441
454
  import { existsSync } from "fs";
442
455
  import path from "path";
@@ -520,11 +533,22 @@ Please report this issue to https://github.com/magne4000/bati`
520
533
  await safeWriteFile(target, fileContent);
521
534
  }
522
535
  targets.add(target);
523
- } else if (parsed.ext.match(/\.[tj]sx?$/) && await fileContainsBatiMeta(p)) {
524
- const mod = await loadFile(p);
525
- const fileContent = await transformAndGenerate(mod.$ast, meta, {
526
- filepath: p
527
- });
536
+ } else if (await fileContainsBatiMeta(p)) {
537
+ let fileContent = "";
538
+ if (parsed.ext.match(/\.[tj]sx?$/)) {
539
+ const mod = await loadFile(p);
540
+ fileContent = await transformAstAndGenerate(mod.$ast, meta, {
541
+ filepath: p
542
+ });
543
+ } else {
544
+ const template = await readFile(p, { encoding: "utf-8" });
545
+ try {
546
+ fileContent = renderSquirrelly(template, meta);
547
+ } catch (e) {
548
+ console.error("SquirrellyJS error while rendering", p);
549
+ throw e;
550
+ }
551
+ }
528
552
  if (fileContent) {
529
553
  await safeWriteFile(target, fileContent);
530
554
  }
@@ -540,7 +564,7 @@ Please report this issue to https://github.com/magne4000/bati`
540
564
  // package.json
541
565
  var package_default = {
542
566
  name: "@batijs/cli",
543
- version: "0.0.68",
567
+ version: "0.0.70",
544
568
  type: "module",
545
569
  scripts: {
546
570
  prerelease: "rimraf ./dist",
@@ -558,7 +582,7 @@ var package_default = {
558
582
  "@batijs/tsup": "workspace:*",
559
583
  "@types/node": "^16.18.40",
560
584
  "@types/which": "^3.0.0",
561
- citty: "^0.1.3",
585
+ citty: "^0.1.4",
562
586
  colorette: "^2.0.20",
563
587
  esbuild: "^0.19.2",
564
588
  espree: "^9.6.1",
@@ -570,7 +594,7 @@ var package_default = {
570
594
  tsup: "^7.2.0",
571
595
  typescript: "^5.2.2",
572
596
  vite: "^4.4.9",
573
- vitest: "^0.34.3",
597
+ vitest: "^0.34.4",
574
598
  which: "^4.0.0"
575
599
  },
576
600
  dependencies: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.68",
3
+ "version": "0.0.70",
4
4
  "type": "module",
5
5
  "keywords": [],
6
6
  "description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
@@ -10,7 +10,7 @@
10
10
  "devDependencies": {
11
11
  "@types/node": "^16.18.40",
12
12
  "@types/which": "^3.0.0",
13
- "citty": "^0.1.3",
13
+ "citty": "^0.1.4",
14
14
  "colorette": "^2.0.20",
15
15
  "esbuild": "^0.19.2",
16
16
  "espree": "^9.6.1",
@@ -22,13 +22,13 @@
22
22
  "tsup": "^7.2.0",
23
23
  "typescript": "^5.2.2",
24
24
  "vite": "^4.4.9",
25
- "vitest": "^0.34.3",
25
+ "vitest": "^0.34.4",
26
26
  "which": "^4.0.0",
27
- "@batijs/build": "0.0.68",
28
- "@batijs/tsup": "0.0.68"
27
+ "@batijs/build": "0.0.70",
28
+ "@batijs/tsup": "0.0.70"
29
29
  },
30
30
  "dependencies": {
31
- "@batijs/core": "0.0.68"
31
+ "@batijs/core": "0.0.70"
32
32
  },
33
33
  "bin": "./dist/index.js",
34
34
  "exports": {