Skip to content

Commit

Permalink
all: release [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed May 4, 2021
1 parent 11a496e commit 0bb1b0a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM hayd/alpine-deno:1.9.2
WORKDIR /app
USER deno

WORKDIR /bin
COPY . .
RUN deno cache --unstable readable.ts

CMD ["run", "--unstable", "--allow-read", "--allow-write", "readable.ts"]
ENTRYPOINT [ "deno", "run", "--unstable", "--allow-read", "--allow-write", "/bin/readable.ts" ]

WORKDIR /data
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Using [Docker](https://www.docker.com/):

```sh
docker pull ghcr.io/bobheadxi/readable:latest
docker run ghcr.io/bobheadxi/readable:latest
docker run -v $(pwd):/data ghcr.io/bobheadxi/readable:latest
```

## Features
Expand All @@ -42,21 +42,17 @@ Both these approaches have significant issues:

- Line-breaking at some arbitrary character column looks nice when viewed, but is easily lost when making and suggesting edits, necessitating reflowing entire paragraphs.
This leads to incomprehensible or uninformative diffs that are difficult to review.

- Writing entire paragraphs is reasonable readable nowadays due to most editors and viewers performing wrapping out-of-the-box, but they make suggestions and diffs difficult to review due to every single change causing a diff on entire paragraph.

Readable performs a variant of [semantic line breaks](https://sembr.org/) that attempts to strike a balance between:

- Making use of how most Markdown specifications ignore single new lines to still provide a good **rendered Markdown** experience.

- Leveraging modern line-wrapping in most viewers to maintain a good **raw Markdown** experience.

- Maintaining understandable diffs in Markdown documentation for a good **reviewing** experience.

In general, Readable's semantic line breaks:

- Allow multiple short sentences to be part of a single line.

- After a character threshold, breaks new sentences to a new line.

This means that changes now reflect changes to *ideas* within semantic boundaries, and more accurately reflect the idea being changed.
Expand Down
29 changes: 29 additions & 0 deletions dev-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,35 @@ const devScripts: DevScripts = {
throw new Error(`unknown target ${target}`);
}
},
"release": async (args, env) => {
const version = args[0];
if (!version) {
throw new Error(`version required`);
}

await Deno.writeTextFile(
"./version.ts",
`// Generated by dev-tool.ts
export const READABLE_VERSION = "${version}";
export const READABLE_COMMIT = "${env.commit}";
`,
);
const commit = Deno.run({
cmd: ["git", "commit", "-a", "-m", `all: release readable@${version}`],
});
const { code: commitStatus } = await commit.status();
if (commitStatus) {
throw new Error("failed to commit");
}
const tag = Deno.run({
cmd: ["git", "tag", version, "-m", `readable@${version}`],
});
const { code: tagStatus } = await tag.status();
if (tagStatus) {
throw new Error("failed to tag");
}
},
};

if (import.meta.main) {
Expand Down
9 changes: 7 additions & 2 deletions readable.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { READABLE_VERSION } from "./version.ts";

import { cac } from "./deps/cac.ts";
import check from "./cmd/check.ts";

import check from "./cmd/check.ts";
import fmt from "./cmd/fmt.ts";

const cli = cac("readable");

cli.version(READABLE_VERSION);

/**
* readable fmt
*/
cli.command("fmt [...globs]", "Format Markdown")
.option("--to-stdout", "Output results to stdout instead of modifying files")
.action(async (globs: string[], opts) => {
.action(async (globs: string[], opts: any) => {
console.debug("fmt");
await fmt(globs, opts);
});
Expand Down

0 comments on commit 0bb1b0a

Please sign in to comment.