Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows fixes #82

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
"**/godot_src/**",
"**/js/**",
".eslintrc.js",
"tsconfig.json",
],
env: {
es2021: true,
Expand Down
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto

# Declare files that will always have LF line endings on checkout.
*.ts text eol=lf
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
example/_godot_defs/dynamic
example/**/*.gd
node_modules/
js/
.DS_Store

# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
export_presets.cfg
34 changes: 29 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,38 @@
"version": "0.2.0",
"configurations": [
{
"name": "Launch Program",
"name": "Run mockProject",
"program": "${workspaceFolder}/js/main.js",
"request": "launch",
"skipFiles": ["<node_internals>/**"],
"args": ["${workspaceFolder}/example/ts2gd.json"],
"skipFiles": [
"<node_internals>/**"
],
"args": [
"${workspaceFolder}/mockProject/ts2gd.json",
"--debug"
],
"type": "pwa-node",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": ["${workspaceFolder}/js/**/*.js"]
"outFiles": [
"${workspaceFolder}/js/**/*.js"
]
},
{
"name": "Run Tests",
"program": "${workspaceFolder}/js/tests/test.js",
"args": [
"${workspaceFolder}/example/ts2gd.json",
"--debug"
],
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}/js/**/*.js"
]
}
]
}
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"typescript.tsserver.experimental.enableProjectDiagnostics": true,
// "typescript.tsserver.experimental.enableProjectDiagnostics": true
// "typescript.preferences.importModuleSpecifierEnding": "js"
// "typescript.tsserver.log": "verbose"
// "typescript.tsserver.log": "verbose",
"files.eol": "\n"
}
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ To compile all source files once:

`ts2gd --buildOnly`

## Windows

ts2gd should run on GNU/Linux, Mac OS and Windows. If you run into issues, please fill a ticket.

Development of ts2gd makes use of symlinks within the repository, thus when cloning on windows, clone with:

```
git clone -c core.symlinks=true --recurse-submodules [email protected]:johnfn/ts2gd.git
```

## Details and Differences

### `get_node`
Expand Down
112 changes: 0 additions & 112 deletions errors.ts

This file was deleted.

2 changes: 1 addition & 1 deletion generate_library_defs/library_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ declare var ${className}: typeof ${className}Constructor & {
fs.writeFileSync(
path.join(
this.paths.staticGodotDefsPath,
fileName.slice(0, -4) + ".d.ts"
this.paths.replaceExtension(fileName, ".d.ts")
),
result
)
Expand Down
6 changes: 3 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ const setup = (tsgdJson: Paths) => {
opt.config.useCaseSensitiveFileNames = false

return {
watchProgram,
program: watchProgram.getProgram().getProgram(),
tsgdJson,
reportWatchStatusChanged,
tsInitializationFinished,
Expand All @@ -265,10 +265,10 @@ export const main = async (args: ParsedArgs) => {
const tsgdJson = new Paths(args)

showLoadingMessage("Initializing TypeScript", args)
const { watchProgram, tsInitializationFinished } = setup(tsgdJson)
const { program, tsInitializationFinished } = setup(tsgdJson)

showLoadingMessage("Scanning project", args)
let project = await makeTsGdProject(tsgdJson, watchProgram, args)
let project = await makeTsGdProject(tsgdJson, program, args)

if (args.buildLibraries || project.shouldBuildLibraryDefinitions(args)) {
showLoadingMessage("Building definition files", args)
Expand Down
6 changes: 6 additions & 0 deletions mockProject/Autoload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// this file will have dynamic content from our test infrastructure

@autoload
class Autoload extends Node2D {
public hello = "hi"
}
8 changes: 8 additions & 0 deletions mockProject/Enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enum SomeEnum {
Value1,
Value2,
}

export class EnumUser {
callSomething(input: SomeEnum): void {}
}
1 change: 1 addition & 0 deletions mockProject/Main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export class Main {}
8 changes: 7 additions & 1 deletion mockProject/Main.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[gd_scene format=2]
[gd_scene load_steps=3 format=2]

[ext_resource path="res://Main.gd" type="Script" id=1]
[ext_resource path="res://nested/Nested.tscn" type="PackedScene" id=2]

[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )

[node name="Hello" type="Label" parent="."]
margin_right = 1027.0
Expand All @@ -11,3 +15,5 @@ valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Nested" parent="." instance=ExtResource( 2 )]
2 changes: 2 additions & 0 deletions mockProject/Test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// this file will have dynamic content from our test infrastructure
export class Test {}
19 changes: 19 additions & 0 deletions mockProject/main.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://Main.gd" type="Script" id=1]
[ext_resource path="res://nested/Nested.tscn" type="PackedScene" id=2]

[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )

[node name="Hello" type="Label" parent="."]
margin_right = 1027.0
margin_bottom = 598.0
text = "Welcome to TS2GD"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Nested" parent="." instance=ExtResource( 2 )]
3 changes: 3 additions & 0 deletions mockProject/nested/Nested.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export class Nested {
constructor() {}
}
6 changes: 6 additions & 0 deletions mockProject/nested/Nested.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://nested/Nested.gd" type="Script" id=1]

[node name="Nested" type="Node2D"]
script = ExtResource( 1 )
34 changes: 33 additions & 1 deletion mockProject/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,44 @@

config_version=4

_global_script_classes=[ {
"base": "Reference",
"class": "Test",
"language": "GDScript",
"path": "res://Test.gd"
}, {
"class": "Main",
"language": "GDScript",
"path": "res://Main.gd"
}, {
"base": "Reference",
"class": "Nested",
"language": "GDScript",
"path": "res://nested/Nested.gd"
} ]

_global_script_class_icons={
"Test": "",
"Main": "",
"Nested": ""
}

[application]

config/name="mockProject"
run/main_scene="res://Main.tscn"
run/main_scene="res://main.tscn"
config/icon="res://icon.png"

[autoload]

Autoload="*res://Autoload.gd"

[global]

autoload=false
tabs=false
spaces=false

[physics]

common/enable_pause_aware_picking=true
Expand Down
2 changes: 1 addition & 1 deletion mockProject/ts2gd.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"destination": "./",
"source": "./",
"godotSourceRepoPath": "./godot_src",
"godotSourceRepoPath": "../godot_src",
"ignore": ["**/ignore_me/**", "ignore_me.ts"]
}
Loading