create-next-pro-cli 0.1.13 → 0.1.14

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 (65) hide show
  1. package/README.md +1 -0
  2. package/bin.ts +0 -0
  3. package/install.sh +1 -0
  4. package/package.json +6 -4
  5. package/src/index.ts +0 -67
  6. package/src/lib/addComponent.ts +0 -139
  7. package/src/lib/addPage.ts +0 -201
  8. package/src/lib/createProject.ts +0 -18
  9. package/src/lib/createProjectWithPrompt.ts +0 -79
  10. package/src/lib/rmPage.ts +0 -52
  11. package/src/lib/utils.test.ts +0 -23
  12. package/src/lib/utils.ts +0 -60
  13. package/src/scaffold-dev.ts +0 -89
  14. package/src/scaffold.ts +0 -86
  15. package/templates/Projects/default/src/app/[locale]/(public)/Login/page.tsx +0 -6
  16. package/templates/Projects/default/src/app/[locale]/(public)/Register/page.tsx +0 -6
  17. package/templates/Projects/default/src/app/[locale]/(public)/_home/loading.tsx +0 -5
  18. package/templates/Projects/default/src/app/[locale]/(public)/_home/page.tsx +0 -6
  19. package/templates/Projects/default/src/app/[locale]/(public)/layout.tsx +0 -9
  20. package/templates/Projects/default/src/app/[locale]/(user)/Dashboard/error.tsx +0 -38
  21. package/templates/Projects/default/src/app/[locale]/(user)/Dashboard/loading.tsx +0 -10
  22. package/templates/Projects/default/src/app/[locale]/(user)/Dashboard/page.tsx +0 -5
  23. package/templates/Projects/default/src/app/[locale]/(user)/Settings/loading.tsx +0 -17
  24. package/templates/Projects/default/src/app/[locale]/(user)/Settings/page.tsx +0 -6
  25. package/templates/Projects/default/src/app/[locale]/(user)/UserInfo/loading.tsx +0 -17
  26. package/templates/Projects/default/src/app/[locale]/(user)/UserInfo/page.tsx +0 -6
  27. package/templates/Projects/default/src/app/[locale]/(user)/layout.tsx +0 -9
  28. package/templates/Projects/default/src/app/[locale]/layout.tsx +0 -31
  29. package/templates/Projects/default/src/app/[locale]/loading.tsx +0 -14
  30. package/templates/Projects/default/src/app/[locale]/not-found.tsx +0 -22
  31. package/templates/Projects/default/src/app/[locale]/page.tsx +0 -6
  32. package/templates/Projects/default/src/app/api/auth/[...nextauth]/route.ts +0 -62
  33. package/templates/Projects/default/src/app/api/auth/post-login/route.ts +0 -26
  34. package/templates/Projects/default/src/app/favicon.ico +0 -0
  35. package/templates/Projects/default/src/app/layout.tsx +0 -11
  36. package/templates/Projects/default/src/app/not-found.tsx +0 -17
  37. package/templates/Projects/default/src/app/page.tsx +0 -6
  38. package/templates/Projects/default/src/app/sitemap.ts +0 -27
  39. package/templates/Projects/default/src/app/styles/globals.css +0 -305
  40. package/templates/Projects/default/src/auth.config.ts +0 -0
  41. package/templates/Projects/default/src/config.ts +0 -4
  42. package/templates/Projects/default/src/lib/auth/disconnect.ts +0 -11
  43. package/templates/Projects/default/src/lib/auth/isConnected.ts +0 -18
  44. package/templates/Projects/default/src/lib/i18n/navigation.ts +0 -19
  45. package/templates/Projects/default/src/lib/i18n/request.ts +0 -31
  46. package/templates/Projects/default/src/lib/i18n/routing.ts +0 -20
  47. package/templates/Projects/default/src/lib/utils.ts +0 -6
  48. package/templates/Projects/default/src/ui/Dashboard/LogoutButton.tsx +0 -27
  49. package/templates/Projects/default/src/ui/Dashboard/StatsCard.tsx +0 -14
  50. package/templates/Projects/default/src/ui/Dashboard/WelcomeCard.tsx +0 -10
  51. package/templates/Projects/default/src/ui/Dashboard/page-ui.tsx +0 -23
  52. package/templates/Projects/default/src/ui/Login/page-ui.tsx +0 -22
  53. package/templates/Projects/default/src/ui/Register/page-ui.tsx +0 -26
  54. package/templates/Projects/default/src/ui/Settings/page-ui.tsx +0 -17
  55. package/templates/Projects/default/src/ui/UserInfo/page-ui.tsx +0 -17
  56. package/templates/Projects/default/src/ui/_global/BackButton.tsx +0 -17
  57. package/templates/Projects/default/src/ui/_global/Button.tsx +0 -75
  58. package/templates/Projects/default/src/ui/_global/GlobalHeader.tsx +0 -55
  59. package/templates/Projects/default/src/ui/_global/GlobalMain.tsx +0 -15
  60. package/templates/Projects/default/src/ui/_global/Loading.tsx +0 -13
  61. package/templates/Projects/default/src/ui/_global/LocaleSwitcher.tsx +0 -38
  62. package/templates/Projects/default/src/ui/_global/PublicNav.tsx +0 -91
  63. package/templates/Projects/default/src/ui/_global/ThemeToggle.tsx +0 -53
  64. package/templates/Projects/default/src/ui/_global/UserNav.tsx +0 -35
  65. package/templates/Projects/default/src/ui/_home/page-ui.tsx +0 -27
@@ -1,55 +0,0 @@
1
- "use client";
2
- import Image from "next/image";
3
- import UserNav from "@/ui/_global/UserNav";
4
- import LocaleSwitcher from "@/ui/_global/LocaleSwitcher";
5
- import PublicNav from "@/ui/_global/PublicNav";
6
- import { useEffect, useState } from "react";
7
- import { Link } from "@/lib/i18n/navigation";
8
- import { isConnected } from "@/lib/auth/isConnected";
9
-
10
- type GlobalHeaderProps = {
11
- isConnectedInitial: boolean;
12
- };
13
-
14
- export default function GlobalHeader({
15
- isConnectedInitial,
16
- }: GlobalHeaderProps) {
17
- const [isConnectedState, setIsConnectedState] = useState(isConnectedInitial);
18
-
19
- // Vérification dynamique côté client (exemple via /api/me)
20
- useEffect(() => {
21
- async function checkConnection() {
22
- setIsConnectedState(await isConnected());
23
- }
24
- checkConnection();
25
- // Optionnel : timer pour rafraîchir périodiquement
26
- // const interval = setInterval(checkConnection, 60000);
27
- // return () => clearInterval(interval);
28
- }, []);
29
-
30
- return (
31
- <header className="fixed top-0 w-full z-50 glass-effect border-b">
32
- <div className="mx-auto flex h-16 max-w-6xl items-center justify-between px-6">
33
- <Link href="/" className="">
34
- <div className="flex items-center h-16">
35
- <Image
36
- src="/cnp-logo.svg"
37
- alt="Logo"
38
- width={63}
39
- height={63}
40
- className="mr-2"
41
- />
42
- <h1 className="text-lg font-semibold tracking-tight select-none">
43
- Create Next Pro
44
- </h1>
45
- </div>
46
- </Link>
47
-
48
- {isConnectedState ? <UserNav /> : <PublicNav />}
49
- <div className="flex items-center h-16">
50
- <LocaleSwitcher />
51
- </div>
52
- </div>
53
- </header>
54
- );
55
- }
@@ -1,15 +0,0 @@
1
- import React from "react";
2
-
3
- export default function GlobalMain({
4
- children,
5
- }: {
6
- children: React.ReactNode;
7
- }) {
8
- return (
9
- <main className="mt-0 min-h-screen bg-neutral-50 font-sans text-gray-900 flex flex-col">
10
- <div className="flex-1 flex flex-col justify-center items-stretch mx-auto w-full px-6 self-stretch">
11
- {children}
12
- </div>
13
- </main>
14
- );
15
- }
@@ -1,13 +0,0 @@
1
- "use client"; // DO NOT FORGET , this is a client component.
2
- import { useTranslations } from "next-intl";
3
-
4
- const Loading = () => {
5
- const t = useTranslations("_global_ui");
6
- return (
7
- <div className="rounded border bg-white p-6 shadow-sm">
8
- <h2 className="text-lg font-semibold mb-2">{t("Loading.title")}</h2>
9
- <p className="text-gray-600">{t("Loading.description")}</p>
10
- </div>
11
- );
12
- };
13
- export default Loading;
@@ -1,38 +0,0 @@
1
- "use client"; // DO NOT FORGET , this is a client component.
2
- import { useRouter, usePathname } from "next/navigation";
3
- import { useParams } from "next/navigation";
4
-
5
- const locales = [
6
- { code: "fr", label: "Français" },
7
- { code: "en", label: "English" },
8
- ];
9
-
10
- export default function LocaleSwitcher() {
11
- const router = useRouter();
12
- const pathname = usePathname();
13
- const params = useParams();
14
- const currentLocale = params?.locale || "fr";
15
-
16
- const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
17
- const newLocale = e.target.value;
18
- if (newLocale === currentLocale) return;
19
- // Replace locale in pathname
20
- const newPath = pathname.replace(`/${currentLocale}`, `/${newLocale}`);
21
- router.push(newPath);
22
- };
23
-
24
- return (
25
- <select
26
- className="ml-2 ring rounded px-2 py-1 text-sm dark:bg-gray-800 dark:text-gray-200"
27
- value={currentLocale}
28
- onChange={handleChange}
29
- aria-label="Select language"
30
- >
31
- {locales.map((l) => (
32
- <option key={l.code} value={l.code}>
33
- {l.label}
34
- </option>
35
- ))}
36
- </select>
37
- );
38
- }
@@ -1,91 +0,0 @@
1
- "use client"; // DO NOT FORGET , this is a client component.
2
- import { Link } from "@/lib/i18n/navigation";
3
- import { useTranslations } from "next-intl";
4
- import { useEffect, useState, useRef } from "react";
5
- import { Button } from "@/ui/_global/Button";
6
- import ThemeToggle from "@/ui/_global/ThemeToggle";
7
- import { Menu, X } from "lucide-react";
8
-
9
- const navLinks = [
10
- { href: "/", labelKey: "public_nav.links.home" },
11
- { href: "/Login", labelKey: "public_nav.links.login" },
12
- { href: "/Register", labelKey: "public_nav.links.register" },
13
- ];
14
-
15
- const PublicNav = () => {
16
- const t = useTranslations("_global_ui");
17
- const [open, setOpen] = useState(false);
18
- const menuRef = useRef<HTMLDivElement>(null);
19
- useEffect(() => {
20
- const handleClickOutside = (event: MouseEvent) => {
21
- if (menuRef.current && !menuRef.current.contains(event.target as Node)) {
22
- setOpen(false);
23
- }
24
- };
25
-
26
- if (open) {
27
- document.addEventListener("mousedown", handleClickOutside);
28
- }
29
-
30
- return () => {
31
- document.removeEventListener("mousedown", handleClickOutside);
32
- };
33
- }, [open]);
34
-
35
- return (
36
- <nav aria-label="Public navigation">
37
- <div className="flex justify-between items-center h-16">
38
- <ul className="flex gap-2 md:gap-4 hidden md:flex items-center space-x-4">
39
- {navLinks.map((link) => (
40
- <li key={link.href}>
41
- <Link
42
- href={link.href}
43
- className="inline-block rounded px-3 py-1.5 text-sm font-medium dark:text-gray-400 light:text-gray-700 hover:text-blue-600 hover:bg-blue-50 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500"
44
- >
45
- {t(link.labelKey)}
46
- </Link>
47
- </li>
48
- ))}
49
- </ul>
50
- <div className="flex items-center space-x-4">
51
- <ThemeToggle />
52
- </div>
53
- <div className="md:hidden flex items-center">
54
- <Button
55
- variant="default"
56
- onClick={() => setOpen((o) => !o)}
57
- className="focus:outline-none"
58
- aria-label="Menu"
59
- >
60
- {open ? <X className="h-7 w-7" /> : <Menu className="h-7 w-7" />}
61
- </Button>
62
- </div>
63
- </div>
64
-
65
- {open && (
66
- <div className="fixed inset-0 z-40 md:hidden">
67
- <div className="absolute inset-0 bg-black/40" aria-hidden="true" />
68
- <div
69
- ref={menuRef}
70
- className="mobil-menu absolute top-4 left-1/2 -translate-x-1/2 flex flex-col gap-2 rounded-xl p-4 shadow-lg animate-fade-in z-50 w-11/12 max-w-xs"
71
- >
72
- <Link href="/Login" onClick={() => setOpen(false)}>
73
- <Button
74
- variant="ghost"
75
- className="w-full text-white justify-center hover:text-blue-300 cursor-pointer glass-effect"
76
- >
77
- {t("public_nav.links.login")}
78
- </Button>
79
- </Link>
80
- <Link href="/Register" onClick={() => setOpen(false)}>
81
- <Button className="w-full bg-gradient-to-r from-blue-500 to-purple-600 hover:from-blue-600 hover:to-purple-700 justify-center cursor-pointer">
82
- {t("public_nav.links.register")}
83
- </Button>
84
- </Link>
85
- </div>
86
- </div>
87
- )}
88
- </nav>
89
- );
90
- };
91
- export default PublicNav;
@@ -1,53 +0,0 @@
1
- "use client";
2
- import { useEffect, useState } from "react";
3
- import { Moon, Sun } from "lucide-react";
4
- import { Button } from "./Button";
5
-
6
- export default function ThemeToggle() {
7
- const [isDark, setIsDark] = useState(false);
8
-
9
- useEffect(() => {
10
- // Initial state from html class
11
- setIsDark(document.documentElement.classList.contains("dark"));
12
- }, []);
13
-
14
- const toggleTheme = () => {
15
- const html = document.documentElement;
16
- if (html.classList.contains("dark")) {
17
- html.classList.add("light");
18
- html.classList.remove("dark");
19
- setIsDark(false);
20
- localStorage.setItem("theme", "light");
21
- } else {
22
- html.classList.add("dark");
23
- html.classList.remove("light");
24
- setIsDark(true);
25
- localStorage.setItem("theme", "dark");
26
- }
27
- };
28
-
29
- useEffect(() => {
30
- // On mount, set theme from localStorage
31
- const theme = localStorage.getItem("theme");
32
- if (theme === "dark") {
33
- document.documentElement.classList.add("dark");
34
- document.documentElement.classList.remove("light");
35
- setIsDark(true);
36
- } else if (theme === "light") {
37
- document.documentElement.classList.add("light");
38
- document.documentElement.classList.remove("dark");
39
- setIsDark(false);
40
- }
41
- }, []);
42
-
43
- return (
44
- <Button
45
- onClick={toggleTheme}
46
- className="ml-2 p-2 rounded-full hover:bg-white/10 transition-colors "
47
- aria-label="Toggle theme"
48
- type="button"
49
- >
50
- {isDark ? <Sun className="h-5 w-5" /> : <Moon className="h-5 w-5" />}
51
- </Button>
52
- );
53
- }
@@ -1,35 +0,0 @@
1
- "use client"; // DO NOT FORGET , this is a client component.
2
- import { Link } from "@/lib/i18n/navigation";
3
- import { useTranslations } from "next-intl";
4
- import LogoutButton from "../Dashboard/LogoutButton";
5
-
6
- const navLinks = [
7
- { href: "/Dashboard", labelKey: "user_nav.links.dashboard" },
8
- { href: "/Settings", labelKey: "user_nav.links.settings" },
9
- { href: "/UserInfo", labelKey: "user_nav.links.user_info" },
10
- ];
11
-
12
- const UserNav = () => {
13
- const t = useTranslations("_global_ui");
14
- return (
15
- <nav aria-label="User navigation">
16
- <ul className="flex gap-2 md:gap-4 h-16 items-center">
17
- {navLinks.map((link) => (
18
- <li key={link.href}>
19
- <Link
20
- href={link.href}
21
- className="inline-block rounded px-3 py-1.5 text-sm font-medium text-gray-700 hover:text-blue-600 hover:bg-blue-50 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500"
22
- >
23
- {t(link.labelKey)}
24
- </Link>
25
- </li>
26
- ))}
27
- <li>
28
- <LogoutButton />
29
- </li>
30
- </ul>
31
- </nav>
32
- );
33
- };
34
-
35
- export default UserNav;
@@ -1,27 +0,0 @@
1
- // src/ui/_home/page-ui.tsx
2
- "use client";
3
-
4
- import { useTranslations } from "next-intl";
5
-
6
- export default function HomePageUI() {
7
- const t = useTranslations("_home");
8
-
9
- return (
10
- <>
11
- <section className="pt-32 pb-20 px-4 sm:px-6 lg:px-8 hero-pattern">
12
- <div className="max-w-7xl mx-auto">
13
- <div className="grid lg:grid-cols-2 gap-12 items-center">
14
- <h1 className="text-5xl lg:text-6xl font-bold mb-6 leading-tight">
15
- {t.rich("title", {
16
- span: (chunks) => (
17
- <span className="gradient-text">{chunks}</span>
18
- ),
19
- })}
20
- </h1>
21
- <p className="text-lg text-gray-400">{t("description")}</p>
22
- </div>
23
- </div>
24
- </section>
25
- </>
26
- );
27
- }