Brands

64 views
Skip to first unread message

Polar Bear

unread,
Nov 16, 2022, 4:24:36 PM11/16/22
to Developing Interactive Simulations in HTML5
Hello, I am trying to add my own brand to a simulation by following the https://github.com/phetsims/brand/. However after following the steps, when I try to grunt it, i get an error saying that 

  0:0  error  Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: ../brand/test-brand/js/Brand.ts.
The file must be included in at least one of the projects provided

I am unsure as to where I should include this file.

Any sort of help is appreciated !

Thank you,

Sam Reid

unread,
Nov 17, 2022, 12:51:05 AM11/17/22
to Polar Bear, Developing Interactive Simulations in HTML5
That error sounds related to the typescript configuration, please add the brand paths to chipper/tsconfig/all/tsconfig.json or write Brand.js (in JavaScript) instead of TypeScript.

Best Regards,
Sam

--
You received this message because you are subscribed to the Google Groups "Developing Interactive Simulations in HTML5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developing-interactive-simu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/developing-interactive-simulations-in-html5/91c17382-c07d-4fd1-9605-552f4ccd566fn%40googlegroups.com.

Polar Bear

unread,
Nov 17, 2022, 9:52:13 AM11/17/22
to Developing Interactive Simulations in HTML5
Hello, Thanks for the reply. I have done that and it fixed the previous issue, however I am now facing an issue where I can not find the module. 
The error i get is 
Error: Cannot find module './test-brand/js/Brand.js'. 

I am unsure as to what I can change. This is the directory, and it seems correct. 

Any sort of help would be appreciated, thank you very much!
Screen Shot 2022-11-17 at 9.40.20 AM.png

samrreid

unread,
Nov 17, 2022, 10:25:53 AM11/17/22
to Developing Interactive Simulations in HTML5
Thanks for identifying this problem, I wrote a GitHub issue for it here:

I do not expect that issue to be resolved in the near future, so please use a workaround like this in the meantime (adding the new brand to the chipper transpiler manually):

Subject: [PATCH] 
---
Index: js/common/Transpiler.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/common/Transpiler.js b/js/common/Transpiler.js
--- a/js/common/Transpiler.js    (revision d6255e4df747e4e9c7dcd6f83ac9fc3dffb7d189)
+++ b/js/common/Transpiler.js    (date 1668698487715)
@@ -291,6 +291,7 @@
       this.visitDirectory( Transpiler.join( '..', repo, 'phet' ) );
       this.visitDirectory( Transpiler.join( '..', repo, 'phet-io' ) );
       this.visitDirectory( Transpiler.join( '..', repo, 'adapted-from-phet' ) );
+      this.visitDirectory( Transpiler.join( '..', repo, 'test-brand' ) );
     }
   }
 

samrreid

unread,
Nov 17, 2022, 10:34:24 AM11/17/22
to Developing Interactive Simulations in HTML5
In the issue referenced above, I committed a command line argument --brands to pick up additional brands.  You can invoke it like so: 

node js/scripts/transpile.js --brands=test-brand


Note: it is not yet integrated into the `grunt` process but this may be good enough to be helpful for now.  Good luck and let me know if it works.


Best Regards,

Sam


Polar Bear

unread,
Nov 17, 2022, 11:39:19 AM11/17/22
to Developing Interactive Simulations in HTML5

For an update, I have pulled the chipper repo and added
this.visitDirectory( Transpiler.join( '..', repo, 'test-brand' ) );  

from above into the Transpiler.js file, and have invoked 

node js/scripts/transpile.js --brands=test-brand

into the chipper directory, but now I am facing an issue of 

Uncaught TypeError: Cannot read properties of undefined (reading 'height').

I assume that this issue is caused by the branding, as if i run the simulation with the original adapted-from-phet brand, there is no issue. 

However, I am not ultimately sure if this issue is on my end, or if it is related to the branding. 

samrreid

unread,
Nov 20, 2022, 10:10:40 AM11/20/22
to Developing Interactive Simulations in HTML5
Maybe try copy/pasting all the assets (including images) from the adapted-from-phet/ directory, to see if the problem is a missing image?

Best Regards,
Sam

Reply all
Reply to author
Forward
0 new messages