Closed triwav closed 1 year ago
Here's a unit test that can be placed within ProjectManager.spec.ts
somewhere.
describe('postfixFiles', () => {
it('skips "common:/" paths', async () => {
let project = new ComponentLibraryProject(params);
project.fileMappings = [];
fsExtra.outputFileSync(`${params.stagingFolderPath}/source/main.brs`, '');
fsExtra.outputFileSync(`${params.stagingFolderPath}/components/Component1.xml`, `
<component name="CustomComponent" extends="Rectangle">
<script type="text/brightscript" uri="common:/LibCore/v30/bslCore.brs"/>
<script type="text/brightscript" uri="CustomComponent.brs"/>
<script type="text/brightscript" uri="pkg:/source/utils.brs"/>
</component>
`);
await project.postfixFiles();
expect(
fsExtra.readFileSync(`${params.stagingFolderPath}/components/Component1.xml`).toString()
).to.eql(`
<component name="CustomComponent" extends="Rectangle">
<script type="text/brightscript" uri="common:/LibCore/v30/bslCore.brs"/>
<script type="text/brightscript" uri="CustomComponent__lib0.brs"/>
<script type="text/brightscript" uri="pkg:/source/utils__lib0.brs"/>
</component>
`);
});
});
Picking up this ticket for investigation
Notes on 1-1 session
.roku-deploy-staging APP
component-libraries/complib.zip
roku-deploy.zip which gets deployed to the TV and run as the Roku app ...
- we have a session running Roku-Debug
- we can run a script to auto-run these
- switch to vscode-brightscript-language master branch and run
- npm run install-local which runs a script in scripts/install-local.js
- which installs files for
- ./roku-debug
- ./roku-deploy
- ./brighterscript
- ./brighterscript-formatter
- then runs a global
- npm install
- so that's 5 script installs in total ... all done from one command ...
- ...... when all is done (and can run several times to ensure all libraries are in sync ... when all is done we can see some changes to package.json and package-lock.json ...
Task Watch
In VSCode 'workspace' ie vscode-brightscript-language now open up 'roku-debug/src/managers/ProjectManager.ts' which will be the right point to start our work. Can add a break point to stop the code and check ... eg line 34 this.breakpointManager = breakpointManager;
Did about 1-2 hours of digging; can now clearly see the whole work flow and how everything is pieced together - started to work in detail on the file renaming aspect now also ... so good progress :)
Run (on Windows) Control-Shift-P, choose 'Tasks: Run Task' and choose 'watch' option to enable watching for file changes (background task)
... also now looks like
"args": [
"--server=4711"
],
fixes this setting of port 4711 for us as well ...
Have identified the point in the code where the path renaming is taking place, just working through the fix ...
Also seems like the 'Task: Run ... watch' command is now being automatically implemented also
After a lot of digging, finally got a hold of the 'big picture' of what the code is doing, all of the moving parts, and was able to drill down into the code in order to locate the specific part in the code where the file name alteration is being done, and prevent it if this is a library file.
Added test also and ran it; seems to be passing now.
Fixed by #112
If you include it like
<script type="text/brightscript" uri="common:/LibCore/v30/bslCore.brs"/>
in a component library it tries to convert that to something like<script type="text/brightscript" uri="common:/LibCore/v30/bslCore__lib2.brs"/>
which then causes the component library to fail to load due that file not existing. Probably the best way to handle is to make sure that the path ispkg:/
before trying to modify the path for it.