Skip to content

Commit

Permalink
feat: lunch blog via iframe dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed May 8, 2023
1 parent 49c477e commit d841365
Show file tree
Hide file tree
Showing 10 changed files with 1,103 additions and 110 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["./node_modules/@terwer/eslint-config-custom/index.cjs"],
}
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# platform

# Ignore artifacts:
dist
node_modules

# Ignore all dts files:
*.d.ts

# lib
/pnpm-lock.yaml
30 changes: 30 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

module.exports = {
semi: false,
singleQuote: false,
printWidth: 120,
}
47 changes: 37 additions & 10 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,53 @@
* SOFTWARE.
*/

const getAppBase = (isSiyuanBuild: boolean, isDev: boolean, isVercelBuild: boolean): string => {
if (isSiyuanBuild) {
return "/plugins/siyuan-blog/"
} else if (isVercelBuild) {
return "/"
} else {
// static
return "/dist/"
}
}

const isDev = process.env.NODE_ENV === "development"
const isVercelBuild = process.env.BUILD_TYPE === "vercel"
const isSiyuanBuild = process.env.BUILD_TYPE === "siyuan"

const appBase = getAppBase(isSiyuanBuild, isDev, isVercelBuild)
const isSsr = isDev || isVercelBuild

const ssrPreset = isVercelBuild ? "vercel" : isDev ? "node-server" : undefined
const ssrServeStatic = isSiyuanBuild

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
ssr: isSsr,
// https://nuxt.com/docs/guide/going-further/custom-routing#hash-mode-spa
router: {
options: {
hashMode: !isSsr,
},
app: {
baseURL: appBase,
head: {
charset: "utf-8",
viewport: "width=device-width, initial-scale=1",
// link: [{ rel: "stylesheet", href: appBase + "lib/webfont/webfont.css?v=" + staticV }],
// script: [
// {
// src: appBase + "lib/lute/lute-1.7.5-20230410.min.js?v=" + staticV,
// body: true,
// },
// ],
},
nitro: {
preset: ssrPreset,
// 开启之后将进行静态伺服
serveStatic: ssrServeStatic,
},
ssr: isSsr,
// https://nuxt.com/docs/guide/going-further/custom-routing#hash-mode-spa
router: {
options: {
hashMode: !isSsr,
},
},
nitro: {
preset: ssrPreset,
// 开启之后将进行静态伺服
serveStatic: ssrServeStatic,
},
})
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
"postinstall": "nuxt prepare"
},
"devDependencies": {
"@terwer/esbuild-config-custom": "^1.0.5",
"@types/node": "^18",
"@terwer/esbuild-config-custom": "latest",
"@terwer/eslint-config-custom": "latest",
"@types/node": "^18.16.5",
"nuxt": "^3.4.3",
"typescript": "^5.0.4"
},
"dependencies": {
"siyuan": "^0.7.1"
"siyuan": "^0.7.1",
"zhi-device": "^0.5.0"
}
}
Loading

0 comments on commit d841365

Please sign in to comment.