@batijs/cli 0.0.1 → 0.0.3
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/$$express-entry.ts.ts +124 -0
- package/dist/boilerplates/@batijs/express/$package.json.js +21 -0
- package/dist/boilerplates/@batijs/express/chunk-package-BS6EEBE7.js +81 -0
- package/dist/boilerplates/@batijs/hattip/$$hattip-entry.ts.ts +84 -0
- package/dist/boilerplates/@batijs/hattip/$package.json.js +23 -0
- package/dist/boilerplates/@batijs/hattip/chunk-package-P5FG3FJS.js +81 -0
- package/dist/boilerplates/@batijs/shared/package.json +17 -0
- package/dist/boilerplates/@batijs/shared/tsconfig.json +18 -0
- package/dist/boilerplates/@batijs/shared/vite.config.ts +5 -0
- package/dist/boilerplates/@batijs/solid/$package.json.js +11 -0
- package/dist/boilerplates/@batijs/solid/$tsconfig.json.js +12 -0
- package/dist/boilerplates/@batijs/solid/$vite.config.ts.js +13 -0
- package/dist/boilerplates/@batijs/solid/assets/logo.svg +36 -0
- package/dist/boilerplates/@batijs/solid/chunk-package-IU66XUZ2.js +79 -0
- package/dist/boilerplates/@batijs/solid/components/Link.tsx +16 -0
- package/dist/boilerplates/@batijs/solid/layouts/LayoutDefault.tsx +74 -0
- package/dist/boilerplates/@batijs/solid/layouts/style.css +29 -0
- package/dist/boilerplates/@batijs/solid/pages/+config.ts +11 -0
- package/dist/boilerplates/@batijs/solid/pages/_error/+Page.tsx +20 -0
- package/dist/boilerplates/@batijs/solid/pages/index/+Page.tsx +17 -0
- package/dist/boilerplates/@batijs/solid/pages/index/Counter.tsx +13 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/@id/+Page.tsx +15 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/@id/+onBeforeRender.ts +29 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/filterMovieData.ts +11 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/index/+Page.tsx +23 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/index/+onBeforeRender.ts +80 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/types.ts +13 -0
- package/dist/boilerplates/@batijs/telefunc/$package.json.js +11 -0
- package/dist/boilerplates/@batijs/telefunc/$vite.config.ts.js +14 -0
- package/dist/boilerplates/@batijs/telefunc/chunk-package-PYDSUPTJ.js +75 -0
- package/dist/boilerplates/boilerplates.json +1 -0
- package/dist/index.js +638 -29
- package/package.json +13 -9
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/** @jsxImportSource solid-js */
|
|
2
|
+
import "./style.css";
|
|
3
|
+
import logoUrl from "../assets/logo.svg";
|
|
4
|
+
import { Link } from "../components/Link";
|
|
5
|
+
import type { JSX } from "solid-js";
|
|
6
|
+
|
|
7
|
+
export default function LayoutDefault(props: { children?: JSX.Element }) {
|
|
8
|
+
return (
|
|
9
|
+
<div
|
|
10
|
+
style={{
|
|
11
|
+
display: "flex",
|
|
12
|
+
"max-width": "900px",
|
|
13
|
+
margin: "auto",
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<Sidebar>
|
|
17
|
+
<Logo />
|
|
18
|
+
<Link href="/">Welcome</Link>
|
|
19
|
+
<Link href="/star-wars">Data Fetching</Link>
|
|
20
|
+
</Sidebar>
|
|
21
|
+
<Content>{props.children}</Content>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function Sidebar(props: { children: JSX.Element }) {
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
id="sidebar"
|
|
30
|
+
style={{
|
|
31
|
+
padding: "20px",
|
|
32
|
+
"flex-shrink": 0,
|
|
33
|
+
display: "flex",
|
|
34
|
+
"flex-direction": "column",
|
|
35
|
+
"line-height": "1.8em",
|
|
36
|
+
"border-right": "2px solid #eee",
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{props.children}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function Content(props: { children: JSX.Element }) {
|
|
45
|
+
return (
|
|
46
|
+
<div id="page-container">
|
|
47
|
+
<div
|
|
48
|
+
id="page-content"
|
|
49
|
+
style={{
|
|
50
|
+
padding: "20px",
|
|
51
|
+
"padding-bottom": "50px",
|
|
52
|
+
"min-height": "100vh",
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{props.children}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function Logo() {
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
style={{
|
|
65
|
+
"margin-top": "20px",
|
|
66
|
+
"margin-bottom": "10px",
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
<a href="/">
|
|
70
|
+
<img src={logoUrl} height={64} width={64} />
|
|
71
|
+
</a>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* Links */
|
|
2
|
+
a {
|
|
3
|
+
text-decoration: none;
|
|
4
|
+
}
|
|
5
|
+
#sidebar a {
|
|
6
|
+
padding: 2px 10px;
|
|
7
|
+
margin-left: -10px;
|
|
8
|
+
}
|
|
9
|
+
#sidebar a.is-active {
|
|
10
|
+
background-color: #eee;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Reset */
|
|
14
|
+
body {
|
|
15
|
+
margin: 0;
|
|
16
|
+
font-family: sans-serif;
|
|
17
|
+
}
|
|
18
|
+
* {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Page Transition Anmiation */
|
|
23
|
+
#page-content {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
transition: opacity 0.3s ease-in-out;
|
|
26
|
+
}
|
|
27
|
+
body.page-is-transitioning #page-content {
|
|
28
|
+
opacity: 0;
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Config } from "solide";
|
|
2
|
+
import Layout from "../layouts/LayoutDefault";
|
|
3
|
+
|
|
4
|
+
// Default config (can be overriden by pages)
|
|
5
|
+
export default {
|
|
6
|
+
Layout,
|
|
7
|
+
// <title>
|
|
8
|
+
title: "My Solide App",
|
|
9
|
+
// <meta name="description">
|
|
10
|
+
description: "Demo showcasing Solide",
|
|
11
|
+
} satisfies Config;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @jsxImportSource solid-js */
|
|
2
|
+
|
|
3
|
+
export default function Page(props: { is404: boolean; errorInfo?: string }) {
|
|
4
|
+
if (props.is404) {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<h1>404 Page Not Found</h1>
|
|
8
|
+
<p>This page could not be found.</p>
|
|
9
|
+
<p>{props.errorInfo}</p>
|
|
10
|
+
</>
|
|
11
|
+
);
|
|
12
|
+
} else {
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<h1>500 Internal Server Error</h1>
|
|
16
|
+
<p>Something went wrong.</p>
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @jsxImportSource solid-js */
|
|
2
|
+
import { Counter } from "./Counter";
|
|
3
|
+
|
|
4
|
+
export default function Page() {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<h1>My Solide app</h1>
|
|
8
|
+
This page is:
|
|
9
|
+
<ul>
|
|
10
|
+
<li>Rendered to HTML.</li>
|
|
11
|
+
<li>
|
|
12
|
+
Interactive. <Counter />
|
|
13
|
+
</li>
|
|
14
|
+
</ul>
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @jsxImportSource solid-js */
|
|
2
|
+
import type { MovieDetails } from "../types";
|
|
3
|
+
|
|
4
|
+
export default function Page(props: { movie: MovieDetails }) {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<h1>{props.movie.title}</h1>
|
|
8
|
+
Release Date: {props.movie.release_date}
|
|
9
|
+
<br />
|
|
10
|
+
Director: {props.movie.director}
|
|
11
|
+
<br />
|
|
12
|
+
Producer: {props.movie.producer}
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default onBeforeRender;
|
|
2
|
+
|
|
3
|
+
import fetch from "cross-fetch";
|
|
4
|
+
import { filterMovieData } from "../filterMovieData";
|
|
5
|
+
import type { PageContextBuiltIn } from "solide";
|
|
6
|
+
import type { MovieDetails } from "../types";
|
|
7
|
+
|
|
8
|
+
async function onBeforeRender(pageContext: PageContextBuiltIn) {
|
|
9
|
+
const response = await fetch(
|
|
10
|
+
`https://star-wars.brillout.com/api/films/${pageContext.routeParams.id}.json`
|
|
11
|
+
);
|
|
12
|
+
let movie = (await response.json()) as MovieDetails;
|
|
13
|
+
|
|
14
|
+
// We remove data we don't need because we pass `pageContext.movie` to
|
|
15
|
+
// the client; we want to minimize what is sent over the network.
|
|
16
|
+
movie = filterMovieData(movie);
|
|
17
|
+
|
|
18
|
+
const { title } = movie;
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
pageContext: {
|
|
22
|
+
pageProps: {
|
|
23
|
+
movie,
|
|
24
|
+
},
|
|
25
|
+
// The page's <title>
|
|
26
|
+
title,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -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,23 @@
|
|
|
1
|
+
/** @jsxImportSource solid-js */
|
|
2
|
+
import { For } from "solid-js";
|
|
3
|
+
import type { Movie } from "../types";
|
|
4
|
+
|
|
5
|
+
export default function Page(props: { movies: Movie[] }) {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<h1>Star Wars Movies</h1>
|
|
9
|
+
<ol>
|
|
10
|
+
<For each={props.movies}>
|
|
11
|
+
{(movie, i) => (
|
|
12
|
+
<li>
|
|
13
|
+
<a href={`/star-wars/${movie.id}`}>{movie.title}</a> ({movie.release_date})
|
|
14
|
+
</li>
|
|
15
|
+
)}
|
|
16
|
+
</For>
|
|
17
|
+
</ol>
|
|
18
|
+
<p>
|
|
19
|
+
Source: <a href="https://star-wars.brillout.com">star-wars.brillout.com</a>.
|
|
20
|
+
</p>
|
|
21
|
+
</>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -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 Solide
|
|
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 Solide 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,11 @@
|
|
|
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("./chunk-package-PYDSUPTJ.js"), {
|
|
6
|
+
dependencies: ["telefunc"]
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
getPackageJson as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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: "telefunc/vite",
|
|
7
|
+
constructor: "telefunc",
|
|
8
|
+
imported: "telefunc"
|
|
9
|
+
});
|
|
10
|
+
return mod.generate().code;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
getViteConfig as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var name = "@batijs/telefunc";
|
|
3
|
+
var version = "0.0.3";
|
|
4
|
+
var description = "";
|
|
5
|
+
var type = "module";
|
|
6
|
+
var scripts = {
|
|
7
|
+
build: "tsup"
|
|
8
|
+
};
|
|
9
|
+
var keywords = [];
|
|
10
|
+
var author = "";
|
|
11
|
+
var license = "MIT";
|
|
12
|
+
var devDependencies = {
|
|
13
|
+
"@batijs/tsup": "workspace:*",
|
|
14
|
+
"@types/node": "^16.18.24",
|
|
15
|
+
telefunc: "^0.1.52",
|
|
16
|
+
vite: "^4.3.2",
|
|
17
|
+
"vite-plugin-ssr": "^0.4.117"
|
|
18
|
+
};
|
|
19
|
+
var dependencies = {
|
|
20
|
+
"@batijs/core": "workspace:*"
|
|
21
|
+
};
|
|
22
|
+
var exports = {
|
|
23
|
+
".": "./dist/index.js",
|
|
24
|
+
"./files": "./dist/index.js"
|
|
25
|
+
};
|
|
26
|
+
var typesVersions = {
|
|
27
|
+
"*": {
|
|
28
|
+
".": [
|
|
29
|
+
"./dist/index.d.ts"
|
|
30
|
+
],
|
|
31
|
+
files: [
|
|
32
|
+
"./dist/index.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var files = [
|
|
37
|
+
"dist/"
|
|
38
|
+
];
|
|
39
|
+
var bati = {
|
|
40
|
+
flag: "telefunc",
|
|
41
|
+
boilerplate: "./dist/files"
|
|
42
|
+
};
|
|
43
|
+
var package_default = {
|
|
44
|
+
name,
|
|
45
|
+
version,
|
|
46
|
+
description,
|
|
47
|
+
type,
|
|
48
|
+
scripts,
|
|
49
|
+
keywords,
|
|
50
|
+
author,
|
|
51
|
+
license,
|
|
52
|
+
devDependencies,
|
|
53
|
+
dependencies,
|
|
54
|
+
exports,
|
|
55
|
+
typesVersions,
|
|
56
|
+
files,
|
|
57
|
+
bati
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
author,
|
|
61
|
+
bati,
|
|
62
|
+
package_default as default,
|
|
63
|
+
dependencies,
|
|
64
|
+
description,
|
|
65
|
+
devDependencies,
|
|
66
|
+
exports,
|
|
67
|
+
files,
|
|
68
|
+
keywords,
|
|
69
|
+
license,
|
|
70
|
+
name,
|
|
71
|
+
scripts,
|
|
72
|
+
type,
|
|
73
|
+
typesVersions,
|
|
74
|
+
version
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"config":{"flag":"express","boilerplate":"./dist/files"},"folder":"@batijs/express"},{"config":{"flag":"hattip","boilerplate":"./dist/files"},"folder":"@batijs/hattip"},{"config":{"boilerplate":"./dist/files"},"folder":"@batijs/shared"},{"config":{"flag":"solid","boilerplate":"./dist/files"},"folder":"@batijs/solid"},{"config":{"flag":"telefunc","boilerplate":"./dist/files"},"folder":"@batijs/telefunc"}]
|