Skip to content

Commit

Permalink
flake.nix with treefmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam committed Oct 31, 2024
1 parent e858374 commit ac861e1
Show file tree
Hide file tree
Showing 20 changed files with 308 additions and 133 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
path: ${{ steps.get_output_dir.outputs.output_dir }}
outputs:
output_dir: ${{ steps.get_output_dir.outputs.output_dir }}

deploy-preview:
if: github.event_name == 'pull_request'
needs: build
Expand All @@ -70,7 +69,6 @@ jobs:
message: |
Branch deployed for review at:
${{ steps.deploy.outputs.URL }}
deploy-production:
if: github.ref == 'refs/heads/main'
needs: build
Expand Down
36 changes: 18 additions & 18 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
[workspace]
members = ["builder"]

[package]
name = "_"
version = "0.0.0"
edition = "2021"

[features]
tokio_console = ["dep:console-subscriber"]

[dependencies]
anyhow = { version = "1.0.66", features = ["backtrace"] }
anyhow = {version = "1.0.66", features = ["backtrace"]}
camino = "1.1.4"
chrono = { version = "0.4.19", features = ["serde"] }
clap = { version = "4.1.4", features = ["derive"] }
console-subscriber = { version = "0.1.8", optional = true }
chrono = {version = "0.4.19", features = ["serde"]}
clap = {version = "4.1.4", features = ["derive"]}
console-subscriber = {version = "0.1.8", optional = true}
futures = "0.3.28"
indexmap = "1.9.2"
once_cell = "1.16.0"
serde = { version = "1.0.138", features = ["derive"] }
serde = {version = "1.0.138", features = ["derive"]}
serde_json = "1.0.82"
ssg-parent = { version = "0.0.0", path = "ssg-parent" }
ssg-parent = {version = "0.0.0", path = "ssg-parent"}
thiserror = "1.0.40"
# TODO less features
tokio = { version = "1.21.0", features = ["full"] }
tokio = {version = "1.21.0", features = ["full"]}
url = "2.3.1"

[features]
tokio_console = ["dep:console-subscriber"]

[package]
name = "_"
version = "0.0.0"
edition = "2021"

[workspace]
members = ["builder"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ $ cargo run -- --help
## Build time generated content

1. All content is generated by components.

1. A component is a type that implements `maud::Render`.

1. A component `Foo` and its implementations are in a module `crate::components::foo`.

1. The `crate::components` module re-exports all the components.

1. Components are never imported directly into scope.
Instead, the `crate::components` module is brought into scope.
A component `Foo` is referred to as `components::Foo`.

1. Component fields are `pub(crate)`. No constructor methods.
An example of how a component is used:

Expand All @@ -33,6 +38,7 @@ $ cargo run -- --help
})
}
```

1. Some types that implement `maud::Render` are not components.
This is because they are used as HTML attribute values.
The `maud::Render` trait is used for attribute values, as well.
40 changes: 20 additions & 20 deletions builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
[package]
name = "builder"
version = "0.0.0"
edition = "2021"

[features]
tokio_console = ["dep:console-subscriber"]

[dependencies]
anyhow = { version = "1.0.66", features = ["backtrace"] }
anyhow = {version = "1.0.66", features = ["backtrace"]}
camino = "1.1.4"
chrono = { version = "0.4.19", features = ["serde"] }
chrono-tz = { version = "0.6.1", features = ["serde"] }
clap = { version = "4.1.4", features = ["derive"] }
chrono = {version = "0.4.19", features = ["serde"]}
chrono-tz = {version = "0.6.1", features = ["serde"]}
clap = {version = "4.1.4", features = ["derive"]}
comrak = "0.17.1"
console-subscriber = { version = "0.1.8", optional = true }
console-subscriber = {version = "0.1.8", optional = true}
const_format = "0.2.30"
csscolorparser = { version = "0.6.0", features = ["serde"] }
csscolorparser = {version = "0.6.0", features = ["serde"]}
custom_attrs = "1.6.0"
derive_more = "0.99.17"
futures = "0.3.28"
Expand All @@ -26,15 +18,23 @@ itertools = "0.10.5"
maud = "0.24.0"
once_cell = "1.16.0"
relative-path = "1.8.0"
rrule = { version = "0.10.0", features = ["serde"] }
rrule = {version = "0.10.0", features = ["serde"]}
schema = "0.1.0"
serde = { version = "1.0.138", features = ["derive"] }
serde = {version = "1.0.138", features = ["derive"]}
serde_json = "1.0.82"
serde_yaml = "0.9.11"
ssg-child = { version = "0.0.0", path = "../ssg-child" }
strum = { version = "0.24.1", features = ["derive"] }
syn = { version = "2.0.5", features = ["full"] }
ssg-child = {version = "0.0.0", path = "../ssg-child"}
strum = {version = "0.24.1", features = ["derive"]}
syn = {version = "2.0.5", features = ["full"]}
thiserror = "1.0.40"
# TODO less features
tokio = { version = "1.21.0", features = ["full"] }
tokio = {version = "1.21.0", features = ["full"]}
url = "2.3.1"

[features]
tokio_console = ["dep:console-subscriber"]

[package]
name = "builder"
version = "0.0.0"
edition = "2021"
89 changes: 48 additions & 41 deletions builder/src/components/calendar/snippet.js
Original file line number Diff line number Diff line change
@@ -1,67 +1,74 @@
/* global FullCalendar */
; (function initCalendar({ events, displayEventTime, selectors }) {
window.addEventListener('DOMContentLoaded', () => {
const styleElm = document.createElement('style');
(function initCalendar({ events, displayEventTime, selectors }) {
window.addEventListener("DOMContentLoaded", () => {
const styleElm = document.createElement("style");

document.head.append(styleElm);

styleElm.sheet.insertRule('.fc .fc-toolbar .fc-toolbar-title { font-size: inherit }')
styleElm.sheet.insertRule('.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 0.5em; }')
styleElm.sheet.insertRule('.fc .fc-timegrid-slot { height: 2.5em; }')
styleElm.sheet.insertRule('.fc .fc-col-header-cell-cushion { text-decoration: none; }')
styleElm.sheet.insertRule(
".fc .fc-toolbar .fc-toolbar-title { font-size: inherit }",
);
styleElm.sheet.insertRule(
".fc .fc-toolbar.fc-header-toolbar { margin-bottom: 0.5em; }",
);
styleElm.sheet.insertRule(".fc .fc-timegrid-slot { height: 2.5em; }");
styleElm.sheet.insertRule(
".fc .fc-col-header-cell-cushion { text-decoration: none; }",
);

const calendarContainerElm = document.querySelector(selectors.calendarContainer)
const calendarContainerElm = document.querySelector(
selectors.calendarContainer,
);
const calendar = new FullCalendar.Calendar(calendarContainerElm, {
initialView: 'timeGridWeek',
slotDuration: '01:00:00',
initialView: "timeGridWeek",
slotDuration: "01:00:00",
expandRows: true,
dayHeaderFormat: { weekday: 'short' },
dayHeaderFormat: { weekday: "short" },
views: {
timeGridWeek: {
allDaySlot: false
}
allDaySlot: false,
},
},
events,
eventContent: ({ event }) => ({ html: event.extendedProps.eventContent }),
height: 'auto',
contentHeight: 'auto',
height: "auto",
contentHeight: "auto",
eventMinHeight: 40,
nowIndicator: true,
displayEventTime,
eventBorderColor: 'transparent',
eventBorderColor: "transparent",
headerToolbar: false,
stickyHeaderDates: false,
})
});

const dateRangeElm = document.querySelector(selectors.dateRange)
const timezoneElm = document.querySelector(selectors.timezone)
const dateRangeElm = document.querySelector(selectors.dateRange);
const timezoneElm = document.querySelector(selectors.timezone);

calendar.on('datesSet', (dateInfo) => {
const start = new Intl.DateTimeFormat().format(dateInfo.start)
const end = new Intl.DateTimeFormat().format(dateInfo.end)
dateRangeElm.textContent = `${start}${end}`
timezoneElm.textContent = `Time zone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}`
})
calendar.on("datesSet", (dateInfo) => {
const start = new Intl.DateTimeFormat().format(dateInfo.start);
const end = new Intl.DateTimeFormat().format(dateInfo.end);
dateRangeElm.textContent = `${start}${end}`;
timezoneElm.textContent = `Time zone: ${Intl.DateTimeFormat().resolvedOptions().timeZone}`;
});

const buttonPrevElm = document.querySelector(selectors.buttonPrev)
const buttonPrevElm = document.querySelector(selectors.buttonPrev);

buttonPrevElm.addEventListener('click', () => {
calendar.prev()
})
buttonPrevElm.addEventListener("click", () => {
calendar.prev();
});

const buttonNextElm = document.querySelector(selectors.buttonNext)
const buttonNextElm = document.querySelector(selectors.buttonNext);

buttonNextElm.addEventListener('click', () => {
calendar.next()
})
buttonNextElm.addEventListener("click", () => {
calendar.next();
});

const buttonTodayElm = document.querySelector(selectors.buttonToday)
const buttonTodayElm = document.querySelector(selectors.buttonToday);

buttonTodayElm.addEventListener('click', () => {
calendar.today()
})

calendar.render()
})
})
buttonTodayElm.addEventListener("click", () => {
calendar.today();
});

calendar.render();
});
});
105 changes: 105 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ac861e1

Please sign in to comment.