@unciatech/file-manager 0.0.28 → 0.0.30

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/cli.cjs CHANGED
@@ -40,11 +40,11 @@ var askQuestion = (query) => {
40
40
  };
41
41
  var TEMPLATE = `"use client";
42
42
 
43
- import React, { Suspense } from "react";
43
+ import React, { Suspense, useMemo } from "react";
44
44
  import { FileManager, MockProvider } from "@unciatech/file-manager";
45
45
 
46
46
  export default function FileManagerDemo() {
47
- const mockProvider = new MockProvider();
47
+ const provider = useMemo(() => new MockProvider(), []);
48
48
 
49
49
  return (
50
50
  <div className="h-screen w-full">
@@ -52,7 +52,7 @@ export default function FileManagerDemo() {
52
52
  <FileManager
53
53
  allowedFileTypes={["audios", "videos", "images", "files"]}
54
54
  viewMode="grid"
55
- provider={mockProvider}
55
+ provider={provider}
56
56
  />
57
57
  </Suspense>
58
58
  </div>
@@ -277,7 +277,7 @@ async function scaffoldVite(projectName2, targetDir) {
277
277
  (0, import_child_process.execSync)(`npm create vite@latest ${projectName2} -- --template react-ts`, { stdio: "inherit" });
278
278
  console.log("\n\u{1F4E6} Installing dependencies (Tailwind + File Manager)...");
279
279
  (0, import_child_process.execSync)("npm install", { cwd: targetDir, stdio: "inherit" });
280
- (0, import_child_process.execSync)("npm install tailwindcss @tailwindcss/vite @unciatech/file-manager", { cwd: targetDir, stdio: "inherit" });
280
+ (0, import_child_process.execSync)("npm install @unciatech/file-manager tailwindcss @tailwindcss/vite tw-animate-css", { cwd: targetDir, stdio: "inherit" });
281
281
  const viteConfigPath = import_path.default.join(targetDir, "vite.config.ts");
282
282
  const viteConfig = `import { defineConfig } from 'vite'
283
283
  import react from '@vitejs/plugin-react'
@@ -293,8 +293,17 @@ export default defineConfig({
293
293
  import_fs.default.writeFileSync(viteConfigPath, viteConfig);
294
294
  const cssPath = import_path.default.join(targetDir, "src", "index.css");
295
295
  import_fs.default.writeFileSync(cssPath, `@import "tailwindcss";
296
- @source "../../node_modules/@unciatech/file-manager/dist";
296
+ @source "../node_modules/@unciatech/file-manager/dist/**/*.{js,ts,jsx,tsx}";
297
297
  `);
298
+ const mainPath = import_path.default.join(targetDir, "src", "main.tsx");
299
+ if (import_fs.default.existsSync(mainPath)) {
300
+ let mainContent = import_fs.default.readFileSync(mainPath, "utf8");
301
+ if (!mainContent.includes("@unciatech/file-manager/styles")) {
302
+ mainContent = `import '@unciatech/file-manager/styles';
303
+ ` + mainContent;
304
+ import_fs.default.writeFileSync(mainPath, mainContent);
305
+ }
306
+ }
298
307
  const componentsDir = import_path.default.join(targetDir, "src", "components");
299
308
  if (!import_fs.default.existsSync(componentsDir)) import_fs.default.mkdirSync(componentsDir, { recursive: true });
300
309
  import_fs.default.writeFileSync(import_path.default.join(componentsDir, "FileManagerDemo.tsx"), TEMPLATE, "utf-8");
package/dist/cli.js CHANGED
@@ -17,11 +17,11 @@ var askQuestion = (query) => {
17
17
  };
18
18
  var TEMPLATE = `"use client";
19
19
 
20
- import React, { Suspense } from "react";
20
+ import React, { Suspense, useMemo } from "react";
21
21
  import { FileManager, MockProvider } from "@unciatech/file-manager";
22
22
 
23
23
  export default function FileManagerDemo() {
24
- const mockProvider = new MockProvider();
24
+ const provider = useMemo(() => new MockProvider(), []);
25
25
 
26
26
  return (
27
27
  <div className="h-screen w-full">
@@ -29,7 +29,7 @@ export default function FileManagerDemo() {
29
29
  <FileManager
30
30
  allowedFileTypes={["audios", "videos", "images", "files"]}
31
31
  viewMode="grid"
32
- provider={mockProvider}
32
+ provider={provider}
33
33
  />
34
34
  </Suspense>
35
35
  </div>
@@ -254,7 +254,7 @@ async function scaffoldVite(projectName2, targetDir) {
254
254
  execSync(`npm create vite@latest ${projectName2} -- --template react-ts`, { stdio: "inherit" });
255
255
  console.log("\n\u{1F4E6} Installing dependencies (Tailwind + File Manager)...");
256
256
  execSync("npm install", { cwd: targetDir, stdio: "inherit" });
257
- execSync("npm install tailwindcss @tailwindcss/vite @unciatech/file-manager", { cwd: targetDir, stdio: "inherit" });
257
+ execSync("npm install @unciatech/file-manager tailwindcss @tailwindcss/vite tw-animate-css", { cwd: targetDir, stdio: "inherit" });
258
258
  const viteConfigPath = path.join(targetDir, "vite.config.ts");
259
259
  const viteConfig = `import { defineConfig } from 'vite'
260
260
  import react from '@vitejs/plugin-react'
@@ -270,8 +270,17 @@ export default defineConfig({
270
270
  fs.writeFileSync(viteConfigPath, viteConfig);
271
271
  const cssPath = path.join(targetDir, "src", "index.css");
272
272
  fs.writeFileSync(cssPath, `@import "tailwindcss";
273
- @source "../../node_modules/@unciatech/file-manager/dist";
273
+ @source "../node_modules/@unciatech/file-manager/dist/**/*.{js,ts,jsx,tsx}";
274
274
  `);
275
+ const mainPath = path.join(targetDir, "src", "main.tsx");
276
+ if (fs.existsSync(mainPath)) {
277
+ let mainContent = fs.readFileSync(mainPath, "utf8");
278
+ if (!mainContent.includes("@unciatech/file-manager/styles")) {
279
+ mainContent = `import '@unciatech/file-manager/styles';
280
+ ` + mainContent;
281
+ fs.writeFileSync(mainPath, mainContent);
282
+ }
283
+ }
275
284
  const componentsDir = path.join(targetDir, "src", "components");
276
285
  if (!fs.existsSync(componentsDir)) fs.mkdirSync(componentsDir, { recursive: true });
277
286
  fs.writeFileSync(path.join(componentsDir, "FileManagerDemo.tsx"), TEMPLATE, "utf-8");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unciatech/file-manager",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Modern file manager component for React and Next.js",
5
5
  "author": "Avi",
6
6
  "license": "MIT",