From 12263a6b4c8e31ad8e9dc39db78659570983a5fd Mon Sep 17 00:00:00 2001 From: Hexagon Date: Thu, 7 Mar 2024 13:18:56 +0000 Subject: [PATCH] Add workflows. Formatting. --- .github/workflows/deno.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/jsr.yml | 20 ++++++++++++++++++++ .gitignore | 2 ++ README.md | 21 ++++++++++++--------- access/mod.ts | 22 ++++++++++++---------- deno.lock | 19 ------------------- mod.ts | 2 +- 7 files changed, 76 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/deno.yml create mode 100644 .github/workflows/jsr.yml delete mode 100644 deno.lock diff --git a/.github/workflows/deno.yml b/.github/workflows/deno.yml new file mode 100644 index 0000000..6f7098b --- /dev/null +++ b/.github/workflows/deno.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/jsr.yml b/.github/workflows/jsr.yml new file mode 100644 index 0000000..dd38b00 --- /dev/null +++ b/.github/workflows/jsr.yml @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore index c6bba59..a58faab 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,5 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* +# Deno / JSR +deno.lock \ No newline at end of file diff --git a/README.md b/README.md index e63510d..b6c9320 100644 --- a/README.md +++ b/README.md @@ -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 | | -| ... | | | | | \ No newline at end of file +| Method | Deno | Node | Bun | Browser (LocalStorage) | +| --------- | ---- | ---- | --- | ---------------------- | +| access | X | X | X | | +| readfile | X | X | X | | +| writefile | X | X | X | | +| ... | | | | | diff --git a/access/mod.ts b/access/mod.ts index bcb5f0b..0bc6064 100644 --- a/access/mod.ts +++ b/access/mod.ts @@ -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 }; \ No newline at end of file +export { access }; diff --git a/deno.lock b/deno.lock deleted file mode 100644 index f30ea86..0000000 --- a/deno.lock +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "3", - "packages": { - "specifiers": { - "jsr:@cross/runtime@^0.0.16": "jsr:@cross/runtime@0.0.16" - }, - "jsr": { - "@cross/runtime@0.0.16": { - "integrity": "91fdccc7048f168b914e37caf06df3416a3bb36cc330ef22b7bd73ac95ff8de0" - } - } - }, - "remote": {}, - "workspace": { - "dependencies": [ - "jsr:@cross/runtime@^0.0.16" - ] - } -} diff --git a/mod.ts b/mod.ts index 34e0ad4..19efd2b 100644 --- a/mod.ts +++ b/mod.ts @@ -1 +1 @@ -export { access } from "./access/mod.ts"; \ No newline at end of file +export { access } from "./access/mod.ts";