Skip to content

Commit

Permalink
fix: filter on .gleam files only
Browse files Browse the repository at this point in the history
  • Loading branch information
cdaringe committed Apr 14, 2024
1 parent 1790b2c commit 3d5d107
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "gserde"
version = "1.2.0"
version = "1.2.1"

# Fill out these fields if you intend to generate HTML documentation or publish
# your project to the Hex package manager.
Expand Down
18 changes: 10 additions & 8 deletions src/gserde.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn gen(req: Request) {
#(
req,
[ser, de]
|> string.join("\n\n"),
|> string.join("\n\n"),
)
}

Expand All @@ -40,7 +40,9 @@ pub fn main() {
}
fswalk.builder()
|> fswalk.with_path("src")
|> fswalk.with_entry_filter(fswalk.only_files)
|> fswalk.with_entry_filter(fn(it) {
string.ends_with(it.filename, ".gleam") && fswalk.only_files(it)
})
|> fswalk.walk
|> fswalk.map(fn(v) { expect(v, "failed to walk").filename })
|> fswalk.each(fn(f) { process_single(f, is_debug) })
Expand Down Expand Up @@ -104,12 +106,12 @@ pub fn process_single(src_filename: String, is_debug) {
simplifile.write(
to: dest_filename,
contents: [
"import gleam/json",
"import gleam/dynamic",
"import " <> src_module_name,
filecontent,
]
|> string.join("\n"),
"import gleam/json",
"import gleam/dynamic",
"import " <> src_module_name,
filecontent,
]
|> string.join("\n"),
)
|> result.unwrap(Nil)
}
Expand Down
4 changes: 2 additions & 2 deletions src/internal/codegen/modules.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ pub fn merge(m1: Mod, m2: Mod) {
functions: list.concat([m1.functions, m2.functions]),
types: list.concat([m1.types, m2.types]),
imports: list.concat([m1.imports, m2.imports])
|> set.from_list
|> set.to_list,
|> set.from_list
|> set.to_list,
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/internal/codegen/statements.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ pub fn call(name: String, arguments: List(GleamStatement)) {
FunctionCall(
name,
arguments
|> map(UseArg),
|> map(UseArg),
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/internal/deserializer.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn gen_decoder(typ, req: Request) {
gens.call(
"dynamic.tuple" <> string.lowercase(m_tuple),
parts
|> list.map(fn(part) { gen_decoder(part, req) }),
|> list.map(fn(part) { gen_decoder(part, req) }),
)
}
x -> {
Expand Down

0 comments on commit 3d5d107

Please sign in to comment.