mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-21 21:45:42 -05:00
Fix TypeScript errors in git-installed plugins
- Install @quartz-community/types as devDependency - Fix plugin imports to define types locally - Fix search inline script fetchData bug - Format code with prettier
This commit is contained in:
parent
574b7fa3a5
commit
9c4a1f8af7
@ -15,4 +15,3 @@ Quartz is a static site generator for digital gardens.
|
|||||||
- Fast search
|
- Fast search
|
||||||
- Graph view
|
- Graph view
|
||||||
- Explorer sidebar
|
- Explorer sidebar
|
||||||
|
|
||||||
|
|||||||
121
package-lock.json
generated
121
package-lock.json
generated
@ -13,9 +13,6 @@
|
|||||||
"@floating-ui/dom": "^1.7.4",
|
"@floating-ui/dom": "^1.7.4",
|
||||||
"@myriaddreamin/rehype-typst": "^0.6.0",
|
"@myriaddreamin/rehype-typst": "^0.6.0",
|
||||||
"@napi-rs/simple-git": "0.1.22",
|
"@napi-rs/simple-git": "0.1.22",
|
||||||
"@quartz-community/explorer": "github:quartz-community/explorer",
|
|
||||||
"@quartz-community/graph": "github:quartz-community/graph",
|
|
||||||
"@quartz-community/search": "github:quartz-community/search",
|
|
||||||
"@tweenjs/tween.js": "^25.0.0",
|
"@tweenjs/tween.js": "^25.0.0",
|
||||||
"ansi-truncate": "^1.4.0",
|
"ansi-truncate": "^1.4.0",
|
||||||
"async-mutex": "^0.5.0",
|
"async-mutex": "^0.5.0",
|
||||||
@ -79,6 +76,7 @@
|
|||||||
"quartz": "quartz/bootstrap-cli.mjs"
|
"quartz": "quartz/bootstrap-cli.mjs"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@quartz-community/types": "file:../types",
|
||||||
"@types/d3": "^7.4.3",
|
"@types/d3": "^7.4.3",
|
||||||
"@types/hast": "^3.0.4",
|
"@types/hast": "^3.0.4",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
@ -97,6 +95,20 @@
|
|||||||
"npm": ">=10.9.2"
|
"npm": ">=10.9.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"../types": {
|
||||||
|
"name": "@quartz-community/types",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"tsup": "^8.5.0",
|
||||||
|
"typescript": "^5.9.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22",
|
||||||
|
"npm": ">=10.9.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@bufbuild/protobuf": {
|
"node_modules/@bufbuild/protobuf": {
|
||||||
"version": "2.11.0",
|
"version": "2.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.11.0.tgz",
|
||||||
@ -1916,108 +1928,9 @@
|
|||||||
"version": "2.9.6",
|
"version": "2.9.6",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@quartz-community/explorer": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "git+ssh://git@github.com/quartz-community/explorer.git#90d00f2217b186cbc96a44b29854abb7004a7f51",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"mdast-util-find-and-replace": "^3.0.1",
|
|
||||||
"rehype-slug": "^6.0.0",
|
|
||||||
"remark-gfm": "^4.0.1",
|
|
||||||
"remark-parse": "^11.0.0",
|
|
||||||
"remark-stringify": "^11.0.0",
|
|
||||||
"unified": "^11.0.5",
|
|
||||||
"unist-util-visit": "^5.0.0",
|
|
||||||
"vfile": "^6.0.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=22",
|
|
||||||
"npm": ">=10.9.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@jackyzha0/quartz": "^4.5.2",
|
|
||||||
"preact": "^10.0.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@jackyzha0/quartz": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"preact": {
|
|
||||||
"optional": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@quartz-community/graph": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "git+ssh://git@github.com/quartz-community/graph.git#71bd8dc24d67d1a9ea461c379b87bab3904739de",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"mdast-util-find-and-replace": "^3.0.1",
|
|
||||||
"rehype-slug": "^6.0.0",
|
|
||||||
"remark-gfm": "^4.0.1",
|
|
||||||
"remark-parse": "^11.0.0",
|
|
||||||
"remark-stringify": "^11.0.0",
|
|
||||||
"unified": "^11.0.5",
|
|
||||||
"unist-util-visit": "^5.0.0",
|
|
||||||
"vfile": "^6.0.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=22",
|
|
||||||
"npm": ">=10.9.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@jackyzha0/quartz": "^4.5.2",
|
|
||||||
"preact": "^10.0.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@jackyzha0/quartz": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"preact": {
|
|
||||||
"optional": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@quartz-community/search": {
|
|
||||||
"version": "0.1.0",
|
|
||||||
"resolved": "git+ssh://git@github.com/quartz-community/search.git#e3b491b0a588c67ec5475cc7b1ccc35de7d8cf59",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@quartz-community/types": "github:quartz-community/types",
|
|
||||||
"mdast-util-find-and-replace": "^3.0.1",
|
|
||||||
"rehype-slug": "^6.0.0",
|
|
||||||
"remark-gfm": "^4.0.1",
|
|
||||||
"remark-parse": "^11.0.0",
|
|
||||||
"remark-stringify": "^11.0.0",
|
|
||||||
"unified": "^11.0.5",
|
|
||||||
"unist-util-visit": "^5.0.0",
|
|
||||||
"vfile": "^6.0.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=22",
|
|
||||||
"npm": ">=10.9.2"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@jackyzha0/quartz": "^4.5.2",
|
|
||||||
"preact": "^10.0.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"@jackyzha0/quartz": {
|
|
||||||
"optional": true
|
|
||||||
},
|
|
||||||
"preact": {
|
|
||||||
"optional": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@quartz-community/types": {
|
"node_modules/@quartz-community/types": {
|
||||||
"version": "0.1.0",
|
"resolved": "../types",
|
||||||
"resolved": "git+ssh://git@github.com/quartz-community/types.git#a342579c845f6dfd74c2aed861b4662a69c5e328",
|
"link": true
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=22",
|
|
||||||
"npm": ">=10.9.2"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"node_modules/@shikijs/core": {
|
"node_modules/@shikijs/core": {
|
||||||
"version": "1.26.2",
|
"version": "1.26.2",
|
||||||
|
|||||||
@ -101,6 +101,7 @@
|
|||||||
"yargs": "^18.0.0"
|
"yargs": "^18.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@quartz-community/types": "file:../types",
|
||||||
"@types/d3": "^7.4.3",
|
"@types/d3": "^7.4.3",
|
||||||
"@types/hast": "^3.0.4",
|
"@types/hast": "^3.0.4",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
|
|||||||
@ -52,7 +52,9 @@ export async function handlePluginInstall() {
|
|||||||
const lockfile = readLockfile()
|
const lockfile = readLockfile()
|
||||||
|
|
||||||
if (!lockfile) {
|
if (!lockfile) {
|
||||||
console.log(styleText("yellow", "⚠ No quartz.lock.json found. Run 'npx quartz plugin add <repo>' first."))
|
console.log(
|
||||||
|
styleText("yellow", "⚠ No quartz.lock.json found. Run 'npx quartz plugin add <repo>' first."),
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +73,9 @@ export async function handlePluginInstall() {
|
|||||||
try {
|
try {
|
||||||
const currentCommit = getGitCommit(pluginDir)
|
const currentCommit = getGitCommit(pluginDir)
|
||||||
if (currentCommit === entry.commit) {
|
if (currentCommit === entry.commit) {
|
||||||
console.log(styleText("gray", ` ✓ ${name}@${entry.commit.slice(0, 7)} already installed`))
|
console.log(
|
||||||
|
styleText("gray", ` ✓ ${name}@${entry.commit.slice(0, 7)} already installed`),
|
||||||
|
)
|
||||||
installed++
|
installed++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -88,7 +92,10 @@ export async function handlePluginInstall() {
|
|||||||
console.log(styleText("cyan", ` → ${name}: cloning...`))
|
console.log(styleText("cyan", ` → ${name}: cloning...`))
|
||||||
execSync(`git clone --depth 1 ${entry.resolved} ${pluginDir}`, { stdio: "ignore" })
|
execSync(`git clone --depth 1 ${entry.resolved} ${pluginDir}`, { stdio: "ignore" })
|
||||||
if (entry.commit !== "unknown") {
|
if (entry.commit !== "unknown") {
|
||||||
execSync(`git fetch --depth 1 origin ${entry.commit}`, { cwd: pluginDir, stdio: "ignore" })
|
execSync(`git fetch --depth 1 origin ${entry.commit}`, {
|
||||||
|
cwd: pluginDir,
|
||||||
|
stdio: "ignore",
|
||||||
|
})
|
||||||
execSync(`git checkout ${entry.commit}`, { cwd: pluginDir, stdio: "ignore" })
|
execSync(`git checkout ${entry.commit}`, { cwd: pluginDir, stdio: "ignore" })
|
||||||
}
|
}
|
||||||
console.log(styleText("green", ` ✓ ${name}@${entry.commit.slice(0, 7)}`))
|
console.log(styleText("green", ` ✓ ${name}@${entry.commit.slice(0, 7)}`))
|
||||||
@ -203,7 +210,9 @@ export async function handlePluginUpdate(names) {
|
|||||||
|
|
||||||
const pluginDir = path.join(PLUGINS_DIR, name)
|
const pluginDir = path.join(PLUGINS_DIR, name)
|
||||||
if (!fs.existsSync(pluginDir)) {
|
if (!fs.existsSync(pluginDir)) {
|
||||||
console.log(styleText("yellow", `⚠ ${name} directory missing. Run 'npx quartz plugin install'.`))
|
console.log(
|
||||||
|
styleText("yellow", `⚠ ${name} directory missing. Run 'npx quartz plugin install'.`),
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +304,9 @@ export async function handlePluginRestore() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log(styleText("cyan", `→ ${name}: cloning ${entry.resolved}@${entry.commit.slice(0, 7)}...`))
|
console.log(
|
||||||
|
styleText("cyan", `→ ${name}: cloning ${entry.resolved}@${entry.commit.slice(0, 7)}...`),
|
||||||
|
)
|
||||||
execSync(`git clone ${entry.resolved} ${pluginDir}`, { stdio: "ignore" })
|
execSync(`git clone ${entry.resolved} ${pluginDir}`, { stdio: "ignore" })
|
||||||
execSync(`git checkout ${entry.commit}`, { cwd: pluginDir, stdio: "ignore" })
|
execSync(`git checkout ${entry.commit}`, { cwd: pluginDir, stdio: "ignore" })
|
||||||
console.log(styleText("green", `✓ ${name} restored`))
|
console.log(styleText("green", `✓ ${name} restored`))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user