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

Miscellaneous Repo Improvements #244

Merged
merged 124 commits into from
Oct 28, 2023
Merged

Miscellaneous Repo Improvements #244

merged 124 commits into from
Oct 28, 2023

Conversation

leeyi45
Copy link
Contributor

@leeyi45 leeyi45 commented Sep 12, 2023

External Packages

There are several packages available on the frontend and in js-slang, making it unnecessary for Source modules to include them when bundled. This PR will further externalize several of these packages (the full list here), reducing the size of files.

In the future, if there are packages that Source modules that require that are also already available at runtime, these packages should also be marked as external, but such changes would also require corresponding updates to the frontenda and/or js-slang

Refinement of Module Scripts

The script system has become increasingly complex. To aid with this I've condensed all the script management code into a single Javascript file. Instead of committing the entire output of compiling module scripts, module scripts can instead be built using the yarn scripts:build command (which should be run automatically on postinstall). Module script functionality remains identical.

yarn test and yarn scripts:test should now both work with Windows paths, where previously Jest only recognized posix style paths as valid patterns.

Error Handling for AnimationCanvas

Animations are calculated at runtime, so there is no way for bundle code to detect beforehand if an animation is invalid or will throw an error. As such, an error screen has been added to the various animation canvases which will allow these to throw errors gracefully. Fixes #225.

image

Change in throwIfNotRune

Similar to how the functions in sound have been modified to allow for custom function names, the throwIfNotRune function in the rune bundle has also been modified to allow custom function names to be shown when errors are thrown.

Updated typedoc

Typedoc has since fixed the issue where the README was not getting generated with the rest of the HTML documentation. The original README file has thus been re-included.

Documentation Relocation

The summaries that used to be present in the functions.ts files of bundles have been relocated to their entry points. These summaries should now be visible within the HTML documentation. Resolves #221.

Tab Development Server

Currently, the frontend is the only way to render module tabs. This means that every change requires a rebuild of the tab, followed by a refresh on the frontend.

This PR will introduce a Vite server that is able to react to changes in tabs and render them live.

For the server to be able to work, components need to be defined as a separate constant, instead of just within the body() function:

export default {
  body; () => <div></div>
}

should be defined like this:

const Component = () => <div></div>
export default {
  body; () => <Component />
}

Use yarn devserver to start the development server.

Standardize Line Encoding

This PR also incorporates the changes from #210. With the addition of .editorconfig and .gitattributes hopefully development across OSes should be more consistent.

# Conflicts:
#	src/bundles/sound/functions.ts
# Conflicts:
#	src/bundles/scrabble/__tests__/index.ts
#	src/bundles/scrabble/functions.ts
#	src/bundles/scrabble/index.ts
#	src/bundles/unity_academy/UnityAcademy.tsx
#	src/bundles/unity_academy/UnityAcademyMaths.ts
#	src/bundles/unity_academy/functions.ts
#	src/bundles/unity_academy/index.ts
#	src/tabs/UnityAcademy/index.tsx
@RichDom2185 RichDom2185 self-requested a review October 17, 2023 13:01
Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one minor comment as below. Could you take a look at the changes I pushed as well, and if it's all good to you, feel free to merge.

Thanks for working on this!

src/bundles/rune/runes_ops.ts Outdated Show resolved Hide resolved
…xternalize

# Conflicts:
#	src/bundles/scrabble/__tests__/index.ts
#	src/bundles/scrabble/functions.ts
#	src/bundles/scrabble/index.ts
#	src/bundles/unity_academy/UnityAcademy.tsx
#	src/bundles/unity_academy/UnityAcademyMaths.ts
#	src/bundles/unity_academy/functions.ts
#	src/bundles/unity_academy/index.ts
#	src/tabs/UnityAcademy/index.tsx
Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

RichDom2185 and others added 12 commits October 19, 2023 08:38
…xternalize

# Conflicts:
#	src/bundles/scrabble/__tests__/index.ts
#	src/bundles/scrabble/functions.ts
#	src/bundles/scrabble/index.ts
…s into module-externalize

# Conflicts:
#	src/bundles/scrabble/__tests__/index.ts
#	src/bundles/scrabble/functions.ts
#	src/bundles/scrabble/index.ts
#	src/bundles/unity_academy/functions.ts
@leeyi45 leeyi45 merged commit cad8822 into master Oct 28, 2023
1 check passed
@leeyi45 leeyi45 deleted the module-externalize branch October 28, 2023 02:34
@sayomaki sayomaki mentioned this pull request Feb 5, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
2 participants