Match MKC and include test files when sharing projects #196
+5
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Sharing a project with testFiles in its
pxt.jsonin the extension will result in a shared project that does not load. This happens because the test files are excluded from the text sent to the backend but still left in thepxt.json. When the project is loaded in a browser, the typescript compiler will fail since the missing test file will be null.Solution
Use MKC
One possible solution is to just use the
makecodepackage directly. However, themakecodepackage does some extra work around downloading and caching the target editor before sharing the project. This is probably the reason we chose to just match the rest of the sharing logic instead of using it directly.Even if we wanted to just use the
makecodeextension, the exposedshareCommandthat we would use returns void and merely logs the link to the console. So, we'd have to update MKC instead of just using it as a drop-in replacement of the already existingshareLink.tsMatch MKC and include test files
The
makecodepackage will include the test files in the shared project if they are present. We can just match that behavior to fix the issue.Validation
I created a local
vsixand installed it. I cloned https://github.com/Kikketer/arcade-testshare locally and opened the folder in new VS Code Window. Using the extension, I was able to share the project. It now loads as expected. https://arcade.makecode.com/85698-69144-34682-34885fixes #7278