@batijs/cli 0.0.251 → 0.0.252

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.
@@ -1,3 +1,4 @@
1
+ /*# BATI include-if-imported #*/
1
2
  import { int, integer, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
2
3
 
3
4
  export const userTable = sqliteTable("users", {
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import { fileURLToPath } from "node:url";
13
13
 
14
14
  // ../build/dist/index.js
15
15
  import { existsSync } from "node:fs";
16
- import { mkdir, opendir, rm, writeFile } from "node:fs/promises";
16
+ import { mkdir, opendir, rm, rmdir, writeFile } from "node:fs/promises";
17
17
  import path from "node:path";
18
18
  import "@batijs/core";
19
19
  import { transformAndFormat as transformAndFormat2 } from "@batijs/core";
@@ -192,7 +192,7 @@ async function safeWriteFile(destination, content) {
192
192
  });
193
193
  await writeFile(destination, content, { encoding: "utf-8" });
194
194
  }
195
- async function safeRmFile(destination) {
195
+ async function safeRmFile(destination, options) {
196
196
  try {
197
197
  await rm(destination, {
198
198
  force: true,
@@ -200,6 +200,15 @@ async function safeRmFile(destination) {
200
200
  recursive: false,
201
201
  retryDelay: 150
202
202
  });
203
+ if (options?.removeEmptyDir) {
204
+ try {
205
+ await rmdir(path.dirname(destination), {
206
+ maxRetries: 3,
207
+ retryDelay: 150
208
+ });
209
+ } catch {
210
+ }
211
+ }
203
212
  } catch {
204
213
  console.warn(`Failed to remove unecessary file: ${destination}`);
205
214
  }
@@ -308,7 +317,7 @@ Please report this issue to https://github.com/vikejs/bati`
308
317
  }
309
318
  for (const target of filesContainingIncludeIfImported) {
310
319
  if (!allImports.has(target)) {
311
- await safeRmFile(target);
320
+ await safeRmFile(target, { removeEmptyDir: true });
312
321
  }
313
322
  }
314
323
  }
@@ -1667,7 +1676,7 @@ var createDefaultQueryTester = function(query, options) {
1667
1676
  // package.json
1668
1677
  var package_default = {
1669
1678
  name: "@batijs/cli",
1670
- version: "0.0.251",
1679
+ version: "0.0.252",
1671
1680
  type: "module",
1672
1681
  scripts: {
1673
1682
  "check-types": "tsc --noEmit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.251",
3
+ "version": "0.0.252",
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.4",
21
21
  "unplugin-purge-polyfills": "^0.0.4",
22
22
  "vite": "^5.4.2",
23
- "@batijs/compile": "0.0.251",
24
- "@batijs/build": "0.0.251"
23
+ "@batijs/build": "0.0.252",
24
+ "@batijs/compile": "0.0.252"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/core": "0.0.251",
28
- "@batijs/features": "0.0.251"
27
+ "@batijs/core": "0.0.252",
28
+ "@batijs/features": "0.0.252"
29
29
  },
30
30
  "bin": "./dist/index.js",
31
31
  "exports": {