Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: test
on:
push:
branches:
- master
- main
pull_request:

Expand All @@ -14,10 +13,9 @@ jobs:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "25.2"
gleam-version: "1.2.0"
otp-version: "27"
gleam-version: "1.9.0"
rebar3-version: "3"
# elixir-version: "1.14.2"
- run: gleam format --check src test
- run: gleam deps download
- run: gleam test
- run: gleam format --check src test
8 changes: 4 additions & 4 deletions gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ description = "Basic file operations that work on all targets"

licences = ["Apache-2.0"]
repository = { type = "github", user = "bcpeinhardt", repo = "simplifile" }
gleam = ">= 0.32.0"
gleam = ">= 1.9.0"
# links = [{ title = "Website", href = "https://gleam.run" }]

[javascript.deno]
allow_all = true

[dependencies]
gleam_stdlib = "~> 0.34 or ~> 1.0"
filepath = "~> 1.0"
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
filepath = ">= 1.0.0 and < 2.0.0"

[dev-dependencies]
gleeunit = "~> 1.0"
gleeunit = ">= 1.0.0 and < 2.0.0"
12 changes: 6 additions & 6 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
# You typically do not need to edit this file

packages = [
{ name = "filepath", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "EFB6FF65C98B2A16378ABC3EE2B14124168C0CE5201553DE652E2644DCFDB594" },
{ name = "gleam_stdlib", version = "0.34.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "1FB8454D2991E9B4C0C804544D8A9AD0F6184725E20D63C3155F0AEB4230B016" },
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
{ name = "filepath", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "65F51013BCF78A603AFFD7992EF1CC6ECA96C74038EB48887F656DE44DBC1902" },
{ name = "gleam_stdlib", version = "0.58.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "091F2D2C4A3A4E2047986C47E2C2C9D728A4E068ABB31FDA17B0D347E6248467" },
{ name = "gleeunit", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "0E6C83834BA65EDCAAF4FE4FB94AC697D9262D83E6F58A750D63C9F6C8A9D9FF" },
]

[requirements]
filepath = { version = "~> 1.0"}
gleam_stdlib = { version = "~> 0.34 or ~> 1.0" }
gleeunit = { version = "~> 1.0" }
filepath = { version = ">= 1.0.0 and < 2.0.0" }
gleam_stdlib = { version = ">= 0.34.0 and < 2.0.0" }
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
26 changes: 17 additions & 9 deletions src/simplifile_js.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export function readBits(filepath) {
* @returns {Ok | GError}
*/
export function writeBits(filepath, contents) {
return gleamResult(() => fs.writeFileSync(path.normalize(filepath), contents.buffer));
return gleamResult(() =>
fs.writeFileSync(path.normalize(filepath), contents.rawBuffer),
);
}

/**
Expand All @@ -38,7 +40,9 @@ export function writeBits(filepath, contents) {
* @returns {Ok | GError}
*/
export function appendBits(filepath, contents) {
return gleamResult(() => fs.appendFileSync(path.normalize(filepath), contents.buffer));
return gleamResult(() =>
fs.appendFileSync(path.normalize(filepath), contents.rawBuffer),
);
}

/**
Expand Down Expand Up @@ -163,7 +167,9 @@ export function readDirectory(filepath) {
* @returns {Ok | GError}
*/
export function copyFile(srcpath, destpath) {
return gleamResult(() => fs.copyFileSync(path.normalize(srcpath), path.normalize(destpath)));
return gleamResult(() =>
fs.copyFileSync(path.normalize(srcpath), path.normalize(destpath)),
);
}

/**
Expand All @@ -174,7 +180,9 @@ export function copyFile(srcpath, destpath) {
* @returns {Ok | GError}
*/
export function renameFile(srcpath, destpath) {
return gleamResult(() => fs.renameSync(path.normalize(srcpath), path.normalize(destpath)));
return gleamResult(() =>
fs.renameSync(path.normalize(srcpath), path.normalize(destpath)),
);
}

/**
Expand Down Expand Up @@ -204,8 +212,8 @@ export function currentDirectory() {
*/
export function fileInfo(filepath) {
return gleamResult(() => {
const stat = fs.statSync(path.normalize(filepath))
return new FileInfo(stat)
const stat = fs.statSync(path.normalize(filepath));
return new FileInfo(stat);
});
}

Expand All @@ -215,9 +223,9 @@ export function fileInfo(filepath) {
*/
export function linkInfo(filepath) {
return gleamResult(() => {
const stat = fs.lstatSync(path.normalize(filepath))
return new FileInfo(stat)
})
const stat = fs.lstatSync(path.normalize(filepath));
return new FileInfo(stat);
});
}

class FileInfo {
Expand Down