create-croissant 0.1.39 → 0.1.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.
- package/dist/index.js +5 -5
- package/package.json +7 -10
- package/template/.oxlintignore +11 -0
- package/template/README.md +6 -6
- package/template/apps/desktop/README.md +1 -1
- package/template/apps/desktop/electron-builder.yml +6 -6
- package/template/apps/desktop/electron.vite.config.ts +8 -8
- package/template/apps/desktop/package.json +4 -13
- package/template/apps/desktop/src/main/index.ts +32 -32
- package/template/apps/desktop/src/preload/index.d.ts +3 -3
- package/template/apps/desktop/src/preload/index.ts +8 -8
- package/template/apps/desktop/src/renderer/src/App.tsx +5 -5
- package/template/apps/desktop/src/renderer/src/assets/base.css +4 -4
- package/template/apps/desktop/src/renderer/src/assets/main.css +3 -3
- package/template/apps/desktop/src/renderer/src/components/Versions.tsx +4 -4
- package/template/apps/desktop/src/renderer/src/main.tsx +7 -7
- package/template/apps/desktop/tsconfig.json +1 -4
- package/template/apps/desktop/tsconfig.node.json +1 -1
- package/template/apps/desktop/tsconfig.web.json +4 -11
- package/template/apps/mobile/app/(tabs)/_layout.tsx +11 -10
- package/template/apps/mobile/app/(tabs)/explore.tsx +29 -27
- package/template/apps/mobile/app/(tabs)/index.tsx +25 -24
- package/template/apps/mobile/app/_layout.tsx +8 -8
- package/template/apps/mobile/app/modal.tsx +6 -6
- package/template/apps/mobile/components/external-link.tsx +5 -5
- package/template/apps/mobile/components/haptic-tab.tsx +4 -4
- package/template/apps/mobile/components/hello-wave.tsx +5 -4
- package/template/apps/mobile/components/parallax-scroll-view.tsx +15 -13
- package/template/apps/mobile/components/themed-text.tsx +14 -14
- package/template/apps/mobile/components/themed-view.tsx +3 -3
- package/template/apps/mobile/components/ui/collapsible.tsx +14 -13
- package/template/apps/mobile/components/ui/icon-symbol.ios.tsx +4 -4
- package/template/apps/mobile/components/ui/icon-symbol.tsx +9 -9
- package/template/apps/mobile/constants/theme.ts +19 -19
- package/template/apps/mobile/hooks/use-color-scheme.ts +1 -1
- package/template/apps/mobile/hooks/use-color-scheme.web.ts +3 -3
- package/template/apps/mobile/hooks/use-theme-color.ts +4 -4
- package/template/apps/mobile/package.json +3 -6
- package/template/apps/mobile/scripts/reset-project.js +2 -2
- package/template/apps/mobile/tsconfig.json +2 -9
- package/template/apps/platform/drizzle.config.ts +5 -5
- package/template/apps/platform/package.json +2 -6
- package/template/apps/platform/src/components/app-sidebar.tsx +60 -69
- package/template/apps/platform/src/components/login-form.tsx +32 -39
- package/template/apps/platform/src/components/search-form.tsx +5 -13
- package/template/apps/platform/src/components/signup-form.tsx +39 -49
- package/template/apps/platform/src/components/version-switcher.tsx +11 -21
- package/template/apps/platform/src/lib/auth-utils.ts +12 -14
- package/template/apps/platform/src/lib/orpc.ts +17 -17
- package/template/apps/platform/src/routeTree.gen.ts +264 -267
- package/template/apps/platform/src/router.tsx +5 -5
- package/template/apps/platform/src/routes/__root.tsx +13 -15
- package/template/apps/platform/src/routes/_auth/account.tsx +61 -50
- package/template/apps/platform/src/routes/_auth/dashboard.tsx +17 -17
- package/template/apps/platform/src/routes/_auth/examples/client-orpc-auth.tsx +13 -13
- package/template/apps/platform/src/routes/_auth/examples/ssr-orpc-auth.tsx +17 -17
- package/template/apps/platform/src/routes/_auth.tsx +5 -5
- package/template/apps/platform/src/routes/_public/examples/client-orpc.tsx +108 -88
- package/template/apps/platform/src/routes/_public/examples/isr.tsx +14 -14
- package/template/apps/platform/src/routes/_public/examples/ssr-orpc.tsx +92 -75
- package/template/apps/platform/src/routes/_public/index.tsx +22 -19
- package/template/apps/platform/src/routes/_public/login.tsx +4 -4
- package/template/apps/platform/src/routes/_public/signup.tsx +6 -5
- package/template/apps/platform/src/routes/_public.tsx +5 -5
- package/template/apps/platform/src/routes/api/auth/$.ts +13 -13
- package/template/apps/platform/src/routes/api/rpc.$.ts +13 -13
- package/template/apps/platform/tsconfig.json +1 -1
- package/template/apps/platform/vite.config.ts +8 -8
- package/template/docker-compose.yml +1 -1
- package/template/package.json +24 -22
- package/template/packages/auth/package.json +8 -12
- package/template/packages/auth/src/lib/auth.ts +1 -1
- package/template/packages/auth/tsconfig.json +1 -1
- package/template/packages/db/package.json +6 -10
- package/template/packages/db/src/index.ts +4 -4
- package/template/packages/db/src/schema.ts +2 -2
- package/template/packages/db/tsconfig.json +1 -1
- package/template/packages/orpc/package.json +6 -10
- package/template/packages/orpc/src/lib/planets.ts +39 -43
- package/template/packages/orpc/src/lib/router.ts +15 -15
- package/template/packages/orpc/tsconfig.json +1 -1
- package/template/packages/ui/package.json +8 -12
- package/template/packages/ui/src/components/accordion.tsx +20 -22
- package/template/packages/ui/src/components/alert-dialog.tsx +31 -56
- package/template/packages/ui/src/components/alert.tsx +15 -23
- package/template/packages/ui/src/components/aspect-ratio.tsx +3 -3
- package/template/packages/ui/src/components/avatar.tsx +19 -35
- package/template/packages/ui/src/components/badge.tsx +13 -17
- package/template/packages/ui/src/components/breadcrumb.tsx +22 -44
- package/template/packages/ui/src/components/button-group.tsx +16 -25
- package/template/packages/ui/src/components/button.tsx +8 -9
- package/template/packages/ui/src/components/calendar.tsx +43 -82
- package/template/packages/ui/src/components/card.tsx +15 -26
- package/template/packages/ui/src/components/carousel.tsx +70 -78
- package/template/packages/ui/src/components/chart.tsx +84 -117
- package/template/packages/ui/src/components/checkbox.tsx +8 -9
- package/template/packages/ui/src/components/collapsible.tsx +5 -9
- package/template/packages/ui/src/components/combobox.tsx +44 -68
- package/template/packages/ui/src/components/command.tsx +32 -47
- package/template/packages/ui/src/components/context-menu.tsx +45 -71
- package/template/packages/ui/src/components/dialog.tsx +29 -51
- package/template/packages/ui/src/components/direction.tsx +1 -4
- package/template/packages/ui/src/components/drawer.tsx +24 -38
- package/template/packages/ui/src/components/dropdown-menu.tsx +45 -55
- package/template/packages/ui/src/components/empty.tsx +16 -27
- package/template/packages/ui/src/components/field.tsx +49 -63
- package/template/packages/ui/src/components/hover-card.tsx +9 -14
- package/template/packages/ui/src/components/input-group.tsx +40 -52
- package/template/packages/ui/src/components/input-otp.tsx +17 -18
- package/template/packages/ui/src/components/input.tsx +6 -6
- package/template/packages/ui/src/components/item.tsx +31 -44
- package/template/packages/ui/src/components/kbd.tsx +5 -5
- package/template/packages/ui/src/components/label.tsx +6 -6
- package/template/packages/ui/src/components/menubar.tsx +51 -64
- package/template/packages/ui/src/components/mode-toggle.tsx +9 -15
- package/template/packages/ui/src/components/native-select.tsx +18 -24
- package/template/packages/ui/src/components/navigation-menu.tsx +28 -35
- package/template/packages/ui/src/components/pagination.tsx +19 -31
- package/template/packages/ui/src/components/popover.tsx +13 -26
- package/template/packages/ui/src/components/progress.tsx +13 -30
- package/template/packages/ui/src/components/radio-group.tsx +7 -7
- package/template/packages/ui/src/components/resizable.tsx +12 -20
- package/template/packages/ui/src/components/scroll-area.tsx +8 -12
- package/template/packages/ui/src/components/select.tsx +31 -42
- package/template/packages/ui/src/components/separator.tsx +6 -10
- package/template/packages/ui/src/components/sheet.tsx +25 -38
- package/template/packages/ui/src/components/sidebar.tsx +137 -170
- package/template/packages/ui/src/components/skeleton.tsx +3 -3
- package/template/packages/ui/src/components/slider.tsx +5 -5
- package/template/packages/ui/src/components/sonner.tsx +20 -24
- package/template/packages/ui/src/components/spinner.tsx +10 -5
- package/template/packages/ui/src/components/switch.tsx +6 -6
- package/template/packages/ui/src/components/table.tsx +18 -45
- package/template/packages/ui/src/components/tabs.tsx +14 -22
- package/template/packages/ui/src/components/textarea.tsx +5 -5
- package/template/packages/ui/src/components/theme-provider.tsx +43 -48
- package/template/packages/ui/src/components/toggle-group.tsx +18 -20
- package/template/packages/ui/src/components/toggle.tsx +9 -10
- package/template/packages/ui/src/components/tooltip.tsx +10 -22
- package/template/packages/ui/src/hooks/use-mobile.ts +11 -11
- package/template/packages/ui/src/lib/utils.ts +4 -4
- package/template/packages/ui/src/styles/globals.css +106 -106
- package/template/packages/ui/tsconfig.json +1 -1
- package/template/turbo.json +15 -6
- package/template/.prettierignore +0 -10
- package/template/apps/desktop/.prettierignore +0 -6
- package/template/apps/desktop/eslint.config.ts +0 -11
- package/template/apps/desktop/prettier.config.ts +0 -3
- package/template/apps/mobile/eslint.config.js +0 -10
- package/template/apps/platform/eslint.config.ts +0 -11
- package/template/apps/platform/prettier.config.ts +0 -3
- package/template/packages/auth/eslint.config.ts +0 -3
- package/template/packages/auth/prettier.config.ts +0 -3
- package/template/packages/config-eslint/index.ts +0 -24
- package/template/packages/config-eslint/package.json +0 -11
- package/template/packages/config-prettier/index.ts +0 -14
- package/template/packages/config-prettier/package.json +0 -7
- package/template/packages/db/eslint.config.ts +0 -3
- package/template/packages/db/prettier.config.ts +0 -3
- package/template/packages/orpc/eslint.config.ts +0 -3
- package/template/packages/orpc/prettier.config.ts +0 -3
- package/template/packages/ui/eslint.config.ts +0 -3
- package/template/packages/ui/prettier.config.ts +0 -3
- package/template/prettier.config.ts +0 -15
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import s from"path";import{fileURLToPath as k}from"url";import i from"chalk";import{Command as y}from"commander";import{execa as j}from"execa";import e from"fs-extra";import P from"inquirer";import u from"ora";var b=k(import.meta.url),g=s.dirname(b),h=new y;h.name("create-croissant").description("Scaffold a new project using the Croissant Stack").argument("[project-name]","Name of the project").action(async m=>{console.log(i.bold.yellow(`
|
|
3
3
|
\u{1F950} Welcome to the Croissant Stack!
|
|
4
|
-
`));let l=await P.prompt([{type:"input",name:"name",message:"What is your project named?",default:m||"my-croissant-app",when:!m},{type:"confirm",name:"install",message:"Would you like to install dependencies?",default:!0},{type:"confirm",name:"mobile",message:"Would you like to include the mobile app (Expo)?",default:!0},{type:"confirm",name:"desktop",message:"Would you like to include the desktop app (Electron)?",default:!0}]),c=m||l.name,o=
|
|
4
|
+
`));let l=await P.prompt([{type:"input",name:"name",message:"What is your project named?",default:m||"my-croissant-app",when:!m},{type:"confirm",name:"install",message:"Would you like to install dependencies?",default:!0},{type:"confirm",name:"mobile",message:"Would you like to include the mobile app (Expo)?",default:!0},{type:"confirm",name:"desktop",message:"Would you like to include the desktop app (Electron)?",default:!0}]),c=m||l.name,o=s.resolve(process.cwd(),c);e.existsSync(o)&&(console.error(i.red(`
|
|
5
5
|
Error: Directory ${c} already exists.
|
|
6
|
-
`)),process.exit(1));let f=u("Scaffolding your project...").start();try{await e.ensureDir(o);let p=
|
|
6
|
+
`)),process.exit(1));let f=u("Scaffolding your project...").start();try{await e.ensureDir(o);let p=s.join(g,"..","template");if(await e.pathExists(p))await e.copy(p,o);else{let t=s.resolve(g,"../../.."),n=["node_modules","dist",".git","packages/create-croissant",".turbo","package-lock.json"];await e.copy(t,o,{filter:a=>{let r=s.relative(t,a);return!n.some(w=>r.startsWith(w))}})}if(!l.mobile){let t=s.join(o,"apps/mobile");if(await e.pathExists(t)){await e.remove(t);let n=s.join(o,"package.json");if(await e.pathExists(n)){let a=await e.readJson(n);a.scripts&&Object.keys(a.scripts).forEach(r=>{r.includes("mobile")&&delete a.scripts[r]}),await e.writeJson(n,a,{spaces:2})}}}if(!l.desktop){let t=s.join(o,"apps/desktop");if(await e.pathExists(t)){await e.remove(t);let n=s.join(o,"package.json");if(await e.pathExists(n)){let a=await e.readJson(n);a.scripts&&Object.keys(a.scripts).forEach(r=>{r.includes("desktop")&&delete a.scripts[r]}),await e.writeJson(n,a,{spaces:2})}}}let d=s.join(o,"package.json");if(await e.pathExists(d)){let t=await e.readJson(d);t.name=c,t.version="0.1.0",delete t.private,await e.writeJson(d,t,{spaces:2})}if(f.succeed(i.green(`Project ${c} created at ${o}`)),l.install){let t=u("Installing dependencies...").start();try{await j("npm",["install"],{cwd:o}),t.succeed(i.green("Dependencies installed!"))}catch{t.fail(i.red("Failed to install dependencies. You may need to run npm install manually."))}}console.log(i.bold.cyan(`
|
|
7
7
|
Next steps:`)),console.log(` cd ${c}`),console.log(" npm run db:up # Start your PostgreSQL database"),console.log(` npm run dev # Start development server
|
|
8
|
-
`),console.log(
|
|
9
|
-
`))}catch(p){f.fail(
|
|
8
|
+
`),console.log(i.yellow(`Happy hacking! \u{1F950}
|
|
9
|
+
`))}catch(p){f.fail(i.red("An error occurred during scaffolding.")),console.error(p),process.exit(1)}});h.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-croissant",
|
|
3
|
-
"
|
|
4
|
-
"access": "public"
|
|
5
|
-
},
|
|
6
|
-
"version": "0.1.39",
|
|
3
|
+
"version": "0.1.41",
|
|
7
4
|
"description": "Scaffold a new project using the Croissant Stack",
|
|
8
5
|
"repository": {
|
|
9
6
|
"type": "git",
|
|
10
7
|
"url": "https://github.com/croissantsam/croissant-stack.git",
|
|
11
8
|
"directory": "packages/create-croissant"
|
|
12
9
|
},
|
|
13
|
-
"main": "./dist/index.js",
|
|
14
|
-
"type": "module",
|
|
15
10
|
"bin": {
|
|
16
11
|
"create-croissant": "./dist/index.js"
|
|
17
12
|
},
|
|
@@ -19,10 +14,14 @@
|
|
|
19
14
|
"dist",
|
|
20
15
|
"template"
|
|
21
16
|
],
|
|
17
|
+
"type": "module",
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "npm run prepare-template && tsup src/index.ts --format esm --clean --minify",
|
|
24
24
|
"dev": "tsup src/index.ts --format esm --watch",
|
|
25
|
-
"lint": "eslint src",
|
|
26
25
|
"typecheck": "tsc --noEmit",
|
|
27
26
|
"prepare-template": "node scripts/prepare-template.js"
|
|
28
27
|
},
|
|
@@ -35,12 +34,10 @@
|
|
|
35
34
|
"ora": "^9.4.0"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"@workspace/config-eslint": "*",
|
|
39
|
-
"@workspace/config-typescript": "*",
|
|
40
|
-
"@workspace/config-prettier": "*",
|
|
41
37
|
"@types/fs-extra": "^11.0.4",
|
|
42
38
|
"@types/inquirer": "^9.0.9",
|
|
43
39
|
"@types/node": "^25.6.0",
|
|
40
|
+
"@workspace/config-typescript": "*",
|
|
44
41
|
"tsup": "^8.5.1"
|
|
45
42
|
}
|
|
46
43
|
}
|
package/template/README.md
CHANGED
|
@@ -97,8 +97,8 @@ All scripts are orchestrated by Turborepo. You can run them from the root direct
|
|
|
97
97
|
|
|
98
98
|
- `npm run dev`: Start all applications in development mode.
|
|
99
99
|
- `npm run build`: Build all applications for production.
|
|
100
|
-
- `npm run
|
|
101
|
-
- `npm run
|
|
100
|
+
- `npm run quality`: Run all quality checks (linting and formatting) using Oxc.
|
|
101
|
+
- `npm run quality:fix`: Automatically fix linting and formatting issues using Oxc.
|
|
102
102
|
- `npm run typecheck`: Run TypeScript type checking across the workspace.
|
|
103
103
|
|
|
104
104
|
### 🗄️ Database Scripts
|
|
@@ -133,11 +133,11 @@ The project uses oRPC for end-to-end type safety. The router is modularized for
|
|
|
133
133
|
On the client side, you can infer types directly from the router:
|
|
134
134
|
|
|
135
135
|
```typescript
|
|
136
|
-
import type { router } from "@workspace/orpc/router"
|
|
137
|
-
import type { InferRouterInputs, InferRouterOutputs } from "@orpc/server"
|
|
136
|
+
import type { router } from "@workspace/orpc/router";
|
|
137
|
+
import type { InferRouterInputs, InferRouterOutputs } from "@orpc/server";
|
|
138
138
|
|
|
139
|
-
type Inputs = InferRouterInputs<typeof router
|
|
140
|
-
type Outputs = InferRouterOutputs<typeof router
|
|
139
|
+
type Inputs = InferRouterInputs<typeof router>;
|
|
140
|
+
type Outputs = InferRouterOutputs<typeof router>;
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
## 🧱 Adding Components
|
|
@@ -4,7 +4,7 @@ An Electron application with React and TypeScript
|
|
|
4
4
|
|
|
5
5
|
## Recommended IDE Setup
|
|
6
6
|
|
|
7
|
-
- [VSCode](https://code.visualstudio.com/)
|
|
7
|
+
- [VSCode](https://code.visualstudio.com/)
|
|
8
8
|
|
|
9
9
|
## Project Setup
|
|
10
10
|
|
|
@@ -3,12 +3,12 @@ productName: desktop
|
|
|
3
3
|
directories:
|
|
4
4
|
buildResources: build
|
|
5
5
|
files:
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
6
|
+
- "!**/.vscode/*"
|
|
7
|
+
- "!src/*"
|
|
8
|
+
- "!electron.vite.config.{js,ts,mjs,cjs}"
|
|
9
|
+
- "!{dev-app-update.yml,CHANGELOG.md,README.md}"
|
|
10
|
+
- "!{.env,.env.*,.npmrc,pnpm-lock.yaml}"
|
|
11
|
+
- "!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}"
|
|
12
12
|
asarUnpack:
|
|
13
13
|
- resources/**
|
|
14
14
|
win:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { resolve } from
|
|
2
|
-
import { defineConfig } from
|
|
3
|
-
import react from
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { defineConfig } from "electron-vite";
|
|
3
|
+
import react from "@vitejs/plugin-react";
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
6
|
main: {},
|
|
@@ -8,9 +8,9 @@ export default defineConfig({
|
|
|
8
8
|
renderer: {
|
|
9
9
|
resolve: {
|
|
10
10
|
alias: {
|
|
11
|
-
|
|
12
|
-
}
|
|
11
|
+
"@renderer": resolve("src/renderer/src"),
|
|
12
|
+
},
|
|
13
13
|
},
|
|
14
|
-
plugins: [react()]
|
|
15
|
-
}
|
|
16
|
-
})
|
|
14
|
+
plugins: [react()],
|
|
15
|
+
},
|
|
16
|
+
});
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
"name": "desktop",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"description": "An Electron application with React and TypeScript",
|
|
5
|
-
"main": "./out/main/index.js",
|
|
6
|
-
"author": "example.com",
|
|
7
5
|
"homepage": "https://electron-vite.org",
|
|
6
|
+
"author": "example.com",
|
|
7
|
+
"main": "./out/main/index.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"format": "prettier --write .",
|
|
10
|
-
"lint": "eslint --cache .",
|
|
11
9
|
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
|
|
12
10
|
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
|
|
13
11
|
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
|
@@ -26,19 +24,12 @@
|
|
|
26
24
|
"electron-updater": "^6.3.9"
|
|
27
25
|
},
|
|
28
26
|
"devDependencies": {
|
|
29
|
-
"@workspace/config-eslint": "*",
|
|
30
|
-
"@workspace/config-typescript": "*",
|
|
31
|
-
"@workspace/config-prettier": "*",
|
|
32
|
-
"@electron-toolkit/eslint-config-prettier": "^3.0.0",
|
|
33
|
-
"@electron-toolkit/eslint-config-ts": "^3.1.0",
|
|
34
27
|
"@electron-toolkit/tsconfig": "^2.0.0",
|
|
35
28
|
"@types/node": "^22.19.1",
|
|
36
29
|
"@vitejs/plugin-react": "^5.1.1",
|
|
30
|
+
"@workspace/config-typescript": "*",
|
|
37
31
|
"electron": "39.8.9",
|
|
38
32
|
"electron-builder": "^26.0.12",
|
|
39
|
-
"electron-vite": "^5.0.0"
|
|
40
|
-
"eslint-plugin-react": "^7.37.5",
|
|
41
|
-
"eslint-plugin-react-hooks": "^7.1.1",
|
|
42
|
-
"eslint-plugin-react-refresh": "^0.5.2"
|
|
33
|
+
"electron-vite": "^5.0.0"
|
|
43
34
|
}
|
|
44
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { join } from
|
|
2
|
-
import { BrowserWindow, app, ipcMain, shell } from
|
|
3
|
-
import { electronApp, is, optimizer } from
|
|
4
|
-
import icon from
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { BrowserWindow, app, ipcMain, shell } from "electron";
|
|
3
|
+
import { electronApp, is, optimizer } from "@electron-toolkit/utils";
|
|
4
|
+
import icon from "../../resources/icon.png?asset";
|
|
5
5
|
|
|
6
6
|
function createWindow(): void {
|
|
7
7
|
// Create the browser window.
|
|
@@ -10,28 +10,28 @@ function createWindow(): void {
|
|
|
10
10
|
height: 670,
|
|
11
11
|
show: false,
|
|
12
12
|
autoHideMenuBar: true,
|
|
13
|
-
...(process.platform ===
|
|
13
|
+
...(process.platform === "linux" ? { icon } : {}),
|
|
14
14
|
webPreferences: {
|
|
15
|
-
preload: join(__dirname,
|
|
16
|
-
sandbox: false
|
|
17
|
-
}
|
|
18
|
-
})
|
|
15
|
+
preload: join(__dirname, "../preload/index.js"),
|
|
16
|
+
sandbox: false,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
19
|
|
|
20
|
-
mainWindow.on(
|
|
21
|
-
mainWindow.show()
|
|
22
|
-
})
|
|
20
|
+
mainWindow.on("ready-to-show", () => {
|
|
21
|
+
mainWindow.show();
|
|
22
|
+
});
|
|
23
23
|
|
|
24
24
|
mainWindow.webContents.setWindowOpenHandler((details) => {
|
|
25
|
-
shell.openExternal(details.url)
|
|
26
|
-
return { action:
|
|
27
|
-
})
|
|
25
|
+
shell.openExternal(details.url);
|
|
26
|
+
return { action: "deny" };
|
|
27
|
+
});
|
|
28
28
|
|
|
29
29
|
// HMR for renderer base on electron-vite cli.
|
|
30
30
|
// Load the remote URL for development or the local html file for production.
|
|
31
|
-
if (is.dev && process.env[
|
|
32
|
-
mainWindow.loadURL(process.env[
|
|
31
|
+
if (is.dev && process.env["ELECTRON_RENDERER_URL"]) {
|
|
32
|
+
mainWindow.loadURL(process.env["ELECTRON_RENDERER_URL"]);
|
|
33
33
|
} else {
|
|
34
|
-
mainWindow.loadFile(join(__dirname,
|
|
34
|
+
mainWindow.loadFile(join(__dirname, "../renderer/index.html"));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -40,35 +40,35 @@ function createWindow(): void {
|
|
|
40
40
|
// Some APIs can only be used after this event occurs.
|
|
41
41
|
app.whenReady().then(() => {
|
|
42
42
|
// Set app user model id for windows
|
|
43
|
-
electronApp.setAppUserModelId(
|
|
43
|
+
electronApp.setAppUserModelId("com.electron");
|
|
44
44
|
|
|
45
45
|
// Default open or close DevTools by F12 in development
|
|
46
46
|
// and ignore CommandOrControl + R in production.
|
|
47
47
|
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
|
|
48
|
-
app.on(
|
|
49
|
-
optimizer.watchWindowShortcuts(window)
|
|
50
|
-
})
|
|
48
|
+
app.on("browser-window-created", (_, window) => {
|
|
49
|
+
optimizer.watchWindowShortcuts(window);
|
|
50
|
+
});
|
|
51
51
|
|
|
52
52
|
// IPC test
|
|
53
|
-
ipcMain.on(
|
|
53
|
+
ipcMain.on("ping", () => console.log("pong"));
|
|
54
54
|
|
|
55
|
-
createWindow()
|
|
55
|
+
createWindow();
|
|
56
56
|
|
|
57
|
-
app.on(
|
|
57
|
+
app.on("activate", function () {
|
|
58
58
|
// On macOS it's common to re-create a window in the app when the
|
|
59
59
|
// dock icon is clicked and there are no other windows open.
|
|
60
|
-
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
|
61
|
-
})
|
|
62
|
-
})
|
|
60
|
+
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
63
|
|
|
64
64
|
// Quit when all windows are closed, except on macOS. There, it's common
|
|
65
65
|
// for applications and their menu bar to stay active until the user quits
|
|
66
66
|
// explicitly with Cmd + Q.
|
|
67
|
-
app.on(
|
|
68
|
-
if (process.platform !==
|
|
69
|
-
app.quit()
|
|
67
|
+
app.on("window-all-closed", () => {
|
|
68
|
+
if (process.platform !== "darwin") {
|
|
69
|
+
app.quit();
|
|
70
70
|
}
|
|
71
|
-
})
|
|
71
|
+
});
|
|
72
72
|
|
|
73
73
|
// In this file you can include the rest of your app's specific main process
|
|
74
74
|
// code. You can also put them in separate files and require them here.
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { contextBridge } from
|
|
2
|
-
import { electronAPI } from
|
|
1
|
+
import { contextBridge } from "electron";
|
|
2
|
+
import { electronAPI } from "@electron-toolkit/preload";
|
|
3
3
|
|
|
4
4
|
// Custom APIs for renderer
|
|
5
|
-
const api = {}
|
|
5
|
+
const api = {};
|
|
6
6
|
|
|
7
7
|
// Use `contextBridge` APIs to expose Electron APIs to
|
|
8
8
|
// renderer only if context isolation is enabled, otherwise
|
|
9
9
|
// just add to the DOM global.
|
|
10
10
|
if (process.contextIsolated) {
|
|
11
11
|
try {
|
|
12
|
-
contextBridge.exposeInMainWorld(
|
|
13
|
-
contextBridge.exposeInMainWorld(
|
|
12
|
+
contextBridge.exposeInMainWorld("electron", electronAPI);
|
|
13
|
+
contextBridge.exposeInMainWorld("api", api);
|
|
14
14
|
} catch (error) {
|
|
15
|
-
console.error(error)
|
|
15
|
+
console.error(error);
|
|
16
16
|
}
|
|
17
17
|
} else {
|
|
18
18
|
// @ts-ignore (define in dts)
|
|
19
|
-
window.electron = electronAPI
|
|
19
|
+
window.electron = electronAPI;
|
|
20
20
|
// @ts-ignore (define in dts)
|
|
21
|
-
window.api = api
|
|
21
|
+
window.api = api;
|
|
22
22
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Versions from
|
|
2
|
-
import electronLogo from
|
|
1
|
+
import Versions from "./components/Versions";
|
|
2
|
+
import electronLogo from "./assets/electron.svg";
|
|
3
3
|
|
|
4
4
|
function App(): React.JSX.Element {
|
|
5
|
-
const ipcHandle = (): void => window.electron.ipcRenderer.send(
|
|
5
|
+
const ipcHandle = (): void => window.electron.ipcRenderer.send("ping");
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
8
|
<>
|
|
@@ -29,7 +29,7 @@ function App(): React.JSX.Element {
|
|
|
29
29
|
</div>
|
|
30
30
|
<Versions></Versions>
|
|
31
31
|
</>
|
|
32
|
-
)
|
|
32
|
+
);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export default App
|
|
35
|
+
export default App;
|
|
@@ -52,14 +52,14 @@ body {
|
|
|
52
52
|
Inter,
|
|
53
53
|
-apple-system,
|
|
54
54
|
BlinkMacSystemFont,
|
|
55
|
-
|
|
55
|
+
"Segoe UI",
|
|
56
56
|
Roboto,
|
|
57
57
|
Oxygen,
|
|
58
58
|
Ubuntu,
|
|
59
59
|
Cantarell,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
"Fira Sans",
|
|
61
|
+
"Droid Sans",
|
|
62
|
+
"Helvetica Neue",
|
|
63
63
|
sans-serif;
|
|
64
64
|
text-rendering: optimizeLegibility;
|
|
65
65
|
-webkit-font-smoothing: antialiased;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
@import
|
|
1
|
+
@import "./base.css";
|
|
2
2
|
|
|
3
3
|
body {
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
overflow: hidden;
|
|
8
|
-
background-image: url(
|
|
8
|
+
background-image: url("./wavy-lines.svg");
|
|
9
9
|
background-size: cover;
|
|
10
10
|
user-select: none;
|
|
11
11
|
}
|
|
@@ -129,7 +129,7 @@ code {
|
|
|
129
129
|
bottom: 30px;
|
|
130
130
|
margin: 0 auto;
|
|
131
131
|
padding: 15px 0;
|
|
132
|
-
font-family:
|
|
132
|
+
font-family: "Menlo", "Lucida Console", monospace;
|
|
133
133
|
display: inline-flex;
|
|
134
134
|
overflow: hidden;
|
|
135
135
|
align-items: center;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useState } from
|
|
1
|
+
import { useState } from "react";
|
|
2
2
|
|
|
3
3
|
function Versions(): React.JSX.Element {
|
|
4
|
-
const [versions] = useState(window.electron.process.versions)
|
|
4
|
+
const [versions] = useState(window.electron.process.versions);
|
|
5
5
|
|
|
6
6
|
return (
|
|
7
7
|
<ul className="versions">
|
|
@@ -9,7 +9,7 @@ function Versions(): React.JSX.Element {
|
|
|
9
9
|
<li className="chrome-version">Chromium v{versions.chrome}</li>
|
|
10
10
|
<li className="node-version">Node v{versions.node}</li>
|
|
11
11
|
</ul>
|
|
12
|
-
)
|
|
12
|
+
);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export default Versions
|
|
15
|
+
export default Versions;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./assets/main.css";
|
|
2
2
|
|
|
3
|
-
import { StrictMode } from
|
|
4
|
-
import { createRoot } from
|
|
5
|
-
import App from
|
|
3
|
+
import { StrictMode } from "react";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
5
|
+
import App from "./App";
|
|
6
6
|
|
|
7
|
-
createRoot(document.getElementById(
|
|
7
|
+
createRoot(document.getElementById("root")!).render(
|
|
8
8
|
<StrictMode>
|
|
9
9
|
<App />
|
|
10
|
-
</StrictMode
|
|
11
|
-
)
|
|
10
|
+
</StrictMode>,
|
|
11
|
+
);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [],
|
|
3
|
-
"references": [
|
|
4
|
-
{ "path": "./tsconfig.node.json" },
|
|
5
|
-
{ "path": "./tsconfig.web.json" }
|
|
6
|
-
],
|
|
3
|
+
"references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.web.json" }],
|
|
7
4
|
"include": [],
|
|
8
5
|
"exclude": ["node_modules", "out", "dist"]
|
|
9
6
|
}
|
|
@@ -5,21 +5,14 @@
|
|
|
5
5
|
"src/renderer/src/**/*",
|
|
6
6
|
"src/renderer/src/**/*.tsx",
|
|
7
7
|
"src/preload/*.d.ts",
|
|
8
|
-
"electron.vite.config.ts"
|
|
9
|
-
"prettier.config.js"
|
|
8
|
+
"electron.vite.config.ts"
|
|
10
9
|
],
|
|
11
10
|
"compilerOptions": {
|
|
12
11
|
"composite": true,
|
|
13
12
|
"paths": {
|
|
14
|
-
"@renderer/*": [
|
|
15
|
-
|
|
16
|
-
]
|
|
17
|
-
"@main/*": [
|
|
18
|
-
"./src/main/src/*"
|
|
19
|
-
],
|
|
20
|
-
"@preload/*": [
|
|
21
|
-
"./src/preload/src/*"
|
|
22
|
-
]
|
|
13
|
+
"@renderer/*": ["./src/renderer/src/*"],
|
|
14
|
+
"@main/*": ["./src/main/src/*"],
|
|
15
|
+
"@preload/*": ["./src/preload/src/*"]
|
|
23
16
|
}
|
|
24
17
|
}
|
|
25
18
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Tabs } from
|
|
2
|
-
import React from
|
|
1
|
+
import { Tabs } from "expo-router";
|
|
2
|
+
import React from "react";
|
|
3
3
|
|
|
4
|
-
import { HapticTab } from
|
|
5
|
-
import { IconSymbol } from
|
|
6
|
-
import { Colors } from
|
|
7
|
-
import { useColorScheme } from
|
|
4
|
+
import { HapticTab } from "@/components/haptic-tab";
|
|
5
|
+
import { IconSymbol } from "@/components/ui/icon-symbol";
|
|
6
|
+
import { Colors } from "@/constants/theme";
|
|
7
|
+
import { useColorScheme } from "@/hooks/use-color-scheme";
|
|
8
8
|
|
|
9
9
|
export default function TabLayout() {
|
|
10
10
|
const colorScheme = useColorScheme();
|
|
@@ -12,21 +12,22 @@ export default function TabLayout() {
|
|
|
12
12
|
return (
|
|
13
13
|
<Tabs
|
|
14
14
|
screenOptions={{
|
|
15
|
-
tabBarActiveTintColor: Colors[colorScheme ??
|
|
15
|
+
tabBarActiveTintColor: Colors[colorScheme ?? "light"].tint,
|
|
16
16
|
headerShown: false,
|
|
17
17
|
tabBarButton: HapticTab,
|
|
18
|
-
}}
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
19
20
|
<Tabs.Screen
|
|
20
21
|
name="index"
|
|
21
22
|
options={{
|
|
22
|
-
title:
|
|
23
|
+
title: "Home",
|
|
23
24
|
tabBarIcon: ({ color }) => <IconSymbol size={28} name="house.fill" color={color} />,
|
|
24
25
|
}}
|
|
25
26
|
/>
|
|
26
27
|
<Tabs.Screen
|
|
27
28
|
name="explore"
|
|
28
29
|
options={{
|
|
29
|
-
title:
|
|
30
|
+
title: "Explore",
|
|
30
31
|
tabBarIcon: ({ color }) => <IconSymbol size={28} name="paperplane.fill" color={color} />,
|
|
31
32
|
}}
|
|
32
33
|
/>
|