@batijs/cli 0.0.94 → 0.0.96
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/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/express/files/express-entry.ts +3 -3
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +3 -3
- package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +3 -3
- package/dist/boilerplates/@batijs/react/files/$.eslintrc.json.js +1 -1
- package/dist/boilerplates/@batijs/react/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/react/files/layouts/HeadDefault.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/layouts/LayoutDefault.tsx +10 -10
- package/dist/boilerplates/@batijs/react/files/pages/index/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/index/Counter.tsx +1 -1
- package/dist/boilerplates/@batijs/shared/files/$index.html.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/$.eslintrc.json.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/layouts/HeadDefault.tsx +1 -1
- package/dist/boilerplates/@batijs/solid/files/layouts/LayoutDefault.tsx +10 -10
- package/dist/boilerplates/@batijs/solid/files/pages/index/+Page.tsx +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/index/Counter.tsx +1 -1
- package/dist/boilerplates/@batijs/vue/files/$.eslintrc.json.js +4 -1
- package/dist/boilerplates/@batijs/vue/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/vue/files/components/Content.vue +11 -5
- package/dist/boilerplates/@batijs/vue/files/components/Counter.vue +10 -5
- package/dist/boilerplates/@batijs/vue/files/components/Logo.vue +14 -5
- package/dist/boilerplates/@batijs/vue/files/components/Sidebar.vue +9 -5
- package/dist/boilerplates/@batijs/vue/files/layouts/HeadDefault.vue +7 -9
- package/dist/boilerplates/@batijs/vue/files/layouts/LayoutDefault.vue +5 -8
- package/dist/boilerplates/@batijs/vue/files/pages/index/+Page.vue +8 -8
- package/dist/index.js +9 -36
- package/package.json +5 -5
|
@@ -33,7 +33,7 @@ async function startServer() {
|
|
|
33
33
|
app.use(viteDevMiddleware);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
if (
|
|
36
|
+
if (BATI.has("authjs")) {
|
|
37
37
|
/**
|
|
38
38
|
* AuthJS
|
|
39
39
|
*
|
|
@@ -51,7 +51,7 @@ async function startServer() {
|
|
|
51
51
|
username: { label: "Username", type: "text", placeholder: "jsmith" },
|
|
52
52
|
password: { label: "Password", type: "password" },
|
|
53
53
|
},
|
|
54
|
-
async authorize(
|
|
54
|
+
async authorize() {
|
|
55
55
|
// Add logic here to look up the user from the credentials supplied
|
|
56
56
|
const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
|
|
57
57
|
|
|
@@ -72,7 +72,7 @@ async function startServer() {
|
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
if (
|
|
75
|
+
if (BATI.has("telefunc")) {
|
|
76
76
|
/**
|
|
77
77
|
* Telefunc route
|
|
78
78
|
*
|
|
@@ -52,7 +52,7 @@ async function startServer() {
|
|
|
52
52
|
|
|
53
53
|
const router = createRouter();
|
|
54
54
|
|
|
55
|
-
if (
|
|
55
|
+
if (BATI.has("authjs")) {
|
|
56
56
|
/**
|
|
57
57
|
* AuthJS
|
|
58
58
|
*
|
|
@@ -70,7 +70,7 @@ async function startServer() {
|
|
|
70
70
|
username: { label: "Username", type: "text", placeholder: "jsmith" },
|
|
71
71
|
password: { label: "Password", type: "password" },
|
|
72
72
|
},
|
|
73
|
-
async authorize(
|
|
73
|
+
async authorize() {
|
|
74
74
|
// Add logic here to look up the user from the credentials supplied
|
|
75
75
|
const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
|
|
76
76
|
|
|
@@ -93,7 +93,7 @@ async function startServer() {
|
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
if (
|
|
96
|
+
if (BATI.has("telefunc")) {
|
|
97
97
|
/**
|
|
98
98
|
* Telefunc route
|
|
99
99
|
*
|
|
@@ -6,7 +6,7 @@ import { renderPage } from "vike/server";
|
|
|
6
6
|
|
|
7
7
|
const router = createRouter();
|
|
8
8
|
|
|
9
|
-
if (
|
|
9
|
+
if (BATI.has("telefunc")) {
|
|
10
10
|
/**
|
|
11
11
|
* Telefunc route
|
|
12
12
|
*
|
|
@@ -29,7 +29,7 @@ if (import.meta.BATI_MODULES?.includes("telefunc")) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (BATI.has("authjs")) {
|
|
33
33
|
/**
|
|
34
34
|
* AuthJS
|
|
35
35
|
*
|
|
@@ -48,7 +48,7 @@ if (import.meta.BATI_MODULES?.includes("authjs")) {
|
|
|
48
48
|
username: { label: "Username", type: "text", placeholder: "username" },
|
|
49
49
|
password: { label: "Password", type: "password" },
|
|
50
50
|
},
|
|
51
|
-
async authorize(
|
|
51
|
+
async authorize() {
|
|
52
52
|
// Add logic here to look up the user from the credentials supplied
|
|
53
53
|
const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
|
|
54
54
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// files/$.eslintrc.json.ts
|
|
2
2
|
import { loadAsJson } from "@batijs/core";
|
|
3
3
|
async function getEslintConfig(props) {
|
|
4
|
-
if (!props.meta.
|
|
4
|
+
if (!props.meta.BATI.has("eslint"))
|
|
5
5
|
return;
|
|
6
6
|
const eslintConfig = await loadAsJson(props);
|
|
7
7
|
eslintConfig.extends = eslintConfig.extends.filter(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { addDependency, loadAsJson } from "@batijs/core";
|
|
3
3
|
async function getPackageJson(props) {
|
|
4
4
|
const packageJson = await loadAsJson(props);
|
|
5
|
-
if (props.meta.
|
|
5
|
+
if (props.meta.BATI.has("eslint")) {
|
|
6
6
|
addDependency(packageJson, await import("../package-UB7NRNF7.js"), {
|
|
7
7
|
devDependencies: ["eslint-config-react-app"]
|
|
8
8
|
});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { addVitePlugin, loadAsMagicast } from "@batijs/core";
|
|
3
3
|
async function getViteConfig(props) {
|
|
4
4
|
const mod = await loadAsMagicast(props);
|
|
5
|
-
const options = props.meta.
|
|
5
|
+
const options = props.meta.BATI.has("vercel") ? {
|
|
6
6
|
prerender: true
|
|
7
7
|
} : {};
|
|
8
8
|
addVitePlugin(mod, {
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
// Default <head> (can be overridden by pages)
|
|
4
4
|
|
|
5
5
|
export default function HeadDefault() {
|
|
6
|
-
if (
|
|
6
|
+
if (BATI.has("plausible.io")) {
|
|
7
7
|
return (
|
|
8
8
|
<>
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
//#
|
|
2
|
+
//# BATI.has("tailwindcss")
|
|
3
3
|
import "./tailwind.css";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import logoUrl from "../assets/logo.svg";
|
|
@@ -8,9 +8,9 @@ import { Link } from "../components/Link";
|
|
|
8
8
|
export default function LayoutDefault({ children }: { children: React.ReactNode }) {
|
|
9
9
|
return (
|
|
10
10
|
<div
|
|
11
|
-
//#
|
|
11
|
+
//# BATI.has("tailwindcss")
|
|
12
12
|
className="flex max-w-5xl m-auto"
|
|
13
|
-
//# !
|
|
13
|
+
//# !BATI.has("tailwindcss")
|
|
14
14
|
style={{
|
|
15
15
|
display: "flex",
|
|
16
16
|
maxWidth: 900,
|
|
@@ -20,7 +20,7 @@ export default function LayoutDefault({ children }: { children: React.ReactNode
|
|
|
20
20
|
<Sidebar>
|
|
21
21
|
<Logo />
|
|
22
22
|
<Link href="/">Welcome</Link>
|
|
23
|
-
{
|
|
23
|
+
{BATI.has("telefunc") ? <Link href="/todo">Todo</Link> : undefined}
|
|
24
24
|
<Link href="/star-wars">Data Fetching</Link>
|
|
25
25
|
</Sidebar>
|
|
26
26
|
<Content>{children}</Content>
|
|
@@ -32,9 +32,9 @@ function Sidebar({ children }: { children: React.ReactNode }) {
|
|
|
32
32
|
return (
|
|
33
33
|
<div
|
|
34
34
|
id="sidebar"
|
|
35
|
-
//#
|
|
35
|
+
//# BATI.has("tailwindcss")
|
|
36
36
|
className="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
|
|
37
|
-
//# !
|
|
37
|
+
//# !BATI.has("tailwindcss")
|
|
38
38
|
style={{
|
|
39
39
|
padding: 20,
|
|
40
40
|
flexShrink: 0,
|
|
@@ -54,9 +54,9 @@ function Content({ children }: { children: React.ReactNode }) {
|
|
|
54
54
|
<div id="page-container">
|
|
55
55
|
<div
|
|
56
56
|
id="page-content"
|
|
57
|
-
//#
|
|
57
|
+
//# BATI.has("tailwindcss")
|
|
58
58
|
className="p-5 pb-12 min-h-screen"
|
|
59
|
-
//# !
|
|
59
|
+
//# !BATI.has("tailwindcss")
|
|
60
60
|
style={{
|
|
61
61
|
padding: 20,
|
|
62
62
|
paddingBottom: 50,
|
|
@@ -72,9 +72,9 @@ function Content({ children }: { children: React.ReactNode }) {
|
|
|
72
72
|
function Logo() {
|
|
73
73
|
return (
|
|
74
74
|
<div
|
|
75
|
-
//#
|
|
75
|
+
//# BATI.has("tailwindcss")
|
|
76
76
|
className="p-5 mb-2"
|
|
77
|
-
//# !
|
|
77
|
+
//# !BATI.has("tailwindcss")
|
|
78
78
|
style={{
|
|
79
79
|
marginTop: 20,
|
|
80
80
|
marginBottom: 10,
|
|
@@ -6,7 +6,7 @@ export function Counter() {
|
|
|
6
6
|
return (
|
|
7
7
|
<button
|
|
8
8
|
type="button"
|
|
9
|
-
//#
|
|
9
|
+
//# BATI.has("tailwindcss")
|
|
10
10
|
className="inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
|
|
11
11
|
onClick={() => setCount((count) => count + 1)}
|
|
12
12
|
>
|
|
@@ -187,7 +187,7 @@ var flags = features.map((f) => f.flag);
|
|
|
187
187
|
// files/$index.html.ts
|
|
188
188
|
var frameworkFeatures = features.filter((f) => f.category === "Framework").map((f) => f.flag);
|
|
189
189
|
function createDefaultIndexHtml(props) {
|
|
190
|
-
if (props.meta.
|
|
190
|
+
if (Array.from(props.meta.BATI).some((m) => frameworkFeatures.includes(m)))
|
|
191
191
|
return null;
|
|
192
192
|
return `<html>
|
|
193
193
|
<head>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// files/$.eslintrc.json.ts
|
|
2
2
|
import { loadAsJson } from "@batijs/core";
|
|
3
3
|
async function getEslintConfig(props) {
|
|
4
|
-
if (!props.meta.
|
|
4
|
+
if (!props.meta.BATI.has("eslint"))
|
|
5
5
|
return;
|
|
6
6
|
const eslintConfig = await loadAsJson(props);
|
|
7
7
|
eslintConfig.extends.push("plugin:solid/typescript");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { addDependency, loadAsJson } from "@batijs/core";
|
|
3
3
|
async function getPackageJson(props) {
|
|
4
4
|
const packageJson = await loadAsJson(props);
|
|
5
|
-
if (props.meta.
|
|
5
|
+
if (props.meta.BATI.has("eslint")) {
|
|
6
6
|
addDependency(packageJson, await import("../package-AH7QMR5B.js"), {
|
|
7
7
|
devDependencies: ["eslint-plugin-solid"]
|
|
8
8
|
});
|
|
@@ -3,7 +3,7 @@ import { addVitePlugin, loadAsMagicast } from "@batijs/core";
|
|
|
3
3
|
async function getViteConfig(props) {
|
|
4
4
|
const mod = await loadAsMagicast(props);
|
|
5
5
|
let options = void 0;
|
|
6
|
-
if (props.meta.
|
|
6
|
+
if (props.meta.BATI.has("vercel")) {
|
|
7
7
|
options = {
|
|
8
8
|
vps: {
|
|
9
9
|
prerender: true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
//#
|
|
2
|
+
//# BATI.has("tailwindcss")
|
|
3
3
|
import "./tailwind.css";
|
|
4
4
|
import type { JSX } from "solid-js";
|
|
5
5
|
import logoUrl from "../assets/logo.svg";
|
|
@@ -8,9 +8,9 @@ import { Link } from "../components/Link";
|
|
|
8
8
|
export default function LayoutDefault(props: { children?: JSX.Element }) {
|
|
9
9
|
return (
|
|
10
10
|
<div
|
|
11
|
-
//#
|
|
11
|
+
//# BATI.has("tailwindcss")
|
|
12
12
|
class="flex max-w-5xl m-auto"
|
|
13
|
-
//# !
|
|
13
|
+
//# !BATI.has("tailwindcss")
|
|
14
14
|
style={{
|
|
15
15
|
display: "flex",
|
|
16
16
|
"max-width": "900px",
|
|
@@ -20,7 +20,7 @@ export default function LayoutDefault(props: { children?: JSX.Element }) {
|
|
|
20
20
|
<Sidebar>
|
|
21
21
|
<Logo />
|
|
22
22
|
<Link href="/">Welcome</Link>
|
|
23
|
-
{
|
|
23
|
+
{BATI.has("telefunc") ? <Link href="/todo">Todo</Link> : undefined}
|
|
24
24
|
<Link href="/star-wars">Data Fetching</Link>
|
|
25
25
|
</Sidebar>
|
|
26
26
|
<Content>{props.children}</Content>
|
|
@@ -32,9 +32,9 @@ function Sidebar(props: { children: JSX.Element }) {
|
|
|
32
32
|
return (
|
|
33
33
|
<div
|
|
34
34
|
id="sidebar"
|
|
35
|
-
//#
|
|
35
|
+
//# BATI.has("tailwindcss")
|
|
36
36
|
class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
|
|
37
|
-
//# !
|
|
37
|
+
//# !BATI.has("tailwindcss")
|
|
38
38
|
style={{
|
|
39
39
|
padding: "20px",
|
|
40
40
|
"flex-shrink": 0,
|
|
@@ -54,9 +54,9 @@ function Content(props: { children: JSX.Element }) {
|
|
|
54
54
|
<div id="page-container">
|
|
55
55
|
<div
|
|
56
56
|
id="page-content"
|
|
57
|
-
//#
|
|
57
|
+
//# BATI.has("tailwindcss")
|
|
58
58
|
class="p-5 pb-12 min-h-screen"
|
|
59
|
-
//# !
|
|
59
|
+
//# !BATI.has("tailwindcss")
|
|
60
60
|
style={{
|
|
61
61
|
padding: "20px",
|
|
62
62
|
"padding-bottom": "50px",
|
|
@@ -72,9 +72,9 @@ function Content(props: { children: JSX.Element }) {
|
|
|
72
72
|
function Logo() {
|
|
73
73
|
return (
|
|
74
74
|
<div
|
|
75
|
-
//#
|
|
75
|
+
//# BATI.has("tailwindcss")
|
|
76
76
|
class="p-5 mb-2"
|
|
77
|
-
//# !
|
|
77
|
+
//# !BATI.has("tailwindcss")
|
|
78
78
|
style={{
|
|
79
79
|
"margin-top": "20px",
|
|
80
80
|
"margin-bottom": "10px",
|
|
@@ -8,7 +8,7 @@ function Counter() {
|
|
|
8
8
|
return (
|
|
9
9
|
<button
|
|
10
10
|
type="button"
|
|
11
|
-
//#
|
|
11
|
+
//# BATI.has("tailwindcss")
|
|
12
12
|
class="inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
|
|
13
13
|
onClick={() => setCount((count) => count + 1)}
|
|
14
14
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// files/$.eslintrc.json.ts
|
|
2
2
|
import { loadAsJson } from "@batijs/core";
|
|
3
3
|
async function getEslintConfig(props) {
|
|
4
|
-
if (!props.meta.
|
|
4
|
+
if (!props.meta.BATI.has("eslint"))
|
|
5
5
|
return;
|
|
6
6
|
const eslintConfig = await loadAsJson(props);
|
|
7
7
|
eslintConfig.extends.push("plugin:vue/vue3-recommended");
|
|
@@ -9,6 +9,9 @@ async function getEslintConfig(props) {
|
|
|
9
9
|
eslintConfig.parserOptions.parser = "@typescript-eslint/parser";
|
|
10
10
|
eslintConfig.rules ??= {};
|
|
11
11
|
eslintConfig.rules["vue/multi-word-component-names"] = "off";
|
|
12
|
+
eslintConfig.rules["vue/singleline-html-element-content-newline"] = "off";
|
|
13
|
+
eslintConfig.rules["vue/max-attributes-per-line"] = "off";
|
|
14
|
+
eslintConfig.rules["vue/html-self-closing"] = "off";
|
|
12
15
|
return eslintConfig;
|
|
13
16
|
}
|
|
14
17
|
export {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { addDependency, loadAsJson, setScripts } from "@batijs/core";
|
|
3
3
|
async function getPackageJson(props) {
|
|
4
4
|
const packageJson = await loadAsJson(props);
|
|
5
|
-
if (props.meta.
|
|
5
|
+
if (props.meta.BATI.has("eslint")) {
|
|
6
6
|
setScripts(packageJson, {
|
|
7
7
|
lint: {
|
|
8
8
|
value: "eslint --ext .js,.jsx,.ts,.tsx,.vue .",
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
-
{{{! /* We are using the SquirrellyJS template syntax */ _}}}
|
|
2
|
-
|
|
3
1
|
<template>
|
|
4
2
|
<div id="page-container">
|
|
3
|
+
<!-- BATI.has("tailwindcss") -->
|
|
5
4
|
<div
|
|
6
5
|
id="page-content"
|
|
7
|
-
{{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
|
|
8
6
|
class="p-5 pb-12 min-h-screen"
|
|
9
|
-
|
|
7
|
+
>
|
|
8
|
+
<slot />
|
|
9
|
+
</div>
|
|
10
|
+
<!-- !BATI.has("tailwindcss") -->
|
|
11
|
+
<div
|
|
12
|
+
id="page-content"
|
|
10
13
|
style="
|
|
11
14
|
padding: 20px;
|
|
12
15
|
padding-bottom: 50px;
|
|
13
16
|
min-height: 100vh;
|
|
14
17
|
"
|
|
15
|
-
{{{ /if }}}
|
|
16
18
|
>
|
|
17
19
|
<slot />
|
|
18
20
|
</div>
|
|
19
21
|
</div>
|
|
20
22
|
</template>
|
|
21
23
|
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
</script>
|
|
26
|
+
|
|
22
27
|
<style>
|
|
23
28
|
/* Page Transition Animation */
|
|
24
29
|
body.page-is-transitioning #page-content {
|
|
@@ -33,3 +38,4 @@ body.page-is-transitioning #page-content {
|
|
|
33
38
|
transition: opacity 0.3s ease-in-out;
|
|
34
39
|
}
|
|
35
40
|
</style>
|
|
41
|
+
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
{{{! /* We are using the SquirrellyJS template syntax */ _}}}
|
|
2
|
-
|
|
3
1
|
<template>
|
|
2
|
+
<!-- BATI.has("tailwindcss") -->
|
|
4
3
|
<button
|
|
5
4
|
type="button"
|
|
6
|
-
{{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
|
|
7
5
|
class="inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
|
|
8
|
-
|
|
6
|
+
@click="state.count++"
|
|
7
|
+
>
|
|
8
|
+
Counter {{ state.count }}
|
|
9
|
+
</button>
|
|
10
|
+
<!-- !BATI.has("tailwindcss") -->
|
|
11
|
+
<button
|
|
12
|
+
type="button"
|
|
9
13
|
@click="state.count++"
|
|
10
14
|
>
|
|
11
15
|
Counter {{ state.count }}
|
|
@@ -13,7 +17,8 @@
|
|
|
13
17
|
</template>
|
|
14
18
|
|
|
15
19
|
<script lang="ts">
|
|
16
|
-
import { reactive } from
|
|
20
|
+
import { reactive } from "vue";
|
|
21
|
+
|
|
17
22
|
export default {
|
|
18
23
|
setup() {
|
|
19
24
|
const state = reactive({ count: 0 })
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
{{{! /* We are using the SquirrellyJS template syntax */ _}}}
|
|
2
|
-
|
|
3
1
|
<template>
|
|
2
|
+
<!-- BATI.has("tailwindcss") -->
|
|
4
3
|
<div
|
|
5
|
-
{{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
|
|
6
4
|
class="p-5 mb-2"
|
|
7
|
-
|
|
5
|
+
>
|
|
6
|
+
<a href="/">
|
|
7
|
+
<img
|
|
8
|
+
src="../assets/logo.svg"
|
|
9
|
+
height="64"
|
|
10
|
+
width="64"
|
|
11
|
+
>
|
|
12
|
+
</a>
|
|
13
|
+
</div>
|
|
14
|
+
<!-- !BATI.has("tailwindcss") -->
|
|
15
|
+
<div
|
|
8
16
|
style="
|
|
9
17
|
margin-top: 20px;
|
|
10
18
|
margin-bottom: 10px;
|
|
11
19
|
"
|
|
12
|
-
{{{ /if }}}
|
|
13
20
|
>
|
|
14
21
|
<a href="/">
|
|
15
22
|
<img
|
|
@@ -20,3 +27,5 @@
|
|
|
20
27
|
</a>
|
|
21
28
|
</div>
|
|
22
29
|
</template>
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
</script>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
{{{! /* We are using the SquirrellyJS template syntax */ _}}}
|
|
2
|
-
|
|
3
1
|
<template>
|
|
2
|
+
<!-- BATI.has("tailwindcss") -->
|
|
4
3
|
<div
|
|
5
4
|
id="sidebar"
|
|
6
|
-
{{{ @if (it.import.meta.BATI_MODULES?.includes("tailwindcss")) }}}
|
|
7
5
|
class="p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"
|
|
8
|
-
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
<!-- !BATI.has("tailwindcss") -->
|
|
10
|
+
<div
|
|
11
|
+
id="sidebar"
|
|
9
12
|
style="
|
|
10
13
|
padding: 20px;
|
|
11
14
|
flex-shrink: 0;
|
|
@@ -14,8 +17,9 @@
|
|
|
14
17
|
line-height: 1.8em;
|
|
15
18
|
border-right: 2px solid #eee;
|
|
16
19
|
"
|
|
17
|
-
{{{ /if }}}
|
|
18
20
|
>
|
|
19
21
|
<slot />
|
|
20
22
|
</div>
|
|
21
23
|
</template>
|
|
24
|
+
<script setup lang="ts">
|
|
25
|
+
</script>
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
{{{! /* We are using the SquirrellyJS template syntax */ _}}}
|
|
2
|
-
|
|
3
1
|
<!-- Default <head> (can be overridden by pages) -->
|
|
4
2
|
|
|
5
3
|
<template>
|
|
@@ -7,13 +5,13 @@
|
|
|
7
5
|
name="viewport"
|
|
8
6
|
content="width=device-width, initial-scale=1"
|
|
9
7
|
>
|
|
10
|
-
|
|
8
|
+
|
|
9
|
+
<!-- BATI.has("plausible.io") -->
|
|
11
10
|
<!-- See https://plausible.io/docs/plausible-script -->
|
|
12
11
|
<!-- TODO: update data-domain -->
|
|
13
|
-
<script
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
src="https://plausible.io/js/script.js"
|
|
17
|
-
/>
|
|
18
|
-
{{{ /if }}}
|
|
12
|
+
<component :is="'script'" defer
|
|
13
|
+
data-domain="yourdomain.com"
|
|
14
|
+
src="https://plausible.io/js/script.js" />
|
|
19
15
|
</template>
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
</script>
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
{{{! /* We are using the SquirrellyJS template syntax */ _}}}
|
|
3
|
-
|
|
4
1
|
<template>
|
|
5
2
|
<div class="layout">
|
|
6
3
|
<Sidebar>
|
|
@@ -8,11 +5,10 @@
|
|
|
8
5
|
<Link href="/">
|
|
9
6
|
Welcome
|
|
10
7
|
</Link>
|
|
11
|
-
|
|
8
|
+
<!-- BATI.has("telefunc") -->
|
|
12
9
|
<Link href="/todo">
|
|
13
10
|
Todo
|
|
14
11
|
</Link>
|
|
15
|
-
{{{ /if }}}
|
|
16
12
|
<Link href="/star-wars">
|
|
17
13
|
Data Fetching
|
|
18
14
|
</Link>
|
|
@@ -29,10 +25,11 @@ import Content from "../components/Content.vue";
|
|
|
29
25
|
</script>
|
|
30
26
|
|
|
31
27
|
<style>
|
|
32
|
-
{
|
|
33
|
-
|
|
28
|
+
/*{ @if (it.BATI.has("tailwindcss")) }*/
|
|
29
|
+
/* see https://stackoverflow.com/questions/55206901/how-to-import-css-files-in-vue-3-child-components */
|
|
30
|
+
@import "./tailwind.css";
|
|
31
|
+
/*{ /if }*/
|
|
34
32
|
|
|
35
|
-
{{{ /if }}}
|
|
36
33
|
body {
|
|
37
34
|
margin: 0;
|
|
38
35
|
font-family: sans-serif;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
{{{! /* We are using the SquirrellyJS template syntax */ _}}}
|
|
2
|
-
|
|
3
1
|
<template>
|
|
4
|
-
|
|
2
|
+
<!-- BATI.has("tailwindcss") -->
|
|
5
3
|
<h1 class="font-bold text-3xl pb-4">
|
|
6
|
-
|
|
4
|
+
My Vike app
|
|
5
|
+
</h1>
|
|
6
|
+
<!-- !BATI.has("tailwindcss") -->
|
|
7
7
|
<h1>
|
|
8
|
-
{{{ /if }}}
|
|
9
8
|
My Vike app
|
|
10
9
|
</h1>
|
|
11
10
|
This page is:
|
|
@@ -18,7 +17,8 @@
|
|
|
18
17
|
</template>
|
|
19
18
|
|
|
20
19
|
<script lang="ts">
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
import Counter from "../../components/Counter.vue";
|
|
21
|
+
|
|
22
|
+
const components = { Counter }
|
|
23
|
+
export default { components }
|
|
24
24
|
</script>
|
package/dist/index.js
CHANGED
|
@@ -450,9 +450,9 @@ async function runMain(cmd, opts = {}) {
|
|
|
450
450
|
|
|
451
451
|
// ../build/dist/index.js
|
|
452
452
|
import { existsSync } from "fs";
|
|
453
|
-
import {
|
|
453
|
+
import { mkdir, opendir, readFile, writeFile } from "fs/promises";
|
|
454
454
|
import path from "path";
|
|
455
|
-
import {
|
|
455
|
+
import { transformAndFormat } from "@batijs/core";
|
|
456
456
|
function queue() {
|
|
457
457
|
const tasks = [];
|
|
458
458
|
return {
|
|
@@ -474,13 +474,6 @@ function toDist(filepath, source, dist) {
|
|
|
474
474
|
split[split.length - 1] = split[split.length - 1].replace(/^\$\$?(.*)\.[tj]sx?$/, "$1");
|
|
475
475
|
return split.join(path.sep).replace(source, dist);
|
|
476
476
|
}
|
|
477
|
-
async function safeCopyFile(source, destination) {
|
|
478
|
-
const destinationDir = path.dirname(destination);
|
|
479
|
-
await mkdir(destinationDir, {
|
|
480
|
-
recursive: true
|
|
481
|
-
});
|
|
482
|
-
await copyFile(source, destination);
|
|
483
|
-
}
|
|
484
477
|
async function safeWriteFile(destination, content) {
|
|
485
478
|
const destinationDir = path.dirname(destination);
|
|
486
479
|
await mkdir(destinationDir, {
|
|
@@ -518,10 +511,6 @@ function transformFileAfterExec(filepath, fileContent) {
|
|
|
518
511
|
throw new Error(`Unsupported extension ${ext} (${filepath})`);
|
|
519
512
|
}
|
|
520
513
|
}
|
|
521
|
-
async function fileContainsBatiMeta(filepath) {
|
|
522
|
-
const code = await readFile(filepath, { encoding: "utf-8" });
|
|
523
|
-
return code.includes("import.meta.BATI_");
|
|
524
|
-
}
|
|
525
514
|
async function importTransformer(p) {
|
|
526
515
|
const importFile = isWin ? "file://" + p : p;
|
|
527
516
|
const f = await import(importFile);
|
|
@@ -563,33 +552,17 @@ Please report this issue to https://github.com/magne4000/bati`
|
|
|
563
552
|
targets.add(target);
|
|
564
553
|
}
|
|
565
554
|
});
|
|
566
|
-
} else
|
|
555
|
+
} else {
|
|
567
556
|
transformAndWriteQ.add(async () => {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
filepath: p
|
|
573
|
-
});
|
|
574
|
-
} else {
|
|
575
|
-
const template = await readFile(p, { encoding: "utf-8" });
|
|
576
|
-
try {
|
|
577
|
-
fileContent = renderSquirrelly(template, meta);
|
|
578
|
-
} catch (e) {
|
|
579
|
-
console.error("SquirrellyJS error while rendering", p);
|
|
580
|
-
throw e;
|
|
581
|
-
}
|
|
582
|
-
}
|
|
557
|
+
const code = await readFile(p, { encoding: "utf-8" });
|
|
558
|
+
const fileContent = await transformAndFormat(code, meta, {
|
|
559
|
+
filepath: p
|
|
560
|
+
});
|
|
583
561
|
if (fileContent) {
|
|
584
562
|
await safeWriteFile(target, fileContent);
|
|
585
563
|
targets.add(target);
|
|
586
564
|
}
|
|
587
565
|
});
|
|
588
|
-
} else {
|
|
589
|
-
simpleCopyQ.add(async () => {
|
|
590
|
-
await safeCopyFile(p, target);
|
|
591
|
-
targets.add(target);
|
|
592
|
-
});
|
|
593
566
|
}
|
|
594
567
|
}
|
|
595
568
|
}
|
|
@@ -600,7 +573,7 @@ Please report this issue to https://github.com/magne4000/bati`
|
|
|
600
573
|
// package.json
|
|
601
574
|
var package_default = {
|
|
602
575
|
name: "@batijs/cli",
|
|
603
|
-
version: "0.0.
|
|
576
|
+
version: "0.0.96",
|
|
604
577
|
type: "module",
|
|
605
578
|
scripts: {
|
|
606
579
|
"check-types": "tsc --noEmit",
|
|
@@ -1763,7 +1736,7 @@ async function run() {
|
|
|
1763
1736
|
}
|
|
1764
1737
|
const hooksMap = await retrieveHooks(hooks);
|
|
1765
1738
|
const meta = {
|
|
1766
|
-
|
|
1739
|
+
BATI: new Set(flags)
|
|
1767
1740
|
};
|
|
1768
1741
|
await main(
|
|
1769
1742
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.96",
|
|
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",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"tsup": "^7.2.0",
|
|
20
20
|
"typescript": "^5.2.2",
|
|
21
21
|
"vite": "^4.4.11",
|
|
22
|
-
"@batijs/build": "0.0.
|
|
23
|
-
"@batijs/tsup": "0.0.
|
|
22
|
+
"@batijs/build": "0.0.96",
|
|
23
|
+
"@batijs/tsup": "0.0.96"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@batijs/core": "0.0.
|
|
27
|
-
"@batijs/features": "0.0.
|
|
26
|
+
"@batijs/core": "0.0.96",
|
|
27
|
+
"@batijs/features": "0.0.96"
|
|
28
28
|
},
|
|
29
29
|
"bin": "./dist/index.js",
|
|
30
30
|
"exports": {
|