Repository navigation
Snap publishing v0.1 - #140
Merged
Merged
Conversation
rekmarks
force-pushed
the
snap-publishing-v0.1
branch
from
November 24, 2021 01:48
5e58f7f to
b78bf59
Compare
shanejonas
reviewed
Nov 24, 2021
rekmarks
force-pushed
the
snap-publishing-v0.1
branch
11 times, most recently
from
November 29, 2021 08:08
e8f277c to
77b13ee
Compare
rekmarks
commented
Nov 29, 2021
shanejonas
reviewed
Dec 1, 2021
| @@ -0,0 +1,79 @@ | |||
| /** | |||
Contributor
There was a problem hiding this comment.
should we check this in? or have it as a postinstall
Contributor
Author
There was a problem hiding this comment.
I'm not completely sure how to think about it. It seems harmless to check in? CI will blow up if it changes unexpectedly. I think there is something nice about having it recorded in the git history as well.
Contributor
There was a problem hiding this comment.
Yea. I'm not partial to either or.
I know golang culture is totally fine with checked in generated code. In JS culture I've found people like to keep the repo tree clean of generated files.
In Golang the convention is to put a comment at the top to warn people not to edit checked-in generated code:
// Code generated by stringer -type Pill pill.go; DO NOT EDIT.
shanejonas
reviewed
Dec 1, 2021
shanejonas
reviewed
Dec 1, 2021
rekmarks
force-pushed
the
snap-publishing-v0.1
branch
10 times, most recently
from
December 8, 2021 04:31
a4be02d to
1e68d57
Compare
rekmarks
force-pushed
the
snap-publishing-v0.1
branch
from
December 8, 2021 05:28
5620836 to
6b72d4f
Compare
rekmarks
force-pushed
the
snap-publishing-v0.1
branch
from
December 8, 2021 05:37
6b72d4f to
d3a24da
Compare
rekmarks
added a commit
that referenced
this pull request
Dec 8, 2021
In preparation for #140, renames the snap name property to id, and updates all variable names and comments to match. Also tweaks some docstrings.
* Add shasum validation, compile ajv validator at build time * Update manifest schema * Update snaps-cli readme * Generate SnapManifest type from the JSON Schema * Add npm Snap package.json schema and types * Add example-snap package * Implement Snap installation from npm * Update package.json schema * Remove unused dependencies * Update controllers tsconfig and build process * Fix example-snap lint script * Fix test fixture generation * Woe to the vanquished (TypeScript interfaces)
rekmarks
force-pushed
the
snap-publishing-v0.1
branch
from
December 8, 2021 06:28
d3a24da to
1bb02ff
Compare
rekmarks
marked this pull request as ready for review
December 8, 2021 06:28
rekmarks
added a commit
that referenced
this pull request
Dec 8, 2021
Removes the "inline" Snap functionality from the `SnapController`, also in preparation for launch / #140.
shanejonas
reviewed
Dec 8, 2021
shanejonas
reviewed
Dec 8, 2021
shanejonas
reviewed
Dec 8, 2021
Co-authored-by: Shane <jonas.shane@gmail.com>
shanejonas
approved these changes
Dec 9, 2021
rekmarks
added a commit
that referenced
this pull request
Dec 10, 2021
Removes the "inline" Snap functionality from the `SnapController`, also in preparation for launch / #140.
rekmarks
added a commit
that referenced
this pull request
Dec 10, 2021
This PR updates all skunkworks packages to match the [new Snaps publishing specification](https://github.com/MetaMask/specifications/blob/87f5e2a29235b174b897e002ca202a66fded9ddc/snaps/publishing.md). Changes are predominantly made in `/controllers` and `/snaps-cli`. In broad strokes, we had to make the following changes to become compatible with the new publishing specification: - Migrate from snap "names" to "ids" (#147) - Handle the new Snap manifest file format - Fetch Snaps from npm _or_ locally, via `localhost` All fetching and manifest validation logic is implemented in `controllers/snaps/`, and relevant utilities are imported therefrom in `snaps-cli`. There are a number of utilities that should probably be migrated to their own package, but we will do that later. Changes in detail: - The `SnapController` changes are mostly isolated to the Snap installation functionality, namely `installSnaps`, `processRequestedSnap`, and `add`. - `controllers/src/snaps/json-schemas` includes the JSON Schemas for Snap `package.json` and `snap.manifest.json` files. - We use `ajv` ("another json schema validator") to precompile validation functions that we use in production. This is done in a build step. Thanks to @shanejonas for suggesting this approach, which saved a ton of effort. - The `snaps-cli` changes are mostly isolated to `src/cmds/init` and `src/cmds/manifest`. Utilities are imported from `/controllers` whenever possible. Closes: https://github.com/MetaMask/MetaMask-planning/issues/54
rekmarks
added a commit
that referenced
this pull request
Dec 15, 2021
This PR adds installation-related `ControllerMessenger` events to the `SnapController`, fixes a bug in `installSnaps`, makes some methods private, and deletes `runExistingSnaps`. The following events are added: - `snapAdded`, emitted when a Snap has been added to state and its status is `installing` - We will leverage this event to record metadata about the Snap in the extension. - `snapInstalled`, emitted when a Snap has been fully installed - `snapRemoved`, emitted when a Snap is removed A bug was introduced in #140, where a successfully installed Snap would be overwritten with an unrelated error in the `installSnaps` result object. This PR prevents this overwrite from happening. The `authorize` and `processRequestedSnap` methods are made private, since they should never be called by third parties. In truth, `add` should also be private, but we currently rely on it for the majority of our tests, and will attend to it later. Finally, the `runExistingSnaps` method is removed because it's a hangover from the old Snaps lifecycle.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR updates all skunkworks packages to match the new Snaps publishing specification. Changes are predominantly made in
/controllersand/snaps-cli.In broad strokes, we had to make the following changes to become compatible with the new publishing specification:
localhostAll fetching and manifest validation logic is implemented in
controllers/snaps/, and relevant utilities are imported therefrom insnaps-cli. There are a number of utilities that should probably be migrated to their own package, but we will do that later.Changes in detail:
SnapControllerchanges are mostly isolated to the Snap installation functionality, namelyinstallSnaps,processRequestedSnap, andadd.controllers/src/snaps/json-schemasincludes the JSON Schemas for Snappackage.jsonandsnap.manifest.jsonfiles.ajv("another json schema validator") to precompile validation functions that we use in production. This is done in a build step. Thanks to @shanejonas for suggesting this approach, which saved a ton of effort.snaps-clichanges are mostly isolated tosrc/cmds/initandsrc/cmds/manifest. Utilities are imported from/controllerswhenever possible.Closes: https://github.com/MetaMask/MetaMask-planning/issues/54