-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
chore: add prepare script to run svelte-kit sync
#409
Conversation
🦋 Changeset detectedLatest commit: a76df1a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
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.
preprepare
scripts are also run when installing only prod dependencies (npm ci --omit=dev
), as one would do in a multi-stage Dockerfile. This script will fail if the svelte-kit
binary from the SK dev dependency isn't present, which will break the build.
My best suggestion currently is to add a fallback so the preprepare
script always succeeds, even if the svelte-kit
binary is missing. I think svelte-kit sync || echo
would be a cross-platform way to do that.
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.
A suggestion from @dominikg was to just keep using prepare
rather than preprepare
. If the concern was merely avoiding doing unnecessary work, I wouldn't worry about that, as the sync is super fast.
pnpm also provides an option to skip pre/post scripts when running the main script, which would break this if someone disabled it. To not run them was previously the default in pnpm 8, but it was changed to run them in pnpm 9 - but given that this possibility is out there, it makes sense to avoid the issue by just using prepare
.
I guess we only need to do that for the app templates and not the library template? |
@benmccann If someone's deploying the embedded demonstration/documentation site for a library, I think they could conceivably have a situation where they install only prod dependencies. I think it's safest to just include the |
For historical context, it looks like you suggested this solution a few years ago: sveltejs/kit#4585. It seems there was some debate then - does it need to be |
Looks like the tests are failing because of Storybook 😝 |
I thought I had had this discussion before! Thanks for digging up the issue. I'm not sure what to suggest around The thing with |
what about |
Oh, |
I wonder if that message will be confusing to users who see it in their Docker logs and aren't sure what the implications of that are and what they should do in response. I tend to think that being silent might be a little less scary since there's nothing we actually need to make the users aware of. |
svelte-kit sync
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.
This looks good to me!
Maybe pnpm dlx sv create
corepack use pnpm@10 # no warning message.
rm -rf node_modules
pnpm i # logs the following warning message:
# The following dependencies have build scripts that were ignored: esbuild
# To allow the execution of build scripts for these packages, add their names to "pnpm.onlyBuiltDependencies" in your "package.json", then run "pnpm rebuild"
|
closes #388
see also sveltejs/kit#13304
I went withpreprepare
as I believe it runs on solely on local installs (not installs from registry. though perhaps installs using git). Had previously been thinking aboutprepare
, but that also runs on publish and we don't need to do it thenmarked as draft as this currently only works on npm: pnpm/pnpm#8987