@batijs/cli 0.0.24 → 0.0.25

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 (40) hide show
  1. package/README.md +3 -3
  2. package/dist/boilerplates/@batijs/edgedb/files/$package.json.js +1 -1
  3. package/dist/boilerplates/@batijs/edgedb/{package-N7DN6762.js → package-NAEM3YOJ.js} +1 -1
  4. package/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
  5. package/dist/boilerplates/@batijs/express/files/express-entry.ts +124 -124
  6. package/dist/boilerplates/@batijs/express/{package-MQDB4QVK.js → package-VWSKNQQS.js} +1 -1
  7. package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
  8. package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +88 -88
  9. package/dist/boilerplates/@batijs/hattip/{package-ZHZMC652.js → package-PAHNC63I.js} +1 -1
  10. package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
  11. package/dist/boilerplates/@batijs/prisma/{package-3DP6BNRZ.js → package-42T5MPMS.js} +1 -1
  12. package/dist/boilerplates/@batijs/shared/files/package.json +2 -2
  13. package/dist/boilerplates/@batijs/shared/files/tsconfig.json +18 -18
  14. package/dist/boilerplates/@batijs/shared/files/vite.config.ts +5 -5
  15. package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -1
  16. package/dist/boilerplates/@batijs/solid/files/assets/logo.svg +36 -36
  17. package/dist/boilerplates/@batijs/solid/files/components/Link.tsx +14 -14
  18. package/dist/boilerplates/@batijs/solid/files/layouts/HeadDefault.tsx +22 -22
  19. package/dist/boilerplates/@batijs/solid/files/layouts/LayoutDefault.tsx +87 -87
  20. package/dist/boilerplates/@batijs/solid/files/layouts/style.css +29 -29
  21. package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +13 -13
  22. package/dist/boilerplates/@batijs/solid/files/pages/_error/+Page.tsx +18 -18
  23. package/dist/boilerplates/@batijs/solid/files/pages/index/+Page.tsx +21 -21
  24. package/dist/boilerplates/@batijs/solid/files/pages/index/Counter.tsx +18 -18
  25. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+Page.tsx +14 -14
  26. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+onBeforeRender.ts +27 -27
  27. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/filterMovieData.ts +11 -11
  28. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+Page.tsx +22 -22
  29. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+onBeforeRender.ts +80 -80
  30. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/types.ts +13 -13
  31. package/dist/boilerplates/@batijs/solid/{package-6HR5REIL.js → package-DVZ6BETH.js} +1 -1
  32. package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
  33. package/dist/boilerplates/@batijs/tailwindcss/files/layouts/tailwind.css +2 -2
  34. package/dist/boilerplates/@batijs/tailwindcss/files/postcss.config.js +6 -6
  35. package/dist/boilerplates/@batijs/tailwindcss/files/tailwind.config.js +8 -8
  36. package/dist/boilerplates/@batijs/tailwindcss/{package-G265GCGU.js → package-7CSFX2AA.js} +1 -1
  37. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
  38. package/dist/boilerplates/@batijs/telefunc/{package-JYH3G3DH.js → package-42IE3DIX.js} +1 -1
  39. package/dist/index.js +12 -5
  40. package/package.json +9 -6
@@ -1,22 +1,22 @@
1
- import { For } from "solid-js";
2
- import type { Movie } from "../types";
3
-
4
- export default function Page(props: { movies: Movie[] }) {
5
- return (
6
- <>
7
- <h1>Star Wars Movies</h1>
8
- <ol>
9
- <For each={props.movies}>
10
- {(movie, i) => (
11
- <li>
12
- <a href={`/star-wars/${movie.id}`}>{movie.title}</a> ({movie.release_date})
13
- </li>
14
- )}
15
- </For>
16
- </ol>
17
- <p>
18
- Source: <a href="https://star-wars.brillout.com">star-wars.brillout.com</a>.
19
- </p>
20
- </>
21
- );
22
- }
1
+ import { For } from "solid-js";
2
+ import type { Movie } from "../types";
3
+
4
+ export default function Page(props: { movies: Movie[] }) {
5
+ return (
6
+ <>
7
+ <h1>Star Wars Movies</h1>
8
+ <ol>
9
+ <For each={props.movies}>
10
+ {(movie, i) => (
11
+ <li>
12
+ <a href={`/star-wars/${movie.id}`}>{movie.title}</a> ({movie.release_date})
13
+ </li>
14
+ )}
15
+ </For>
16
+ </ol>
17
+ <p>
18
+ Source: <a href="https://star-wars.brillout.com">star-wars.brillout.com</a>.
19
+ </p>
20
+ </>
21
+ );
22
+ }
@@ -1,80 +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
- }
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
+ }
@@ -1,13 +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
- };
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
+ };
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/solid";
3
3
  var private2 = true;
4
- var version = "0.0.24";
4
+ var version = "0.0.25";
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-G265GCGU.js"), {
5
+ return addDependency(packageJson, await import("../package-7CSFX2AA.js"), {
6
6
  devDependencies: ["tailwindcss", "postcss", "autoprefixer"]
7
7
  });
8
8
  }
@@ -1,3 +1,3 @@
1
- @tailwind base;
2
- @tailwind components;
1
+ @tailwind base;
2
+ @tailwind components;
3
3
  @tailwind utilities;
@@ -1,6 +1,6 @@
1
- export default {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- }
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -1,8 +1,8 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
- content: ["./{pages,layouts,components,src}/**/*.{html,js,jsx,ts,tsx}"],
4
- theme: {
5
- extend: {},
6
- },
7
- plugins: [],
8
- };
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: ["./{pages,layouts,components,src}/**/*.{html,js,jsx,ts,tsx}"],
4
+ theme: {
5
+ extend: {},
6
+ },
7
+ plugins: [],
8
+ };
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var name = "@batijs/tailwindcss";
3
3
  var private2 = true;
4
- var version = "0.0.24";
4
+ var version = "0.0.25";
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-JYH3G3DH.js"), {
5
+ return addDependency(packageJson, await import("../package-42IE3DIX.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.24";
4
+ var version = "0.0.25";
5
5
  var description = "";
6
6
  var type = "module";
7
7
  var scripts = {
package/dist/index.js CHANGED
@@ -554,6 +554,7 @@ import { copyFile, mkdir, opendir, readFile, writeFile } from "fs/promises";
554
554
  import { existsSync } from "fs";
555
555
  import path from "path";
556
556
  var reIgnoreFile = /^(chunk-|asset-|#)/gi;
557
+ var isWin = process.platform === "win32";
557
558
  function toDist(filepath, source, dist) {
558
559
  const split = filepath.split(path.sep);
559
560
  split[split.length - 1] = split[split.length - 1].replace(/^\$\$?(.*)\.[tj]sx?$/, "$1");
@@ -622,7 +623,8 @@ async function main(options, meta) {
622
623
  Please report this issue to https://github.com/magne4000/bati`
623
624
  );
624
625
  } else if (parsed.name.startsWith("$") && parsed.ext.match(/\.jsx?$/)) {
625
- const f = await import(p);
626
+ const importFile = isWin ? "file://" + p : p;
627
+ const f = await import(importFile);
626
628
  const fileContent = transformFileAfterExec(
627
629
  target,
628
630
  await f.default(targets.has(target) ? () => readFile(target, { encoding: "utf-8" }) : void 0, meta)
@@ -651,14 +653,14 @@ Please report this issue to https://github.com/magne4000/bati`
651
653
  // package.json
652
654
  var package_default = {
653
655
  name: "@batijs/cli",
654
- version: "0.0.24",
656
+ version: "0.0.25",
655
657
  description: "Scaffold typescript projects with ease and modularity",
656
658
  type: "module",
657
659
  scripts: {
658
- prerelease: "rm -rf ./dist",
660
+ prerelease: "rimraf ./dist",
659
661
  prepublishOnly: "pnpm run build",
660
662
  test: "pnpm run build && vitest run --test-timeout=50000",
661
- build: "rm -rf dist && tsup"
663
+ build: "rimraf ./dist && tsup"
662
664
  },
663
665
  keywords: [],
664
666
  author: "",
@@ -674,8 +676,11 @@ var package_default = {
674
676
  execa: "^7.1.1",
675
677
  "get-port": "^7.0.0",
676
678
  "node-fetch": "^3.3.1",
679
+ rimraf: "^5.0.1",
680
+ "tree-kill": "^1.2.2",
677
681
  tsup: "^6.7.0",
678
682
  typescript: "^5.1.3",
683
+ vite: "^4.3.9",
679
684
  vitest: "^0.32.0"
680
685
  },
681
686
  dependencies: {
@@ -822,6 +827,7 @@ var {
822
827
  // index.ts
823
828
  var __filename = fileURLToPath(import.meta.url);
824
829
  var __dirname = dirname(__filename);
830
+ var isWin2 = process.platform === "win32";
825
831
  function boilerplatesDir() {
826
832
  if (existsSync2(join(__dirname, "boilerplates", "boilerplates.json"))) {
827
833
  return join(__dirname, "boilerplates");
@@ -926,12 +932,13 @@ async function retrieveHooks(hooks) {
926
932
  for (const hook of hooks) {
927
933
  for await (const file of walk(hook)) {
928
934
  const parsed = parse(file);
935
+ const importFile = isWin2 ? "file://" + file : file;
929
936
  switch (parsed.name) {
930
937
  case "cli":
931
938
  if (!map.has("cli")) {
932
939
  map.set("cli", []);
933
940
  }
934
- map.get("cli").push((await import(file)).default);
941
+ map.get("cli").push((await import(importFile)).default);
935
942
  break;
936
943
  default:
937
944
  throw new Error(`Unsupported hook ${parsed.name}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "description": "Scaffold typescript projects with ease and modularity",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -15,14 +15,17 @@
15
15
  "execa": "^7.1.1",
16
16
  "get-port": "^7.0.0",
17
17
  "node-fetch": "^3.3.1",
18
+ "rimraf": "^5.0.1",
19
+ "tree-kill": "^1.2.2",
18
20
  "tsup": "^6.7.0",
19
21
  "typescript": "^5.1.3",
22
+ "vite": "^4.3.9",
20
23
  "vitest": "^0.32.0",
21
- "@batijs/build": "0.0.24",
22
- "@batijs/tsup": "0.0.24"
24
+ "@batijs/build": "0.0.25",
25
+ "@batijs/tsup": "0.0.25"
23
26
  },
24
27
  "dependencies": {
25
- "@batijs/core": "0.0.24"
28
+ "@batijs/core": "0.0.25"
26
29
  },
27
30
  "bin": "./dist/index.js",
28
31
  "exports": {
@@ -39,8 +42,8 @@
39
42
  "dist/"
40
43
  ],
41
44
  "scripts": {
42
- "prerelease": "rm -rf ./dist",
45
+ "prerelease": "rimraf ./dist",
43
46
  "test": "pnpm run build && vitest run --test-timeout=50000",
44
- "build": "rm -rf dist && tsup"
47
+ "build": "rimraf ./dist && tsup"
45
48
  }
46
49
  }