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

Merge corrected LuaLS annotation code #106

Merged
merged 6 commits into from
Dec 2, 2023
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
5 changes: 1 addition & 4 deletions .github/workflows/lest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Lest CI

on:
workflow_call:
push:
branches-ignore:
- master

jobs:
lint:
Expand Down Expand Up @@ -34,7 +31,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
luaVersion: ["5.1.5", "5.2.4", "5.3.6", "5.4.4", "luajit-openresty", "luajit-2.0.5", "luajit-2.1.0-beta3"]
luaVersion: ["5.1.5", "5.2.4", "5.3.6", "5.4.4", "luajit-2.0.5", "luajit-2.1.0-beta3"]

steps:
- uses: actions/checkout@v3
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/luals_annotations_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: LuaLS Annotations
on:
push:
branches:
- master
jobs:
deploy-annotations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18

- run: npm install

- name: Build LuaLS-annotations
run: npm run build:luals-annotations

- name: Generate annotations
run: npm run annotate:luals -- /tmp/annotations.lua

- name: Checkout to new branch
run: |
git checkout luals-annotations || git checkout --orphan luals-annotations && git rm --cached -r .

- name: Pull changes
run: git pull origin luals-annotations

- name: Copy annotations
run: cp /tmp/annotations.lua .

- name: Push annotations
uses: EndBug/add-and-commit@v9
with:
add: "annotations.lua"
default_author: github_actions
message: "update annotations"
new_branch: luals-annotations
9 changes: 9 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Pull request created or updated

on: pull_request

jobs:
lest:
uses: "./.github/workflows/lest.yml"
# Only run on forks to avoid duplicating the "push" workflow
if: ${{ github.event.pull_request.head.repo.fork }}
10 changes: 10 additions & 0 deletions .github/workflows/push_feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Push to feature branch

on:
push:
branches-ignore:
- master

jobs:
lest:
uses: ./.github/workflows/lest.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
packages/**/dist
node_modules
packages/**/coverage
.idea/discord.xml
*.tsbuildinfo
66 changes: 65 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"format:site": "prettier --check packages/site",
"format:docs": "prettier --check packages/docs",
"build:lest": "npm run build --workspace=packages/lest",
"build:luals-annotations": "npm run build --workspace=packages/luals-annotations",
"test:luals-annotations": "npm run test --workspace=packages/luals-annotations",
"annotate:luals": "npm run start --workspace=packages/luals-annotations",
"build:docs": "npm run build --workspace=packages/docs",
"build:site": "npm run build:docs && npm run build --workspace=packages/site",
"test:lest": "npm run test --workspace=packages/lest",
Expand All @@ -17,7 +20,8 @@
"workspaces": [
"packages/lest",
"packages/docs",
"packages/site"
"packages/site",
"packages/luals-annotations"
],
"devDependencies": {
"@commitlint/cli": "^17.5.1",
Expand All @@ -30,6 +34,5 @@
"trim": "0.0.3",
"got": ">=11.8.5",
"semver": ">=7.5.2"

}
}
10 changes: 8 additions & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
"name": "@lest/docs",
"private": true,
"description": "API documentation in JSON form.",
"main": "dist/index",
"types": "dist/index",
"main": "dist/src/index",
"types": "dist/src/index",
"exports": {
".": "./dist/src/index.js",
"./functions": "./dist/src/functions/index.js",
"./types": "./dist/src/types/index.js",
"./matchers": "./dist/src/matchers/index.js"
},
"scripts": {
"build": "tsc"
}
Expand Down
5 changes: 3 additions & 2 deletions packages/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
"outDir": "./dist",
"composite": true
},
"include": ["src/**/*.ts"]
"include": ["src/**/*.ts", "src/**/*.json"]
}
16 changes: 16 additions & 0 deletions packages/luals-annotations/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
testMatch: ["**/*.test.ts"],
collectCoverage: true,
collectCoverageFrom: ["src/**/{!(index),}.ts"],
coverageThreshold: {
global: {
lines: 100,
branches: 100,
functions: 100,
statements: 100,
},
},
};
23 changes: 23 additions & 0 deletions packages/luals-annotations/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "@lest/luals-annotations",
"description": "Package to automatically create LuaLS annotations for Lest",
"main": "dist/index",
"scripts": {
"start:ts-node": "ts-node src/index.ts",
"start": "node dist/index.js",
"dev": "npm run --debug start:ts-node && onchange \"src/**/*.ts\" -- npm run --debug start:ts-node",
"build": "tsc --build tsconfig.build.json",
"test": "jest"
},
"devDependencies": {
"@types/jest": "^29.5.2",
"jest": "^29.5.0",
"onchange": "^7.1.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3"
},
"dependencies": {
"@lest/docs": "*"
}
}
Loading
Loading