Code Monkey home page Code Monkey logo

single-spa-inspector's Introduction

single-spa Devtools Inspector

A Firefox/Chrome devtools extension to provide utilities for helping with single-spa applications.

Full Documentation

Feature requests

If you would like to request a feature to be added, please open an issue with the title "Enhancement:"


How to contribute

To fix a bug, add features, or just build the extension locally:

Firefox

  1. Install Firefox
  2. Create a FF profile called single-spa-inspector-dev. Alternatively, temporarily install the extension as documented in https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing.
  3. Clone this repo
  4. nvm use (ensures we're all using the same version of node)
  5. npm i
  6. npm start
  7. Open devtools and navigate to the single-spa Inspector tab

Create a Firefox dev profile

Currently, development happens by default in Firefox. If you would like Firefox to remember any settings that you change to Firefox itself, this project is configured to use a profile called "single-spa-inspector-dev". To create this profile, go to about:profiles. Firefox will use that profile and remember any changes you make (e.g. devtools location, devtools dark mode, etc.)

Debugging

Once single-spa Inspector is running, open a new tab and navigate to about:debugging. single-spa Inspector should be listed as a Temporary Extension, and a "Debug" control should be displayed. Click on this to enable devtools for the extension. In the upper-right corner, click on the divided square icon next to the 3-dot menu, and select /build/panel.html as the target. You can now inspect the inspector UI as you would a normal webpage.

Chrome

  1. Install Chrome

  2. Create a Chrome profile

    • This process is somewhat convoluted but needed in order to save preferences and any additional extensions
    • Before starting any processes, open the Chrome Profiles directory
      • Mac: ~/Library/Application Support/Google/Chrome
      • Windows: %LOCALAPPDATA%\Google\Chrome\User Data
      • See the Chromium User Data Directory docs for other platforms/chrome builds
    • In that folder, take note of the Profile folders (eg. named "Profile 1", "Profile 2", etc. on Mac)
    • Open Chrome and add a new profile
    • Return to the Chrome user data folder and locate the newly created Profile folder
    • Rename the folder to "single-spa-inspector-dev" (for convenience)
    • Copy the file path for this profile folder
  3. Start Chrome with $CHROME_PROFILE_PATH env set to the profile folder path

    # for Mac
    CHROME_PROFILE_PATH="~/Library/Application Support/Google/Chrome/single-spa-inspector-dev" npm run start:chrome

Debugging

  • Open single-spa inspector in devtools
  • Right-click on any element inside of the inspector, and click "Inspect"
  • A new instance of devtools will appear to inspect the devtools DOM

Publishing a New Version

  1. Update the version in manifest.json and package.json (they should match)

  2. Ensure that the necessary Firefox env values are in your local .env

    WEXT_SHIPIT_FIREFOX_JWT_ISSUER=xxxxx
    WEXT_SHIPIT_FIREFOX_JWT_SECRET=xxxxx
    
  3. Ensure that the necessary Chrome env values are in your local .env

    WEXT_SHIPIT_CHROME_EXTENSION_ID=xxxxx
    WEXT_SHIPIT_CHROME_CLIENT_ID=xxxxx
    WEXT_SHIPIT_CHROME_CLIENT_SECRET=xxxxx
    WEXT_SHIPIT_CHROME_REFRESH_TOKEN=xxxxx
  4. Run npm run deploy

  • Alternatively, to deploy individual browsers you can run npm run deploy:firefox or npm run deploy:chrome

You may also want to verify the status at the respective extensions page


Thanks

single-spa-inspector's People

Contributors

dependabot[bot] avatar filoxo avatar frehner avatar joeldenning avatar linusu avatar themcmurder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

single-spa-inspector's Issues

Impossible to see Utility module

Hi I use "single-spa-inspector" but I have a small problem my SPA (utility module) does not appear in the list, so impossible to override the path ...

Is is expected ?
Thanks for your help !

Have overlays look for container div with default id

Helper libraries such as single-spa-vue, single-spa-angular, and single-spa-react all implement a default dom element getter now that appends a div to the dom with an html id that follows a certain convention.

Single-spa-inspector could check if that html id exists when looking for a div to append overlays to. This would be awesome because then single-spa users don't even have to do export const devtools from their apps. See related single-spa/single-spa-react#51.

Special chars in app names not properly escaped

App names such as @openmrs/esm-devtools are not being properly escaped as CSSOMStrings, and so the corresponding node isn't being found and the overlay isn't being created. It would need to use CSS.escape() to derive the app names into valid selectors.

Add ability to toggle on/off *all* of the overlays at once

When demoing to potential consulting clients, or just trying to explain which applications are active to devs new to single-spa, I like seeing all the overlays at once.

Having a button to toggle them all off/on at once would be cool.

RFC: update single-spa-inspector

Single-spa-inspector is still in use, but its API has been limited because it doesn't interop with SystemJS and relies on single-spa's API only. In order to keep it alive and help provide the community value, I'm proposing that this extension should be updated and use import-map-overrides. The main idea is to rely on the import-map-overrides JS API to implement all if not most of the current features, on top of upgrading deps and build configuration.

Opening this as an RFC in order to:

  • begin gauging community value
  • ask for community involvement

If you'd like to see single-spa-inspector updated, please leave a ๐Ÿ‘๐Ÿผ on this comment. If you'd like to be involved in this development effort, please DM me in the single-spa Slack workspace and reference this issue.

auto deployments

now that we can use github actions and @filoxo has implemented an easy-to-use script, we should be able to fairly easily setup auto deployments.

The question I have is: when should a deployment happen?

  • On every merge to master?
    • The potential problem with that is that we have to update the manifest version for the new version to work, and there's the possibility that we forget and then the deployment fails
  • On every new tag?
    • I'm not even sure this is possible with github actions, but I think it has the potential to be the more foolproof way of dealing with potential deployment issues on master
  • Others?

Overlays do not resize dynamically

When an app resizes, the overlay does not until it is removed and readded. In this example, navbar-ui had had a banner displayed above it. When I dismissed that banner, the overall size of navbar-ui changed but the overlay is still the original size.

Screen Shot 2019-10-11 at 12 23 55 PM

extention not working for chrome

Uncaught (in promise) Error: eval Cmd 'window.SINGLE_SPA_DEVTOOLS.exposed Methods.getRawAppData()' failed: {"code":"E_PROTOCOLERROR","description":"Inspector protocol error: %s","details":["Object reference chain is too long"],"isError":true}

Google Chrome
Version 90.0.4430.212 (Official Build) (x86_64)

Inspector display no table rows

there is no table rows displayed in the inspector.
I have tested imports-map-override like the below:
`html

<import-map-overrides-full
show-when-local-storage="devtools"

`
it works well, but the single-spa-inpector always displays empty rows,it seems that no apps to display.

Temporary disable an override

Since working for quite some time with the inspector, its very powerful!
Can we further improve it by add a toggle that can temporary disable an override? This would help a lot ๐Ÿ‘

image

Overlays are not removed when app is unmounted

When manually unmounting an app, the overlay is not being removed. In this example below, I've manually toggled navbar-ui and at the top you can still see the overlay title visible (but cut off).

Screen Shot 2019-10-11 at 12 21 14 PM

automate extension update process

currently I'm just doing it manually. it would be great to add a script that does it for us though.

For Chrome, I think it's possible to do that at the moment.

For FF, I don't entirely know if the whole process can be automated at the moment or not. See this thread and comment: mozilla/web-ext#804 (comment)

web-ext causing extremely high cpu usage

I wasn't able to find any issues about this in the web-ext repo, so I think it may have to do with something that I've just misconfigured...? Anyway, when you run npm run start:firefox, my CPU usage for node goes up to ~370% :(

Order of apps is reversed

The sort order of the apps is now reversed so mounted apps are shown last. These should be sorted alphabetically with mounted apps grouped first.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.