Skip to content

Commit

Permalink
chore: move TS compilation to script_dist
Browse files Browse the repository at this point in the history
  • Loading branch information
tsa96 authored and Gocnak committed Oct 7, 2023
1 parent 33dbeb5 commit 748cf08
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
extends: ['eslint:recommended', 'plugin:unicorn/recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
root: true,
parserOptions: { project: 'tsconfig.json' },
ignorePatterns: ['.eslintrc.js', 'node_modules', '__types_momentum.js', 'tools', 'scripts_dist'],
ignorePatterns: ['.eslintrc.js', 'node_modules', '__types_momentum.js', 'tools', 'script_dist'],
rules: {
// We don't use modules or really any kind of import system.
'@typescript-eslint/explicit-module-boundary-types': 'off',
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ node_modules
# Specific files
learn.vdf
__types_momentum.js
scripts_dist/
script_dist/
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
scripts/types/
scripts_dist/
script_dist/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The Sass module structure, found in `styles/`, is quite conventional, with all t

Panorama uses the [V8 JavaScript engine](https://v8.dev) to interpret and run the JavaScript files, found in `scripts/`, at runtime, which are included in XML files within `<scripts>` tags (similar to regular web development).

We also support TypeScript - any `.ts` file `scripts/` are compiled to corresponding JavaScript files in `scripts_dist/`, whilst `.js` are just copied over. Note that we don't use any kind of import/module/bundling system as it's not supported in engine code. Instead we just declare the same XML `<scripts>` tags and scripts get the same scope (yeah, old school). Use `/// <reference path="foo.ts" />` to keep TypeScript happy.
We also support TypeScript - any `.ts` file `scripts/` are compiled to corresponding JavaScript files in `script_dist/`, whilst `.js` are just copied over. Note that we don't use any kind of import/module/bundling system as it's not supported in engine code. Instead we just declare the same XML `<scripts>` tags and scripts get the same scope (yeah, old school). Use `/// <reference path="foo.ts" />` to keep TypeScript happy.

JavaScript communicates with the game via events and APIs exposed by the game. The [pano-typed](https://github.com/StrataSource/pano-typed) package (submoduled in `scripts/types/`) which provides types and documentation for the exposed APIs and events. These are updated manually, and some things may be missing. A full list of which can be found by running `dump_panorama_events markdown` and `dump_panorama_js_scopes markdown` in-game (best to the game in `-condebug` and read `momentum/console.log`). Feel free to add any APIs/events to the `pano-typed` package! If anything is missing completely, please contact us in Discord and we can check in engine code for you.

Expand Down
2 changes: 1 addition & 1 deletion panorama.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"NamedPaths"
{
"resources" "panorama"
"scripts" "panorama/scripts_dist"
"scripts" "panorama/script_dist"
"config" "panorama/config"
"materials" "materials"
"images" "panorama/images"
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"lib": ["ESNext"],
"module": "None",
"rootDir": "scripts/",
"outDir": "scripts_dist/",
"outDir": "script_dist/",
"alwaysStrict": true,
"isolatedModules": true,
"allowJs": true,
Expand Down

0 comments on commit 748cf08

Please sign in to comment.