@newt-app/templates 0.4.0 → 0.5.0

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 (2) hide show
  1. package/dist/index.js +41 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -178,7 +178,7 @@ Open [http://localhost:3000](http://localhost:3000).
178
178
  // src/root/templates/env-example.ts
179
179
  var env_example_default = {
180
180
  filename: ".env",
181
- template: `DATABASE_URL=postgresql://user:password@localhost:5432/dbname
181
+ template: `DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
182
182
  BETTER_AUTH_URL=http://localhost:3000
183
183
  BETTER_AUTH_SECRET=your-secret-here`
184
184
  };
@@ -1081,7 +1081,10 @@ import { AppModule } from './app.module';
1081
1081
  async function bootstrap() {
1082
1082
  const app = await NestFactory.create(AppModule, { bodyParser: false });
1083
1083
  app.setGlobalPrefix('api');
1084
- app.enableCors({ origin: 'http://localhost:3000', credentials: true });
1084
+ app.enableCors({
1085
+ origin: process.env.CORS_ORIGIN ?? 'http://localhost:3000',
1086
+ credentials: true,
1087
+ });
1085
1088
  await app.listen(process.env.PORT ?? 3001);
1086
1089
  }
1087
1090
  void bootstrap();`
@@ -1973,6 +1976,7 @@ import { AuthForm } from '@/app/auth-form';
1973
1976
  import { Link } from '@<%= projectName %>/ui/link';
1974
1977
  import { Logo } from '@<%= projectName %>/ui/logo';
1975
1978
  import { TodoList } from '@/app/todo-list';
1979
+ import { ModeToggle } from '@<%= projectName %>/ui/mode-toggle';
1976
1980
  import { Card, CardContent, CardHeader, CardTitle } from '@<%= projectName %>/ui/card';
1977
1981
 
1978
1982
  export default function Home() {
@@ -1985,9 +1989,12 @@ export default function Home() {
1985
1989
 
1986
1990
  return (
1987
1991
  <main className="max-w-lg mx-auto min-h-full px-4 py-8 space-y-4">
1988
- <div className="pb-4 border-b">
1989
- <p className="font-mono text-sm text-muted-foreground">apps/web/page.tsx</p>
1990
- <p className="text-sm text-muted-foreground">Delete me to get started!</p>
1992
+ <div className="pb-4 border-b flex items-start justify-between">
1993
+ <div>
1994
+ <p className="font-mono text-sm text-muted-foreground">apps/web/page.tsx</p>
1995
+ <p className="text-sm text-muted-foreground">Delete me to get started!</p>
1996
+ </div>
1997
+ <ModeToggle />
1991
1998
  </div>
1992
1999
 
1993
2000
  <div className="flex items-center gap-3 py-2">
@@ -7869,6 +7876,33 @@ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
7869
7876
  `
7870
7877
  };
7871
7878
 
7879
+ // src/shadcn-ui/templates/mode-toggle.ts
7880
+ var mode_toggle_default = {
7881
+ filename: "packages/ui/src/components/mode-toggle.tsx",
7882
+ template: `'use client';
7883
+
7884
+ import { Moon, Sun } from 'lucide-react';
7885
+ import { useTheme } from 'next-themes';
7886
+ import { Button } from '@<%= projectName %>/ui/button';
7887
+
7888
+ export function ModeToggle() {
7889
+ const { resolvedTheme, setTheme } = useTheme();
7890
+
7891
+ return (
7892
+ <Button
7893
+ variant="ghost"
7894
+ size="icon"
7895
+ onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}
7896
+ >
7897
+ <Sun className="hidden dark:block" />
7898
+ <Moon className="block dark:hidden" />
7899
+ <span className="sr-only">Toggle theme</span>
7900
+ </Button>
7901
+ );
7902
+ }
7903
+ `
7904
+ };
7905
+
7872
7906
  // src/shadcn-ui/index.ts
7873
7907
  var shadcnUi = {
7874
7908
  templates: [
@@ -7931,7 +7965,8 @@ var shadcnUi = {
7931
7965
  textarea_default,
7932
7966
  toggle_group_default,
7933
7967
  toggle_default,
7934
- tooltip_default
7968
+ tooltip_default,
7969
+ mode_toggle_default
7935
7970
  ],
7936
7971
  packages: [
7937
7972
  { package: "next-themes", module: "apps/web", version: "^0.4.6" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newt-app/templates",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "private": false,
5
5
  "description": "Templates for newt-app",
6
6
  "type": "module",