Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for jsr repository #679

Merged
merged 54 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e79c45b
chore: :package: add jsr module metadatas
JOTSR Feb 29, 2024
4e104e5
refactor: :package: replace remote url imports by jsr or npm
JOTSR Feb 29, 2024
6daec80
fix: :wrench: prefix exports with `./`
JOTSR Feb 29, 2024
d6af963
fix: :package: remove `/mod` from `@std/path`
JOTSR Feb 29, 2024
564d1bf
refactor: :label: fix all slow types for jsr exports
JOTSR Feb 29, 2024
3fe231a
chore(upgrade): :arrow_up: deno/[email protected]
JOTSR Feb 29, 2024
eb72f6b
ci: add jsr publish workflow
JOTSR Feb 29, 2024
5cec103
style: run deno fmt on deno.jsonc
JOTSR Mar 8, 2024
ac01ba4
refactor: :truck: rename cliffy scope
JOTSR Mar 8, 2024
cc44644
refactor: :recycle: split cliffy in submodules with deno workspaces
JOTSR Mar 8, 2024
b7c5a7d
refactor: :label: simplify literals types to string
JOTSR Mar 8, 2024
aebf585
refactor: :recycle: replace `deps`/`dev_deps` by direct imports
JOTSR Mar 8, 2024
be0f0d2
ci: publish on release and dry run on main push
JOTSR Mar 8, 2024
587cfd1
fix: update missing import
JOTSR Mar 8, 2024
df78f58
refactor: dissociate examples imports
JOTSR Mar 13, 2024
f06d9c1
fix: :package: remove `examples` from workspace
JOTSR Mar 14, 2024
706e2c9
style: :art: apply `deno fmt` to harmonize sources
JOTSR Mar 14, 2024
3513bf4
fix cross package imports
c4spar Mar 17, 2024
2a8f296
fix: :construction_worker: `deno.jsonc` not loaded during tests in `s…
JOTSR Mar 18, 2024
1008ac2
Merge branch 'main' of github.com:JOTSR/deno-cliffy
JOTSR Mar 18, 2024
31c9d73
style: fix fmt
JOTSR Mar 18, 2024
766634a
Merge remote-tracking branch 'origin/main' into JOTSR-main
c4spar Mar 18, 2024
eb19021
Merge remote-tracking branch 'origin/main' into JOTSR-main
c4spar Mar 18, 2024
269648c
import ValidationError from @cliffy/flags
c4spar Mar 18, 2024
cd621ec
Merge remote-tracking branch 'origin/main' into JOTSR-main
c4spar Mar 18, 2024
0c34bbd
refactor: :recycle: don't force `deno.jsonc` prefers default options
JOTSR Mar 19, 2024
af3d77f
Merge branch 'main' of github.com:JOTSR/deno-cliffy
JOTSR Mar 19, 2024
3016d1f
remove examples/deno.json
c4spar Mar 19, 2024
820c260
Merge remote-tracking branch 'origin/main' into JOTSR-main
c4spar Mar 19, 2024
87a954b
fix imports
c4spar Mar 19, 2024
d7e3de6
fix test imports
c4spar Mar 19, 2024
0e6ce61
remove config option
c4spar Mar 19, 2024
1b69821
merge main branch
c4spar Apr 7, 2024
ef3046f
fmt
c4spar Apr 7, 2024
6c5bd08
fix
c4spar Apr 7, 2024
2d306d1
Merge remote-tracking branch 'origin/main' into JOTSR-main
c4spar Apr 7, 2024
bfe0dde
fix import
c4spar Apr 7, 2024
297574f
remove name and version from main deno.jsonc
c4spar Apr 9, 2024
9a7ebae
remove submodule exports from command/mod.ts
c4spar May 5, 2024
00397c2
add exports to ansi/deno.json
c4spar May 5, 2024
ee17e96
fix imports
c4spar May 5, 2024
7e4f76e
add workaround for workspace issue
c4spar May 5, 2024
c4171e5
fix examples
c4spar May 5, 2024
87b3a95
debug
c4spar May 5, 2024
ae2c9d8
debug
c4spar May 5, 2024
bd469ec
debug
c4spar May 5, 2024
df989de
debug
c4spar May 5, 2024
2e442fd
debug
c4spar May 5, 2024
682ccfd
debug
c4spar May 5, 2024
058d093
debug
c4spar May 5, 2024
463c41e
debug
c4spar May 5, 2024
e5d618e
adapt ansi exports
c4spar May 5, 2024
6ac036c
adapt publish workflow
c4spar May 5, 2024
1a0a3a4
cleanup
c4spar May 5, 2024
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
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish

on:
pull_request:
push:
branches: [main]
release:
types: [published]

env:
DENO_UNSTABLE_WORKSPACES: true

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Deno
uses: denoland/setup-deno@v1

- name: Publish (dry run)
if: github.event_name != 'release'
run: deno publish --dry-run

- name: Publish
if: github.event_name == 'release'
run: deno publish
4 changes: 2 additions & 2 deletions ansi/ansi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type Ansi = AnsiFactory & AnsiChain;
* If invoked as method, a new Ansi instance will be returned.
*
* ```ts
* import { ansi } from "./mod.ts";
* import { ansi } from "@cliffy/ansi";
*
* await Deno.stdout.write(
* new TextEncoder().encode(
Expand All @@ -44,7 +44,7 @@ export type Ansi = AnsiFactory & AnsiChain;
* Or shorter:
*
* ```ts
* import { ansi } from "./mod.ts";
* import { ansi } from "@cliffy/ansi";
*
* await Deno.stdout.write(
* ansi.cursorTo(0, 0).eraseScreen.bytes(),
Expand Down
30 changes: 15 additions & 15 deletions ansi/ansi_escapes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { encodeBase64 } from "./deps.ts";
import { encodeBase64 } from "@std/encoding/base64";

/** Escape sequence: `\x1B` */
const ESC = "\x1B";
/** Control sequence intro: `\x1B[` */
const CSI = `${ESC}[`;
const CSI: string = `${ESC}[`;
/** Operating system command: `\x1B]` */
const OSC = `${ESC}]`;
/** Link separator */
Expand All @@ -12,7 +12,7 @@ const SEP = ";";
/** Ring audio bell: `\u0007` */
export const bel = "\u0007";
/** Get cursor position. */
export const cursorPosition = `${CSI}6n`;
export const cursorPosition: string = `${CSI}6n`;

/**
* Move cursor to x, y, counting from the top left corner.
Expand Down Expand Up @@ -98,15 +98,15 @@ export function cursorPrevLine(count = 1): string {
}

/** Move cursor to first column of current row. */
export const cursorLeft = `${CSI}G`;
export const cursorLeft: string = `${CSI}G`;
/** Hide cursor. */
export const cursorHide = `${CSI}?25l`;
export const cursorHide: string = `${CSI}?25l`;
/** Show cursor. */
export const cursorShow = `${CSI}?25h`;
export const cursorShow: string = `${CSI}?25h`;
/** Save cursor. */
export const cursorSave = `${ESC}7`;
export const cursorSave: string = `${ESC}7`;
/** Restore cursor. */
export const cursorRestore = `${ESC}8`;
export const cursorRestore: string = `${ESC}8`;

/**
* Scroll window up by n lines.
Expand All @@ -125,7 +125,7 @@ export function scrollDown(count = 1): string {
}

/** Clear screen. */
export const eraseScreen = `${CSI}2J`;
export const eraseScreen: string = `${CSI}2J`;

/**
* Clear screen up by n lines.
Expand All @@ -144,11 +144,11 @@ export function eraseDown(count = 1): string {
}

/** Clear current line. */
export const eraseLine = `${CSI}2K`;
export const eraseLine: string = `${CSI}2K`;
/** Clear to line end. */
export const eraseLineEnd = `${CSI}0K`;
export const eraseLineEnd: string = `${CSI}0K`;
/** Clear to line start. */
export const eraseLineStart = `${CSI}1K`;
export const eraseLineStart: string = `${CSI}1K`;

/**
* Clear screen and move cursor by n lines up and move cursor to first column.
Expand All @@ -170,7 +170,7 @@ export const clearScreen = "\u001Bc";
* Clear the whole terminal, including scrollback buffer.
* (Not just the visible part of it).
*/
export const clearTerminal = Deno.build.os === "windows"
export const clearTerminal: string = Deno.build.os === "windows"
? `${eraseScreen}${CSI}0f`
// 1. Erases the screen (Only done in case `2` is not supported)
// 2. Erases the whole screen including scrollback buffer
Expand All @@ -185,7 +185,7 @@ export const clearTerminal = Deno.build.os === "windows"
* @param url Link url.
*
* ```ts
* import { link } from "./mod.ts";
* import { link } from "@cliffy/ansi/ansi-escapes";
*
* console.log(
* link("Click me.", "https://deno.land"),
Expand Down Expand Up @@ -223,7 +223,7 @@ export interface ImageOptions {
* @param options Image options.
*
* ```ts
* import { image } from "./mod.ts";
* import { image } from "@cliffy/ansi/ansi-escapes";
*
* const response = await fetch("https://deno.land/images/hashrock_simple.png");
* const imageBuffer: ArrayBuffer = await response.arrayBuffer();
Expand Down
2 changes: 1 addition & 1 deletion ansi/ansi_escapes_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
scrollDown,
scrollUp,
} from "./ansi_escapes.ts";
import { assertEquals } from "../dev_deps.ts";
import { assertEquals } from "@std/assert";

Deno.test({
name: "ansi - ansi escapes - cursorTo x",
Expand Down
2 changes: 1 addition & 1 deletion ansi/ansi_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "../dev_deps.ts";
import { assertEquals } from "@std/assert";
import { ansi } from "./ansi.ts";

Deno.test({
Expand Down
4 changes: 2 additions & 2 deletions ansi/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export interface Chain<TContext extends Chain<TContext>> {
* @param url Link url.
*
* ```ts
* import { ansi } from "./mod.ts";
* import { ansi } from "@cliffy/ansi";
*
* console.log(
* ansi.link("Click me.", "https://deno.land"),
Expand All @@ -124,7 +124,7 @@ export interface Chain<TContext extends Chain<TContext>> {
* @param options Image options.
*
* ```ts
* import { ansi } from "./mod.ts";
* import { ansi } from "@cliffy/ansi";
*
* const response = await fetch("https://deno.land/images/hashrock_simple.png");
* const imageBuffer: ArrayBuffer = await response.arrayBuffer();
Expand Down
6 changes: 3 additions & 3 deletions ansi/colors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as stdColors from "https://deno.land/[email protected]/fmt/colors.ts";
import * as stdColors from "@std/fmt/colors";

type ExcludedColorMethods = "setColorEnabled" | "getColorEnabled";
type PropertyNames = keyof typeof stdColors;
Expand Down Expand Up @@ -39,15 +39,15 @@ for (const name of methodNames) {
* Chainable colors module.
*
* ```ts
* import { colors } from "./mod.ts";
* import { colors } from "@cliffy/ansi/colors";
*
* console.log(colors.blue.bgRed.bold('Welcome to Deno.Land!'));
* ```
*
* If invoked as method, a new Ansi instance will be returned.
*
* ```ts
* import { Colors, colors } from "./mod.ts";
* import { Colors, colors } from "@cliffy/ansi/colors";
*
* const myColors: Colors = colors();
* console.log(myColors.blue.bgRed.bold('Welcome to Deno.Land!'));
Expand Down
4 changes: 2 additions & 2 deletions ansi/colors_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assertEquals, bold, red } from "../dev_deps.ts";
import { underline } from "../prompt/deps.ts";
import { assertEquals } from "@std/assert";
import { bold, red, underline } from "@std/fmt/colors";
import { colors } from "./colors.ts";

Deno.test({
Expand Down
4 changes: 2 additions & 2 deletions ansi/cursor_position.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { cursorPosition } from "./ansi_escapes.ts";
import type { ReaderSync, WriterSync } from "./deps.ts";
import type { ReaderSync, WriterSync } from "@std/io/types";

/** Cursor position. */
export interface Cursor {
Expand All @@ -25,7 +25,7 @@ const decoder = new TextDecoder();
* @param options Options.
*
* ```ts
* import { Cursor, getCursorPosition } from "./mod.ts";
* import { Cursor, getCursorPosition } from "@cliffy/ansi/cursor-position";
*
* const cursor: Cursor = getCursorPosition();
* console.log(cursor); // { x: 0, y: 14}
Expand Down
11 changes: 11 additions & 0 deletions ansi/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@cliffy/ansi",
"version": "1.0.0-rc.4",
"exports": {
".": "./ansi.ts",
"./ansi-escapes": "./ansi_escapes.ts",
"./colors": "./colors.ts",
"./cursor-position": "./cursor_position.ts",
"./tty": "./tty.ts"
}
}
5 changes: 0 additions & 5 deletions ansi/deps.ts

This file was deleted.

51 changes: 0 additions & 51 deletions ansi/mod.ts

This file was deleted.

4 changes: 2 additions & 2 deletions ansi/tty.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as ansiEscapes from "./ansi_escapes.ts";
import type { Chain } from "./chain.ts";
import { Cursor, getCursorPosition } from "./cursor_position.ts";
import type { ReaderSync, WriterSync } from "./deps.ts";
import { ReaderSync, WriterSync } from "@std/io/types";

/** Create new `Ansi` instance. */
export interface TtyOptions {
Expand Down Expand Up @@ -39,7 +39,7 @@ export type Tty = TtyFactory & TtyChain;
* If invoked as method, a new Tty instance will be returned.
*
* ```ts
* import { tty } from "./mod.ts";
* import { tty } from "@cliffy/ansi/tty";
*
* tty.cursorTo(0, 0).eraseScreen();
* ```
Expand Down
2 changes: 1 addition & 1 deletion ansi/tty_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assertEquals } from "../dev_deps.ts";
import { assertEquals } from "@std/assert";
import { tty } from "./tty.ts";

Deno.test({
Expand Down
2 changes: 1 addition & 1 deletion command/_errors.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { didYouMeanCommand } from "./_utils.ts";
import type { Command } from "./command.ts";
import { getFlag } from "./_utils.ts";
import { bold } from "./deps.ts";
import { bold } from "@std/fmt/colors";
import { EnvVar } from "./types.ts";

export class CommandError extends Error {
Expand Down
6 changes: 3 additions & 3 deletions command/_utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { closestString } from "https://deno.land/[email protected]/text/closest_string.ts";
import { closestString } from "@std/text/closest-string";
import {
OptionType,
UnexpectedArgumentAfterVariadicArgumentError,
UnexpectedRequiredArgumentError,
} from "../flags/_errors.ts";
import { OptionType } from "../flags/deprecated.ts";
} from "@cliffy/flags";
import type { Command } from "./command.ts";
import type { Argument } from "./types.ts";

Expand Down
Loading
Loading