Skip to content

Commit

Permalink
Convert to bun and bun:test
Browse files Browse the repository at this point in the history
Also rewrote the readme to align with the rest of my repositories.
  • Loading branch information
DvvCz committed May 2, 2024
1 parent 0cc44bf commit 09150e3
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 70 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Playground
name: playground

on:
push:
Expand Down Expand Up @@ -27,17 +27,17 @@ jobs:

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Setup Project
run: |
npm ci
npm run build
npm run build -w @ramattra/ramattra-playground
bun install --frozen-lockfile
bun run build
bun run build -w @ramattra/ramattra-playground
- name: Upload artifact
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: tests

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: oven-sh/setup-bun@v1

- run: |
bun install --frozen-lockfile
bun run build
bun test
18 changes: 0 additions & 18 deletions .github/workflows/vitest.yml

This file was deleted.

8 changes: 3 additions & 5 deletions .github/workflows/vsx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- uses: oven-sh/setup-bun@v1

- name: Setup
run: |
npm ci
npm run build
bun install --frozen-lockfile
bun run build
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
Expand Down
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
# Ramattra [![Vitest](https://github.com/DvvCz/Ramattra/actions/workflows/vitest.yml/badge.svg)](https://github.com/DvvCz/Ramattra/actions) [![Playground](https://github.com/DvvCz/Ramattra/actions/workflows/playground.yml/badge.svg)](https://dvvcz.github.io/Ramattra)
<h1 align="center"> ramattra </h1>

A language similar to Typescript that compiles to [Overwatch Workshop Scripts](https://workshop.codes/wiki).
<p align="center">
A language similar to Typescript that compiles to <a href="https://workshop.codes/wiki">Overwatch Workshop Scripts</a>.
</p>

<div align="center">
<a href="https://github.com/DvvCz/ramattra/actions">
<img alt="GitHub Actions Workflow Status" src="https://github.com/DvvCz/ramattra/actions/workflows/test.yml/badge.svg">
</a>
<a href="https://dvvcz.github.io/ramattra">
<img alt="GitHub Release" src="https://github.com/DvvCz/ramattra/actions/workflows/playground.yml/badge.svg">
</a>
</div>

## ⚠️ Notice

This project is under some rewriting, notably to use [bun](https://bun.sh) as the package manager, and to have a hand-written parser.
So `ramattra` is under hiatus until I get time to do these.

## Features
- [x] Language Server
- [x] [Online Playground](https://dvvcz.github.io/Ramattra)
- [x] CLI

## Example
### Familiar Syntax

If you're familiar with typescript or rust, you should practically already know ramattra.

### Language Server

For development in VSCode (and other editors), language server protocol is supported.

- [x] Errors
- [x] Autocomplete
- [ ] Intellisense

![Example](assets/example.png)

### Online Playground

You can try `ramattra` online, [right here](https://dvvcz.github.io/ramattra), without a need to install it on your PC.

## Wiki

You can find information about the language [on the wiki](https://github.com/DvvCz/Ramattra/wiki).
You can find more information [on the wiki](https://github.com/DvvCz/ramattra/wiki).
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
"version": "0.1.0",
"private": true,
"scripts": {
"playground:dev": "cd packages/ramattra-playground && npm run dev",
"build": "tsc -b tsconfig.build.json",
"test": "vitest",
"coverage": "vitest run --coverage"
"playground:dev": "cd packages/ramattra-playground && bun run dev",
"playground:build": "cd packages/ramattra-playground && bun run build",
"build": "tsc -b tsconfig.build.json"
},
"workspaces": ["packages/*"],
"devDependencies": {
"@biomejs/biome": "1.6.2",
"@vitest/coverage-v8": "^0.34.2",
"@types/bun": "^1.1.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.6",
"vitest": "^0.34.2"
"typescript": "^5.1.6"
}
}
1 change: 1 addition & 0 deletions packages/ramattra-cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env node

import { Command } from "commander";
import { assemble, parse } from "@ramattra/ramattra-core";
import * as fs from "node:fs/promises";
Expand Down
2 changes: 1 addition & 1 deletion packages/ramattra-core/src/compiler/assembler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dedent } from "@ramattra/ramattra-util";
import { analyze, IRExpr, IRStmt } from "./analyzer.js";
import { analyze, type IRExpr, type IRStmt } from "./analyzer.js";
import optimize from "./optimizer.js";

export function assemble(src: string): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/ramattra-core/tests/analyze.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { analyze } from "../src/compiler/analyzer.js";
import { expect, it } from "vitest";
import { expect, it } from "bun:test";

it("should allow indexing arrays", () => {
expect(() => analyze(`
Expand Down
2 changes: 1 addition & 1 deletion packages/ramattra-core/tests/parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parse, Parser } from "../src/compiler/parser.js";
import { expect, it } from "vitest";
import { expect, it } from "bun:test";
import { dedent } from "@ramattra/ramattra-util";

const exp = (src: string) => Parser.parse(src, { startRule: "Expr" });
Expand Down
2 changes: 1 addition & 1 deletion packages/ramattra-core/tests/typing.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it, test } from "vitest";
import { expect, it, test } from "bun:test";
import { TypeSolver, any, never, number, string, boolean, array, fn, variadic, generic } from "../src/compiler/typing";

test("all types should satisfy any", () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/ramattra-language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
"private": true,
"main": "dist/node.js",
"scripts": {
"test": "vitest",
"watch": "tsc --watch"
},
"dependencies": {
"vscode-languageserver": "^8.1.0",
"vscode-languageserver-textdocument": "^1.0.8"
}
}
}
6 changes: 2 additions & 4 deletions packages/ramattra-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"private": true,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "vitest"
}
}
"scripts": {}
}
6 changes: 2 additions & 4 deletions packages/ramattra-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@
"private": true,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "vitest"
}
}
"scripts": {}
}
2 changes: 1 addition & 1 deletion packages/ramattra-util/tests/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it } from "vitest";
import { expect, it } from "bun:test";
import { dedent } from "../src/index.js";

it("should dedent simple string", () => {
Expand Down
16 changes: 4 additions & 12 deletions packages/ramattra-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@
"languages": [
{
"id": "ramattra",
"aliases": [
"Ramattra",
"ramattra"
],
"extensions": [
".ram",
".ramattra"
],
"aliases": ["Ramattra", "ramattra"],
"extensions": [".ram", ".ramattra"],
"configuration": "./language-configuration.json"
}
],
Expand All @@ -33,13 +27,11 @@
}
]
},
"scripts": {
"test": "vitest"
},
"scripts": {},
"dependencies": {
"vscode-languageclient": "^8.1.0"
},
"devDependencies": {
"@types/vscode": "^1.75.0"
}
}
}

0 comments on commit 09150e3

Please sign in to comment.