Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar authored Sep 28, 2024
2 parents 0863061 + 62fa792 commit 8b239df
Show file tree
Hide file tree
Showing 153 changed files with 2,785 additions and 1,862 deletions.
1 change: 1 addition & 0 deletions .bun-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.x
1 change: 1 addition & 0 deletions .deno-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v1.x
39 changes: 34 additions & 5 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,53 @@ on:
- cron: 0 3 * * *
jobs:
canary:
name: Deno Canary
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
runtime:
- name: deno
version: canary
- name: deno
version: rc
- name: node
version: nightly
# - name: bun
# version: canary
os: [macOS-latest, windows-latest, ubuntu-latest]
deno_version: [canary]
env:
RUST_BACKTRACE: full
DENO_FUTURE: 1
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno_version }}
deno-version: ${{ matrix.runtime.version }}

- name: Create package.json
if: ${{ matrix.runtime.name == 'node' || matrix.runtime.name == 'bun' }}
run: deno task setup:${{ matrix.runtime.name }} --no-install

- name: Setup Node
if: matrix.runtime.name == 'node'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.runtime.version }}

- name: Setup Bun
if: matrix.runtime.name == 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.runtime.version }}

- name: Setup pnpm
if: ${{ matrix.runtime.name == 'node' }}
uses: pnpm/action-setup@v4
with:
run_install: true

- name: Run tests
run: deno task test
run: deno task test:${{ matrix.runtime.name }}
19 changes: 14 additions & 5 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,23 @@ on:
pull_request:
jobs:
lint:
name: Lint source
name: Lint source deno-${{ matrix.deno_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
deno_version: [v1.x, rc]
env:
RUST_BACKTRACE: full
DENO_FUTURE: 1
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
deno-version: ${{ matrix.deno_version }}

- name: Setup shellcheck
run: >
Expand All @@ -37,5 +41,10 @@ jobs:
- name: Run zsh check
run: ./shellcheck --shell bash <(deno run -r ./examples/command/shell-completions.ts completions zsh)

- name: Type-check examples
run: deno task check:examples
- name: Type-check
if: matrix.deno_version == 'rc'
run: deno task check

- name: Type-check
if: matrix.deno_version == 'v1.x'
run: deno task check:deno-v1
62 changes: 51 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,74 @@ on:
pull_request:
jobs:
test:
name: ${{ matrix.module }} ${{ matrix.os }} deno-${{ matrix.deno }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
module: [ansi, command, flags, keycode, keypress, prompt, table, testing]
runtime:
- name: deno
version: v1.x
- name: deno
version: rc
- name: node
# - name: bun
os: [macOS-latest, windows-latest, ubuntu-latest]
deno: [v1.x]
env:
RUST_BACKTRACE: full
DENO_FUTURE: 1
CLIFFY_SNAPSHOT_DELAY: 2000
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: ${{ matrix.deno }}
deno-version: ${{ matrix.runtime.version }}
# deno-version-file: ".deno-version"

- name: Test ${{ matrix.module }}
run: deno task coverage:${{ matrix.module }}
- name: Create package.json
if: ${{ matrix.runtime.name == 'node' || matrix.runtime.name == 'bun' }}
run: deno task setup:${{ matrix.runtime.name }} --no-install

- name: Upload ${{ matrix.module }} coverage
- name: Setup Node
if: ${{ matrix.runtime.name == 'node' }}
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"

- name: Setup Bun
if: ${{ matrix.runtime.name == 'bun' }}
uses: oven-sh/setup-bun@v2
with:
bun-version-file: ".bun-version"

- name: Setup pnpm
if: ${{ matrix.runtime.name == 'node' }}
uses: pnpm/action-setup@v4
with:
run_install: true

- name: Run tests
if: matrix.runtime.name == 'deno' && matrix.runtime.version == 'v1.x'
shell: bash
run: deno task coverage:deno-v1

- name: Run tests
if: matrix.runtime.name == 'deno' && matrix.runtime.version == 'rc'
shell: bash
run: deno task coverage:deno-v2

- name: Run tests
if: matrix.runtime != 'deno'
shell: bash
run: deno task coverage:${{ matrix.runtime.name }}

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
name: ${{ matrix.module }}-${{ matrix.os }}-${{ matrix.deno }}
files: dist/coverage/${{ matrix.module }}/cov.lcov
flags: ${{ matrix.module }}
fail_ci_if_error: true
name: ${{ matrix.runtime.name }}-${{ matrix.os }}
files: dist/coverage/${{ matrix.runtime.name }}/cov.lcov
flags: ${{ matrix.runtime.name }}
token: ${{ secrets.CODECOV_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@ dist
testing/__snapshots__/snapshot_test_fixture.ts.snap
testing/__snapshots__/snapshot_test_fixture_2.ts.snap
__snapshots_test__

# Node files
node_modules
.npmrc
bun.lockb
package.json
pnpm-lock.yaml
tsconfig.json
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.x
35 changes: 18 additions & 17 deletions ansi/ansi_escapes_test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test } from "@cliffy/internal/testing/test";
import {
cursorBackward,
cursorDown,
Expand All @@ -16,7 +17,7 @@ import {
} from "./ansi_escapes.ts";
import { assertEquals } from "@std/assert";

Deno.test({
test({
name: "ansi - ansi escapes - cursorTo x",
fn() {
assertEquals(
Expand All @@ -26,7 +27,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorTo x y",
fn() {
assertEquals(
Expand All @@ -36,7 +37,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorMove right down",
fn() {
assertEquals(
Expand All @@ -46,7 +47,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorMove left up",
fn() {
assertEquals(
Expand All @@ -56,7 +57,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorUp",
fn() {
assertEquals(
Expand All @@ -66,7 +67,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorDown",
fn() {
assertEquals(
Expand All @@ -76,7 +77,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorForward",
fn() {
assertEquals(
Expand All @@ -86,7 +87,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorBackward",
fn() {
assertEquals(
Expand All @@ -96,7 +97,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorNextLine",
fn() {
assertEquals(
Expand All @@ -106,7 +107,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - cursorPrevLine",
fn() {
assertEquals(
Expand All @@ -116,7 +117,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - scrollUp",
fn() {
assertEquals(
Expand All @@ -126,7 +127,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - scrollDown",
fn() {
assertEquals(
Expand All @@ -136,7 +137,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - eraseUp",
fn() {
assertEquals(
Expand All @@ -146,7 +147,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - eraseUp",
fn() {
assertEquals(
Expand All @@ -156,7 +157,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - link",
fn() {
assertEquals(
Expand All @@ -166,7 +167,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - image",
fn() {
assertEquals(
Expand All @@ -180,7 +181,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - ansi escapes - image preserveAspectRatio",
fn() {
assertEquals(
Expand Down
9 changes: 5 additions & 4 deletions ansi/ansi_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { test } from "@cliffy/internal/testing/test";
import { assertEquals } from "@std/assert";
import { ansi } from "./ansi.ts";

Deno.test({
test({
name: "ansi - chainable ansi escapes",
fn() {
assertEquals(
Expand All @@ -11,7 +12,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - toArray",
fn() {
assertEquals(
Expand All @@ -21,7 +22,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - chainable ansi escape custom instance",
fn() {
const myAnsi = ansi();
Expand All @@ -39,7 +40,7 @@ Deno.test({
},
});

Deno.test({
test({
name: "ansi - empty ansi chain",
fn() {
assertEquals(ansi().toString(), "");
Expand Down
Loading

0 comments on commit 8b239df

Please sign in to comment.