create-vitnode-app 0.0.9-canary.4 → 0.0.9-canary.41

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 (38) hide show
  1. package/README.md +3 -3
  2. package/dist/index.cjs +35 -34
  3. package/eslint.config.mjs +9 -0
  4. package/package.json +5 -5
  5. package/templates/basic/.env.template +16 -0
  6. package/templates/basic/.gitignore_template +0 -10
  7. package/templates/basic/apps/backend/codegen.ts +1 -1
  8. package/templates/basic/apps/backend/drizzle.config.ts +1 -2
  9. package/templates/basic/apps/backend/src/app.module.ts +5 -6
  10. package/templates/basic/apps/backend/src/{database.ts → database/config.ts} +5 -5
  11. package/templates/basic/apps/backend/src/database/database.module.ts +17 -0
  12. package/templates/basic/apps/backend/src/{database.service.ts → database/database.service.ts} +1 -1
  13. package/templates/basic/apps/backend/src/main.ts +6 -6
  14. package/templates/basic/apps/backend/src/plugins/plugins.module.ts +1 -1
  15. package/templates/basic/apps/backend/src/plugins/welcome/config.json +2 -2
  16. package/templates/basic/apps/frontend/global.d.ts +5 -4
  17. package/templates/basic/apps/frontend/src/app/[locale]/(main)/not-found.tsx +5 -0
  18. package/templates/basic/apps/frontend/src/app/[locale]/error.tsx +7 -0
  19. package/templates/basic/apps/frontend/{app → src/app/[locale]}/global.css +8 -8
  20. package/templates/basic/apps/frontend/{app → src/app}/[locale]/layout.tsx +1 -1
  21. package/templates/basic/apps/frontend/{app → src/app}/layout.tsx +0 -2
  22. package/templates/basic/apps/frontend/src/plugins/welcome/templates/default-page.tsx +39 -0
  23. package/templates/basic/apps/frontend/tailwind.config.ts +5 -5
  24. package/templates/basic/apps/frontend/tsconfig.json +1 -1
  25. package/templates/basic/turbo.json +2 -1
  26. package/templates/eslint/apps/backend/eslint.config.mjs +4 -0
  27. package/templates/eslint/apps/frontend/eslint.config.mjs +4 -0
  28. package/templates/basic/.env_template +0 -5
  29. package/templates/basic/apps/backend/src/plugins/welcome/admin/database/functions.ts +0 -6
  30. package/templates/basic/apps/frontend/plugins/welcome/templates/default-page.tsx +0 -38
  31. package/templates/eslint/apps/backend/.eslintrc.json +0 -5
  32. package/templates/eslint/apps/frontend/.eslintrc.json +0 -4
  33. /package/templates/basic/apps/frontend/{app/[locale] → src/app/[locale]/(main)}/error.tsx +0 -0
  34. /package/templates/basic/apps/frontend/{app → src/app}/[locale]/(main)/layout.tsx +0 -0
  35. /package/templates/basic/apps/frontend/{i18n.ts → src/i18n.ts} +0 -0
  36. /package/templates/basic/apps/frontend/{middleware.ts → src/middleware.ts} +0 -0
  37. /package/templates/basic/apps/frontend/{plugins → src/plugins}/welcome/langs/en.json +0 -0
  38. /package/templates/basic/apps/frontend/{plugins → src/plugins}/welcome/langs/pl.json +0 -0
@@ -0,0 +1,9 @@
1
+ // @ts-check
2
+ import eslintVitNode from 'eslint-config-typescript-vitnode/eslint.shared.mjs';
3
+
4
+ export default [
5
+ ...eslintVitNode,
6
+ {
7
+ ignores: ['tsup.config.ts', 'templates'],
8
+ },
9
+ ];
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "create-vitnode-app",
3
- "version": "0.0.9-canary.4",
3
+ "version": "0.0.9-canary.41",
4
4
  "description": "Create a new VitNode app in seconds.",
5
5
  "author": "VitNode Team",
6
6
  "license": "MIT",
7
7
  "homepage": "https://vitnode.com",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/aXenDeveloper/VitNode.git",
10
+ "url": "git+https://github.com/VitNode/vitnode.git",
11
11
  "directory": "packages/create-vitnode-app"
12
12
  },
13
13
  "type": "module",
@@ -34,15 +34,15 @@
34
34
  "devDependencies": {
35
35
  "@types/cross-spawn": "^6.0.6",
36
36
  "@types/figlet": "^1.5.8",
37
- "@types/node": "^22.1.0",
37
+ "@types/node": "^22.5.1",
38
38
  "@types/prompts": "^2.4.9",
39
39
  "@types/validate-npm-package-name": "^4.0.2",
40
40
  "commander": "^12.1.0",
41
41
  "cross-spawn": "^7.0.3",
42
- "ora": "^8.0.1",
42
+ "ora": "^8.1.0",
43
43
  "tsup": "^8.2.4",
44
44
  "typescript": "^5.5.4",
45
- "eslint-config-typescript-vitnode": "0.0.9-canary.4"
45
+ "eslint-config-typescript-vitnode": "0.0.9-canary.41"
46
46
  },
47
47
  "scripts": {
48
48
  "lint": "eslint .",
@@ -0,0 +1,16 @@
1
+ NEXT_PUBLIC_BACKEND_URL=http://localhost:8080
2
+ NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000
3
+
4
+ # ! Database
5
+ DB_USER=root
6
+ DB_PASSWORD=root
7
+ # DB_HOST=database
8
+ # DB_DATABASE=vitnode
9
+ # DB_PORT=5432
10
+ # DB_SSL=false
11
+
12
+ # !!! SECIURE ENVIRONMENT VARIABLES !!!
13
+ # Automatically generated by create-vitnode-app
14
+ # Do not change this environment below, unless you know what you are doing
15
+ # Changing these values may break your session and other security features
16
+ LOGIN_TOKEN_SECRET=vitnode_secret
@@ -52,17 +52,7 @@ yarn-error.log*
52
52
  /apps/backend/schema.gql
53
53
 
54
54
  ## Configuration
55
- /apps/backend/src/plugins/*/admin/database/migrations
56
55
  /apps/backend/src/plugins/core/
57
56
 
58
57
  ## Frontend
59
- /apps/frontend/app/not-found.tsx
60
- /apps/frontend/app/\[\locale\]\/(main)/(vitnode)
61
- /apps/frontend/app/\[\locale\]\/(main)/page.tsx
62
- /apps/frontend/app/\[\locale\]\/admin/layout.tsx
63
- /apps/frontend/app/\[\locale\]\/admin/(vitnode)
64
- /apps/frontend/app/\[\locale\]\/admin/(auth)/(vitnode)
65
- /apps/frontend/app/\[\locale\]\/admin/(auth)/layout.tsx
66
- /apps/frontend/plugins/admin
67
- /apps/frontend/plugins/core
68
58
  /apps/frontend/next-env.d.ts
@@ -4,7 +4,7 @@ import { codegenConfig } from 'vitnode-backend';
4
4
  import { CodegenConfig } from '@graphql-codegen/cli';
5
5
 
6
6
  const config: CodegenConfig = codegenConfig({
7
- pathOutGql: join(process.cwd(), '..', 'frontend', 'graphql'),
7
+ pathOutGql: join(process.cwd(), '..', 'frontend', 'src', 'graphql'),
8
8
  });
9
9
 
10
10
  export default config;
@@ -1,7 +1,6 @@
1
+ import { DATABASE_ENVS } from '@/database/config';
1
2
  import { defineConfig } from 'drizzle-kit';
2
3
 
3
- import { DATABASE_ENVS } from '@/database';
4
-
5
4
  export default defineConfig({
6
5
  dialect: 'postgresql',
7
6
  dbCredentials: DATABASE_ENVS,
@@ -1,22 +1,21 @@
1
- import { join } from 'path';
2
-
3
1
  import { Module } from '@nestjs/common';
2
+ import { join } from 'path';
4
3
  import { VitNodeCoreModule } from 'vitnode-backend';
5
4
 
5
+ import { DATABASE_ENVS, schemaDatabase } from './database/config';
6
+ import { DatabaseModule } from './database/database.module';
6
7
  import { PluginsModule } from './plugins/plugins.module';
7
- import { DATABASE_ENVS, schemaDatabase } from './database';
8
8
 
9
9
  @Module({
10
10
  imports: [
11
11
  VitNodeCoreModule.register({
12
- paths: {
13
- envFile: join(process.cwd(), '..', '..', '.env'),
14
- },
12
+ pathToEnvFile: join(process.cwd(), '..', '..', '.env'),
15
13
  database: {
16
14
  config: DATABASE_ENVS,
17
15
  schemaDatabase,
18
16
  },
19
17
  }),
18
+ DatabaseModule,
20
19
  PluginsModule,
21
20
  ],
22
21
  })
@@ -1,4 +1,4 @@
1
- // ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
1
+ // ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
2
2
  import tableCore from '@/plugins/core/admin/database/index';
3
3
  import tableWelcome from '@/plugins/welcome/admin/database/index';
4
4
  // ! === IMPORT ===
@@ -10,10 +10,10 @@ export const schemaDatabase = {
10
10
  };
11
11
 
12
12
  export const DATABASE_ENVS = {
13
- host: process.env.DB_HOST || 'localhost',
13
+ host: process.env.DB_HOST ?? 'localhost',
14
14
  port: process.env.DB_PORT ? +process.env.DB_PORT : 5432,
15
- user: process.env.DB_USER || 'root',
16
- password: process.env.DB_PASSWORD || 'root',
17
- database: process.env.DB_DATABASE || 'vitnode',
15
+ user: process.env.DB_USER ?? 'root',
16
+ password: process.env.DB_PASSWORD ?? 'root',
17
+ database: process.env.DB_DATABASE ?? 'vitnode',
18
18
  ssl: process.env.DB_SSL ? process.env.DB_SSL === 'true' : false,
19
19
  };
@@ -0,0 +1,17 @@
1
+ import { Global, Module } from '@nestjs/common';
2
+
3
+ import { DATABASE_ENVS, schemaDatabase } from './config';
4
+ import { DatabaseService } from './database.service';
5
+
6
+ @Global()
7
+ @Module({
8
+ providers: [
9
+ {
10
+ provide: 'DATABASE_MODULE_OPTIONS',
11
+ useValue: { config: DATABASE_ENVS, schemaDatabase },
12
+ },
13
+ DatabaseService,
14
+ ],
15
+ exports: [DatabaseService],
16
+ })
17
+ export class DatabaseModule {}
@@ -1,7 +1,7 @@
1
1
  import { Injectable } from '@nestjs/common';
2
2
  import { InternalDatabaseService } from 'vitnode-backend';
3
3
 
4
- import { schemaDatabase } from './database';
4
+ import { schemaDatabase } from './config';
5
5
 
6
6
  @Injectable()
7
7
  export class DatabaseService extends InternalDatabaseService<
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-console */
2
- import { NestFactory } from '@nestjs/core';
3
2
  import { INestApplication } from '@nestjs/common';
3
+ import { NestFactory } from '@nestjs/core';
4
4
  import { nestjsMainApp } from 'vitnode-backend';
5
5
 
6
6
  import { AppModule } from './app.module';
@@ -18,10 +18,10 @@ async function bootstrap() {
18
18
  },
19
19
  });
20
20
 
21
- await app.listen(process.env.PORT ?? '8080', '', () => {
22
- console.log(
23
- `Application is running on: http://localhost:${process.env.PORT ?? 8080}/graphql`,
24
- );
21
+ const port = Number(process.env.PORT) || 8080;
22
+ await app.listen(port, '', () => {
23
+ console.log(`Application is running on: http://localhost:${port}/graphql`);
25
24
  });
26
25
  }
27
- bootstrap();
26
+
27
+ void bootstrap();
@@ -1,4 +1,4 @@
1
- // ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
1
+ // ! DO NOT TOUCH THIS FILE!!! IT IS GENERATED BY VITNODE-CLI
2
2
 
3
3
  import { Module } from '@nestjs/common';
4
4
 
@@ -6,7 +6,7 @@
6
6
  "code": "welcome",
7
7
  "author": "VitNode",
8
8
  "author_url": "https://vitnode.com/",
9
- "support_url": "https://github.com/aXenDeveloper/vitnode/issues",
9
+ "support_url": "https://github.com/VitNode/vitnode/issues",
10
10
  "allow_default": true,
11
11
  "nav": []
12
- }
12
+ }
@@ -1,8 +1,9 @@
1
- import type core from '@/plugins/core/langs/en.json';
2
- import type welcome from '@/plugins/welcome/langs/en.json';
3
- import type admin from '@/plugins/admin/langs/en.json';
1
+ import core from '@/plugins/core/langs/en.json';
2
+ import admin from '@/plugins/admin/langs/en.json';
3
+ import welcome from '@/plugins/welcome/langs/en.json';
4
+ // ! === IMPORT ===
4
5
 
5
- type Messages = typeof core & typeof admin & typeof welcome;
6
+ type Messages = typeof core & typeof admin & typeof welcome; // ! === MODULE ===
6
7
 
7
8
  declare global {
8
9
  interface IntlMessages extends Messages {}
@@ -0,0 +1,5 @@
1
+ import { ErrorView } from 'vitnode-frontend/views/theme/views/error/error-view';
2
+
3
+ export default function NotFoundPage() {
4
+ return <ErrorView code="404" />;
5
+ }
@@ -0,0 +1,7 @@
1
+ 'use client';
2
+
3
+ import { ErrorView } from 'vitnode-frontend/views/theme/views/error/error-view';
4
+
5
+ export default function Error() {
6
+ return <ErrorView code="500" />;
7
+ }
@@ -42,23 +42,23 @@
42
42
  }
43
43
 
44
44
  .dark {
45
- --background: 216 32% 7%;
45
+ --background: 220 11% 6%;
46
46
  --foreground: 0 0% 98%;
47
- --card: 216 32% 10%;
47
+ --card: 225 11% 8%;
48
48
  --card-foreground: 0 0% 98%;
49
49
  /* --popover: var(--card); */
50
50
  /* --popover-foreground: var(--card-foreground); */
51
51
  --primary: 220 83% 60%;
52
52
  --primary-foreground: 220 40% 98%;
53
- --secondary: 222 25% 18%;
53
+ --secondary: 216 10% 18%;
54
54
  --secondary-foreground: 0 0% 98%;
55
- --muted: 216 32% 11%;
56
- --muted-foreground: 216 18% 64%;
57
- --accent: 216 32% 14%;
55
+ --muted: 228 11% 12%;
56
+ --muted-foreground: 216 0% 68%;
57
+ --accent: 228 11% 14%;
58
58
  --accent-foreground: 0 0% 98%;
59
- --destructive: 359 78% 55%;
59
+ --destructive: 359 75% 60%;
60
60
  --destructive-foreground: 210 40% 98%;
61
- --border: 216 25% 16%;
61
+ --border: 228 10% 16%;
62
62
  /* --input: var(--border); */
63
63
  /* --ring: var(--primary); */
64
64
  --cover: 216 64% 39%;
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
1
  import { GeistSans } from 'geist/font/sans';
3
2
  import {
4
3
  RootLayout,
5
4
  RootLayoutProps,
6
5
  generateMetadataRootLayout,
7
6
  } from 'vitnode-frontend/views/layout/root-layout';
7
+ import './global.css';
8
8
 
9
9
  export const generateMetadata = generateMetadataRootLayout;
10
10
 
@@ -1,5 +1,3 @@
1
- import './global.css';
2
-
3
1
  export default async function RootLayout({
4
2
  children,
5
3
  }: {
@@ -0,0 +1,39 @@
1
+ import { LogoVitNode } from 'vitnode-frontend/components/logo-vitnode';
2
+ import { Button } from 'vitnode-frontend/components/ui/button';
3
+ import { Link } from 'vitnode-frontend/navigation';
4
+
5
+ export default function DefaultPage() {
6
+ return (
7
+ <main className="container my-10 flex max-w-5xl flex-wrap items-center justify-between gap-8 px-8 sm:px-16">
8
+ <div className="max-w-md space-y-4">
9
+ <h1 className="text-balance text-3xl font-bold tracking-tight md:text-4xl">
10
+ Ready to build?
11
+ </h1>
12
+
13
+ <p className="text-muted-foreground text-pretty">
14
+ Dive in and create install or your first plugin!
15
+ </p>
16
+
17
+ <div className="flex flex-wrap items-center gap-2 md:gap-4">
18
+ <Button className="rounded-full px-6" asChild>
19
+ <Link href="/admin" target="_blank">
20
+ Go to AdminCP
21
+ </Link>
22
+ </Button>
23
+
24
+ <Button className="rounded-full px-6" variant="ghost" asChild>
25
+ <Link
26
+ href="https://vitnode.com/docs"
27
+ target="_blank"
28
+ rel="noopener noreferrer"
29
+ >
30
+ Read our Docs
31
+ </Link>
32
+ </Button>
33
+ </div>
34
+ </div>
35
+
36
+ <LogoVitNode className="w-60" />
37
+ </main>
38
+ );
39
+ }
@@ -4,11 +4,11 @@ import vitnodeConfig from 'vitnode-frontend/tailwind.config';
4
4
  const config = {
5
5
  presets: [vitnodeConfig],
6
6
  content: [
7
- '../../node_modules/vitnode-frontend/src/components/**/*.tsx',
8
- '../../node_modules/vitnode-frontend/src/views/**/*.tsx',
9
- './components/**/*.{ts,tsx}',
10
- './app/**/*.{ts,tsx}',
11
- './plugins/**/templates/**/*.{ts,tsx}',
7
+ './node_modules/vitnode-frontend/src/components/**/*.tsx',
8
+ './node_modules/vitnode-frontend/src/views/**/*.tsx',
9
+ './src/components/**/*.tsx',
10
+ './src/app/**/*.tsx',
11
+ './src/plugins/**/templates/**/*.tsx',
12
12
  ],
13
13
  } satisfies Config;
14
14
 
@@ -12,7 +12,7 @@
12
12
  }
13
13
  ],
14
14
  "paths": {
15
- "@/*": ["./*"]
15
+ "@/*": ["./src/*"]
16
16
  }
17
17
  },
18
18
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"]
@@ -11,7 +11,8 @@
11
11
  "persistent": true
12
12
  },
13
13
  "codegen": {
14
- "dependsOn": ["^codegen"]
14
+ "dependsOn": ["^codegen"],
15
+ "cache": false
15
16
  },
16
17
  "config:init": {
17
18
  "dependsOn": ["^config:init"]
@@ -0,0 +1,4 @@
1
+ // @ts-check
2
+ import eslintVitNode from 'eslint-config-typescript-vitnode/eslint.shared.mjs';
3
+
4
+ export default [...eslintVitNode];
@@ -0,0 +1,4 @@
1
+ // @ts-check
2
+ import eslintVitNode from 'eslint-config-typescript-vitnode/eslint.react.mjs';
3
+
4
+ export default [...eslintVitNode];
@@ -1,5 +0,0 @@
1
- # !!! SECIURE ENVIRONMENT VARIABLES !!!
2
- # Automatically generated by create-vitnode-app
3
- # Do not change this environment below, unless you know what you are doing
4
- # Changing these values may break your session and other security features
5
- LOGIN_TOKEN_SECRET=vitnode_secret
@@ -1,6 +0,0 @@
1
- // ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
2
- import { default as tables } from './index';
3
-
4
- export const getTables = () => {
5
- return Object.keys(tables);
6
- };
@@ -1,38 +0,0 @@
1
- import { LogoVitNode } from 'vitnode-frontend/components/logo-vitnode';
2
- import { buttonVariants } from 'vitnode-frontend/components/ui/button';
3
- import { Link } from 'vitnode-frontend/navigation';
4
- import { BookIcon, KeyRoundIcon } from 'lucide-react';
5
-
6
- export default function DefaultPage() {
7
- return (
8
- <main className="container mt-10 flex max-w-lg flex-col items-center justify-center gap-8 text-center">
9
- <LogoVitNode className="w-48" />
10
-
11
- <div className="space-y-1">
12
- <h1 className="text-3xl font-bold">Ready to build?</h1>
13
-
14
- <p className="text-muted-foreground">
15
- Dive in and install your first plugin! Or, if you&apos;re feeling
16
- adventurous, create your own masterpiece.
17
- </p>
18
- </div>
19
-
20
- <div className="flex flex-wrap items-center justify-center gap-4">
21
- <Link href="/admin" target="_blank" className={buttonVariants()}>
22
- <KeyRoundIcon /> Go to AdminCP
23
- </Link>
24
-
25
- <Link
26
- href="https://vitnode.com/"
27
- target="_blank"
28
- rel="noopener noreferrer"
29
- className={buttonVariants({
30
- variant: 'ghost',
31
- })}
32
- >
33
- <BookIcon /> Read our Docs
34
- </Link>
35
- </div>
36
- </main>
37
- );
38
- }
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/eslintrc",
3
- "extends": ["eslint-config-typescript-vitnode/.eslintrc.shared.json"],
4
- "ignorePatterns": ["uploads"]
5
- }
@@ -1,4 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/eslintrc",
3
- "extends": ["eslint-config-typescript-vitnode/.eslintrc.react.json"]
4
- }