Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c552cebbb6 | ||
|
|
949d72c394 | ||
|
|
dcd1bf25e7 | ||
|
|
45c988c989 | ||
|
|
2815c3e652 | ||
|
|
4b311f8b4c | ||
|
|
4712330faa | ||
|
|
77ed355011 | ||
|
|
974d4a5e69 | ||
|
|
6c8adfea0d | ||
|
|
16599dce42 | ||
|
|
e1febc63f2 | ||
|
|
c7a65d6fbd | ||
|
|
12d3ad3341 | ||
|
|
0443871583 | ||
|
|
1db8f3ccbb | ||
|
|
83df0813c6 | ||
|
|
ec7109a487 | ||
|
|
929faacbc4 | ||
|
|
f964e5a42d | ||
|
|
1d7389f3e8 |
+29
-62
@@ -1,64 +1,32 @@
|
||||
name: Publish GitHub Action
|
||||
name: Publish Action Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- github-action/package.json
|
||||
workflow_call:
|
||||
inputs:
|
||||
action-directory:
|
||||
required: true
|
||||
type: string
|
||||
description: 'Path to the action directory (e.g., github-actions/bundle-script)'
|
||||
package-json-path:
|
||||
required: true
|
||||
type: string
|
||||
description: 'Path to package.json relative to repo root'
|
||||
action-name:
|
||||
required: true
|
||||
type: string
|
||||
description: 'Name of the action for display purposes'
|
||||
prefix:
|
||||
required: true
|
||||
type: string
|
||||
description: 'Prefix for version tags (e.g., bundle-script will create tags like bundle-script/v1.0.0)'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
verify_action:
|
||||
name: Verify action
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: github-action/package-lock.json
|
||||
|
||||
- name: Install action dependencies
|
||||
working-directory: github-action
|
||||
run: npm ci
|
||||
|
||||
- name: Create verification fixture
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p test-action-input
|
||||
cat <<'EOF' > test-action-input/main.lua
|
||||
local message = {}
|
||||
|
||||
message.hello = function()
|
||||
return "hello"
|
||||
end
|
||||
|
||||
return message
|
||||
EOF
|
||||
|
||||
- name: Run action locally
|
||||
uses: ./github-action
|
||||
with:
|
||||
source-root: test-action-input
|
||||
output-file: test-action-output/compiled.lua
|
||||
|
||||
- name: Assert compiled output exists
|
||||
shell: bash
|
||||
run: test -f test-action-output/compiled.lua
|
||||
|
||||
derive_release:
|
||||
name: Derive release metadata
|
||||
runs-on: ubuntu-latest
|
||||
needs: verify_action
|
||||
outputs:
|
||||
version: ${{ steps.derive.outputs.version }}
|
||||
release_tag: ${{ steps.derive.outputs.release_tag }}
|
||||
@@ -79,24 +47,24 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
version=$(node -p "require('./github-action/package.json').version")
|
||||
version=$(node -p "require('./${{ inputs.package-json-path }}').version")
|
||||
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "github-action/package.json version must be semver X.Y.Z, got: $version" >&2
|
||||
echo "${{ inputs.action-name }}/package.json version must be semver X.Y.Z, got: $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IFS='.' read -r major minor patch <<< "$version"
|
||||
release_tag="action/v${version}"
|
||||
rolling_minor_tag="action/v${major}.${minor}"
|
||||
rolling_major_tag="action/v${major}"
|
||||
release_tag="${{ inputs.prefix }}/v${version}"
|
||||
rolling_minor_tag="${{ inputs.prefix }}/v${major}.${minor}"
|
||||
rolling_major_tag="${{ inputs.prefix }}/v${major}"
|
||||
|
||||
latest_release_tag=$(git tag --list 'action/v*.*.*' --sort=-version:refname | head -n 1)
|
||||
latest_release_tag=$(git tag --list '${{ inputs.prefix }}/v*.*.*' --sort=-version:refname | head -n 1)
|
||||
|
||||
bump_kind="initial"
|
||||
should_publish="true"
|
||||
|
||||
if [[ -n "$latest_release_tag" ]]; then
|
||||
latest_version=${latest_release_tag#action/v}
|
||||
latest_version=${latest_release_tag#${{ inputs.prefix }}/v}
|
||||
|
||||
if [[ "$version" == "$latest_version" ]]; then
|
||||
should_publish="false"
|
||||
@@ -107,7 +75,7 @@ jobs:
|
||||
if (( major < latest_major )) || \
|
||||
(( major == latest_major && minor < latest_minor )) || \
|
||||
(( major == latest_major && minor == latest_minor && patch < latest_patch )); then
|
||||
echo "github-action/package.json version $version must be greater than latest published $latest_version" >&2
|
||||
echo "${{ inputs.action-name }}/package.json version $version must be greater than latest published $latest_version" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -136,7 +104,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
{
|
||||
echo "## Action release plan"
|
||||
echo "## ${{ inputs.action-name }} release plan"
|
||||
echo ""
|
||||
echo "- Version: ${{ steps.derive.outputs.version }}"
|
||||
echo "- Release tag: ${{ steps.derive.outputs.release_tag }}"
|
||||
@@ -190,11 +158,10 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
{
|
||||
echo "## Published action tags"
|
||||
echo "## Published ${{ inputs.action-name }} tags"
|
||||
echo ""
|
||||
echo "- Immutable: ${{ needs.derive_release.outputs.release_tag }}"
|
||||
echo "- Rolling minor: ${{ needs.derive_release.outputs.rolling_minor_tag }}"
|
||||
echo "- Rolling major: ${{ needs.derive_release.outputs.rolling_major_tag }}"
|
||||
echo "- Bump kind: ${{ needs.derive_release.outputs.bump_kind }}"
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Publish Bundle Script Action
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- github-actions/bundle-script/package.json
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
publish_action:
|
||||
uses: ./.github/workflows/_publish-action-release.yml
|
||||
with:
|
||||
action-directory: github-actions/bundle-script
|
||||
package-json-path: github-actions/bundle-script/package.json
|
||||
action-name: Bundle Script
|
||||
prefix: bundle-script
|
||||
@@ -0,0 +1,63 @@
|
||||
name: Publish Install Lua Addon Action
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- github-actions/install-lua-addon/package.json
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
## Verify that when the action has been run it actually has the lua addons installed
|
||||
test_action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: github-actions/install-lua-addon/package-lock.json
|
||||
|
||||
- name: Run Action Locally
|
||||
uses: ./github-actions/install-lua-addon
|
||||
with:
|
||||
destination-path: './some/test/lua-addons'
|
||||
|
||||
- name: Verify lua addons were installed
|
||||
run: |
|
||||
echo "Listing contents of the Lua addons directory"
|
||||
ls -la ./some/test/lua-addons
|
||||
|
||||
echo "Checking if dcs-types addon was installed"
|
||||
if [ -d "./some/test/lua-addons/dcs-types" ]; then
|
||||
echo "✓ dcs-types directory found"
|
||||
else
|
||||
echo "✗ dcs-types directory not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking if config.json exists in dcs-types"
|
||||
if [ -f "./some/test/lua-addons/dcs-types/config.json" ]; then
|
||||
echo "✓ config.json found"
|
||||
else
|
||||
echo "✗ config.json not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All checks passed!"
|
||||
|
||||
publish_action:
|
||||
needs: test_action
|
||||
uses: ./.github/workflows/_publish-action-release.yml
|
||||
with:
|
||||
action-directory: github-actions/install-lua-addon
|
||||
package-json-path: github-actions/install-lua-addon/package.json
|
||||
action-name: Install Lua Addon
|
||||
prefix: install-lua-addon
|
||||
@@ -34,20 +34,23 @@ jobs:
|
||||
- name: Exit if tag exists
|
||||
if: steps.tag_check.outputs.tag_exists == 'true'
|
||||
run: |
|
||||
echo "Tag already exists, exiting."
|
||||
exit 1
|
||||
echo "::warning::Tag already exists, exiting."
|
||||
exit 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
if: steps.tag_check.outputs.tag_exists == 'false'
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.tag_check.outputs.tag_exists == 'false'
|
||||
run: |
|
||||
cd dutchies-dcs-scripting-tools
|
||||
npm install
|
||||
|
||||
- name: Build extension
|
||||
if: steps.tag_check.outputs.tag_exists == 'false'
|
||||
run: |
|
||||
cd dutchies-dcs-scripting-tools
|
||||
npm run compile
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@
|
||||
"${workspaceFolder}/dutchies-dcs-scripting-tools/dist/**/*.js",
|
||||
"${workspaceFolder}/compiler/dist/**/*.js"
|
||||
],
|
||||
"preLaunchTask": "watch"
|
||||
"timeout": 5000
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -13,5 +13,6 @@
|
||||
"cSpell.words": [
|
||||
"dutchie",
|
||||
"dutchies"
|
||||
]
|
||||
],
|
||||
"Lua.workspace.library": [],
|
||||
}
|
||||
Vendored
+1
@@ -19,6 +19,7 @@
|
||||
"label": "watch",
|
||||
"type": "npm",
|
||||
"script": "watch",
|
||||
"dependsOn": "compile",
|
||||
"isBackground": true,
|
||||
"presentation": {
|
||||
"reveal": "never"
|
||||
|
||||
@@ -22,8 +22,9 @@ Get the extension here: https://marketplace.visualstudio.com/items?itemName=dutc
|
||||
### Features:
|
||||
|
||||
- [x] Compile the mission script just like in the VS Code extension, but in a Github Action.
|
||||
- [x] Install Lua addons and type definitions for scripting linter support on agents
|
||||
|
||||
### Usage:
|
||||
### Compile Script:
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -34,7 +35,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dutchie031/DcsMissionScriptingTools/github-action@action/v1
|
||||
- uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-actions/bundle-script@bundle-script/v1
|
||||
with:
|
||||
source-root: 'src'
|
||||
output-file: 'output/compiled.lua'
|
||||
@@ -47,3 +48,18 @@ jobs:
|
||||
|
||||
|
||||
```
|
||||
|
||||
### Add Lua Types
|
||||
|
||||
```yaml
|
||||
name: Install Lua Addons
|
||||
on: [push]
|
||||
jobs:
|
||||
install-lua-addons:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: https://git.dutchie031.com/dutchie031/DcsMissionScriptingTools/github-actions/install-lua-addon@install-lua-addon/v1
|
||||
with:
|
||||
destination-path: 'lua-addons'
|
||||
```
|
||||
+41
-20
@@ -1,6 +1,6 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { CompilationError } from './CompilationError';
|
||||
import { CompilationError, CompilationErrorType } from './CompilationError';
|
||||
|
||||
/*
|
||||
Block types.
|
||||
@@ -68,10 +68,21 @@ export abstract class CodeBlock {
|
||||
const fileContent = fs.readFileSync(luaFilePath, 'utf-8');
|
||||
|
||||
let leftCursor = 0;
|
||||
let lineCursor = 0;
|
||||
let lineCounter = 0;
|
||||
const file: LuaFile = new LuaFile();
|
||||
let currentBlock: CodeBlock = file;
|
||||
|
||||
function advanceCursor(number: number = 1) {
|
||||
leftCursor += number;
|
||||
lineCursor += number;
|
||||
}
|
||||
|
||||
function newLine() {
|
||||
lineCounter++;
|
||||
lineCursor = 0;
|
||||
}
|
||||
|
||||
let currentWord = '';
|
||||
let currentBlockString = '';
|
||||
|
||||
@@ -85,10 +96,6 @@ export abstract class CodeBlock {
|
||||
currentBlockString += currentChar;
|
||||
const nextChar = leftCursor < fileContent.length - 1 ? fileContent[leftCursor + 1] : '';
|
||||
|
||||
if (currentChar === '\n') {
|
||||
lineCounter++;
|
||||
}
|
||||
|
||||
if (currentChar === '-' && nextChar === '-') {
|
||||
currentBlockString = currentBlockString.slice(0, -1); // Remove the '-' from the block string
|
||||
const nextNextChar = leftCursor < fileContent.length - 2 ? fileContent[leftCursor + 2] : '';
|
||||
@@ -97,19 +104,20 @@ export abstract class CodeBlock {
|
||||
leftCursor += 3; // Skip the --[
|
||||
while (leftCursor < fileContent.length && !(fileContent[leftCursor] === ']' && fileContent[leftCursor + 1] === ']')) {
|
||||
if (fileContent[leftCursor] === '\n') {
|
||||
lineCounter++;
|
||||
newLine();
|
||||
}
|
||||
leftCursor++;
|
||||
advanceCursor()
|
||||
}
|
||||
leftCursor += 2; // Skip the closing ]]
|
||||
advanceCursor(2); // Skip the closing ]]
|
||||
} else {
|
||||
// Comment line, skip to end of line
|
||||
while (leftCursor < fileContent.length && fileContent[leftCursor] !== '\n') {
|
||||
leftCursor++;
|
||||
advanceCursor();
|
||||
}
|
||||
if (fileContent[leftCursor] === '\n') {
|
||||
lineCounter++;
|
||||
newLine();
|
||||
}
|
||||
advanceCursor();
|
||||
}
|
||||
currentWord = '';
|
||||
continue;
|
||||
@@ -117,14 +125,14 @@ export abstract class CodeBlock {
|
||||
else if (currentChar === '"' || currentChar === "'") {
|
||||
// String literal, skip to closing quote
|
||||
const quoteType = currentChar;
|
||||
leftCursor++;
|
||||
advanceCursor();
|
||||
while (leftCursor < fileContent.length && fileContent[leftCursor] !== quoteType) {
|
||||
// Add string but don't process it for keywords
|
||||
currentBlockString += fileContent[leftCursor];
|
||||
leftCursor++;
|
||||
advanceCursor();
|
||||
}
|
||||
currentBlockString += quoteType; // Add the closing quote
|
||||
leftCursor++; // Skip the closing quote
|
||||
advanceCursor(); // Skip the closing quote
|
||||
currentWord = '';
|
||||
continue;
|
||||
}
|
||||
@@ -144,6 +152,9 @@ export abstract class CodeBlock {
|
||||
currentBlockString = '';
|
||||
currentWord = '';
|
||||
}
|
||||
newLine();
|
||||
advanceCursor();
|
||||
continue;
|
||||
}
|
||||
else if (currentChar === ")" && currentBlock.blockType === BlockType.Require) {
|
||||
currentBlockString = trimEndPreserveNewlines(currentBlockString); // Remove trailing spaces/tabs
|
||||
@@ -152,6 +163,9 @@ export abstract class CodeBlock {
|
||||
currentBlock.childBlocks.push(lineBlock);
|
||||
currentBlockString = '';
|
||||
|
||||
// Update charEnd to include the closing parenthesis
|
||||
(currentBlock as RequireBlock).charEnd = lineCursor + 1;
|
||||
|
||||
currentBlock = currentBlock.getParentBlock()!;
|
||||
}
|
||||
//Table blocks
|
||||
@@ -178,7 +192,7 @@ export abstract class CodeBlock {
|
||||
currentBlock = tableBlock;
|
||||
|
||||
let braceCounter = 1;
|
||||
leftCursor++;
|
||||
advanceCursor();
|
||||
while (leftCursor < fileContent.length && braceCounter > 0) {
|
||||
const char = fileContent[leftCursor];
|
||||
currentBlockString += char;
|
||||
@@ -194,23 +208,29 @@ export abstract class CodeBlock {
|
||||
currentBlock.childBlocks.push(lineBlock);
|
||||
currentBlockString = '';
|
||||
lineCounter++;
|
||||
lineCursor = 0;
|
||||
}
|
||||
leftCursor++;
|
||||
advanceCursor();
|
||||
}
|
||||
|
||||
// Find newline or other character
|
||||
let tempCursor = leftCursor;
|
||||
let tempLineCursor = lineCursor;
|
||||
while (tempCursor < fileContent.length && fileContent[tempCursor] !== '\n' && fileContent[tempCursor].trim() === '') {
|
||||
currentBlockString += fileContent[tempCursor];
|
||||
tempCursor++;
|
||||
tempLineCursor++;
|
||||
}
|
||||
|
||||
if (tempCursor < fileContent.length && fileContent[tempCursor] === '\n') {
|
||||
currentBlockString += '\n';
|
||||
lineCounter++;
|
||||
lineCursor = 0;
|
||||
leftCursor = tempCursor + 1;
|
||||
} else if (tempCursor > leftCursor) {
|
||||
// We found whitespace but no newline, so position cursor at last whitespace
|
||||
leftCursor = tempCursor - 1;
|
||||
leftCursor = tempCursor;
|
||||
lineCursor = tempLineCursor;
|
||||
}
|
||||
// else: no whitespace after table, leave leftCursor where it is
|
||||
|
||||
@@ -279,7 +299,7 @@ export abstract class CodeBlock {
|
||||
currentBlock.childBlocks.push(line);
|
||||
}
|
||||
|
||||
blockToAdd = new RequireBlock(lineCounter, currentBlock, leftCursor - currentWord.length, leftCursor);
|
||||
blockToAdd = new RequireBlock(lineCounter, currentBlock, Math.max(0, lineCursor - trimmedWord.length), lineCursor);
|
||||
currentBlockString = trimmedWord; // Start the require block content with 'require' keyword
|
||||
}
|
||||
else if (trimmedWord === 'end') {
|
||||
@@ -288,7 +308,8 @@ export abstract class CodeBlock {
|
||||
onError?.({
|
||||
filePath: luaFilePath,
|
||||
line: fileContent.substring(0, leftCursor).split('\n').length - 1,
|
||||
message: "Unexpected 'end' without matching block start"
|
||||
message: "Unexpected 'end' without matching block start",
|
||||
type: CompilationErrorType.Syntax
|
||||
});
|
||||
} else {
|
||||
currentBlock = parent;
|
||||
@@ -302,7 +323,7 @@ export abstract class CodeBlock {
|
||||
|
||||
currentWord = '';
|
||||
}
|
||||
leftCursor++;
|
||||
advanceCursor();
|
||||
}
|
||||
// Handle case where file ends while in a ReturnBlock
|
||||
if (currentBlock.blockType === BlockType.Return) {
|
||||
@@ -548,7 +569,7 @@ export class FunctionBlock extends CodeBlock {
|
||||
|
||||
export class RequireBlock extends CodeBlock {
|
||||
|
||||
constructor(sourceLineNumber: number, parent: CodeBlock, public readonly charStart?: number, public readonly charEnd?: number) {
|
||||
constructor(sourceLineNumber: number, parent: CodeBlock, public readonly charStart?: number, public charEnd?: number) {
|
||||
super(sourceLineNumber, BlockType.Require, parent);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,4 +6,14 @@ export interface CompilationError {
|
||||
charStart?: number;
|
||||
charEnd?: number;
|
||||
message: string;
|
||||
type: CompilationErrorType;
|
||||
metaData?: Map<string, any>;
|
||||
}
|
||||
|
||||
export enum CompilationErrorType {
|
||||
Syntax = "Syntax",
|
||||
Semantic = "Semantic",
|
||||
Runtime = "Runtime",
|
||||
DependencyCircular = "DependencyCircular",
|
||||
DependencyNotFound = "DependencyNotFound"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { LuaFile, BlockType, CodeBlock, RequireBlock, ReturnBlock, FunctionBlock, TableBlock } from './CodeBlocks';
|
||||
import { CompilationError } from './CompilationError';
|
||||
import { CompilationError, CompilationErrorType } from './CompilationError';
|
||||
|
||||
export interface ScriptCompilerOptions {
|
||||
sourcePath: string,
|
||||
@@ -17,7 +17,7 @@ export interface ICompilationLogger {
|
||||
writeLine(message: string): void;
|
||||
}
|
||||
|
||||
export { CompilationError };
|
||||
export { CompilationError, CompilationErrorType };
|
||||
|
||||
class Metrics {
|
||||
public totalLinesRead : number = 0;
|
||||
@@ -70,7 +70,8 @@ export class ScriptCompiler {
|
||||
this.options.onError?.({
|
||||
filePath: fullPath,
|
||||
line: 0,
|
||||
message: `Duplicate file key detected: ${key}. This can happen if two files have different capitalization. Lua is case sensitive, but the compiler treats file keys as case insensitive.`
|
||||
message: `Duplicate file key detected: ${key}. This can happen if two files have different capitalization. Lua is case sensitive, but the compiler treats file keys as case insensitive.`,
|
||||
type: CompilationErrorType.Semantic
|
||||
});
|
||||
continue;
|
||||
}
|
||||
@@ -305,7 +306,8 @@ class Writer {
|
||||
this.onError({
|
||||
filePath: file.fullPath,
|
||||
line: 0,
|
||||
message: `Circular dependency detected: ${cycle.map(x => x.split('.').pop()).join(' -> ')}`
|
||||
message: `Circular dependency detected: ${cycle.map(x => x.split('.').pop()).join(' -> ')}`,
|
||||
type: CompilationErrorType.DependencyCircular
|
||||
});
|
||||
}
|
||||
return true;
|
||||
@@ -348,7 +350,13 @@ class Writer {
|
||||
line: dep.requiredAtLine,
|
||||
charStart: dep.charStart,
|
||||
charEnd: dep.charEnd,
|
||||
message: `Missing dependency: ${dep.fileKey}`
|
||||
message: `Missing dependency: ${dep.fileKey}`,
|
||||
type: CompilationErrorType.DependencyNotFound,
|
||||
metaData: new Map(
|
||||
[
|
||||
["dependency", dep.fileKey],
|
||||
]
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ async function main() {
|
||||
format: 'cjs',
|
||||
minify: production,
|
||||
sourcemap: !production,
|
||||
sourcesContent: false,
|
||||
sourcesContent: true,
|
||||
platform: 'node',
|
||||
outfile: 'dist/extension.js',
|
||||
external: ['vscode'],
|
||||
|
||||
@@ -42,10 +42,107 @@
|
||||
---@field Easting number
|
||||
---@field Northing number
|
||||
|
||||
do --mission table
|
||||
|
||||
---@class MissionTable
|
||||
---@field drawings Drawings
|
||||
---@field coalition Coalitions
|
||||
---@field triggers Triggers
|
||||
---@field theatre string?
|
||||
---@field version number
|
||||
---@field start_time number
|
||||
---@field goals table?
|
||||
---@field weather table?
|
||||
|
||||
do -- drawings
|
||||
|
||||
---@class Drawings
|
||||
---@field options DrawingOptions
|
||||
---@field layers Array<DrawingLayer>
|
||||
|
||||
---@class DrawingOptions
|
||||
---@field hiddenOnF10Map HiddenOnF10Map
|
||||
|
||||
---@class HiddenOnF10Map
|
||||
---@field Observer HiddenOnF10MapSettings
|
||||
---@field Instructor HiddenOnF10MapSettings
|
||||
---@field ForwardObserver HiddenOnF10MapSettings
|
||||
---@field Spectator HiddenOnF10MapSettings
|
||||
---@field ArtilleryCommander HiddenOnF10MapSettings
|
||||
---@field Pilot HiddenOnF10MapSettings
|
||||
|
||||
---@class HiddenOnF10MapSettings
|
||||
---@field Neutral boolean
|
||||
---@field Blue boolean
|
||||
---@field Red boolean
|
||||
|
||||
---@class DrawingLayer
|
||||
---@field name string
|
||||
---@field visible boolean
|
||||
---@field objects Array<DrawingObject>
|
||||
|
||||
end
|
||||
|
||||
do -- coalitions
|
||||
---@class Coalitions
|
||||
---@field red Coalition
|
||||
---@field blue Coalition
|
||||
---@field neutral Coalition
|
||||
|
||||
---@class Coalition
|
||||
---@field bullseye Vec2
|
||||
---@field name string
|
||||
---@field nav_points Array<NavPoint>
|
||||
---@field country Array<Country>
|
||||
|
||||
---@class NavPoint
|
||||
---@field type string
|
||||
---@field comment string
|
||||
---@field callSignStr string
|
||||
---@field id number
|
||||
---@field properties table
|
||||
|
||||
---@class Country
|
||||
---@field id number
|
||||
---@field name string
|
||||
---@field vehicle Groups
|
||||
---@field plane Groups
|
||||
---@field helicopter Groups
|
||||
---@field static Groups
|
||||
---@field ship Groups
|
||||
|
||||
---@class Groups
|
||||
---@field group Array<table>
|
||||
|
||||
end
|
||||
|
||||
do -- triggers
|
||||
---@class Triggers
|
||||
---@field zones Array<MissionTriggerZone>
|
||||
|
||||
---@class MissionTriggerZone
|
||||
---@field radius number
|
||||
---@field zoneId number
|
||||
---@field properties Array<TriggerZoneProperty>
|
||||
---@field hidden boolean
|
||||
---@field x number
|
||||
---@field y number
|
||||
---@field name string
|
||||
---@field type number
|
||||
---@field heading number
|
||||
---@field verticies Array<Vec2>
|
||||
|
||||
---@class TriggerZoneProperty
|
||||
---@field key string
|
||||
---@field value string
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
do -- env
|
||||
---@class env
|
||||
---@field mission table TODO: Mission
|
||||
---@field mission MissionTable
|
||||
---@field warehouses table
|
||||
---@field info fun(log:string, showMessageBox:boolean?) Prints passed log line with prefix 'info'
|
||||
---@field warning fun(log:string, showMessageBox:boolean?) Prints passed log line with prefix 'warning'
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
---@meta LfsTypes
|
||||
|
||||
---@alias lfs.AttributeName
|
||||
---|'dev' -- on Unix systems, this represents the device that the inode resides on. On Windows systems, represents the drive number of the disk containing the file
|
||||
---|'ino' -- on Unix systems, this represents the inode number. On Windows systems this has no meaning
|
||||
---|'mode' -- string representing the associated protection mode (the values could be file, directory, link, socket, named pipe, char device, block device or other)
|
||||
---|'nlink' -- number of hard links to the file
|
||||
---|'uid' -- user-id of owner (Unix only, always 0 on Windows)
|
||||
---|'gid' -- group-id of owner (Unix only, always 0 on Windows)
|
||||
---|'rdev' -- on Unix systems, represents the device type, for special file inodes. On Windows systems represents the same as dev
|
||||
---|'access' -- time of last access
|
||||
---|'modification' -- time of last data modification
|
||||
---|'change' -- time of last file status change
|
||||
---|'size' -- file size, in bytes
|
||||
---|'permissions' -- file permissions string
|
||||
---|'blocks' -- block allocated for file; (Unix only)
|
||||
---|'blksize' -- optimal file system I/O blocksize; (Unix only)
|
||||
|
||||
---@alias lfs.AttributeMode
|
||||
---|'file'
|
||||
---|'directory'
|
||||
---|'link'
|
||||
---|'socket'
|
||||
---|'char device'
|
||||
---|"block device"
|
||||
---|"named pipe"
|
||||
|
||||
---@class lfs.Attributes
|
||||
---@field [lfs.AttributeName] any
|
||||
---@field ['mode'] lfs.AttributeMode
|
||||
|
||||
---@alias lfs.FileMode
|
||||
---| "binary"
|
||||
---| "text"
|
||||
|
||||
---@class lfs.Lock
|
||||
---@field free fun() Releases the lock on the file/directory.
|
||||
|
||||
---@class lfs.DirObject
|
||||
---@field next fun(self: lfs.DirObject): string? Returns a directory entry's name as a string, or `nil` if there are no more entries.
|
||||
---@field close fun(self: lfs.DirObject) Explicitly closes the directory before iteration finishes.
|
||||
|
||||
---@class lfs
|
||||
---@field attributes fun(path:string, result_param: lfs.AttributeName | lfs.Attributes | table): lfs.Attributes? Returns a table with the file attributes corresponding to filepath (or `nil` followed by an error message and a system-dependent error code in case of error). If the second optional argument is given and is a string, then only the value of the named attribute is returned (this use is equivalent to lfs.attributes(filepath)[request_name], but the table is not created and only one attribute is retrieved from the O.S.). if a table is passed as the second argument, it (result_table) is filled with attributes and returned instead of a new table
|
||||
---@field chdir fun(path:string) : boolean?, string? Changes the current working directory to the given path. <br> Returns true in case of success or `nil` plus an error string.
|
||||
---@field lock_dir fun(path:string, seconds_stale: number?) : lfs.Lock?, string? Creates a lockfile (called lockfile.lfs) in path if it does not exist and returns the lock. If the lock already exists checks if it's stale, using the second parameter (default for the second parameter is `INT_MAX`, which in practice means the lock will never be stale. To free the the lock call `lock:free()`. <br>In case of any errors it returns `nil` and the error message. In particular, if the lock exists and is not stale it returns the "File exists" message.
|
||||
---@field currentdir fun(): string?, string? Returns a string with the current working directory or `nil` plus an error string.
|
||||
---@field dir fun(path: string): fun(): string?, lfs.DirObject Lua iterator over the entries of a given directory. Each time the iterator is called with `dir_obj` it returns a directory entry's name as a string, or `nil` if there are no more entries. You can also iterate by calling `dir_obj:next()`, and explicitly close the directory before the iteration finished with `dir_obj:close()`. Raises an error if `path` is not a directory.
|
||||
---@field lock fun(filehandle, mode: string, start?: number, length?: number): boolean?, string? Locks a file or a part of it. The mode can be `'r'` (read/shared lock) or `'w'` (write/exclusive lock). Returns `true` if successful, or `nil` plus an error string in case of error.
|
||||
---@field link fun(old: string, new: string, symlink?: boolean): boolean?, string?, number? Creates a link. If the optional third argument is true, creates a symbolic link; otherwise creates a hard link.
|
||||
---@field mkdir fun(dirname: string): boolean?, string?, number? Creates a new directory. Returns `true` in case of success or `nil`, an error message and a system-dependent error code in case of error.
|
||||
---@field rmdir fun(dirname: string): boolean?, string?, number? Removes an existing directory. Returns `true` in case of success or `nil`, an error message and a system-dependent error code in case of error.
|
||||
---@field setmode fun(file, mode: lfs.FileMode): boolean?, string? Sets the writing mode for a file. The mode can be `'binary'` or `'text'`. Returns `true` followed by the previous mode string, or `nil` followed by an error string in case of error. On non-Windows platforms, setting the mode has no effect and is always returned as `'binary'`.
|
||||
---@field symlinkattributes fun(filepath: string, request_name?: lfs.AttributeName | string): lfs.Attributes? | any Gets information about a symlink itself (not the file it refers to). Identical to `lfs.attributes` but also adds a `target` field containing the filename the symlink points to. On Windows, this is identical to `lfs.attributes`.
|
||||
---@field touch fun(filepath: string, atime?: number, mtime?: number): boolean?, string?, number? Sets access and modification times of a file. Times are in seconds (from `os.time()`). If `mtime` is omitted, `atime` is used; if both are omitted, the current time is used. Returns `true` in case of success or `nil`, an error message and a system-dependent error code in case of error.
|
||||
---@field unlock fun(filehandle, start?: number, length?: number): boolean?, string? Unlocks a file or a part of it. Returns `true` if successful, or `nil` plus an error string in case of error.
|
||||
|
||||
---@class DcsLfs : lfs
|
||||
---@field tempdir fun(): string Returns the DCS temporary directory.
|
||||
---@field writedir fun(): string Returns the Saved Games directory.
|
||||
---@field realpath fun(path: string): string Returns the absolute path of a file.
|
||||
---@field normpath fun(path: string): string Returns the normalized path.
|
||||
---@field md5sum fun(path: string): string Returns the MD5 checksum of the file at the given path.
|
||||
---@field locations fun(): table Returns available drives.
|
||||
|
||||
-- In DCS lfs can be removed, hence the option of it being `nil`.
|
||||
---@type DcsLfs|nil
|
||||
lfs = lfs or nil
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "dutchies-dcs-scripting-tools",
|
||||
"displayName": "Dutchies Dcs Scripting Tools",
|
||||
"description": "Scripting tools to create DCS script and frameworks easier",
|
||||
"version": "0.0.5",
|
||||
"version": "0.2.0",
|
||||
"author": {
|
||||
"name": "dutchie031",
|
||||
"email": "54616262+dutchie031@users.noreply.github.com"
|
||||
@@ -15,7 +15,7 @@
|
||||
"publisher": "dutchie031",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"vscode": "1.108.1"
|
||||
"vscode": "^1.108.1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -36,7 +36,7 @@
|
||||
"properties": {
|
||||
"dutchies-dcs-scripting-tools.dcsTypes": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"default": false,
|
||||
"description": "Enable or disable DCS Types (adds types for DCS functions and objects)"
|
||||
},
|
||||
"dutchies-dcs-scripting-tools.spearheadTypes": {
|
||||
@@ -64,6 +64,14 @@
|
||||
"type":"string",
|
||||
"default": "${workspaceFolder}/dist",
|
||||
"description": "Where the compiled Lua files will be output. default: ${workspaceFolder}/dist"
|
||||
},
|
||||
"dutchies-dcs-scripting-tools.globalRequirables": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"default": [],
|
||||
"description": "List of global requirable Lua scripts that will be included automatically."
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -114,7 +122,6 @@
|
||||
"watch": "npm-run-all -p watch:*",
|
||||
"watch:esbuild": "node esbuild.js --watch",
|
||||
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
|
||||
"watch:compiler": "cd ../compiler && npm run watch",
|
||||
"package": "npm run check-types && npm run lint && node esbuild.js --production",
|
||||
"compile-tests": "tsc -p . --outDir out",
|
||||
"watch-tests": "tsc -p . -w --outDir out",
|
||||
|
||||
@@ -1,39 +1,75 @@
|
||||
// The module 'vscode' contains the VS Code extensibility API
|
||||
// Import the module and reference it with the alias vscode in your code below
|
||||
import * as vscode from 'vscode';
|
||||
import { ScriptCompiler, ScriptCompilerOptions, CompilationError, ICompilationLogger } from 'dcs-script-compiler';
|
||||
import * as path from 'path';
|
||||
import { ScriptCompiler, ScriptCompilerOptions, CompilationError, ICompilationLogger, CompilationErrorType } from 'dcs-script-compiler';
|
||||
import { Logger } from './logger';
|
||||
import * as luaAddonsManager from './lua-addons-manager';
|
||||
|
||||
const luaWorkSpaceSettingKey = "Lua.workspace";
|
||||
const librarySettingsKey = "library";
|
||||
const diagnosticCollection = vscode.languages.createDiagnosticCollection('lua-transpiler');
|
||||
|
||||
let pluginPath : string | undefined;
|
||||
// Diagnostic codes
|
||||
const DIAGNOSTIC_CODE_MISSING_GLOBAL = 'lua-missing-global-dependency';
|
||||
|
||||
const logger = new Logger();
|
||||
|
||||
const luaAddonNames: string[] = [ "dcs-types" ];
|
||||
|
||||
const extensionName = 'dutchies-dcs-scripting-tools';
|
||||
const publisherName = 'dutchie031';
|
||||
const extensionSettingsFilter = `@ext:${publisherName}.${extensionName}`;
|
||||
|
||||
let luaAddonsManagerInstance: luaAddonsManager.LuaAddonsManager | undefined;
|
||||
|
||||
// State tracking for addon updates
|
||||
let extensionPath: string | undefined;
|
||||
let workspaceRoot: string | undefined;
|
||||
let luaAddonsTargetPath: string | undefined;
|
||||
let currentExtensionVersion: string | undefined;
|
||||
let isUpdatingAddons = false;
|
||||
|
||||
//TODO:
|
||||
// - ENABLE/DISABLE with settings instead of commands (or both)
|
||||
|
||||
// This method is called when your extension is activated
|
||||
// Your extension is activated the very first time the command is executed
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
|
||||
pluginPath = context.asAbsolutePath('lua-addons');
|
||||
extensionPath = context.extensionPath;
|
||||
workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath;
|
||||
|
||||
if (workspaceRoot === undefined) {
|
||||
vscode.window.showErrorMessage('Workspace root not found. Lua addons manager cannot be initialized.');
|
||||
return;
|
||||
}
|
||||
|
||||
luaAddonsTargetPath = path.join(workspaceRoot, '.vscode' , 'lua-addons');
|
||||
luaAddonsManagerInstance = new luaAddonsManager.LuaAddonsManager(luaAddonsTargetPath, context.extensionPath);
|
||||
|
||||
if (!luaAddonsManagerInstance) {
|
||||
vscode.window.showErrorMessage('Failed to initialize Lua addons manager.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize extension version
|
||||
try {
|
||||
currentExtensionVersion = await luaAddonsManagerInstance.getPackageVersion();
|
||||
logger.debug(`Extension version: ${currentExtensionVersion}`);
|
||||
} catch (err) {
|
||||
logger.error(`Failed to determine extension version: ${err instanceof Error ? err.message : String(err)}`);
|
||||
}
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.enable', async () => {
|
||||
enableIntellisense();
|
||||
await enableIntellisense();
|
||||
})
|
||||
);
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.disable', async () => {
|
||||
disableIntellisense();
|
||||
await disableIntellisense();
|
||||
})
|
||||
);
|
||||
|
||||
@@ -55,6 +91,23 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
})
|
||||
);
|
||||
|
||||
// Register code actions provider for quick fixes
|
||||
context.subscriptions.push(
|
||||
vscode.languages.registerCodeActionsProvider('lua', new LuaQuickFixProvider(), {
|
||||
providedCodeActionKinds: [vscode.CodeActionKind.QuickFix]
|
||||
})
|
||||
);
|
||||
|
||||
// Register command to add global requirable
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand(
|
||||
'dutchies-dcs-scripting-tools.addGlobalRequirable',
|
||||
async (dependency: string) => {
|
||||
await addGlobalRequirable(dependency);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
vscode.workspace.onDidSaveTextDocument(async(document) => {
|
||||
logger.info(`Document saved: ${document.uri.fsPath} | Language: ${document.languageId}`);
|
||||
if (document.languageId === 'lua') {
|
||||
@@ -71,20 +124,28 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
const config = vscode.workspace.getConfiguration(extensionName);
|
||||
const dcsTypesEnabled = config.get<boolean>('dcsTypes') || false;
|
||||
if (dcsTypesEnabled) {
|
||||
addPluginPathToSettings();
|
||||
await updateLuaAddons();
|
||||
} else {
|
||||
removePluginPathFromSettings();
|
||||
await disableIntellisense();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Check and update lua-addons on activation if dcsTypes is enabled
|
||||
await checkAndUpdateAddonsOnStartup();
|
||||
|
||||
logger.info('Dutchies DCS Scripting Tools extension activated');
|
||||
}
|
||||
|
||||
// This method is called when your extension is deactivated
|
||||
export function deactivate()
|
||||
export async function deactivate()
|
||||
{
|
||||
removePluginPathFromSettings();
|
||||
// Clean up addon paths from settings on deactivation
|
||||
try {
|
||||
await removeVersionedPluginPathsFromSettings();
|
||||
} catch (err) {
|
||||
logger.error(`Error cleaning up on deactivation: ${err instanceof Error ? err.message : String(err)}`);
|
||||
}
|
||||
logger.info('Dutchies DCS Scripting Tools extension deactivated');
|
||||
}
|
||||
|
||||
@@ -141,16 +202,40 @@ async function compileLuaScripts() {
|
||||
logger.error('Compilation failed: ' + (err as Error).message + '\n' + (err as Error).stack);
|
||||
}
|
||||
|
||||
const globalRequirables: string[] = config.get<string[]>('globalRequirables') || [];
|
||||
|
||||
// Update diagnostics
|
||||
diagnosticCollection.clear();
|
||||
for (const [filePath, errors] of errorsByFile) {
|
||||
const uri = vscode.Uri.file(filePath);
|
||||
const diagnostics = errors.map(error => {
|
||||
const range = new vscode.Range(error.line, error.charStart ?? 0, error.line, error.charEnd ?? 0);
|
||||
const diagnostic = new vscode.Diagnostic(range, error.message, vscode.DiagnosticSeverity.Error);
|
||||
diagnostic.source = 'DCS Lua Transpiler';
|
||||
return diagnostic;
|
||||
});
|
||||
if (error.type === CompilationErrorType.DependencyNotFound) {
|
||||
const dependencyStr = error.metaData?.get("dependency") ?? undefined;
|
||||
if (dependencyStr) {
|
||||
if (globalRequirables.includes(dependencyStr)) {
|
||||
// Do nothing, it is a globally requirable dependency
|
||||
const range = new vscode.Range(error.line, error.charStart ?? 0, error.line, error.charEnd ?? 0);
|
||||
const diagnostic = new vscode.Diagnostic(range, "Unchecked: Globally marked dependency", vscode.DiagnosticSeverity.Hint);
|
||||
diagnostic.source = 'DCS Lua Transpiler';
|
||||
return diagnostic;
|
||||
} else {
|
||||
const range = new vscode.Range(error.line, error.charStart ?? 0, error.line, error.charEnd ?? 0);
|
||||
const diagnostic = new vscode.Diagnostic(range, error.message, vscode.DiagnosticSeverity.Error);
|
||||
diagnostic.code = { value: DIAGNOSTIC_CODE_MISSING_GLOBAL, target: vscode.Uri.parse('https://example.com') };
|
||||
diagnostic.source = 'DCS Lua Transpiler';
|
||||
// Store the dependency name for the quick fix to access
|
||||
(diagnostic as any).dependency = dependencyStr;
|
||||
return diagnostic;
|
||||
}
|
||||
}
|
||||
return undefined; //Something weird happened, let's ignore it for now.
|
||||
} else {
|
||||
const range = new vscode.Range(error.line, error.charStart ?? 0, error.line, error.charEnd ?? 0);
|
||||
const diagnostic = new vscode.Diagnostic(range, error.message, vscode.DiagnosticSeverity.Error);
|
||||
diagnostic.source = 'DCS Lua Transpiler';
|
||||
return diagnostic;
|
||||
}
|
||||
}).filter(diagnostic => diagnostic !== undefined);
|
||||
diagnosticCollection.set(uri, diagnostics);
|
||||
}
|
||||
}
|
||||
@@ -162,11 +247,12 @@ async function enableIntellisense() {
|
||||
config.update("dcsTypes", true, vscode.ConfigurationTarget.Workspace);
|
||||
}
|
||||
|
||||
addPluginPathToSettings();
|
||||
await updateLuaAddons();
|
||||
await addPluginPathsToSettings();
|
||||
await vscode.commands.executeCommand(
|
||||
"lua.startServer"
|
||||
);
|
||||
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools enabled.');
|
||||
vscode.window.showInformationMessage(`DCS-Types installed. Version ${currentExtensionVersion}.`);
|
||||
}
|
||||
|
||||
async function disableIntellisense() {
|
||||
@@ -175,32 +261,264 @@ async function disableIntellisense() {
|
||||
config.update("dcsTypes", false, vscode.ConfigurationTarget.Workspace);
|
||||
}
|
||||
|
||||
removePluginPathFromSettings();
|
||||
await removeVersionedPluginPathsFromSettings();
|
||||
if(luaAddonsManagerInstance){
|
||||
await luaAddonsManagerInstance.removeAllExtensions(luaAddonNames);
|
||||
}
|
||||
|
||||
await vscode.commands.executeCommand(
|
||||
"lua.startServer"
|
||||
);
|
||||
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools disabled.');
|
||||
}
|
||||
|
||||
function addPluginPathToSettings() {
|
||||
if (pluginPath) {
|
||||
const luaSettings = vscode.workspace.getConfiguration(luaWorkSpaceSettingKey);
|
||||
const librarySettings = luaSettings.get<string[]>(librarySettingsKey) || [];
|
||||
if (!librarySettings.includes(pluginPath)) {
|
||||
librarySettings.push(pluginPath);
|
||||
luaSettings.update(librarySettingsKey, librarySettings, vscode.ConfigurationTarget.Workspace);
|
||||
/**
|
||||
* Updates lua-addons by copying them from the extension bundle to the workspace
|
||||
* with versioned naming, cleaning old versions, and updating Lua settings
|
||||
*/
|
||||
async function updateLuaAddons(): Promise<void> {
|
||||
// Prevent concurrent update operations
|
||||
if (isUpdatingAddons) {
|
||||
logger.debug('Addon update already in progress, skipping.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!extensionPath || !workspaceRoot || !currentExtensionVersion) {
|
||||
logger.warn('Cannot update addons: extension path, workspace root, or version not available.');
|
||||
return;
|
||||
}
|
||||
|
||||
isUpdatingAddons = true;
|
||||
|
||||
if (luaAddonsManagerInstance === undefined) {
|
||||
logger.warn('Lua Addons Manager instance is not available.');
|
||||
isUpdatingAddons = false;
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
logger.info('Starting lua-addons update...');
|
||||
|
||||
for (const addonName of luaAddonNames) {
|
||||
const packageVersion = await luaAddonsManagerInstance.getPackageVersion();
|
||||
const addonVersion = await luaAddonsManagerInstance.getExtensionVersion(addonName);
|
||||
|
||||
if (packageVersion && packageVersion !== addonVersion) {
|
||||
logger.warn(
|
||||
`Version mismatch for addon ${addonName}: package=${packageVersion}, installed=${addonVersion}`
|
||||
);
|
||||
|
||||
luaAddonsManagerInstance.removeExtension(addonName);
|
||||
luaAddonsManagerInstance.installExtension(addonName);
|
||||
}
|
||||
}
|
||||
logger.info(`Lua-addons update completed successfully (version ${currentExtensionVersion}).`);
|
||||
|
||||
} catch (err) {
|
||||
const errorMsg = err instanceof Error ? err.message : String(err);
|
||||
logger.error(`Failed to update lua-addons: ${errorMsg}`);
|
||||
vscode.window.showErrorMessage(`Failed to update Dcs Lua Types: ${errorMsg}`);
|
||||
} finally {
|
||||
isUpdatingAddons = false;
|
||||
}
|
||||
}
|
||||
|
||||
function removePluginPathFromSettings() {
|
||||
if (pluginPath) {
|
||||
const luaSettings = vscode.workspace.getConfiguration(luaWorkSpaceSettingKey);
|
||||
const librarySettings = luaSettings.get<string[]>(librarySettingsKey) || [];
|
||||
const libIndex = librarySettings.indexOf(pluginPath);
|
||||
if (libIndex !== -1) {
|
||||
librarySettings.splice(libIndex, 1);
|
||||
luaSettings.update(librarySettingsKey, librarySettings, vscode.ConfigurationTarget.Workspace);
|
||||
/**
|
||||
* Checks on extension startup if lua-addons need to be updated
|
||||
* Runs only if dcsTypes is enabled in the workspace
|
||||
*/
|
||||
async function checkAndUpdateAddonsOnStartup(): Promise<void> {
|
||||
if (!extensionPath || !workspaceRoot || !currentExtensionVersion) {
|
||||
logger.debug('Skipping addon version check on startup: missing initialization data.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const config = vscode.workspace.getConfiguration(extensionName);
|
||||
const dcsTypesEnabled = config.get<boolean>('dcsTypes') || false;
|
||||
|
||||
if (!dcsTypesEnabled) {
|
||||
logger.debug('dcsTypes not enabled, skipping addon check on startup.');
|
||||
return;
|
||||
}
|
||||
|
||||
logger.debug('Checking lua-addons versions on startup...');
|
||||
|
||||
if (!luaAddonsManagerInstance) {
|
||||
logger.debug('Lua Addons Manager instance is not available, skipping addon version check.');
|
||||
return;
|
||||
}
|
||||
|
||||
let updateNeeded = false;
|
||||
for (const addonName of luaAddonNames) {
|
||||
const packageVersion = await luaAddonsManagerInstance.getPackageVersion();
|
||||
const addonVersion = await luaAddonsManagerInstance.getExtensionVersion(addonName);
|
||||
if (packageVersion && packageVersion !== addonVersion) {
|
||||
updateNeeded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (updateNeeded) {
|
||||
const userChoice = await vscode.window.showInformationMessage(
|
||||
'DCS-Types are not up to date with the current extension version. Do you want to update them?',
|
||||
{ modal: false },
|
||||
'Update'
|
||||
);
|
||||
|
||||
if (userChoice === 'Update') {
|
||||
await updateLuaAddons();
|
||||
vscode.window.showInformationMessage(`DCS-Types updated to version ${currentExtensionVersion}.`);
|
||||
} else {
|
||||
logger.info('User declined DCS-Types update.');
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
`Error checking lua-addons on startup: ${err instanceof Error ? err.message : String(err)}`
|
||||
);
|
||||
// Don't fail activation if check fails; user can manually enable/disable
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an absolute path to a workspace-relative path using ${workspaceFolder}
|
||||
*/
|
||||
function convertToWorkspaceFolderPath(absolutePath: string): string {
|
||||
if (!workspaceRoot) {
|
||||
return absolutePath;
|
||||
}
|
||||
// Normalize paths for comparison (handle both forward and back slashes)
|
||||
const normalizedAbsolute = absolutePath.replace(/\\/g, '/');
|
||||
const normalizedWorkspace = workspaceRoot.replace(/\\/g, '/');
|
||||
|
||||
if (normalizedAbsolute.startsWith(normalizedWorkspace)) {
|
||||
const relativePath = normalizedAbsolute.substring(normalizedWorkspace.length);
|
||||
// Remove leading slash if present
|
||||
const cleanPath = relativePath.startsWith('/') ? relativePath.substring(1) : relativePath;
|
||||
return `\${workspaceFolder}/${cleanPath}`;
|
||||
}
|
||||
return absolutePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the lua-addons directory to the Lua workspace library settings.
|
||||
* Lua Language Server automatically discovers versioned addons within this directory.
|
||||
*/
|
||||
async function addPluginPathsToSettings(): Promise<void> {
|
||||
if (!luaAddonsTargetPath) {
|
||||
logger.warn('Lua addons target path not available.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const luaSettings = vscode.workspace.getConfiguration(luaWorkSpaceSettingKey);
|
||||
let librarySettings = luaSettings.get<string[]>(librarySettingsKey) || [];
|
||||
|
||||
const workspaceFolderPath = convertToWorkspaceFolderPath(luaAddonsTargetPath);
|
||||
|
||||
if (!librarySettings.includes(workspaceFolderPath)) {
|
||||
librarySettings.push(workspaceFolderPath);
|
||||
logger.debug(`Added lua-addons path to Lua settings: ${workspaceFolderPath}`);
|
||||
await luaSettings.update(librarySettingsKey, librarySettings, vscode.ConfigurationTarget.Workspace);
|
||||
} else {
|
||||
logger.debug('Lua-addons path already in settings.');
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(`Failed to add lua-addons path to settings: ${err instanceof Error ? err.message : String(err)}`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the lua-addons directory from the Lua workspace library settings
|
||||
*/
|
||||
async function removeVersionedPluginPathsFromSettings(): Promise<void> {
|
||||
if (!luaAddonsTargetPath) {
|
||||
logger.debug('Lua addons target path not available, skipping removal.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const luaSettings = vscode.workspace.getConfiguration(luaWorkSpaceSettingKey);
|
||||
let librarySettings = luaSettings.get<string[]>(librarySettingsKey) || [];
|
||||
|
||||
const workspaceFolderPath = convertToWorkspaceFolderPath(luaAddonsTargetPath);
|
||||
const filteredSettings = librarySettings.filter(path => path !== workspaceFolderPath);
|
||||
|
||||
if (filteredSettings.length !== librarySettings.length) {
|
||||
await luaSettings.update(librarySettingsKey, filteredSettings, vscode.ConfigurationTarget.Workspace);
|
||||
logger.debug(`Removed lua-addons path from Lua settings: ${workspaceFolderPath}`);
|
||||
} else {
|
||||
logger.debug('Lua-addons path not found in settings.');
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(`Failed to remove lua-addons path from settings: ${err instanceof Error ? err.message : String(err)}`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Code actions provider for Lua quick fixes
|
||||
*/
|
||||
class LuaQuickFixProvider implements vscode.CodeActionProvider {
|
||||
provideCodeActions(
|
||||
document: vscode.TextDocument,
|
||||
range: vscode.Range | vscode.Selection,
|
||||
context: vscode.CodeActionContext,
|
||||
): vscode.CodeAction[] {
|
||||
const codeActions: vscode.CodeAction[] = [];
|
||||
|
||||
// Check for missing global dependency diagnostics
|
||||
for (const diagnostic of context.diagnostics) {
|
||||
const codeValue = typeof diagnostic.code === 'object' && diagnostic.code !== null
|
||||
? (diagnostic.code as any).value
|
||||
: diagnostic.code;
|
||||
|
||||
if (codeValue === DIAGNOSTIC_CODE_MISSING_GLOBAL) {
|
||||
const dependency = (diagnostic as any).dependency;
|
||||
if (dependency) {
|
||||
const action = new vscode.CodeAction(
|
||||
`Mark '${dependency}' as globally available`,
|
||||
vscode.CodeActionKind.QuickFix
|
||||
);
|
||||
action.command = {
|
||||
title: `Add '${dependency}' to global requireables`,
|
||||
command: 'dutchies-dcs-scripting-tools.addGlobalRequirable',
|
||||
arguments: [dependency]
|
||||
};
|
||||
action.diagnostics = [diagnostic];
|
||||
codeActions.push(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return codeActions;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a dependency to the global requireables list in workspace settings
|
||||
* @param dependency - The dependency name to add
|
||||
*/
|
||||
async function addGlobalRequirable(dependency: string): Promise<void> {
|
||||
try {
|
||||
const config = vscode.workspace.getConfiguration(extensionName);
|
||||
const globalRequirables = config.get<string[]>('globalRequirables') || [];
|
||||
|
||||
if (!globalRequirables.includes(dependency)) {
|
||||
globalRequirables.push(dependency);
|
||||
await config.update('globalRequirables', globalRequirables, vscode.ConfigurationTarget.Workspace);
|
||||
vscode.window.showInformationMessage(`Added '${dependency}' to global requireables.`);
|
||||
|
||||
// Recompile to update diagnostics
|
||||
await compileLuaScripts();
|
||||
} else {
|
||||
vscode.window.showInformationMessage(`'${dependency}' is already in global requireables.`);
|
||||
}
|
||||
} catch (err) {
|
||||
const errorMsg = err instanceof Error ? err.message : String(err);
|
||||
vscode.window.showErrorMessage(`Failed to add global requirable: ${errorMsg}`);
|
||||
logger.error(`Error adding global requirable: ${errorMsg}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,14 @@ export class Logger {
|
||||
this.outputChannel.appendLine(`[${new Date().toISOString()}][ERROR] ${message}`);
|
||||
}
|
||||
|
||||
debug(message: string) {
|
||||
this.outputChannel.appendLine(`[${new Date().toISOString()}][DEBUG] ${message}`);
|
||||
}
|
||||
|
||||
warn(message: string) {
|
||||
this.outputChannel.appendLine(`[${new Date().toISOString()}][WARN] ${message}`);
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.outputChannel.clear();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
import path from "path";
|
||||
import * as fs from 'fs/promises';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
/*
|
||||
* Lua addon naming conventions:
|
||||
* <addon-name>.<major>.<minor>.<patch>
|
||||
*/
|
||||
|
||||
export class LuaAddonsManager {
|
||||
|
||||
/** Path where addons are installed */
|
||||
private targetPath: string;
|
||||
|
||||
/** Path where addon sources are located */
|
||||
private sourceExtensionPath: string;
|
||||
|
||||
private extensionContextPath: string;
|
||||
|
||||
/**
|
||||
* Creates a new LuaAddonsManager instance.
|
||||
*
|
||||
* @param extensionPath - Directory where addons are installed
|
||||
* @param sourceExtensionPath - Directory where addon sources are located
|
||||
*/
|
||||
public constructor(luaTargetPath: string, extensionPath: string) {
|
||||
this.targetPath = luaTargetPath;
|
||||
this.sourceExtensionPath = path.join(extensionPath, "lua-addons");
|
||||
this.extensionContextPath = extensionPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves the version of an installed addon by name.
|
||||
*
|
||||
* Searches for a folder matching the naming pattern `<name>.<major>.<minor>.<patch>`
|
||||
* and returns the version string.
|
||||
*
|
||||
* @param name - The addon name to search for (without version suffix)
|
||||
* @returns The version string in format "major.minor.patch", or undefined if not found
|
||||
* @throws Never throws, returns undefined if addon not found
|
||||
*/
|
||||
async getExtensionVersion(name: string): Promise<string | undefined> {
|
||||
const folders = await fs.readdir(this.targetPath, { withFileTypes: true });
|
||||
for (const folder of folders) {
|
||||
if (!folder.isDirectory()) { continue; }
|
||||
|
||||
const versionMatch = folder.name.match(/^(.+)\.(\d+)\.(\d+)\.(\d+)$/);
|
||||
if (!versionMatch) { continue; }
|
||||
|
||||
const addonName = versionMatch[1];
|
||||
if (addonName === name) {
|
||||
return `${versionMatch[2]}.${versionMatch[3]}.${versionMatch[4]}`;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the version from the package.json file in the extension path.
|
||||
*
|
||||
* @returns The version string from package.json
|
||||
* @throws Error if package.json cannot be read or is missing the version field
|
||||
*/
|
||||
async getPackageVersion(): Promise<string | undefined> {
|
||||
try {
|
||||
const packageJsonPath = path.join(this.extensionContextPath,'package.json');
|
||||
const content = await fs.readFile(packageJsonPath, 'utf-8');
|
||||
const packageJson = JSON.parse(content);
|
||||
|
||||
const version = packageJson.version as string | undefined;
|
||||
if (!version) {
|
||||
throw new Error('Version field not found in package.json');
|
||||
}
|
||||
|
||||
return version;
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
`Failed to read extension version: ${err instanceof Error ? err.message : String(err)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a single addon by name.
|
||||
*
|
||||
* Deletes the addon directory matching the given name, regardless of version.
|
||||
*
|
||||
* @param name - The addon name to remove (without version suffix)
|
||||
* @throws Error if the removal operation fails
|
||||
*/
|
||||
async removeExtension(name: string): Promise<void> {
|
||||
return this.removeAllExtensions([name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes multiple addons by name.
|
||||
*
|
||||
* Scans the extension directory for folders matching the addon naming pattern
|
||||
* `<name>.<major>.<minor>.<patch>` and removes those whose base name is in the
|
||||
* provided list. Removes all versions of matched addons.
|
||||
*
|
||||
* @param names - Array of addon names to remove (without version suffix)
|
||||
* @throws Error if the removal operation fails
|
||||
*/
|
||||
async removeAllExtensions(names: string[]): Promise<void> {
|
||||
const folders = await fs.readdir(this.targetPath, { withFileTypes: true });
|
||||
for (const folder of folders) {
|
||||
if (!folder.isDirectory()) { continue; }
|
||||
|
||||
// Check if folder name matches versioning pattern: name.major.minor.patch
|
||||
const versionMatch = folder.name.match(/^(.+)\.(\d+)\.(\d+)\.(\d+)$/);
|
||||
if (!versionMatch) { continue; }
|
||||
|
||||
// Extract addon name from the versioned folder name
|
||||
const addonName = versionMatch[1];
|
||||
|
||||
if (names.includes(addonName)) {
|
||||
const folderPath = path.join(this.targetPath, folder.name);
|
||||
await fs.rm(folderPath, { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs an addon from source to the target installation directory.
|
||||
*
|
||||
* Copies the addon directory from sourceExtensionPath to extensionPath.
|
||||
* The source directory name should match the addon name.
|
||||
*
|
||||
* @param name - The addon name/directory to install (without version suffix)
|
||||
* @throws Error if source directory not found or copy operation fails
|
||||
*/
|
||||
async installExtension(name: string): Promise<void> {
|
||||
const sourceFolderPath = path.join(this.sourceExtensionPath, name);
|
||||
|
||||
const version = await this.getPackageVersion();
|
||||
const versionedName = `${name}.${version}`;
|
||||
const targetFolderPath = path.join(this.targetPath, versionedName);
|
||||
|
||||
if (!existsSync(sourceFolderPath)) {
|
||||
throw new Error(`Source extension folder not found: ${sourceFolderPath}`);
|
||||
}
|
||||
await fs.mkdir(targetFolderPath, { recursive: true });
|
||||
await fs.cp(sourceFolderPath, targetFolderPath, { recursive: true });
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
import * as assert from 'assert';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import { existsSync } from 'fs';
|
||||
import { LuaAddonsManager } from '../lua-addons-manager';
|
||||
|
||||
/**
|
||||
* Integration tests for LuaAddonsManager
|
||||
* Uses temporary directories to avoid polluting the file system
|
||||
*/
|
||||
|
||||
suite('LuaAddonsManager', () => {
|
||||
let tempDir: string;
|
||||
|
||||
suiteSetup(async () => {
|
||||
tempDir = path.join(os.tmpdir(), `dcs-test-${Date.now()}-${Math.random()}`);
|
||||
});
|
||||
|
||||
suiteTeardown(async () => {
|
||||
if (existsSync(tempDir)) {
|
||||
await fs.rm(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
suite('getExtensionVersion', () => {
|
||||
test('should return undefined if addon not found', async () => {
|
||||
const extensionDir = path.join(tempDir, 'getExtensionVersion-1');
|
||||
const sourceDir = path.join(tempDir, 'getExtensionVersion-1-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
const version = await manager.getExtensionVersion('nonexistent');
|
||||
|
||||
assert.strictEqual(version, undefined);
|
||||
});
|
||||
|
||||
test('should return version string for installed addon', async () => {
|
||||
const extensionDir = path.join(tempDir, 'getExtensionVersion-2');
|
||||
const sourceDir = path.join(tempDir, 'getExtensionVersion-2-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'dcs-types.1.2.3'), { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
const version = await manager.getExtensionVersion('dcs-types');
|
||||
|
||||
assert.strictEqual(version, '1.2.3');
|
||||
});
|
||||
|
||||
test('should return first matching version if multiple versions exist', async () => {
|
||||
const extensionDir = path.join(tempDir, 'getExtensionVersion-3');
|
||||
const sourceDir = path.join(tempDir, 'getExtensionVersion-3-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon.1.0.0'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon.2.0.0'), { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
const version = await manager.getExtensionVersion('addon');
|
||||
|
||||
// Should return one of the versions (first found)
|
||||
assert.match(version!, /^[12]\.0\.0$/);
|
||||
});
|
||||
});
|
||||
|
||||
suite('getPackageVersion', () => {
|
||||
test('should read version from package.json', async () => {
|
||||
const extensionDir = path.join(tempDir, 'getPackageVersion-1');
|
||||
const sourceDir = path.join(tempDir, 'getPackageVersion-1-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
const packageJson = path.join(extensionDir, 'package.json');
|
||||
await fs.writeFile(packageJson, JSON.stringify({ version: '2.1.0' }));
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
const version = await manager.getPackageVersion();
|
||||
|
||||
assert.strictEqual(version, '2.1.0');
|
||||
});
|
||||
|
||||
test('should throw error if package.json not found', async () => {
|
||||
const extensionDir = path.join(tempDir, 'getPackageVersion-2');
|
||||
const sourceDir = path.join(tempDir, 'getPackageVersion-2-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await assert.rejects(
|
||||
() => manager.getPackageVersion(),
|
||||
/Failed to read extension version/
|
||||
);
|
||||
});
|
||||
|
||||
test('should throw error if version field missing', async () => {
|
||||
const extensionDir = path.join(tempDir, 'getPackageVersion-3');
|
||||
const sourceDir = path.join(tempDir, 'getPackageVersion-3-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
const packageJson = path.join(extensionDir, 'package.json');
|
||||
await fs.writeFile(packageJson, JSON.stringify({ name: 'test' }));
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await assert.rejects(
|
||||
() => manager.getPackageVersion(),
|
||||
/Version field not found/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
suite('removeExtension', () => {
|
||||
test('should remove addon by name', async () => {
|
||||
const extensionDir = path.join(tempDir, 'removeExtension-1');
|
||||
const sourceDir = path.join(tempDir, 'removeExtension-1-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon1.1.0.0'), { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await manager.removeExtension('addon1');
|
||||
|
||||
const remaining = await fs.readdir(extensionDir);
|
||||
assert.strictEqual(remaining.length, 0);
|
||||
});
|
||||
|
||||
test('should not affect other addons', async () => {
|
||||
const extensionDir = path.join(tempDir, 'removeExtension-2');
|
||||
const sourceDir = path.join(tempDir, 'removeExtension-2-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon1.1.0.0'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon2.1.0.0'), { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await manager.removeExtension('addon1');
|
||||
|
||||
const remaining = await fs.readdir(extensionDir);
|
||||
assert.strictEqual(remaining.length, 1);
|
||||
assert.strictEqual(remaining[0], 'addon2.1.0.0');
|
||||
});
|
||||
});
|
||||
|
||||
suite('removeAllExtensions', () => {
|
||||
test('should remove multiple addons by name', async () => {
|
||||
const extensionDir = path.join(tempDir, 'removeAllExtensions-1');
|
||||
const sourceDir = path.join(tempDir, 'removeAllExtensions-1-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon1.1.0.0'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon2.1.0.0'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon3.1.0.0'), { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await manager.removeAllExtensions(['addon1', 'addon2']);
|
||||
|
||||
const remaining = await fs.readdir(extensionDir);
|
||||
assert.deepStrictEqual(remaining.sort(), ['addon3.1.0.0']);
|
||||
});
|
||||
|
||||
test('should delete all versions of matching addons', async () => {
|
||||
const extensionDir = path.join(tempDir, 'removeAllExtensions-2');
|
||||
const sourceDir = path.join(tempDir, 'removeAllExtensions-2-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon1.0.0.1'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon1.0.0.2'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon1.0.0.3'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon2.1.0.0'), { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await manager.removeAllExtensions(['addon1']);
|
||||
|
||||
const remaining = await fs.readdir(extensionDir);
|
||||
assert.deepStrictEqual(remaining.sort(), ['addon2.1.0.0']);
|
||||
});
|
||||
|
||||
test('should ignore folders with invalid version format', async () => {
|
||||
const extensionDir = path.join(tempDir, 'removeAllExtensions-3');
|
||||
const sourceDir = path.join(tempDir, 'removeAllExtensions-3-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'addon1.1.0.0'), { recursive: true });
|
||||
await fs.mkdir(path.join(extensionDir, 'invalid-folder'), { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await manager.removeAllExtensions(['addon1']);
|
||||
|
||||
const remaining = await fs.readdir(extensionDir);
|
||||
assert.deepStrictEqual(remaining.sort(), ['invalid-folder']);
|
||||
});
|
||||
|
||||
test('should not throw if addon does not exist', async () => {
|
||||
const extensionDir = path.join(tempDir, 'removeAllExtensions-4');
|
||||
const sourceDir = path.join(tempDir, 'removeAllExtensions-4-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
// Should not throw
|
||||
await manager.removeAllExtensions(['nonexistent']);
|
||||
});
|
||||
});
|
||||
|
||||
suite('installExtension', () => {
|
||||
test('should copy addon from source to target', async () => {
|
||||
const extensionDir = path.join(tempDir, 'installExtension-1');
|
||||
const sourceDir = path.join(tempDir, 'installExtension-1-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
const sourceAddon = path.join(sourceDir, 'addon1');
|
||||
await fs.mkdir(sourceAddon, { recursive: true });
|
||||
await fs.writeFile(path.join(sourceAddon, 'file.lua'), 'content');
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await manager.installExtension('addon1');
|
||||
|
||||
const targetAddon = path.join(extensionDir, 'addon1');
|
||||
assert.strictEqual(existsSync(targetAddon), true);
|
||||
assert.strictEqual(existsSync(path.join(targetAddon, 'file.lua')), true);
|
||||
});
|
||||
|
||||
test('should throw error if source directory does not exist', async () => {
|
||||
const extensionDir = path.join(tempDir, 'installExtension-2');
|
||||
const sourceDir = path.join(tempDir, 'installExtension-2-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await assert.rejects(
|
||||
() => manager.installExtension('nonexistent'),
|
||||
/Source extension folder not found/
|
||||
);
|
||||
});
|
||||
|
||||
test('should copy nested directories recursively', async () => {
|
||||
const extensionDir = path.join(tempDir, 'installExtension-3');
|
||||
const sourceDir = path.join(tempDir, 'installExtension-3-source');
|
||||
await fs.mkdir(extensionDir, { recursive: true });
|
||||
await fs.mkdir(sourceDir, { recursive: true });
|
||||
const sourceAddon = path.join(sourceDir, 'addon1');
|
||||
await fs.mkdir(path.join(sourceAddon, 'subdir'), { recursive: true });
|
||||
await fs.writeFile(path.join(sourceAddon, 'file.lua'), 'root');
|
||||
await fs.writeFile(path.join(sourceAddon, 'subdir', 'file.lua'), 'nested');
|
||||
|
||||
const manager = new LuaAddonsManager(extensionDir, sourceDir);
|
||||
await manager.installExtension('addon1');
|
||||
|
||||
const targetAddon = path.join(extensionDir, 'addon1');
|
||||
assert.strictEqual(existsSync(path.join(targetAddon, 'file.lua')), true);
|
||||
assert.strictEqual(existsSync(path.join(targetAddon, 'subdir', 'file.lua')), true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Generated
-789
@@ -1,789 +0,0 @@
|
||||
{
|
||||
"name": "gh-scripting-compiler",
|
||||
"version": "0.0.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "gh-scripting-compiler",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.27.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.11.1.tgz",
|
||||
"integrity": "sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/http-client": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
|
||||
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/http-client": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.3.tgz",
|
||||
"integrity": "sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tunnel": "^0.0.6",
|
||||
"undici": "^5.25.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/io": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
|
||||
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@cspotcode/source-map-support": {
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
|
||||
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "0.3.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz",
|
||||
"integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz",
|
||||
"integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz",
|
||||
"integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz",
|
||||
"integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz",
|
||||
"integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz",
|
||||
"integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz",
|
||||
"integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz",
|
||||
"integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz",
|
||||
"integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openharmony-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz",
|
||||
"integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz",
|
||||
"integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz",
|
||||
"integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@fastify/busboy": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
|
||||
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/resolve-uri": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/sourcemap-codec": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
|
||||
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
|
||||
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.0.3",
|
||||
"@jridgewell/sourcemap-codec": "^1.4.10"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/node10": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz",
|
||||
"integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tsconfig/node12": {
|
||||
"version": "1.0.11",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
|
||||
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tsconfig/node14": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
|
||||
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
|
||||
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "25.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.2.tgz",
|
||||
"integrity": "sha512-tO4ZIRKNC+MDWV4qKVZe3Ql/woTnmHDr5JD8UI5hn2pwBrHEwOEMZK7WlNb5RKB6EoJ02gwmQS9OrjuFnZYdpg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.16.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
|
||||
"integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/acorn-walk": {
|
||||
"version": "8.3.5",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz",
|
||||
"integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.11.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/arg": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/diff": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
|
||||
"integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.27.7",
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz",
|
||||
"integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.27.7",
|
||||
"@esbuild/android-arm": "0.27.7",
|
||||
"@esbuild/android-arm64": "0.27.7",
|
||||
"@esbuild/android-x64": "0.27.7",
|
||||
"@esbuild/darwin-arm64": "0.27.7",
|
||||
"@esbuild/darwin-x64": "0.27.7",
|
||||
"@esbuild/freebsd-arm64": "0.27.7",
|
||||
"@esbuild/freebsd-x64": "0.27.7",
|
||||
"@esbuild/linux-arm": "0.27.7",
|
||||
"@esbuild/linux-arm64": "0.27.7",
|
||||
"@esbuild/linux-ia32": "0.27.7",
|
||||
"@esbuild/linux-loong64": "0.27.7",
|
||||
"@esbuild/linux-mips64el": "0.27.7",
|
||||
"@esbuild/linux-ppc64": "0.27.7",
|
||||
"@esbuild/linux-riscv64": "0.27.7",
|
||||
"@esbuild/linux-s390x": "0.27.7",
|
||||
"@esbuild/linux-x64": "0.27.7",
|
||||
"@esbuild/netbsd-arm64": "0.27.7",
|
||||
"@esbuild/netbsd-x64": "0.27.7",
|
||||
"@esbuild/openbsd-arm64": "0.27.7",
|
||||
"@esbuild/openbsd-x64": "0.27.7",
|
||||
"@esbuild/openharmony-arm64": "0.27.7",
|
||||
"@esbuild/sunos-x64": "0.27.7",
|
||||
"@esbuild/win32-arm64": "0.27.7",
|
||||
"@esbuild/win32-ia32": "0.27.7",
|
||||
"@esbuild/win32-x64": "0.27.7"
|
||||
}
|
||||
},
|
||||
"node_modules/make-error": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ts-node": {
|
||||
"version": "10.9.2",
|
||||
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
|
||||
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@cspotcode/source-map-support": "^0.8.0",
|
||||
"@tsconfig/node10": "^1.0.7",
|
||||
"@tsconfig/node12": "^1.0.7",
|
||||
"@tsconfig/node14": "^1.0.0",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"acorn": "^8.4.1",
|
||||
"acorn-walk": "^8.1.1",
|
||||
"arg": "^4.1.0",
|
||||
"create-require": "^1.1.0",
|
||||
"diff": "^4.0.1",
|
||||
"make-error": "^1.1.1",
|
||||
"v8-compile-cache-lib": "^3.0.1",
|
||||
"yn": "3.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"ts-node": "dist/bin.js",
|
||||
"ts-node-cwd": "dist/bin-cwd.js",
|
||||
"ts-node-esm": "dist/bin-esm.js",
|
||||
"ts-node-script": "dist/bin-script.js",
|
||||
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||
"ts-script": "dist/bin-script-deprecated.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@swc/core": ">=1.2.50",
|
||||
"@swc/wasm": ">=1.2.50",
|
||||
"@types/node": "*",
|
||||
"typescript": ">=2.7"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@swc/core": {
|
||||
"optional": true
|
||||
},
|
||||
"@swc/wasm": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.9.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.29.0",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
|
||||
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.18.2",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
|
||||
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/v8-compile-cache-lib": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
|
||||
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/yn": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gh-scripting-compiler",
|
||||
"version": "0.0.1",
|
||||
"version": "1.1.0",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "node esbuild.js",
|
||||
@@ -8,12 +8,12 @@
|
||||
"package": "node esbuild.js --production"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0"
|
||||
"@actions/core": "3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.0.0",
|
||||
"esbuild": "^0.27.2"
|
||||
"typescript": "7.0.2",
|
||||
"esbuild": "0.28.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
name: 'Install Lua Addon'
|
||||
description: 'Installs DCS Lua addons and type definitions for scripting.'
|
||||
inputs:
|
||||
destination-path:
|
||||
description: 'The destination path in the repository where lua-addons should be installed.'
|
||||
required: true
|
||||
default: 'lua-addons'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Build action
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
|
||||
- name: Install lua-addons
|
||||
run: node ${{ github.action_path }}/dist/index.js
|
||||
shell: bash
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
INPUT_DESTINATION-PATH: ${{ inputs.destination-path }}
|
||||
@@ -0,0 +1,59 @@
|
||||
const esbuild = require("esbuild");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const production = process.argv.includes('--production');
|
||||
const watch = process.argv.includes('--watch');
|
||||
|
||||
async function copyDirectory(src, dest) {
|
||||
await fs.promises.mkdir(dest, { recursive: true });
|
||||
const entries = await fs.promises.readdir(src, { withFileTypes: true });
|
||||
|
||||
for (const entry of entries) {
|
||||
const srcPath = path.join(src, entry.name);
|
||||
const destPath = path.join(dest, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
await copyDirectory(srcPath, destPath);
|
||||
} else {
|
||||
await fs.promises.copyFile(srcPath, destPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// Copy lua-addons to dist directory
|
||||
const luaAddonsSource = path.join(__dirname, '../../dutchies-dcs-scripting-tools/lua-addons');
|
||||
const luaAddonsDest = path.join(__dirname, 'dist/lua-addons');
|
||||
|
||||
if (fs.existsSync(luaAddonsSource)) {
|
||||
await copyDirectory(luaAddonsSource, luaAddonsDest);
|
||||
console.log('Lua addons copied to dist/');
|
||||
}
|
||||
|
||||
const ctx = await esbuild.context({
|
||||
entryPoints: [
|
||||
'src/index.ts'
|
||||
],
|
||||
bundle: true,
|
||||
format: 'cjs',
|
||||
minify: production,
|
||||
sourcemap: !production,
|
||||
sourcesContent: false,
|
||||
platform: 'node',
|
||||
outfile: 'dist/index.js',
|
||||
external: ['@actions/core'],
|
||||
logLevel: 'silent',
|
||||
});
|
||||
if (watch) {
|
||||
await ctx.watch();
|
||||
} else {
|
||||
await ctx.rebuild();
|
||||
await ctx.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(e => {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
});
|
||||
+1145
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "gh-lua-addon-installer",
|
||||
"version": "1.1.0",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "node esbuild.js",
|
||||
"watch": "node esbuild.js --watch",
|
||||
"package": "node esbuild.js --production"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "1.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "7.0.2",
|
||||
"esbuild": "0.28.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as fs from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
async function copyDirectory(src: string, dest: string): Promise<void> {
|
||||
await fs.mkdir(dest, { recursive: true });
|
||||
const entries = await fs.readdir(src, { withFileTypes: true });
|
||||
|
||||
for (const entry of entries) {
|
||||
const srcPath = path.join(src, entry.name);
|
||||
const destPath = path.join(dest, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
await copyDirectory(srcPath, destPath);
|
||||
} else {
|
||||
await fs.copyFile(srcPath, destPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const destinationPath = core.getInput('destination-path');
|
||||
if (!destinationPath) {
|
||||
core.setFailed('Destination path is required.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Reference lua-addons bundled in dist directory
|
||||
// __dirname is dist/, lua-addons is bundled alongside
|
||||
const bundledAddonsDir = path.resolve(__dirname, './lua-addons');
|
||||
|
||||
// Verify bundled addons directory exists
|
||||
if (!existsSync(bundledAddonsDir)) {
|
||||
core.setFailed(`Lua-addons directory not found at: ${bundledAddonsDir}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the workspace root and resolve destination path
|
||||
const workspaceRoot = process.env.GITHUB_WORKSPACE || process.cwd();
|
||||
const absoluteDestinationPath = path.join(workspaceRoot, destinationPath);
|
||||
|
||||
core.info(`Copying lua-addons to: ${absoluteDestinationPath}`);
|
||||
|
||||
// Create destination directory if it doesn't exist
|
||||
await fs.mkdir(absoluteDestinationPath, { recursive: true });
|
||||
|
||||
// Copy all bundled addons to the destination
|
||||
const addons = await fs.readdir(bundledAddonsDir, { withFileTypes: true });
|
||||
for (const addon of addons) {
|
||||
if (addon.isDirectory()) {
|
||||
const sourceAddonDir = path.join(bundledAddonsDir, addon.name);
|
||||
const destAddonDir = path.join(absoluteDestinationPath, addon.name);
|
||||
|
||||
core.info(`Installing addon: ${addon.name}`);
|
||||
await copyDirectory(sourceAddonDir, destAddonDir);
|
||||
core.info(`✓ ${addon.name} installed`);
|
||||
}
|
||||
}
|
||||
|
||||
core.info('Lua addons installation completed successfully.');
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
core.setFailed(error.message);
|
||||
} else {
|
||||
core.setFailed('An unknown error occurred');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "commonjs",
|
||||
"types": ["node"],
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
]
|
||||
}
|
||||
Generated
+30
-21
@@ -11,7 +11,7 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "22.x",
|
||||
"@types/node": "^22.20.2",
|
||||
"@types/vscode": "^1.108.1",
|
||||
"@vscode/test-cli": "^0.0.12",
|
||||
"@vscode/test-electron": "^2.5.2",
|
||||
@@ -32,7 +32,7 @@
|
||||
}
|
||||
},
|
||||
"dutchies-dcs-scripting-tools": {
|
||||
"version": "0.0.5",
|
||||
"version": "0.1.7",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/mocha": "10.0.10",
|
||||
@@ -47,7 +47,7 @@
|
||||
"typescript-eslint": "8.70.0"
|
||||
},
|
||||
"engines": {
|
||||
"vscode": "1.108.1"
|
||||
"vscode": "^1.108.1"
|
||||
}
|
||||
},
|
||||
"dutchies-dcs-scripting-tools/node_modules/@eslint/config-array": {
|
||||
@@ -1220,29 +1220,43 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
|
||||
"integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==",
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
|
||||
"integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@humanfs/types": "^0.15.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/node": {
|
||||
"version": "0.16.7",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz",
|
||||
"integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==",
|
||||
"version": "0.16.8",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz",
|
||||
"integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@humanfs/core": "^0.19.1",
|
||||
"@humanfs/core": "^0.19.2",
|
||||
"@humanfs/types": "^0.15.0",
|
||||
"@humanwhocodes/retry": "^0.4.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/types": {
|
||||
"version": "0.15.0",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz",
|
||||
"integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=18.18.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanwhocodes/module-importer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
|
||||
@@ -1374,9 +1388,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.19.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.17.tgz",
|
||||
"integrity": "sha512-wGdMcf+vPYM6jikpS/qhg6WiqSV/OhG+jeeHT/KlVqxYfD40iYJf9/AE1uQxVWFvU7MipKRkRv8NSHiCGgPr8Q==",
|
||||
"version": "22.20.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.2.tgz",
|
||||
"integrity": "sha512-xlvWf4Vs9n1PEVYwP1n4vvG07M6y8WgvJ2t0vbrWTmijsIHp1cS+uJ2kMIRdY3nHZK0nCYKrPeD171+SzF4/zw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -1435,7 +1449,6 @@
|
||||
"integrity": "sha512-zYvrmj9Yxd63UGaXw+kdt6A0F0s0qveJyuatIM77bYC2DE4pgmg7a50u8LR7PRtXd0x+h+Tl3eXabGm06SWd3Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.70.0",
|
||||
"@typescript-eslint/types": "8.70.0",
|
||||
@@ -1720,7 +1733,6 @@
|
||||
"integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -2657,7 +2669,6 @@
|
||||
"integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.8.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
@@ -3964,9 +3975,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.1.tgz",
|
||||
"integrity": "sha512-CY6crGq313MX8GkwvB7tzgp99vjQxY1++5y10/BKN/GUfHqWaOGQMNZkBvqSzsZKWk/ijwHlWzzkLulsGHhjWQ==",
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz",
|
||||
"integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -5757,7 +5768,6 @@
|
||||
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -5888,7 +5898,6 @@
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/mocha": "^10.0.10",
|
||||
"@types/node": "22.x",
|
||||
"@types/node": "^22.20.2",
|
||||
"@types/vscode": "^1.108.1",
|
||||
"@vscode/test-cli": "^0.0.12",
|
||||
"@vscode/test-electron": "^2.5.2",
|
||||
|
||||
Reference in New Issue
Block a user