@batijs/cli 0.0.234-beta.3 → 0.0.235

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.
@@ -18,15 +18,7 @@ import installCrypto from "@hattip/polyfills/crypto";
18
18
  import installGetSetCookie from "@hattip/polyfills/get-set-cookie";
19
19
  import installWhatwgNodeFetch from "@hattip/polyfills/whatwg-node";
20
20
  import { type NodeHTTPCreateContextFnOptions, nodeHTTPRequestHandler } from "@trpc/server/adapters/node-http";
21
- import {
22
- createApp,
23
- createRouter,
24
- eventHandler,
25
- fromNodeMiddleware,
26
- fromWebHandler,
27
- toNodeListener,
28
- toWebRequest,
29
- } from "h3";
21
+ import { createApp, createRouter, eventHandler, fromNodeMiddleware, toNodeListener, toWebRequest } from "h3";
30
22
  import serveStatic from "serve-static";
31
23
 
32
24
  installWhatwgNodeFetch();
@@ -86,13 +78,13 @@ async function startServer() {
86
78
  * Auth.js route
87
79
  * @link {@see https://authjs.dev/getting-started/installation}
88
80
  **/
89
- router.use("/api/auth/**", fromWebHandler(authjsHandler));
81
+ router.use("/api/auth/**", fromWebMiddleware(authjsHandler));
90
82
  }
91
83
 
92
84
  if (BATI.has("firebase-auth")) {
93
85
  app.use(fromWebMiddleware(firebaseAuthMiddleware));
94
- router.post("/api/sessionLogin", fromWebHandler(firebaseAuthLoginHandler));
95
- router.post("/api/sessionLogout", fromWebHandler(firebaseAuthLogoutHandler));
86
+ router.post("/api/sessionLogin", fromWebMiddleware(firebaseAuthLoginHandler));
87
+ router.post("/api/sessionLogout", fromWebMiddleware(firebaseAuthLogoutHandler));
96
88
  }
97
89
 
98
90
  if (BATI.has("trpc")) {
@@ -123,15 +115,15 @@ async function startServer() {
123
115
  *
124
116
  * @link {@see https://telefunc.com}
125
117
  **/
126
- router.post("/_telefunc", fromWebHandler(telefuncHandler));
118
+ router.post("/_telefunc", fromWebMiddleware(telefuncHandler));
127
119
  }
128
120
 
129
121
  if (BATI.has("ts-rest")) {
130
- router.use("/api/**", fromWebHandler(tsRestHandler));
122
+ router.use("/api/**", fromWebMiddleware(tsRestHandler));
131
123
  }
132
124
 
133
125
  if (!BATI.has("telefunc") && !BATI.has("trpc") && !BATI.has("ts-rest")) {
134
- router.post("/api/todo/create", fromWebHandler(createTodoHandler));
126
+ router.post("/api/todo/create", fromWebMiddleware(createTodoHandler));
135
127
  }
136
128
 
137
129
  /**
@@ -139,7 +131,7 @@ async function startServer() {
139
131
  *
140
132
  * @link {@see https://vike.dev}
141
133
  **/
142
- router.use("/**", fromWebHandler(vikeHandler));
134
+ router.use("/**", fromWebMiddleware(vikeHandler));
143
135
 
144
136
  app.use(router);
145
137
 
package/dist/index.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  } from "./chunk-MFJ4ET44.js";
6
6
 
7
7
  // index.ts
8
- import { existsSync as existsSync2 } from "fs";
9
- import { exec as nodeExec } from "child_process";
8
+ import { existsSync as existsSync2, rmSync } from "fs";
9
+ import { execSync } from "child_process";
10
10
  import { access, constants, lstat, readdir, readFile as readFile3 } from "fs/promises";
11
11
  import { dirname, join, parse } from "path";
12
12
  import { fileURLToPath } from "url";
@@ -1588,7 +1588,7 @@ var createDefaultQueryTester = function(query, options) {
1588
1588
  // package.json
1589
1589
  var package_default = {
1590
1590
  name: "@batijs/cli",
1591
- version: "0.0.234-beta.3",
1591
+ version: "0.0.235",
1592
1592
  type: "module",
1593
1593
  scripts: {
1594
1594
  "check-types": "tsc --noEmit",
@@ -1880,21 +1880,32 @@ function testFlags(flags, bl) {
1880
1880
  }
1881
1881
  return true;
1882
1882
  }
1883
- async function gitInit(cwd) {
1883
+ function gitInit(cwd) {
1884
+ const exists = which("git");
1885
+ if (!exists) return;
1884
1886
  try {
1885
- const exists = which("git");
1886
- if (!exists) return;
1887
- await new Promise((resolve, reject) => {
1888
- nodeExec("git init", { cwd }, (err) => {
1889
- if (err) {
1890
- reject(err);
1891
- } else {
1892
- resolve(void 0);
1893
- }
1894
- });
1887
+ execSync("git init", {
1888
+ cwd,
1889
+ stdio: "ignore"
1895
1890
  });
1891
+ execSync("git add .", { cwd, stdio: "ignore" });
1892
+ execSync(
1893
+ [
1894
+ "git",
1895
+ '-c user.name="Bati"',
1896
+ '-c user.email="no-reply@batijs.dev"',
1897
+ "commit",
1898
+ "--no-gpg-sign",
1899
+ '--message="scaffold Vike app with Bati"'
1900
+ ].join(" "),
1901
+ { cwd, stdio: "ignore" }
1902
+ );
1896
1903
  } catch (e) {
1897
- console.warn(`${yellow("\u26A0")} failed to execute \`git init\` in destination folder. Skipping.`);
1904
+ try {
1905
+ rmSync(join(cwd, ".git"), { recursive: true, force: true });
1906
+ } catch {
1907
+ }
1908
+ console.warn(`${yellow("\u26A0")} failed to initialize a git repository in destination folder. Skipping.`);
1898
1909
  }
1899
1910
  }
1900
1911
  async function run() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.234-beta.3",
3
+ "version": "0.0.235",
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",
@@ -20,12 +20,12 @@
20
20
  "typescript": "^5.5.3",
21
21
  "unplugin-purge-polyfills": "^0.0.4",
22
22
  "vite": "^5.3.4",
23
- "@batijs/build": "0.0.234-beta.3",
24
- "@batijs/compile": "0.0.234-beta.3"
23
+ "@batijs/compile": "0.0.235",
24
+ "@batijs/build": "0.0.235"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/core": "0.0.234-beta.3",
28
- "@batijs/features": "0.0.234-beta.3"
27
+ "@batijs/core": "0.0.235",
28
+ "@batijs/features": "0.0.235"
29
29
  },
30
30
  "bin": "./dist/index.js",
31
31
  "exports": {