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

Rework #1 #34

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5156a6c
Started refactoring entire internal lib from scratch
EthanThatOneKid Nov 12, 2021
7e50e1b
yeye
EthanThatOneKid Nov 12, 2021
b0540c3
made some progress but tests arent passing :/
EthanThatOneKid Nov 15, 2021
d1470f7
created base tokenzior functionality
EthanThatOneKid Nov 24, 2021
35ca584
todo: fix broken tests
EthanThatOneKid Nov 24, 2021
b68c749
progress
EthanThatOneKid Nov 24, 2021
e3bea27
progress
EthanThatOneKid Nov 24, 2021
f0102bb
woo progress
EthanThatOneKid Nov 24, 2021
0ebac47
progress
EthanThatOneKid Nov 25, 2021
e43b212
progress
EthanThatOneKid Nov 25, 2021
3690b2c
progress
EthanThatOneKid Nov 25, 2021
001672f
progress
EthanThatOneKid Nov 25, 2021
0965508
Update utils.test.ts
EthanThatOneKid Nov 25, 2021
e837ab0
progress
EthanThatOneKid Nov 26, 2021
8f21d7e
progress
EthanThatOneKid Nov 26, 2021
d9d9c1f
progress
EthanThatOneKid Nov 27, 2021
8bafc86
progress
EthanThatOneKid Nov 27, 2021
e6617e8
progress
EthanThatOneKid Nov 28, 2021
538081b
progress
EthanThatOneKid Nov 28, 2021
6fca6dc
progress
EthanThatOneKid Nov 28, 2021
7b3f2e0
progress
EthanThatOneKid Nov 28, 2021
b2bd98d
covered text_builder utils testcases
EthanThatOneKid Dec 8, 2021
0163e07
Update token.test.ts
EthanThatOneKid Dec 8, 2021
5fc87f4
Create check_lib.yaml
EthanThatOneKid Dec 8, 2021
f8be624
fixed lint errors
EthanThatOneKid Dec 8, 2021
9249a21
Update check_lib.yaml
EthanThatOneKid Dec 8, 2021
ad9a81d
Update check_lib.yaml
EthanThatOneKid Dec 8, 2021
1eaf7b2
Update check_lib.yaml
EthanThatOneKid Dec 8, 2021
d44abf8
progress
EthanThatOneKid Dec 9, 2021
86cde15
Update deno_redirect.ts
EthanThatOneKid Dec 9, 2021
3f20d43
fsdffdsfgads
EthanThatOneKid Dec 16, 2021
1b85eec
progress on fart server
EthanThatOneKid Dec 18, 2021
0a1f91d
cleaningisdfmdsf
EthanThatOneKid Dec 18, 2021
db91aa5
Create watch_serve.ts
EthanThatOneKid Dec 18, 2021
0c12660
uhhhhhhhhhhhhhhhhhhhhhhhhhhb hgvyujhbuiyxfgh
EthanThatOneKid Dec 18, 2021
b2615ad
reorganized lib lgtm
EthanThatOneKid Dec 19, 2021
7690f00
Update transpile.ts
EthanThatOneKid Dec 19, 2021
f95dfeb
started working on this coverage thing
EthanThatOneKid Dec 19, 2021
8680e26
sad bug in the transpiler
EthanThatOneKid Dec 21, 2021
b748ee4
progress
EthanThatOneKid Dec 23, 2021
4b3f831
everything is ok
EthanThatOneKid Dec 23, 2021
8a72c89
neat work
EthanThatOneKid Dec 23, 2021
4dd562a
some progress with 3 failures
EthanThatOneKid Dec 23, 2021
85beff3
added some changes
EthanThatOneKid Dec 23, 2021
c277f89
Update transpile.ts
EthanThatOneKid Dec 23, 2021
fa81791
kwik progress
EthanThatOneKid Dec 26, 2021
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
38 changes: 38 additions & 0 deletions .github/workflows/check_lib.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Fart Lib Check

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

jobs:
website_check:
runs-on: ubuntu-latest

strategy:
matrix:
deno_version: [canary]
# See supported Deno releases at:
# https://github.com/denoland/deno/releases

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

- name: Set up Deno ${{ matrix.deno_version }}
uses: denoland/setup-deno@v1
with:
node-version: ${{ matrix.deno_version }}

- name: Lint
run: deno lint

- name: Test and Check Coverage
run: |
deno test lib --coverage=cov_profile
deno coverage cov_profile --lcov > cov_profile.lcov
deno run --allow-read --unstable devops/check_cov.ts
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Mac for Deno
Users
Users

# Secrets
.env
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
"https://cdn.skypack.dev": false,
"https://fart.tools": false
},
"cSpell.words": ["typemap", "typemaps"]
"cSpell.words": ["transpiles", "typedefs", "typemap", "typemaps"]
}
2 changes: 1 addition & 1 deletion deps/std/flags.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { parse } from "https://deno.land/std@0.110.0/flags/mod.ts";
export { parse } from "https://deno.land/std@0.119.0/flags/mod.ts";
2 changes: 1 addition & 1 deletion deps/std/fs.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { exists, expandGlob } from "https://deno.land/std@0.110.0/fs/mod.ts";
export { exists, expandGlob } from "https://deno.land/std@0.119.0/fs/mod.ts";
2 changes: 1 addition & 1 deletion deps/std/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export {
join,
normalize,
parse,
} from "https://deno.land/std@0.110.0/path/mod.ts";
} from "https://deno.land/std@0.119.0/path/mod.ts";
11 changes: 10 additions & 1 deletion deps/std/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@ export {
assert,
assertEquals,
assertThrows,
} from "https://deno.land/[email protected]/testing/asserts.ts";
} from "https://deno.land/[email protected]/testing/asserts.ts";
export {
bench,
runBenchmarks,
} from "https://deno.land/[email protected]/testing/bench.ts";
export type {
BenchmarkResult,
BenchmarkRunProgress,
BenchmarkTimer,
} from "https://deno.land/[email protected]/testing/bench.ts";
4 changes: 1 addition & 3 deletions deps/third_party/octokit/rest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
// More info: https://cdn.skypack.dev/@octokit/rest/rest.js
export { Octokit } from "https://cdn.skypack.dev/@octokit/[email protected]";

// More info:
// https://cdn.skypack.dev/@octokit/rest/rest.js
59 changes: 59 additions & 0 deletions devops/check_cov.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Name: check_cov.ts
* Author: EthanThatOneKid
* Description: This script checks the coverage of the codebase.
*
* Handy Commands:
* - Generate cov: deno test lib --coverage=cov_profile & deno coverage cov_profile --lcov > cov_profile.lcov
* - Check cov: deno run --allow-read --unstable devops/check_cov.ts
* - Visualize cov: deno coverage cov_profile
*/

import { source as parseFile } from "https://cdn.skypack.dev/lcov-parse";

interface LineDetail {
line: number;
hit: number;
}

interface FunctionDetail {
name: string;
line: number;
hit: number;
}

interface BranchDetail {
line: number;
block: number;
branch: number;
taken: number;
}

interface LcovResult {
file: string;
lines: { found: number; hit: number; details: LineDetail[] };
functions: { found: number; hit: number; details: FunctionDetail[] };
branches: { found: number; hit: number; details: BranchDetail[] };
}

const lcov = await Deno.readTextFile("./cov_profile.lcov");

// TODO: Compute which files have uncovered code and its percentage.
// TODO: Compute overall coverage percentage.
parseFile(lcov, (errorMessage: string | null, results: LcovResult[]) => {
if (errorMessage !== null) {
return console.error(errorMessage);
}
for (const report of results) {
const uncoveredFns = report.functions.details.filter((fn) => fn.hit === 0);
if (uncoveredFns.length > 0) {
console.log("\nFile:", report.file);
for (const fn of uncoveredFns) {
console.log(
"Uncovered function!",
`${fn.name} (${report.file}:${fn.line})`,
);
}
}
}
});
7 changes: 7 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@ self_link: https://fart.tools/getting-started
> Fart deserves better!

> Curious reader, visit <https://fart.tools/getting-started/>.

## Project Scripts

- **Upgrade a Dependency**: `deno run --unstable --allow-read --allow-write devops/upgrade_dep.ts -y --verbose --dep=std --v=0.116.0`
- **Run the CLI**: `deno run --allow-read --allow-write fart_cli/run.ts ./ex/pokemon/mod.fart --reg=ts --output=./ex/pokemon/mod.out.ts`
- **Spin up Server**: `deno run --allow-net --allow-read --allow-env --unstable fart_server/serve_http.ts`
- **Develop the Server**: `deployctl run --watch fart_server/worker.ts`
10 changes: 0 additions & 10 deletions docs/scripts.md

This file was deleted.

3 changes: 0 additions & 3 deletions ex/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions ex/generate-deno-cli/README.md

This file was deleted.

1 change: 0 additions & 1 deletion ex/go-generate/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions ex/import_map.json

This file was deleted.

26 changes: 0 additions & 26 deletions ex/pokemon/dex.ts

This file was deleted.

38 changes: 0 additions & 38 deletions ex/pokemon/mod.fart

This file was deleted.

27 changes: 0 additions & 27 deletions ex/pokemon/pokeball.ts

This file was deleted.

44 changes: 0 additions & 44 deletions ex/pokemon/run.ts

This file was deleted.

9 changes: 9 additions & 0 deletions fart_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Fart Server

## Usage

### Spin up local Fart server

```bash
deno run --allow-env --allow-net fart_server/serve.ts
```
12 changes: 12 additions & 0 deletions fart_server/bonus_features/doc_generator/deno_doc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// deno-lint-ignore-file

/**
* @param url ex: <https://deno.land/x/[email protected]/lib/fart.ts>
* @returns raw HTML generated from [`deno doc`](https://deno.land/[email protected]/tools/documentation_generator)
* @todo @ethanthatonekid mirror https://doc.deno.land/https/deno.land%2Fx%2Ffart%40v0.1%2Flib%2Ffart.ts
* @todo @ethanthatonekid serve any static files
* @todo @ethanthatonekid remove deno-lint-ignore-file
*/
export const fetchDenoDoc = async (url: string): Promise<string> => {
return "";
};
10 changes: 10 additions & 0 deletions fart_server/bonus_features/doc_generator/gh_doc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// deno-lint-ignore-file

/**
* @param url ex: <https://etok.codes/fart/blob/main/docs/pokemon-example.md>
* @returns raw HTML of parsed documentation found on <https://etok.codes/fart/>
* @todo @ethanthatonekid refactor https://github.com/EthanThatOneKid/fart/blob/c43f2333458b2cbc40d167610d87e2a2e3f89885/std/server/middleware/gh_docs.ts
*/
export const fetchGitHubDoc = async (url: string): Promise<string> => {
return "";
};
2 changes: 2 additions & 0 deletions fart_server/bonus_features/doc_generator/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { fetchGitHubDoc } from "./gh_doc.ts";
export { fetchDenoDoc } from "./deno_doc.ts";
1 change: 1 addition & 0 deletions fart_server/bonus_features/shortlinks/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { redirectIfShortlink } from "./shortlinks.ts";
5 changes: 5 additions & 0 deletions fart_server/bonus_features/shortlinks/shortlinks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"/design": "https://docs.google.com/document/d/1pGNLsDr-WysIIqB4nc1pTCL8FMmPxkJMNoGsRMkA0TY/edit",
"/github": "https://github.com/EthanThatOneKid/fart",
"/author": "https://etok.codes"
}
Loading