Skip to content

Commit

Permalink
Add workflows. Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexagon committed Mar 7, 2024
1 parent 03c300c commit 12263a6
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 39 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deno CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Setup repo
uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Verify formatting
run: deno fmt --check

- name: Run linter
run: deno lint

- name: Check types
run: deno check mod.ts
20 changes: 20 additions & 0 deletions .github/workflows/jsr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Publish to jsr
on:
release:
types: [released]

workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Publish package
run: npx jsr publish
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,5 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
# Deno / JSR
deno.lock
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# @cross/fs

Available for Node, Deno Bun and Browser at [jsr.io/@cross/fs](https://jsr.io/@cross/fs).
Available for Node, Deno Bun and Browser at
[jsr.io/@cross/fs](https://jsr.io/@cross/fs).

**Work in progress** Cross Runtime filesystem operations for JavaScript and TypeScript.
**Work in progress** Cross Runtime filesystem operations for JavaScript and
TypeScript.

For cross rutime path operations, [jsr.io/@std/path](https://jsr.io/@std/path) will cover most scenarios, this library focuses on the file system operations.
For cross rutime path operations, [jsr.io/@std/path](https://jsr.io/@std/path)
will cover most scenarios, this library focuses on the file system operations.

## Coverage

| Method | Deno | Node | Bun | Browser (LocalStorage) |
|--------|------|------|-----|-------- |
| access | X | X | X | |
| readfile | X | X | X | |
| writefile | X | X | X | |
| ... | | | | |
| Method | Deno | Node | Bun | Browser (LocalStorage) |
| --------- | ---- | ---- | --- | ---------------------- |
| access | X | X | X | |
| readfile | X | X | X | |
| writefile | X | X | X | |
| ... | | | | |
22 changes: 12 additions & 10 deletions access/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ import { CurrentRuntime, Runtime } from "@cross/runtime";

// Defailt to failure
// deno-lint-ignore prefer-const
let access = () => { throw new Error("Unsupported Runtime") };
let access = () => {
throw new Error("Unsupported Runtime");
};

switch (CurrentRuntime) {
case Runtime.Node:
break;
case Runtime.Deno:
break;
case Runtime.Bun:
break;
case Runtime.Browser:
break;
case Runtime.Node:
break;
case Runtime.Deno:
break;
case Runtime.Bun:
break;
case Runtime.Browser:
break;
}

export { access };
export { access };
19 changes: 0 additions & 19 deletions deno.lock

This file was deleted.

2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { access } from "./access/mod.ts";
export { access } from "./access/mod.ts";

0 comments on commit 12263a6

Please sign in to comment.