mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
feat(cli): configure baseUrl during create
This commit is contained in:
parent
0f446954a4
commit
c82f845a40
@ -1,270 +0,0 @@
|
|||||||
# yaml-language-server: $schema=../../plugins/quartz-plugins.schema.json
|
|
||||||
# Template: default
|
|
||||||
# A clean Quartz setup with sensible defaults.
|
|
||||||
configuration:
|
|
||||||
pageTitle: Quartz 5
|
|
||||||
pageTitleSuffix: ""
|
|
||||||
enableSPA: true
|
|
||||||
enablePopovers: true
|
|
||||||
analytics:
|
|
||||||
provider: plausible
|
|
||||||
locale: en-US
|
|
||||||
baseUrl: quartz.jzhao.xyz
|
|
||||||
ignorePatterns:
|
|
||||||
- private
|
|
||||||
- templates
|
|
||||||
- .obsidian
|
|
||||||
defaultDateType: modified
|
|
||||||
theme:
|
|
||||||
fontOrigin: googleFonts
|
|
||||||
cdnCaching: true
|
|
||||||
typography:
|
|
||||||
header: Schibsted Grotesk
|
|
||||||
body: Source Sans Pro
|
|
||||||
code: IBM Plex Mono
|
|
||||||
colors:
|
|
||||||
lightMode:
|
|
||||||
light: "#faf8f8"
|
|
||||||
lightgray: "#e5e5e5"
|
|
||||||
gray: "#b8b8b8"
|
|
||||||
darkgray: "#4e4e4e"
|
|
||||||
dark: "#2b2b2b"
|
|
||||||
secondary: "#284b63"
|
|
||||||
tertiary: "#84a59d"
|
|
||||||
highlight: rgba(143, 159, 169, 0.15)
|
|
||||||
textHighlight: "#fff23688"
|
|
||||||
darkMode:
|
|
||||||
light: "#161618"
|
|
||||||
lightgray: "#393639"
|
|
||||||
gray: "#646464"
|
|
||||||
darkgray: "#d4d4d4"
|
|
||||||
dark: "#ebebec"
|
|
||||||
secondary: "#7b97aa"
|
|
||||||
tertiary: "#84a59d"
|
|
||||||
highlight: rgba(143, 159, 169, 0.15)
|
|
||||||
textHighlight: "#b3aa0288"
|
|
||||||
plugins:
|
|
||||||
- source: github:quartz-community/note-properties
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
includeAll: false
|
|
||||||
includedProperties:
|
|
||||||
- description
|
|
||||||
- tags
|
|
||||||
- aliases
|
|
||||||
excludedProperties: []
|
|
||||||
hidePropertiesView: false
|
|
||||||
delimiters: "---"
|
|
||||||
language: yaml
|
|
||||||
order: 5
|
|
||||||
- source: github:quartz-community/created-modified-date
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
priority:
|
|
||||||
- frontmatter
|
|
||||||
- git
|
|
||||||
- filesystem
|
|
||||||
order: 10
|
|
||||||
- source: github:quartz-community/syntax-highlighting
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
theme:
|
|
||||||
light: github-light
|
|
||||||
dark: github-dark
|
|
||||||
keepBackground: false
|
|
||||||
order: 20
|
|
||||||
- source: github:quartz-community/obsidian-flavored-markdown
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
enableInHtmlEmbed: false
|
|
||||||
enableCheckbox: true
|
|
||||||
order: 30
|
|
||||||
- source: github:quartz-community/github-flavored-markdown
|
|
||||||
enabled: true
|
|
||||||
order: 40
|
|
||||||
- source: github:quartz-community/table-of-contents
|
|
||||||
enabled: true
|
|
||||||
order: 50
|
|
||||||
- source: github:quartz-community/crawl-links
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
markdownLinkResolution: shortest
|
|
||||||
order: 60
|
|
||||||
- source: github:quartz-community/description
|
|
||||||
enabled: true
|
|
||||||
order: 70
|
|
||||||
- source: github:quartz-community/latex
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
renderEngine: katex
|
|
||||||
order: 80
|
|
||||||
- source: github:quartz-community/citations
|
|
||||||
enabled: false
|
|
||||||
order: 85
|
|
||||||
- source: github:quartz-community/hard-line-breaks
|
|
||||||
enabled: false
|
|
||||||
order: 90
|
|
||||||
- source: github:quartz-community/ox-hugo
|
|
||||||
enabled: false
|
|
||||||
order: 91
|
|
||||||
- source: github:quartz-community/roam
|
|
||||||
enabled: false
|
|
||||||
order: 92
|
|
||||||
- source: github:quartz-community/remove-draft
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/explicit-publish
|
|
||||||
enabled: false
|
|
||||||
- source: github:quartz-community/alias-redirects
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/content-index
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
enableSiteMap: true
|
|
||||||
enableRSS: true
|
|
||||||
- source: github:quartz-community/favicon
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/og-image
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/cname
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/canvas-page
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/bases-page
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/content-page
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/folder-page
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/tag-page
|
|
||||||
enabled: true
|
|
||||||
- source: github:quartz-community/explorer
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: left
|
|
||||||
priority: 50
|
|
||||||
- source: github:quartz-community/graph
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: right
|
|
||||||
priority: 10
|
|
||||||
- source: github:quartz-community/search
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: left
|
|
||||||
priority: 20
|
|
||||||
group: toolbar
|
|
||||||
groupOptions:
|
|
||||||
grow: true
|
|
||||||
- source: github:quartz-community/backlinks
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: right
|
|
||||||
priority: 30
|
|
||||||
- source: github:quartz-community/article-title
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: beforeBody
|
|
||||||
priority: 10
|
|
||||||
- source: github:quartz-community/content-meta
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: beforeBody
|
|
||||||
priority: 20
|
|
||||||
- source: github:quartz-community/tag-list
|
|
||||||
enabled: false
|
|
||||||
layout:
|
|
||||||
position: beforeBody
|
|
||||||
priority: 30
|
|
||||||
- source: github:quartz-community/page-title
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: left
|
|
||||||
priority: 10
|
|
||||||
- source: github:quartz-community/darkmode
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: left
|
|
||||||
priority: 30
|
|
||||||
group: toolbar
|
|
||||||
- source: github:quartz-community/reader-mode
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: left
|
|
||||||
priority: 35
|
|
||||||
group: toolbar
|
|
||||||
- source: github:quartz-community/breadcrumbs
|
|
||||||
enabled: true
|
|
||||||
layout:
|
|
||||||
position: beforeBody
|
|
||||||
priority: 5
|
|
||||||
condition: not-index
|
|
||||||
- source: github:quartz-community/comments
|
|
||||||
enabled: false
|
|
||||||
options:
|
|
||||||
provider: giscus
|
|
||||||
options: {}
|
|
||||||
layout:
|
|
||||||
position: afterBody
|
|
||||||
priority: 10
|
|
||||||
- source: github:quartz-community/footer
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
links:
|
|
||||||
GitHub: https://github.com/jackyzha0/quartz
|
|
||||||
Discord Community: https://discord.gg/cRFFHYye7t
|
|
||||||
- source: github:quartz-community/recent-notes
|
|
||||||
enabled: false
|
|
||||||
- source: github:quartz-community/spacer
|
|
||||||
enabled: true
|
|
||||||
options: {}
|
|
||||||
order: 25
|
|
||||||
layout:
|
|
||||||
position: left
|
|
||||||
priority: 25
|
|
||||||
display: mobile-only
|
|
||||||
- source: github:quartz-community/bases-page
|
|
||||||
enabled: true
|
|
||||||
options: {}
|
|
||||||
order: 50
|
|
||||||
- source: github:quartz-community/note-properties
|
|
||||||
enabled: true
|
|
||||||
options:
|
|
||||||
includeAll: false
|
|
||||||
includedProperties:
|
|
||||||
- description
|
|
||||||
- tags
|
|
||||||
- aliases
|
|
||||||
excludedProperties: []
|
|
||||||
hidePropertiesView: false
|
|
||||||
delimiters: "---"
|
|
||||||
language: yaml
|
|
||||||
order: 5
|
|
||||||
layout:
|
|
||||||
position: beforeBody
|
|
||||||
priority: 15
|
|
||||||
display: all
|
|
||||||
layout:
|
|
||||||
groups:
|
|
||||||
toolbar:
|
|
||||||
priority: 35
|
|
||||||
direction: row
|
|
||||||
gap: 0.5rem
|
|
||||||
byPageType:
|
|
||||||
"404":
|
|
||||||
positions:
|
|
||||||
beforeBody: []
|
|
||||||
left: []
|
|
||||||
right: []
|
|
||||||
content: {}
|
|
||||||
folder:
|
|
||||||
exclude:
|
|
||||||
- reader-mode
|
|
||||||
positions:
|
|
||||||
right: []
|
|
||||||
tag:
|
|
||||||
exclude:
|
|
||||||
- reader-mode
|
|
||||||
positions:
|
|
||||||
right: []
|
|
||||||
canvas: {}
|
|
||||||
bases: {}
|
|
||||||
@ -32,6 +32,11 @@ export const CreateArgv = {
|
|||||||
choices: ["new", "copy", "symlink"],
|
choices: ["new", "copy", "symlink"],
|
||||||
describe: "strategy for content folder setup",
|
describe: "strategy for content folder setup",
|
||||||
},
|
},
|
||||||
|
baseUrl: {
|
||||||
|
string: true,
|
||||||
|
alias: ["b"],
|
||||||
|
describe: "base URL for your Quartz site (e.g. mysite.github.io/quartz)",
|
||||||
|
},
|
||||||
links: {
|
links: {
|
||||||
string: true,
|
string: true,
|
||||||
alias: ["l"],
|
alias: ["l"],
|
||||||
|
|||||||
@ -35,6 +35,7 @@ import {
|
|||||||
readPluginsJson,
|
readPluginsJson,
|
||||||
writePluginsJson,
|
writePluginsJson,
|
||||||
extractPluginName,
|
extractPluginName,
|
||||||
|
updateGlobalConfig,
|
||||||
} from "./plugin-data.js"
|
} from "./plugin-data.js"
|
||||||
import {
|
import {
|
||||||
UPSTREAM_NAME,
|
UPSTREAM_NAME,
|
||||||
@ -68,6 +69,7 @@ export async function handleCreate(argv) {
|
|||||||
let linkResolutionStrategy = argv.links?.toLowerCase()
|
let linkResolutionStrategy = argv.links?.toLowerCase()
|
||||||
const sourceDirectory = argv.source
|
const sourceDirectory = argv.source
|
||||||
let template = argv.template?.toLowerCase()
|
let template = argv.template?.toLowerCase()
|
||||||
|
let baseUrl = argv.baseUrl
|
||||||
|
|
||||||
// If all cmd arguments were provided, check if they're valid
|
// If all cmd arguments were provided, check if they're valid
|
||||||
if (setupStrategy && linkResolutionStrategy) {
|
if (setupStrategy && linkResolutionStrategy) {
|
||||||
@ -253,6 +255,24 @@ See the [documentation](https://quartz.jzhao.xyz) for how to get started.
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Base URL prompt
|
||||||
|
if (!baseUrl) {
|
||||||
|
baseUrl = exitIfCancel(
|
||||||
|
await text({
|
||||||
|
message: "Enter the base URL for your Quartz site (e.g. mysite.github.io/quartz)",
|
||||||
|
placeholder: "mysite.github.io",
|
||||||
|
validate(value) {
|
||||||
|
if (!value || value.trim().length === 0) {
|
||||||
|
return "Base URL cannot be empty"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strip protocol prefix if user included it
|
||||||
|
baseUrl = baseUrl.replace(/^https?:\/\//, "").replace(/\/+$/, "")
|
||||||
|
|
||||||
// Create config if it doesn't exist
|
// Create config if it doesn't exist
|
||||||
if (!configExists()) {
|
if (!configExists()) {
|
||||||
if (template && template !== "default") {
|
if (template && template !== "default") {
|
||||||
@ -279,6 +299,9 @@ See the [documentation](https://quartz.jzhao.xyz) for how to get started.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update baseUrl in configuration
|
||||||
|
updateGlobalConfig({ baseUrl })
|
||||||
|
|
||||||
// setup remote
|
// setup remote
|
||||||
execSync(`git remote show upstream || git remote add upstream ${QUARTZ_SOURCE_REPO}`, {
|
execSync(`git remote show upstream || git remote add upstream ${QUARTZ_SOURCE_REPO}`, {
|
||||||
stdio: "ignore",
|
stdio: "ignore",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user