Skip to content

Commit

Permalink
adds vitest plus fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarusA committed Jan 6, 2024
1 parent 6c8117d commit 0bf3292
Show file tree
Hide file tree
Showing 13 changed files with 2,403 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
with:
node-version: 18
cache: npm # or pnpm / yarn
cache-dependency-path: 'package.json' # this should be a package-lock.json file
cache-dependency-path: 'package-lock.json' # this should be a package-lock.json file
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Install dependencies
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ docs/src/examples

.cache
dev
test_record
test_record
node_modules
55 changes: 54 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,57 @@

[beautiful.makie.org](https://beautiful.makie.org)

Web page with basic examples showing how to use makie in julia
Web page with basic examples showing how to use makie in julia.

Some guidance on how to dev this locally:

```shell
npm install -D vitest
```
or
```shell
npm i
```
if a package*.json file is provided. Also you will need vitepress

```shell
npm add -D vitepress
```

## Generating files
> For this you should have [julia](https://julialang.org/downloads/) installed in your computer.
Then `cd` into the `docs` folder and `activate` and `instantiate` the `env` there:

```julia
julia>]
```
```julia
pkg> activate .
```
```julia
pkg> instantiate
```
then do

```julia
julia> include("gen_mds.jl")
```
and
```julia
julia> include("make.jl")
```
these step will generate all files needed in order to build the site, you could serve/build/preview it by doing

```shell
BeautifualMakie $ npm run docs:dev
```

```shell
BeautifualMakie $ npm run docs:build
```
and

```shell
BeautifualMakie $ npm run docs:preview
```
56 changes: 1 addition & 55 deletions docs/gen_mds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,58 +37,4 @@ srcsfiles = get_files(src_folders)
for p in srcsfiles
Literate.markdown(get_example_path(p), joinpath(OUTPUT, dirname(p));
documenter=true, credit=false)
end

# using Pkg

# ENV["MODERNGL_DEBUGGING"] = "true"; Pkg.build("ModernGL")
# using Literate, ProgressMeter
# using GLMakie
# if !GLMakie.ModernGL.enable_opengl_debugging
# # can't error, since we can't enable debugging for users
# @warn("TESTING WITHOUT OPENGL DEBUGGING")
# end
# get_example_path(p) = joinpath(@__DIR__, "examples", p)
# OUTPUT = joinpath(@__DIR__, "src", "examples", "generated")

# folders = readdir(joinpath(@__DIR__, "examples"))
# setdiff!(folders, [".DS_Store"])
# #setdiff!(folders, ["bars"])
# setdiff!(folders, ["cheat_sheets", "aog"])

# #folders = ["aog"]

# function get_files()
# srcsfiles = []
# for f in folders
# names = readdir(joinpath(@__DIR__, "examples", f))
# setdiff!(names, [".DS_Store", "density_ridges.jl",
# "world_energy.jl", "gapminder.jl",
# "vertical_feature_mask.jl",
# "submarine_cables.jl",
# "timeseries_proj.jl",
# "boxplots_collection.jl",
# "collection_violins.jl",
# "earthquakes_proj.jl",
# "rasters.jl",
# "makie_contributors.jl"])

# fpaths = "$(f)/" .* names
# srcsfiles = vcat(srcsfiles, fpaths...)
# end
# return srcsfiles
# end

# srcsfiles = get_files()

# mkdir("test-record")
# cd("test-record")
# using Makie
# @showprogress for p in srcsfiles
# path = joinpath(@__DIR__, "examples", p)
# println(p)
# fig = Base.evalfile(path)
# fig = Makie.current_figure()
# name = splitext(basename(p))[1]
# save(name * ".png", fig)
# end
end
25 changes: 22 additions & 3 deletions docs/src/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
import { defineConfig } from 'vitepress'
// We can use mergeConfig method from vite or vitest/config entries to merge Vitepress config with Vitest config:
import { mergeConfig } from 'vite';
import { defineConfig as defineViteConfig} from 'vitepress';
import { defineConfig as defineVitestConfig } from 'vitest/config';
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'

// https://vitepress.dev/reference/site-config
export default defineConfig({
const vitestConfig = defineVitestConfig({
build: {
chunkSizeWarningLimit:500,
rollupOptions: {
output:{
manualChunks(id) {
if (id.includes('node_modules')) {
return id.toString().split('node_modules/')[1].split('/')[0].toString();
}
}
}
}
},
});
const viteConfig = defineViteConfig({
base: '/',
title: "Beautiful Makie",
description: "A gallery collection",
Expand Down Expand Up @@ -461,4 +478,6 @@ export default defineConfig({
copyright: '© Copyright 2023 <strong>Lazaro Alonso</strong>'
}
}
})
})

export default mergeConfig(viteConfig, vitestConfig);
2 changes: 1 addition & 1 deletion examples/aog/density_ridges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ save("densityridges1.png", current_figure()); # hide
# ![](densityridges1.png)

p_len = data(penguins)
#p_len = AoG.density()
## p_len = AoG.density()
p_len *= mapping(:flipper_length_mm, color=:species)
p_len *= visual(AoG.Density, direction=:y, offset = 1.0,
alpha = 0.2, strokewidth = 1.5, strokecolor = :grey20)
Expand Down
17 changes: 9 additions & 8 deletions examples/datavis/earthquakes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ with_theme(theme_black()) do
halign=0.0, justification=:left)
zoom!(ax.scene, cameracontrols(ax.scene), 0.55)
rotate!(ax.scene, 3.0)

record(fig, "earthquakes.mp4", framerate = 24, update=false) do io
for i in 3.0:0.015:9.5
rotate!(ax.scene, i)
recordframe!(io) # record a new frame
end
end
save("earthquakes.png", fig; update=false)
##run this to get a smooth animation
## record(fig, "earthquakes.mp4", framerate = 24, update=false) do io
## for i in 3.0:0.015:9.5
## rotate!(ax.scene, i)
## recordframe!(io) # record a new frame
## end
## end
end

# ![type:video](earthquakes.mp4)
# ![](earthquakes.png)
2 changes: 1 addition & 1 deletion examples/datavis/earthquakes_proj.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ with_theme(theme_dark(), size = (1400,800)) do
gax = GeoAxis(fig[1,2]; aspect = 1, dest = "+proj=eqdc +lat_1=90 +lat_2=90")
axlocs = Axis(fig[1,1], xlabel = "depth [km]", ylabel = "magnitude")
lines!(gax, GeoMakie.coastlines(), color=:papayawhip, linewidth=0.5)
#obj = draw!(gax, p)
## obj = draw!(gax, p)
obj = scatter!(gax, df[!, :longitude], df[!, :latitude];
color = df[!, :mag], colormap = Reverse(:Hiroshige),
markersize = 50*(exp.(df[!, :mag]) .- mn)/mx )
Expand Down
2 changes: 1 addition & 1 deletion examples/geo/projections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function plotproj()
k = 1
for i in 1:2, j in 1:2
ga = GeoAxis(fig[i, j]; dest=sproj[k], title=sproj[k])
#hidedecorations!(ga)
## hidedecorations!(ga)
lines!(ga, GeoMakie.coastlines()) # plot coastlines from Natural Earth.
k += 1
end
Expand Down
2 changes: 1 addition & 1 deletion examples/geo/us_states.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ GLMakie.activate!()

states = Downloads.download("https://raw.githubusercontent.com/PublicaMundi/MappingAPI/master/data/geojson/us-states.json")
states_geo = GeoJSON.read(read(states, String))
#n = length(GeoInterface.features(states_geo))
## n = length(GeoInterface.features(states_geo))
n = length(states_geo)

fig = Figure(size=(1200, 800), fontsize=22)
Expand Down
2 changes: 1 addition & 1 deletion examples/geo/vertical_feature_mask.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ image!(ax, -180..180, -90..90, earth_img'[:,end:-1:1])
rotate!(ax.scene, 2*pi/2.6)
fig
zoom!(ax.scene, cameracontrols(ax.scene), 30)
#center!(ax.scene)
## center!(ax.scene)
save("vertical_feature_mask.png", fig, update=false); # hide

# ![](vertical_feature_mask.png)
Loading

0 comments on commit 0bf3292

Please sign in to comment.