Scratch3-Dev-Tools icon indicating copy to clipboard operation
Scratch3-Dev-Tools copied to clipboard

Split the code in multiple files

Open d-siganos opened this issue 5 years ago • 12 comments

I think that the inject3.js file is a bit too big, and it would certainly help a lot if you were to split the file into a couple of smaller ones. To further organize the code, we should add these new files in a separate folder.

d-siganos avatar Aug 24 '20 09:08 d-siganos

I support this.

I think it should be split up like this:

  • helpHTML becomes a separate html file
  • initInner stays in the original file
  • eventMouseMove, eventMouseDown, and other event related functions move to an event file.
  • Functions that edit the scratch gui move to a gui file.
  • Functions that are used as utilities by other functions e.g replaceVariable, injectScript, getWorkspace are added to a utils file.

Each file should be under 750 lines.

Joeclinton1 avatar Aug 24 '20 12:08 Joeclinton1

I have not really looked at the code very carefully, so I will read it more concentrated and will try to improve what you just said if I see anything else.

d-siganos avatar Aug 24 '20 12:08 d-siganos

@BonfireScratch Also, perhaps each main feature should get it's own file. E.g Do cleanup should be in it's own file.

Will you be submitting a pull request for this?

Joeclinton1 avatar Aug 24 '20 12:08 Joeclinton1

@BonfireScratch Also, perhaps each main feature should get it's own file. E.g Do cleanup should be in it's own file.

Will you be submitting a pull request for this?

Quite possibly, yes. However, I am a bit busy with my own projects, so it may take some extra time.

d-siganos avatar Aug 24 '20 12:08 d-siganos

A tiny note for the installing documentation: In Chrome/Chromium, you need to be on Developer Mode. Will be mentioned in my PR

d-siganos avatar Aug 24 '20 12:08 d-siganos

Btw, I got an email notification but I can't see your comment here, did you delete it?

Joeclinton1 avatar Aug 24 '20 20:08 Joeclinton1

Btw, I got an email notification but I can't see your comment here, did you delete it?

Yea, my problem was solved when I removed and readded the extension. So far I have decoupled the HTML from the file, moved the event handling functions, and now working on accessing them from the main file.

d-siganos avatar Aug 25 '20 04:08 d-siganos

i too agree

Akash-Karthik avatar Sep 17 '20 11:09 Akash-Karthik

Btw, I got an email notification but I can't see your comment here, did you delete it?

Sometime you have to reload the page for it to show up

scratchusernamemrtbts avatar Sep 17 '20 12:09 scratchusernamemrtbts

I have stopped development on this because the file structure is too complicated for me... Perhaps @griffpatch should fix it himself

d-siganos avatar Sep 28 '20 12:09 d-siganos

You are right there... It is a real mash of code... I'm afraid it was very much thrown together in whatever time I had spare! - I really do need to re-architect it.

On Mon, 28 Sep 2020 at 13:48, -Bonfire- [email protected] wrote:

I have stopped development on this because the file structure is too complicated for me... Perhaps @griffpatch https://github.com/griffpatch should fix it himself

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/griffpatch/Scratch3-Dev-Tools/issues/23#issuecomment-699984509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTM3PVPAKZQZ6PUJVLCQQLSICAYBANCNFSM4QJKB7JQ .

griffpatch avatar Sep 28 '20 13:09 griffpatch

Since Scratch 3 Developer Tools v1.9.0 (based on the Scratch Addons addon), the code is split into multiple files. See https://github.com/ScratchAddons/ScratchAddons/tree/master/addons/editor-devtools. Note that this repo is now outdated. The source code for extension Scratch 3 Developer Tools v1.9.0 and above is automatically built with https://github.com/ScratchAddons/devtools-script based on the Scratch Addons addon, into the DevtoolsExtension repo: https://github.com/ScratchAddons/DevtoolsExtension

WorldLanguages avatar Feb 20 '21 19:02 WorldLanguages