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

feature(actions): Initial Implementation #9

Merged
merged 4 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ jobs:
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run test
validate-schemas:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
- run: bun run build check test

- name: publish
run: bun internals/scripts/source/publish.ts
run: bun internals/scripts/source/publish.mts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39 changes: 39 additions & 0 deletions .vscode/actions.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"Action for Crafting": {
"prefix": "actr",
"body": [
"{",
"\t\"inputs\": [",
"\t\t{ \"amount\": ${1:1}, \"id\": \"${2:TODO: Insert Item ID}\", \"type\": \"item\" }",
"\t],",
"\t\"outputs\": [",
"\t\t{ \"amount\": ${3:1}, \"id\": \"${4:TODO: Insert Item ID}\", \"type\": \"item\" }",
"\t],",
"\t\"place\": [",
"\t\t{",
"\t\t\t\"grid\": [",
"\t\t\t\t${5:null},",
"\t\t\t\t${6:null},",
"\t\t\t\t${7:null},",
"\t\t\t\t${8:null},",
"\t\t\t\t${9:null},",
"\t\t\t\t${10:null},",
"\t\t\t\t${11:null},",
"\t\t\t\t${12:null},",
"\t\t\t\t${13:null}",
"\t\t\t],",
"\t\t\t\"type\": \"workbench\"",
"\t\t}",
"\t]",
"},",
],
"description": "Add Recipe Action",
},
"Action Input/Output Item": {
"prefix": "acti",
"body": [
"{ \"amount\": ${1:1}, \"id\": \"${2:TODO: Insert Item ID}\", \"type\": \"item\" }",
],
"description": "Add item in action.inputs and action.outputs",
},
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This repo contains the opensource parts of <https://skyblock.finance>

| Name | What does this do? | Getting Started |
| --------------------------: | :------------------------------------------- | :--------------------------------- |
| `@skyblock-finance/actions` | Recipes, etc. | [README](/packages/actions#readme) |
| `@skyblock-finance/schemas` | Strong validation for Skyblock API responses | [README](/packages/schemas#readme) |

## Contributing
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion internals/eslint-config/turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turbo.build/schema.json",
"$schema": "https://turbo.build/schema.v1.json",
"extends": ["//"],
"pipeline": {}
}
2 changes: 1 addition & 1 deletion internals/fake-root/turbo.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://turbo.build/schema.json",
"$schema": "https://turbo.build/schema.v1.json",
"extends": ["//"],
"pipeline": {
"check:eslint": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { $, semver } from 'bun'
import { z } from 'zod'

const packagesToConsider = ['packages/schemas']
const packagesToConsider = ['packages/actions', 'packages/schemas']

const packageJsonSchema = z.object({ name: z.string(), version: z.string() })

Expand Down
1 change: 1 addition & 0 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"packages/*": {
"entry": ["scripts/*.ts", "source/index.ts"],
"ignore": ["**/*.test.ts"],
"project": ["source/**/*.ts"]
}
}
Expand Down
3 changes: 3 additions & 0 deletions packages/actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @skyblock-finance/actions

This package contains actions players can take in Hypixel Skyblock
131 changes: 131 additions & 0 deletions packages/actions/data/$schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"additionalProperties": false,
"definitions": {
"currencyAction": {
"additionalProperties": false,
"properties": {
"amount": {
"type": "number"
},
"type": {
"enum": ["bit", "coin", "mote", "north-star"],
"type": "string"
}
},
"required": ["amount", "type"]
},
"itemAction": {
"additionalProperties": false,
"properties": {
"amount": {
"type": "number"
},
"id": {
"type": "string"
},
"type": {
"const": "item"
}
},
"required": ["id", "amount", "type"],
"type": "object"
}
},
"properties": {
"$schema": {
"type": "string"
},
"actions": {
"items": {
"additionalProperties": false,
"properties": {
"inputs": {
"items": {
"oneOf": [
{ "$ref": "#/definitions/currencyAction" },
{ "$ref": "#/definitions/itemAction" }
],
"type": "object"
},
"type": "array"
},
"outputs": {
"items": {
"oneOf": [
{ "$ref": "#/definitions/currencyAction" },
{ "$ref": "#/definitions/itemAction" }
],
"type": "object"
},
"type": "array"
},
"place": {
"items": {
"oneOf": [
{
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"const": "item"
}
},
"required": ["id", "type"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"grid": {
"items": {
"maxLength": 9,
"minLength": 9,
"oneOf": [
{ "$ref": "#/definitions/itemAction" },
{ "type": "null" }
]
},
"type": "array"
},
"type": {
"const": "workbench"
}
},
"required": ["type"],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"id": {
"type": "string"
},
"type": {
"const": "npc"
}
},
"required": ["id", "type"],
"type": "object"
}
],
"type": "object"
},
"type": "array"
},
"requirements": {
"items": {},
"type": "array"
}
},
"required": ["inputs", "outputs", "place"],
"type": "object"
},
"type": "array"
}
},
"required": ["actions"],
"type": "object"
}
Loading
Loading