-
Notifications
You must be signed in to change notification settings - Fork 324
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
Use turbo for dev #383
Use turbo for dev #383
Conversation
@@ -3,7 +3,7 @@ | |||
"private": true, | |||
"version": "0.10.1", | |||
"scripts": { | |||
"dev": "vite", | |||
"_dev": "vite", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Annoying, but we don't want to run the dev
mode of this playground package during normal dev. Interested in future support for an ignore
flag in Turbo. In the meantime, this is rarely used so I'm 💯 ok with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does --ignore
give you this from the top-level script?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's broken right now vercel/turborepo#445 and will be replaced by a new --filter
syntax eventually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Questions, mostly because I haven't used Turbo before and wanted to understand it better. Thanks in advance
package.json
Outdated
"build-hydrogen-template": "yarn workspace template-hydrogen-default build", | ||
"build-lint": "yarn workspace eslint-plugin-hydrogen build", | ||
"dev": "yarn turbo run dev --parallel --continue", | ||
"build": "yarn turbo run build --parallel --continue", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just looking at the turbo docs here, so I understand:
--parallel
mentions that it's good for "developing with live reloading." For a build script, does this come with some cons of using it?
--continue
says that it will continue even in the presence of an error code. I don't think we would want that for a build script? (If something fails during a build, we would that to stop so that we can't publish a broken build or something, right?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah good catch - copy/pasted from dev without thinking of this.
package.json
Outdated
"build-dev": "yarn build-hydrogen-template", | ||
"build-hydrogen-template": "yarn workspace template-hydrogen-default build", | ||
"build-lint": "yarn workspace eslint-plugin-hydrogen build", | ||
"dev": "yarn turbo run dev --parallel --continue", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to learn Turbo here, forgive my questions:
Should we consider adding --no-cache
to the dev script? It says that it's "useful for watch commands"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've set cache: false
in turbo.json
, which I assume is the same thing.
@@ -3,7 +3,7 @@ | |||
"private": true, | |||
"version": "0.10.1", | |||
"scripts": { | |||
"dev": "vite", | |||
"_dev": "vite", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does --ignore
give you this from the top-level script?
turbo.json
Outdated
"$schema": "https://turborepo.org/schema.json", | ||
"baseBranch": "origin/main", | ||
"pipeline": { | ||
"build": {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that setting outputs
is important to the caching aspect of Turbo, I think? https://turborepo.org/docs/reference/configuration#outputs
So we would want to put dist
in there, or am I misunderstanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It defaults to [dist/**, build/**]
, so we should be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah missed that. 👍
efd6e7f
to
c8f4b17
Compare
Description
IDK if Turbo is compatible withdev
style commands, where atsc --watch
has to run, complete initial build, and then another consuming package can use it. I can't find any docs on this.tl;dr is thatdev#vite.config.js
fails because@shopify/hydrogen/plugin
does not yet resolve to a compiled file when it tries to runhydrogen
at all and instead just let Vite do the heavy lifting? That seems to be the approach thenpx create-turbo
scaffolded app takes: let Next.js transpile the UI deps 🤔Update: Solved this by doing two things:
rm -rf
the dist output as apredev
task anymore. YOLO it's probably fine.@shopify/hydrogen#build
a prereq for runningdev
in the pipeline. This means it's always available for the starter template Vite plugin.Fixes #667
Additional context
Before submitting the PR, please make sure you do the following:
fixes #123
)