Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"test": "tsx --test",
"profile": "0x -D prof ./quartz/bootstrap-cli.mjs build --concurrency=1",
"install-plugins": "npx tsx ./quartz/plugins/loader/install-plugins.ts",
"prebuild": "npm run install-plugins"
"prebuild": "npm run install-plugins",
"postinstall": "node quartz/bootstrap-postinstall.mjs"
},
"engines": {
"npm": ">=10.9.2",
Expand Down
27 changes: 27 additions & 0 deletions quartz/bootstrap-postinstall.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env node
import { chmodSync, existsSync, mkdirSync, symlinkSync, unlinkSync } from "fs"
import path from "path"

const root = path.resolve(import.meta.dirname, "..")
const target = path.join(root, "quartz", "bootstrap-cli.mjs")

try {
chmodSync(target, 0o755)
} catch {
// best-effort, not fatal if it were to fail
}

const binDir = path.join(root, "node_modules", ".bin")
mkdirSync(binDir, { recursive: true })

// only tested on mac, someone on windows will have to add a .cmd shim for this
const linkPath = path.join(binDir, "quartz")
const relativeTarget = path.relative(binDir, target)
try {
if (existsSync(linkPath)) {
unlinkSync(linkPath)
}
symlinkSync(relativeTarget, linkPath)
} catch (err) {
console.warn(`[quartz] could not link node_modules/.bin/quartz: ${err.message}`)
}
Comment on lines +75 to +77
Loading