STR: 1. Using Firefox 4.01, log in to https://builder-addons.allizom.org/ 2. Click "Create" and then choose "Library" 3. Delete the index.js file and once that's removed, type in the editor widget Actual results: Error: item is null Source File: https://builder-addons.allizom.org/media/lib/mootools/mootools-core-1.3.2.js Line: 936 Screencast: http://screencast.com/t/NBtsf4aKDh
So, when you delete all files, the editor window should become read-only, until a new file is created.
Assignee: nobody → smcarthur
Priority: -- → P1
Can we just prevent rename/delete of the index.js file as we do with main.js?
If we want to enforce that all Libraries have an index.js. It wouldn't change names (otherwise, its too hard to realize why one of your modules can't be deleted). We could then add to the package.json of the library that the index.js is the main_module. This would allow require('libname'), and it would load that main_module of that library (currently set to nothing, but could be the index.js file).
Yeah that sounds good, I especially like this part: "This would allow require('libname')". Let's do it, you agree?
I believe the best would be a library to have at least one module
An example of the downside: your mootools-server has its module also named mootools-server. If we enforced a required index.js, we would need to add one to any library that doesn't have one. Then, whereas before when require('mootools-server') would first try to load the library, see there was no main_module, and then look for modules and find 'mootools-server', with this it would load the index.js, which could have nothing in it. Still would be better to make this "breakage" now as opposed to later...
So which is it? All libraries get a permanent index.js module (allowing require('mylib'), but breaking some pre-existing uses), or simply stop deleting modules if module count == 1?
I'd vote for the latter
I personally vote for the former, because I think being able to require('mylib') to be a beneficial pattern for the Builder. dbuc, which?
I'd like to see the former, this needs to work: require('mylib');
Summary: JS Error in mootools.js - Error: item is null → Deleting all modules from library causes error in editor
Code has landed. https://github.com/mozilla/FlightDeck/commit/53866e1867bade9ab95292a7f03e8bb0ba6295e2 However, the migration fails. @clouserw: what should i change to get this working? Updater output: [localhost] out: Running .py migation 11: [localhost] out: python -B manage.py runscript migrations.011-ensure_library_main_module [localhost] out: Error: Had trouble running this: python -B manage.py runscript migrations.011-ensure_library_main_module [localhost] out: stdout: Unknown option: -B [localhost] out: usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... [localhost] out: Try `python -h' for more information.
Got the migration working. Fixed on master.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Verified FIXED; unable to get UI to delete index.js under "Lib" in a library.
Status: RESOLVED → VERIFIED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.