Skip to content

Commit

Permalink
generate type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Endercass committed Oct 23, 2024
1 parent 66a5a21 commit e280453
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
dist.js
build/
anuraos-types/
bin/
aboutproxy/
v86/
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ server/passkey
package-lock.json
.direnv
result
anuraos-types/
public/config.json
static/
x86_image_wizard/apline/anura-run
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,22 @@ watch: bundle FORCE
bundle: tsc css lint milestone
mkdir -p build/artifacts

DTS = $(shell cd build; find lib -type f -name "*.d.ts")
TYPE_FOLDERS = $(shell cd build; find lib -type d)
ANURA_VERSION = $(shell jq -r '.version' package.json)

tsc:
mkdir -p build/artifacts
cp -r src/* build/artifacts
npx tsc
mkdir -p anuraos-types
cd anuraos-types/; \
mkdir -p $(TYPE_FOLDERS)
cd build/; \
cp --parents $(DTS) ../anuraos-types/
echo $(DTS) | sed 's/ \+/\n/g' | sed 's/.*/\/\/\/ <reference path="&" \/>/' > anuraos-types/index.d.ts
jq '.version = "$(ANURA_VERSION)"' types-package.json > anuraos-types/package.json

css: src/*.css
# shopt -s globstar; cat src/**/*.css | npx postcss --use autoprefixer -o build/bundle.css
shopt -s globstar; cat src/**/*.css > build/bundle.css
Expand Down
12 changes: 12 additions & 0 deletions types-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@mercuryworkshop/anuraos-types",
"version": "$VER",
"description": "Type declarations for anuraOS",
"types": "index.d.ts",
"author": "Mercury Workshop",
"license": "AGPL-3.0-only",
"repository": {
"type": "git",
"url": "git+https://github.com/MercuryWorkshop/AnuraOS.git"
}
}

0 comments on commit e280453

Please sign in to comment.