Created
January 3, 2019 04:54
-
-
Save sqs/823d340fe697c178384b4018f1cde274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/doc/extensions/authoring/publishing.md b/doc/extensions/authoring/publishing.md | |
index ddd670600..147efece3 100644 | |
--- a/doc/extensions/authoring/publishing.md | |
+++ b/doc/extensions/authoring/publishing.md | |
@@ -19,11 +19,26 @@ At this point, your extension has been built and sent to Sourcegraph. The output | |
Any user can publish to the Sourcegraph.com extension registry, all Sourcegraph instances can use extensions from Sourcegraph.com, and all Sourcegraph.com extensions are visible to everyone. If you need to publish an extension privately, use a private extension registry on your own self-hosted Sourcegraph instance. | |
-## Testing your extension | |
+## Using extensions in local development (sideloading) | |
-Your extension will need to be published to Sourcegraph.com or an Enterprise instance in order for it to be tested. While we are working on [publishing to a local instance for testing](https://github.com/sourcegraph/sourcegraph/issues/489), flagging your extension as a work-in-progress (WIP) is the best solution for now. | |
+When developing an extension, you can sideload it from your local development machine's Parcel dev server (instead of needing to republish it after each code change). This makes the development cycle faster and avoids breaking the published version of your extension. | |
-### WIP extensions | |
+To set this up: | |
+ | |
+1. In your extension's directory, run `npm run serve` to run the Parcel dev server. Wait until it reports that it's listening on http://localhost:1234. (If it uses a port other than 1234, adjust the step below to use the actual port.) | |
+1. TODO(loic): update the [extension creator](https://github.com/sourcegraph/create-extension) to make parcel also serve package.json, or add a step here explaining how to make parcel serve package.json | |
+1. TODO(loic): document how to make the extension debug menu visible (`localStorage.debug=true;location.reload()` in the web app or browser ext background page), and/or make it easier for users to make it visible | |
+1. Enter `http://localhost:1234/package.json` in the **Sideload extension URL** field. (TODO(loic): assumes you accept my feedback about having users enter the package.json URL; change if not) | |
+1. Reload your browser window. Your extension will be enabled. | |
+ | |
+After doing this, the development cycle is as follows: | |
+ | |
+1. Make a change to your extension's code, then save the file. | |
+1. Reload your browser window. (It will fetch the newly compiled JavaScript bundle for your extension.) | |
+ | |
+When you're done, clear the sideload URL from the extensions debug menu. | |
+ | |
+## WIP extensions | |
An extension with no published releases, or whose title begins with `WIP:` or `[WIP]`, is considered a work-in-progress (WIP) extension. WIP extensions: | |
@@ -34,30 +49,5 @@ An extension with no published releases, or whose title begins with `WIP:` or `[ | |
You can use WIP extensions for testing in-development extensions, as well as new versions of an existing extension. | |
-## Refreshing extension code without republishing | |
- | |
-When iterating on your extension, each code change requires republishing. You can avoid this by using the Parcel bundler's development server to override the URL for the extension file when publishing. This lets you see the latest changes in your browser by reloading the page, without republishing. | |
- | |
-To set this up: | |
- | |
-1. If the extension is in use, add a `wip-` prefix to the current name and a `WIP:` or `[WIP]` to the title. | |
+Don't forget to delete your WIP extension when it's no longer needed (in the **Manage** tab on the extension's registry page). | |
-1. In a terminal window, run `npm run serve` in your extension's directory to run the Parcel dev server. Wait until it reports that it's listening on http://localhost:1234 (or another port number). | |
- | |
-In another terminal window, run `src extensions publish -url http://localhost:1234/my-extension.js` (my-extension.js being the bundled JavaScript file in your dist directory). Sourcegraph will now fetch the extension code from the value of the `-url` argument. | |
- | |
-1. Make a change inside `src`, then save. Your code will be re-bundled and a reload of the browser window will cause your changes to be loaded. | |
- | |
-### When you are ready to publish | |
- | |
-You've written the code, you've tested your extension, and now you're almost ready to publish. Lastly, you'll need to remove the WIP extension: | |
- | |
-1. Open the WIP extension detail page | |
-- Click the **Manage** tab | |
-- Click the **Delete extension** button | |
- | |
-Now publish the extension: | |
- | |
-``` | |
-run src extensions publish | |
-``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment