New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate code and conditional build #191

Merged
merged 17 commits into from Aug 4, 2018

Conversation

2 participants
@matatk
Owner

matatk commented Aug 4, 2018

This massively re-organises the code around ES6 modules, to make it much simpler when built, so that:

  • Things like the injector are much simpler.
  • It’s easier to add/remove code.
  • It’s easy to do cross-browser behavioural differences and not include code/data that needn’t be.

Fixes #189

matatk added some commits Jul 30, 2018

Use rollup
* This just-about works on Firefox; need to do build environment
  variables next, and a lot of clean-up. It's a mess for any browser
  other than Firefox. Also the code that represents the entry points
  should be named appropriately (e.g. '_content.js'?) and all of the
  filenames need looking at. Finally, the names of exports should be
  looked at---should they be hardcoded, or default?
* Updated tests to use rollup-generated test code (much simpler; very
  neat and easy :-)).
* Had to disable linting the build/ dir afterwards (due to semicolons
  etc.); would like to re-enable that.
Tidy up script ignores
* This ignores and removes certain scripts. In future it would be neater
  for them to be generated and go directly to their build directories,
  rather than stop over in src/static/.
* Also ensure rollup is run before a quick or a normal build.
Make it work on Firefox (62+)
* Set open_at_install on the sidebar to false, so that the starting
  state is always known (need to use this approach until isOpen() is fixed
  to propogate user input blessedness for event handling).
* Set minimum required Firefox version to 62 as required (partly
  addresses #190).
* Use Firefox Developer Edition for testing (due to the requirement for
  Firefox 62).
* Also open the Browser Console by default when using web-ext.
Use rollup-plugin-terser
* Update deps.
* Update build script to use the plugin.
* Test the plugin in the code. This appears to've uncovered a bug with
  terser: terser-js/terser#92
Use best options for terser
* Thanks for the help on terser-js/terser#92 :-)
Cross-browser running again
* Remove loadsa script inclusions from manifests.
* Create cross-browser compatibility script and import.
* Create cross-browser specialPages script and import.
* Remove now-defo-unused code from build script.
* Increase terser compress passes to two to avoid dangling strings.
Factor out Logger; Re-name exports; Tidy imports
* Factor out Logger.
* Give all default exports their names back.
* Remove redundant ".js" suffixes from imports.
* Remove options-change logging (debugging info).
* Rename contrast.js to contrastChecker.js to reflect name.
Fix content script injector
* Reinstate the content script injector. This always has to be imported,
  but can return null on Firefox.
* Set terser's `conditionals` compressor option so that simple tests for
  one browser can be filtered out.
Use rollup-plugin-esformatter
Alas the output after rollup and terser was a bit wonky. Experimenting
with two spaces for now, as whilst I doubt it will be sufficiently
readable, it might take up less space in browser inspector windows, so
may be good; will see...
Browser-appropriate defaultSettings
* Remove interface defaultSettings from Chrome and Edge.
* Remove debugging info.
Trying to figure out Opera
* Remvoe some but not all debugging things; trying to figure out why
  Opera is not showing the browserAction toolbar button sometimes.

@matatk matatk merged commit 22fef45 into master Aug 4, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@matatk matatk deleted the consolidate-code-and-conditional-build branch Aug 4, 2018

@@ -210,6 +210,7 @@ Changes
- 2.4.0 - in development
- Show the current keyboard commands on the splash page and allow the user to update them on Chrome and Opera. \[[\#187](https://github.com/matatk/landmarks/pull/187)\]
- Offer an optional sidebar instead of the pop-up on Firefox and Opera. \[[\#188](https://github.com/matatk/landmarks/pull/188)\]
- Massive re-organisation of the code to make it easier to manage and accommodate and take advantage of cross-browser differences. \[[\#191](https://github.com/matatk/landmarks/pull/191)\]

This comment has been minimized.

@MarkWithall

MarkWithall Aug 6, 2018

This seems to have a tab, whereas the rest has spaces.

This comment has been minimized.

@matatk

matatk Aug 6, 2018

Owner

Oops; good catch; thanks :-). I usually remember to replace them. Should probably reformat the whole list, but as it gets longer, the task gets less desirable... :-)

@matatk matatk referenced this pull request Aug 8, 2018

Closed

Fix spacing in README #193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment