feat: directly open affine page on production
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"module": "true",
|
"module": "true",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev:app": "tauri dev",
|
"dev:app": "cross-env NODE_ENV=development tauri dev",
|
||||||
"build:prerequisite": "pnpm build:submodules && pnpm build:affine && pnpm build:preload",
|
"build:prerequisite": "pnpm build:submodules && pnpm build:affine && pnpm build:preload",
|
||||||
"dev:web": "vite",
|
"dev:web": "vite",
|
||||||
"build:rs-types": "zx scripts/generateTsTypingsFromJsonSchema.mjs",
|
"build:rs-types": "zx scripts/generateTsTypingsFromJsonSchema.mjs",
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@blocksuite/store": "^0.3.1",
|
||||||
"@emotion/react": "^11.10.5",
|
"@emotion/react": "^11.10.5",
|
||||||
"@emotion/styled": "^11.10.5",
|
"@emotion/styled": "^11.10.5",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
|
|||||||
1
client-app/src-tauri/Cargo.lock
generated
1
client-app/src-tauri/Cargo.lock
generated
@@ -7,6 +7,7 @@ name = "AFFiNE"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"dotenvy",
|
||||||
"futures",
|
"futures",
|
||||||
"ipc_types",
|
"ipc_types",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ project-root = "0.2.2"
|
|||||||
schemars = "0.8.3"
|
schemars = "0.8.3"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
dotenvy = "0.15.6"
|
||||||
tauri = {version = "1.2", features = ["api-all", "devtools"] }
|
tauri = {version = "1.2", features = ["api-all", "devtools"] }
|
||||||
tokio = { version = "1.23.0", features = ["rt", "macros"] }
|
tokio = { version = "1.23.0", features = ["rt", "macros"] }
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,23 @@
|
|||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
mod state;
|
mod state;
|
||||||
|
use dotenvy::dotenv;
|
||||||
use state::AppState;
|
use state::AppState;
|
||||||
use tokio::sync::Mutex;
|
use std::env;
|
||||||
use tauri::TitleBarStyle;
|
use tauri::TitleBarStyle;
|
||||||
|
use tokio::sync::Mutex;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
tauri::async_runtime::set(tokio::runtime::Handle::current());
|
tauri::async_runtime::set(tokio::runtime::Handle::current());
|
||||||
|
dotenv().ok();
|
||||||
let preload = include_str!("../../public/preload/index.js");
|
let preload = include_str!("../../public/preload/index.js");
|
||||||
|
let is_dev = env::var("NODE_ENV").unwrap_or_default() == "development";
|
||||||
|
let initial_path = if is_dev {
|
||||||
|
"index.html"
|
||||||
|
} else {
|
||||||
|
"affine-out/index.html"
|
||||||
|
};
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
.manage(AppState(Mutex::new(
|
.manage(AppState(Mutex::new(
|
||||||
state::AppStateRaw::new().await.unwrap(),
|
state::AppStateRaw::new().await.unwrap(),
|
||||||
@@ -20,7 +29,7 @@ async fn main() {
|
|||||||
// manually create window here, instead of in the tauri.conf.json, to add `initialization_script` here
|
// manually create window here, instead of in the tauri.conf.json, to add `initialization_script` here
|
||||||
.setup(move |app| {
|
.setup(move |app| {
|
||||||
let _window =
|
let _window =
|
||||||
tauri::WindowBuilder::new(app, "label", tauri::WindowUrl::App("index.html".into()))
|
tauri::WindowBuilder::new(app, "label", tauri::WindowUrl::App(initial_path.into()))
|
||||||
.title("AFFiNE")
|
.title("AFFiNE")
|
||||||
.inner_size(1000.0, 800.0)
|
.inner_size(1000.0, 800.0)
|
||||||
.title_bar_style(TitleBarStyle::Overlay)
|
.title_bar_style(TitleBarStyle::Overlay)
|
||||||
|
|||||||
@@ -5,11 +5,11 @@
|
|||||||
"author": "toeverything",
|
"author": "toeverything",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev",
|
"dev": "cross-env NODE_ENV=development pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev",
|
||||||
"dev:ac": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev:ac",
|
"dev:ac": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev:ac",
|
||||||
"dev:client": "concurrently \"pnpm --filter=@affine/client-app dev:app\" \"pnpm dev\"",
|
"dev:client": "cross-env NODE_ENV=development concurrently \"pnpm --filter=@affine/client-app dev:app\" \"pnpm dev\"",
|
||||||
"build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/datacenter -r build",
|
"build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/datacenter -r build",
|
||||||
"build:client": " pnpm --filter=@affine/client-app build",
|
"build:client": " pnpm --filter=@affine/client-app build:app",
|
||||||
"export": "pnpm --filter @affine/app export",
|
"export": "pnpm --filter @affine/app export",
|
||||||
"start": "pnpm --filter @affine/app start",
|
"start": "pnpm --filter @affine/app start",
|
||||||
"lint": "pnpm --filter @affine/app lint",
|
"lint": "pnpm --filter @affine/app lint",
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||||
"@typescript-eslint/parser": "^5.47.0",
|
"@typescript-eslint/parser": "^5.47.0",
|
||||||
"concurrently": "^7.6.0",
|
"concurrently": "^7.6.0",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.30.0",
|
"eslint": "^8.30.0",
|
||||||
"eslint-config-next": "12.3.1",
|
"eslint-config-next": "12.3.1",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
|||||||
5
pnpm-lock.yaml
generated
5
pnpm-lock.yaml
generated
@@ -12,6 +12,7 @@ importers:
|
|||||||
'@typescript-eslint/eslint-plugin': ^5.47.0
|
'@typescript-eslint/eslint-plugin': ^5.47.0
|
||||||
'@typescript-eslint/parser': ^5.47.0
|
'@typescript-eslint/parser': ^5.47.0
|
||||||
concurrently: ^7.6.0
|
concurrently: ^7.6.0
|
||||||
|
cross-env: ^7.0.3
|
||||||
eslint: ^8.30.0
|
eslint: ^8.30.0
|
||||||
eslint-config-next: 12.3.1
|
eslint-config-next: 12.3.1
|
||||||
eslint-config-prettier: ^8.5.0
|
eslint-config-prettier: ^8.5.0
|
||||||
@@ -32,6 +33,7 @@ importers:
|
|||||||
'@typescript-eslint/eslint-plugin': 5.48.0_wxmz6cyorqfuzhhglktlvr5lve
|
'@typescript-eslint/eslint-plugin': 5.48.0_wxmz6cyorqfuzhhglktlvr5lve
|
||||||
'@typescript-eslint/parser': 5.48.0_p4cjf2r47dnfiqufepc5hp43sq
|
'@typescript-eslint/parser': 5.48.0_p4cjf2r47dnfiqufepc5hp43sq
|
||||||
concurrently: 7.6.0
|
concurrently: 7.6.0
|
||||||
|
cross-env: 7.0.3
|
||||||
eslint: 8.31.0
|
eslint: 8.31.0
|
||||||
eslint-config-next: 12.3.1_p4cjf2r47dnfiqufepc5hp43sq
|
eslint-config-next: 12.3.1_p4cjf2r47dnfiqufepc5hp43sq
|
||||||
eslint-config-prettier: 8.5.0_eslint@8.31.0
|
eslint-config-prettier: 8.5.0_eslint@8.31.0
|
||||||
@@ -46,6 +48,7 @@ importers:
|
|||||||
|
|
||||||
client-app:
|
client-app:
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@blocksuite/store': ^0.3.1
|
||||||
'@emotion/react': ^11.10.5
|
'@emotion/react': ^11.10.5
|
||||||
'@emotion/styled': ^11.10.5
|
'@emotion/styled': ^11.10.5
|
||||||
'@tauri-apps/api': ^1.2.0
|
'@tauri-apps/api': ^1.2.0
|
||||||
@@ -93,6 +96,7 @@ importers:
|
|||||||
yjs: ^13.5.43
|
yjs: ^13.5.43
|
||||||
zx: ^7.1.1
|
zx: ^7.1.1
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@blocksuite/store': 0.3.1_yjs@13.5.44
|
||||||
'@emotion/react': 11.10.5_kzbn2opkn2327fwg5yzwzya5o4
|
'@emotion/react': 11.10.5_kzbn2opkn2327fwg5yzwzya5o4
|
||||||
'@emotion/styled': 11.10.5_qvatmowesywn4ye42qoh247szu
|
'@emotion/styled': 11.10.5_qvatmowesywn4ye42qoh247szu
|
||||||
'@tauri-apps/api': 1.2.0
|
'@tauri-apps/api': 1.2.0
|
||||||
@@ -11523,6 +11527,7 @@ packages:
|
|||||||
/which/2.0.2:
|
/which/2.0.2:
|
||||||
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
|
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
|
||||||
engines: {node: '>= 8'}
|
engines: {node: '>= 8'}
|
||||||
|
hasBin: true
|
||||||
dependencies:
|
dependencies:
|
||||||
isexe: 2.0.0
|
isexe: 2.0.0
|
||||||
dev: true
|
dev: true
|
||||||
|
|||||||
Reference in New Issue
Block a user