Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: untangle quartz from local configs in least amount of changes #1730

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from

Conversation

necauqua
Copy link
Contributor

@necauqua necauqua commented Jan 19, 2025

For the current setup where people have to fork or at least clone quartz this changes nothing - but it allows you to install quartz as a devDependency via npm and have it actually work.

One real change is switch from .quartz-cache to
node_modules/.cache/quartz for transpilation results, this is an artifact from my previous attempts, I guess with this one I can change it back - but node_modules/.cache feels more better imo idk.

edit: OTOH if you want to have quartz be a completely separate binary (which this also enables I think), having it create a node_modules folder is weird, so I made a quick hack for that for now.

Example:

$ mkdir my-repo && cd my-repo
$ npm i quartz@necauqua/quartz#untangled # quartz@ prefix is important
$ cp node_modules/quartz/quartz.*.ts .   # copy the default configs
$ mkdir content && echo "# Hello World!" > content/index.md
$ npx quartz build --serve # this just works!
$ echo 'body { background: red !important; }' > styles.scss

Notice how I used my branch in the npm i line, ideally it'd be npm i quartz@jackyzha0/quartz, or maybe we can somehow get the quartz package on npm and it'll just be npm i quartz.
In the latter case npx quartz build will literally just work without a local npm package at all?.

Having some support for components and plugins being in separate npm packages instead of people copying code around is not out of the picture with this too btw.

Closes #502

@necauqua
Copy link
Contributor Author

necauqua commented Jan 19, 2025

Ugh and windows strikes the dream down (cuz not sure what it doesn't like and don't have a win machine to test - time to spin up a vm?.) ah wait it's just path separator bs, one moment

Also looking at diffs I realised we can just use the import cfg from "$config" spell everywhere and remove cfg from BuildCtx, which will simplify workers, cuz cfg was the only reason we had to reconstruct BuildCtx in an annoying way.

@necauqua necauqua force-pushed the untangled branch 2 times, most recently from 36f6b3c to 9fac023 Compare January 20, 2025 00:18
For the current setup where people have to fork or at least clone quartz
this changes nothing - but it allows you to install quartz as a
devDependency via npm and have it actually work.

One real change is switch from `.quartz-cache` to
`node_modules/.cache/quartz` for transpilation results, this is an
artifact from my previous attempts, I guess with this one I can change
it back - but `node_modules/.cache` feels more better imo idk.

edit: OTOH if you want to have quartz be a _completely_ separate binary
(which this also enables I think), having it create a node_modules
folder is weird, so I made a quick hack for that for now.

Example:
```bash
$ mkdir my-repo && cd my-repo
$ npm i quartz@necauqua/quartz#untangled # quartz@ prefix is important
$ cp node_modules/quartz/quartz.*.ts .   # copy the default configs
$ mkdir content && echo "# Hello World!" > content/index.md
$ npx quartz build --serve # this just works!
$ echo 'body { background: red !important; }' > styles.scss
```
Notice how I used my branch in the `npm i` line, ideally it'd be
`npm i quartz@jackyzho0/quartz`, or maybe we can somehow get the quartz
package on npm and it'll just be `npm i quartz`.
In the latter case `npx quartz build` will literally just work without
a local npm package at all?.

Having some support for components and plugins being in separate npm
packages instead of people copying code around is not out of the picture
with this too btw.

Closes jackyzha0#502

MOVE ME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bundled quartz cli
1 participant