Skip to content

Update lavamoat browserify docs#476

Merged
leotm merged 5 commits into
mainfrom
update-lavamoat-browserify-docs
Mar 30, 2023
Merged

Update lavamoat browserify docs#476
leotm merged 5 commits into
mainfrom
update-lavamoat-browserify-docs

Conversation

@leotm

@leotm leotm commented Mar 27, 2023

Copy link
Copy Markdown
Member

Follow-up to #475 spotted from going thru js example

  • Fix examples link
  • Fix resolve/lib/sync.js throws error it can't find lavamoat-browserify from node_modules
    • Install lavamoat-browserify with Yarn before running lavamoat
  • Fix yarn start server broken MM logo (screen) if user forgets to run yarn lavamoat first
    • Error: LavaMoat - required package not in allowlist: package "metamask-logo" requested "metamask-logo>gl-mat4" as "gl-mat4/perspective"
    • i.e. Run yarn lavamoat to fully update policy.json we provide
  • Update remaining examples documentation and files (browserify and serve left alone)

nb: same RN v8 warnings (excluding Promises)

Screenshot 2023-03-27 at 12 59 26

and in cli example console.error only on localhost:5000 (favicon.ico 404 only on refresh)


nb: js example

Screenshot 2023-03-27 at 13 10 47


Should we mention in docs to expect these errors or are these unexpected to look at fixing?
No console.error's running zero extensions

@leotm leotm force-pushed the update-lavamoat-browserify-docs branch from 9d28481 to 86599cf Compare March 27, 2023 11:29
Comment thread packages/browserify/examples/00-simple-cli/yarn.lock
- Fix examples link
- Fix resolve/lib/sync.js throws error it can't find lavamoat-browserify from node_modules
  - Install lavamoat-browserify with Yarn before running lavamoat
- Fix yarn start server broken MM logo if user forgets to run yarn lavamoat first
  - Error: LavaMoat - required package not in allowlist: package "metamask-logo" requested "metamask-logo>gl-mat4" as "gl-mat4/perspective"
  - i.e. Run yarn lavamoat to fully update policy.json we provide
- Update remaining examples documentation, files and deps
@leotm leotm force-pushed the update-lavamoat-browserify-docs branch from 86599cf to 25a8dba Compare March 27, 2023 11:39
Comment thread packages/browserify/examples/00-simple-cli/policy.json
Comment on lines +1 to +4
{
"resources": {
}
} No newline at end of file

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leotm leotm Mar 27, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could omit our policy configs and rely on running yarn lavamoat in instructions to autogen

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline at EOF

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to both examples in 4bd9640
but i noticed yarn lavamoat always removes missing EOF newlines in policy.json

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we intend to be consistent can revert this commit
or follow-up with lavamoat cli to add missing newlines in both policy configs
(atm policy-override.json isn't formatted if it exists)

@leotm leotm marked this pull request as ready for review March 27, 2023 12:34
@leotm leotm requested a review from a team March 27, 2023 12:34
},
"dependencies": {
"metamask-logo": "^2.2.1"
"lavamoat-browserify": "^16.0.0",

@legobeat legobeat Mar 27, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be a devDependency i think?

@leotm leotm Mar 27, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops yes ^ updated in b5432db including docs

},
"dependencies": {
"metamask-logo": "^2.2.1"
"lavamoat-browserify": "^16.0.0",

@legobeat legobeat Mar 27, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be a devDependency i think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated in b5432db including docs

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you experience problems running these examples? I test my code against example 01 constantly, never experiencing any problems..

just making sure @weizman you're adding lavamoat-browserify too right in this example 🤔
i checked yarn global add lavamoat-browserify@15.5.0 (since 16 was wrongly introduced) but it has no binaries

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leotm lavamoat-browserify is not supposed to have any binaries AFAIK - what are you missing specifically?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok ^ was just wondering how we're testing the example without lavamoat-browserify as a dependency

e.g. possibly locally

Screenshot 2023-03-28 at 11 37 37

but yep it's not pos globally (since no binaries)

so deffo want it as a dependency (devDep as you pointed out)

so think PR now looks good to merge if you're happy

Comment thread packages/browserify/examples/README.md
@weizman

weizman commented Mar 27, 2023

Copy link
Copy Markdown
Member

I'm confused about the general motivation here. Did you experience problems running these examples?
I test my code against example 01 constantly, never experiencing any problems..

@weizman

weizman commented Mar 27, 2023

Copy link
Copy Markdown
Member

I think I might understand the confusion here.. I'm pretty sure you see errors because of the extensions you have installed while testing this page.
The examples scuttle global object properties, which the extensions you have installed rely on when they try to inject code into the page.
When running these examples, you must do so with zero extensions enabled to see it functioning correctly.
Mind giving it a try to make sure I make sense?

@leotm

leotm commented Mar 27, 2023

Copy link
Copy Markdown
Member Author

I think I might understand the confusion here.. I'm pretty sure you see errors because of the extensions you have installed while testing this page. The examples scuttle global object properties, which the extensions you have installed rely on when they try to inject code into the page. When running these examples, you must do so with zero extensions enabled to see it functioning correctly. Mind giving it a try to make sure I make sense?

perfect thanks exactly right its my extensions ^ can confirm no console.errors incognito
(thought uBlock Origin disabled was enough)

@leotm

leotm commented Mar 27, 2023

Copy link
Copy Markdown
Member Author

I'm confused about the general motivation here. Did you experience problems running these examples? I test my code against example 01 constantly, never experiencing any problems..

yep exactly was wondering where the examples link supposed to go to and why couldn't run the js example or cli one

Screenshot 2023-03-27 at 16 19 25

then was curious why yarn start renders our logo fine in browser w/o running yarn lavamoat in js example
but doesn't in cli example

and why we commit yarn lavamoat autogen'ed files in js example but not fully in cli example

so thought this PR might address those problems i ran into

leotm and others added 3 commits March 27, 2023 16:35
Co-authored-by: weizman <weizmangal@gmail.com>
@leotm leotm requested a review from legobeat March 27, 2023 16:29
Comment thread packages/browserify/examples/README.md Outdated

@legobeat legobeat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small suggestion, lgtm otherwise!

Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com>
@leotm leotm merged commit e1cac44 into main Mar 30, 2023
@leotm leotm deleted the update-lavamoat-browserify-docs branch March 30, 2023 14:26
legobeat pushed a commit that referenced this pull request Jun 2, 2023
- fix: Node.js 18 compatibility (#551)
- deps: update lavamoat-core@^12.4.0->^14.1.1
- deps: @lavamoat/lavapack@^3.3.0->^5.1.2
- doc: update examples and docs (#476)
- change: Add back policyDebug option (#440)
legobeat pushed a commit that referenced this pull request Jun 2, 2023
- fix: Node.js 18 compatibility (#551)
- deps: update lavamoat-core@^12.4.0->^14.1.1
- deps: @lavamoat/lavapack@^3.3.0->^5.1.2
- doc: update examples and docs (#476)
- change: Add back policyDebug option (#440)
legobeat pushed a commit that referenced this pull request Jun 6, 2023
- fix: Node.js 18 compatibility (#551)
- deps: update lavamoat-core@^12.4.0->^14.1.1
- deps: @lavamoat/lavapack@^3.3.0->^5.1.2
- doc: update examples and docs (#476)
- change: Add back policyDebug option (#440)
legobeat pushed a commit that referenced this pull request Jun 6, 2023
- fix: Node.js 18 compatibility (#551)
- deps: update lavamoat-core@^12.4.0->^14.1.1
- deps: @lavamoat/lavapack@^3.3.0->^5.1.2
- doc: update examples and docs (#476)
- change: Add back policyDebug option (#440)
boneskull pushed a commit to boneskull/LavaMoat that referenced this pull request Feb 6, 2024
- fix: Node.js 18 compatibility (LavaMoat#551)
- deps: update lavamoat-core@^12.4.0->^14.1.1
- deps: @lavamoat/lavapack@^3.3.0->^5.1.2
- doc: update examples and docs (LavaMoat#476)
- change: Add back policyDebug option (LavaMoat#440)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants