-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Loading unpacked extensions #1508
Conversation
5ec2da1
to
8169f13
Compare
This exposes the package.json when running `yarn serve`, which allows [loading unpacked extensions](sourcegraph/sourcegraph#1508)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level idea lgtm. Haven’t reviewed code.
8169f13
to
670bb31
Compare
Codecov Report
|
This is now ready for review |
) | ||
), | ||
cold('-a--|', { a: '' }), | ||
() => of(null) | ||
).activeExtensions | ||
) | ||
).toBe('-a-b-|', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there an expected break in time? (the -
between a
and b
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level looks great. I added several comments about docs, impl, etc.
Also, you should add docs to doc/extensions/authoring/publishing.md
about this new sideloading feature. Here is what I would recommend (feel free to add/change, just wanted to help out): documentation diff with TODOs. (One other awesome thing about this new feature is that it lets us remove a lot of complexity around the WIP extension creation/publishing process.)
type="text" | ||
id="extension-status__unpackedurl" | ||
className="form-control" | ||
onChange={this.onUnpackedURLChange} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will using onChange
instead of waiting for blur
or submit
cause a lot of weird error messages if you are typing the URL in character-by-character? I think so, and that will probably confuse people. My guess is that the amount of effort now on your part required to avoid that confusion is worth it. (You could use a window.prompt(...)
to avoid complicating the code here to handle the not-yet-committed state.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id="extension-status__unpackedurl" | ||
className="form-control" | ||
onChange={this.onUnpackedURLChange} | ||
placeholder="URL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placeholder="URL" | |
placeholder="URL to extension's package.json" |
And then modify the fetchUnpackedExtension code above slightly to treat the user's input URL as the package.json URL instead of appending as in ${baseUrl}/package.json
.
This resolves the user's confusion "What URL do I put in there?" and makes it clear they need to make the package.json HTTP-accessible too (not just the extension JS file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end, I decided against making this the URL to the package.json, and made it explicit that the user should enter the URL to the Parcel dev server. I also made this explicit in the publishing docs.
The extension creator will be updated to make sure the package.json is HTTP-accessible when running npm run serve
.
Since parcel can only serve from dist/, our code assumes that the package.json is served from inside of dist/ (through a symlink, as set up by the extension creator), and that the relative path to the bundle should be fixed accordingly. I'd rather hide that complexity from the user.
Excluding WIP extensions from result sets added a lot of complexity to the code (API parameters) and the UI. It is sufficient to just sort them last. There will be fewer WIP extensions present anyway after #1508 is merged.
694e746
to
5c2e693
Compare
Excluding WIP extensions from result sets added a lot of complexity to the code (API parameters) and the UI. It is sufficient to just sort them last. There will be fewer WIP extensions present anyway after #1508 is merged.
* remove extension title, use extension ID instead The extension title (the package.json extension manifest's `title` property) was redundant and added complexity: - It made it difficult to see the publisher of an extension on the extension registry, which is important for finding the right or trusted extension to use. - It was fairly redundant with the extension ID (`my-extension` vs `My extension`). - The presence of a title meant that the descriptions were longer and had boilerplate content (such as "This is a Sourcegraph extension that..."). Now that there is no title and it won't feel duplicative, descriptions can be shorter and more to-the-point. This, in turn, means that we can show the description on a single line in the extension registry list page, which reduces visual variance among extensions (some of which had multi-line descriptions, some of which had one-line descriptions). The only feature that required the use of the title was marking an extension as WIP. You can now do that by setting the extension manifest `wip` property to true. For backcompat, titles with `WIP:` and `[WIP]` prefixes still indicate WIP extensions. * show "Categories" dropdown next to extension registry search query input This lets users easily filter extensions by category. * add "Include WIP extensions" option to extension registry list page This removes the GraphQL includeWIP query parameter because it is no longer necessary. API clients can now express the same thing by including `#wip` in the query. It was only ever used by the immediate web app, never any other clients, so it is safe to remove. * add "Show enabled/disabled extensions" to the extension registry list page This lets users see only enabled extensions, or only disabled extensions. * remove include/exclude WIP, only sort WIP last Excluding WIP extensions from result sets added a lot of complexity to the code (API parameters) and the UI. It is sufficient to just sort them last. There will be fewer WIP extensions present anyway after #1508 is merged. * make category:"Other" also match extensions w/manifest with no category
ExtensionStorageSubject is an RxJS subject backed by an extension storage item
Co-Authored-By: lguychard <l.guychard@gmail.com>
5c2e693
to
fdd8a58
Compare
fdd8a58
to
23696af
Compare
closes #489
This PR adds the ability to load locally served Sourcegraph extensions. Review by commit.
The URL to an unpacked extension can be set using the debug palette:
In the browser extension, the unpacked extension url is stored in
chrome.storage.local
. This is done to avoid reading & fetching a URL from localStorage that may have been set by other scripts.In the webapp, the value is read from localStorage.
By using localStorage/chrome.storage.local rather than settings, and only allowing one unpacked extension, we avoid usage of this feature to circumvent the "private extensions registry is a premium feature" restriction.
TODO: