Skip to content

Commit e700d25

Browse files
committed
Fixes
1 parent 846360f commit e700d25

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

.github/workflows/test.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ jobs:
3333
key: ${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-${{ hashFiles('**/mix.lock') }}
3434
restore-keys: |
3535
${{ runner.os }}-mix-${{ env.elixir }}-${{ env.otp }}-
36+
- name: Restore bun cache
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/.bun/install/cache
41+
key: ${{ runner.os }}-bun-${{ hashFiles('assets/bun.lock') }}
3642
- name: Install mix dependencies
3743
run: mix deps.get
3844
- name: Check formatting
@@ -43,14 +49,10 @@ jobs:
4349
run: mix test
4450
env:
4551
TEST_GIT_SSH_KEY: ${{ secrets.TEST_GIT_SSH_KEY }}
46-
- name: Restore bun cache
47-
uses: actions/cache@v4
48-
with:
49-
path: |
50-
~/.bun/install/cache
51-
key: ${{ runner.os }}-bun-${{ hashFiles('assets/bun.lock') }}
5252
- name: Install bun dependencies
53-
run: mix bun.install --if-missing
53+
run: |
54+
mix bun.install --if-missing
55+
mix bun assets install
5456
- name: Check assets formatting
5557
run: mix bun assets run format-check
5658
- name: Run assets tests

assets/vite.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export default defineConfig({
3232
server: {
3333
port: 4432,
3434
origin: "http://localhost:4432",
35+
cors: {
36+
origin: ["http://localhost:4000"],
37+
},
3538
},
3639
});
3740

config/config.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ config :phoenix, :json_library, JSON
1818

1919
# Configure bun (the version is required)
2020
config :bun,
21-
version: "1.3.9",
21+
version: "1.2.23",
2222
assets: [args: ~w(), cd: Path.expand("../assets", __DIR__)]
2323

2424
# Additional mime types

lib/mix/tasks/compile.ensure_livebook_priv.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ defmodule Mix.Tasks.Compile.EnsureLivebookPriv do
1313
# In case Livebook is used as a library as in nerves_livebook,
1414
# the assets.setup is not called, so we use this custom compiler
1515
# to invoke the task and make the assets work transparently.
16-
if not File.exists?(priv_static_dir) do
16+
if Mix.env() == :prod and not File.exists?(priv_static_dir) do
1717
Mix.shell().info("Generating priv/static")
1818

19-
:ok = Mix.Task.run("assets.setup")
19+
Mix.Task.run("bun.install", ~w"--if-missing")
20+
Mix.Task.run("bun", ~w"assets install")
21+
Mix.Task.run("bun", ~w" assets run build")
2022
end
2123

2224
:ok

0 commit comments

Comments
 (0)