Skip to content

Commit

Permalink
build: replace squirrelly with eta (#23215)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch authored Mar 4, 2024
1 parent 5915234 commit ffdf690
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ app/_locales/** linguist-generated
# yarn berry suggested .gitattributes
/.yarn/releases/** binary
/.yarn/plugins/** binary

app/*.html linguist-language=EJS
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"rvest.vs-code-prettier-eslint",
"streetsidesoftware.code-spell-checker"
"streetsidesoftware.code-spell-checker",
"DigitalBrainstem.javascript-ejs-support"
]
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"cSpell.words": ["blockaid", "lavamoat"],
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.tabSize": 2,
"files.associations": {
"app/*.html": "ejs"
},
"files.trimTrailingWhitespace": true,
"javascript.preferences.importModuleSpecifier": "relative",
"json.schemas": [
Expand Down
13 changes: 0 additions & 13 deletions .yarn/patches/squirrelly-npm-9.0.0-3cf710c7bb.patch

This file was deleted.

8 changes: 3 additions & 5 deletions app/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no">
{{ @if (it.isTest) }}
<title>MetaMask</title>
{{ #elif (it.isMMI) }}
<% if (it.isMMI && !it.isTest) { %>
<title>MetaMask Institutional</title>
{{ #else }}
<% } else { %>
<title>MetaMask</title>
{{/if}}
<% } %>
<link rel="stylesheet" type="text/css" href="./index.css">
</head>
<body>
Expand Down
8 changes: 4 additions & 4 deletions app/notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />

{{ @if (it.isTest) }}
<% if (it.isTest) { %>
<title>MetaMask Dialog</title>
{{ #elif (it.isMMI) }}
<% } else if (it.isMMI) { %>
<title>MetaMask Institutional</title>
{{ #else }}
<% } else { %>
<title>MetaMask</title>
{{/if}}
<% } %>

<style>
#app-content {
Expand Down
5 changes: 3 additions & 2 deletions development/build/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const through = require('through2');
const endOfStream = pify(require('end-of-stream'));
const labeledStreamSplicer = require('labeled-stream-splicer').obj;
const wrapInStream = require('pumpify').obj;
const Sqrl = require('squirrelly');
const { Eta } = require('eta');
const lavapack = require('@lavamoat/lavapack');
const lavamoatBrowserify = require('lavamoat-browserify');
const terser = require('terser');
Expand Down Expand Up @@ -1325,7 +1325,8 @@ function renderHtmlFile({
const htmlFilePath = `./app/${htmlName}.html`;
const htmlTemplate = readFileSync(htmlFilePath, 'utf8');

const htmlOutput = Sqrl.render(htmlTemplate, { isMMI, isTest });
const eta = new Eta();
const htmlOutput = eta.renderString(htmlTemplate, { isMMI, isTest });
browserPlatforms.forEach((platform) => {
const dest = `./dist/${platform}/${htmlName}.html`;
// we dont have a way of creating async events atm
Expand Down
18 changes: 9 additions & 9 deletions lavamoat/build-system/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -3283,6 +3283,15 @@
"eslint>strip-ansi>ansi-regex": true
}
},
"eta": {
"builtin": {
"node:fs": true,
"node:path": true
},
"globals": {
"define": true
}
},
"fancy-log": {
"builtin": {
"console.Console": true
Expand Down Expand Up @@ -7533,15 +7542,6 @@
"fetch": true
}
},
"squirrelly": {
"builtin": {
"fs.existsSync": true,
"fs.readFileSync": true,
"path.dirname": true,
"path.extname": true,
"path.resolve": true
}
},
"string.prototype.matchall": {
"packages": {
"string.prototype.matchall>call-bind": true,
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@
"web3@^0.20.7": "patch:web3@npm%3A0.20.7#./.yarn/patches/web3-npm-0.20.7-ee7ef00c57.patch",
"watchify@^4.0.0": "patch:watchify@npm%3A4.0.0#./.yarn/patches/watchify-npm-4.0.0-4fd965dd49.patch",
"undeclared-identifiers@^1.1.2": "patch:undeclared-identifiers@npm%3A1.1.2#./.yarn/patches/undeclared-identifiers-npm-1.1.2-13d6792e9e.patch",
"squirrelly@^9.0.0": "patch:squirrelly@npm%3A9.0.0#./.yarn/patches/squirrelly-npm-9.0.0-3cf710c7bb.patch",
"stylelint@^13.6.1": "patch:stylelint@npm%3A13.6.1#./.yarn/patches/stylelint-npm-13.6.1-47aaddf62b.patch",
"luxon@^3.0.1": "patch:luxon@npm%3A3.2.1#./.yarn/patches/luxon-npm-3.2.1-56f8d97395.patch",
"luxon@^3.2.1": "patch:luxon@npm%3A3.2.1#./.yarn/patches/luxon-npm-3.2.1-56f8d97395.patch",
Expand Down Expand Up @@ -502,6 +501,7 @@
"eslint-plugin-react": "^7.23.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-storybook": "^0.6.15",
"eta": "^3.2.0",
"fake-indexeddb": "^4.0.1",
"fancy-log": "^1.3.3",
"fast-glob": "^3.2.2",
Expand Down Expand Up @@ -567,7 +567,6 @@
"source-map": "^0.7.4",
"source-map-explorer": "^2.4.2",
"sprintf-js": "^1.1.3",
"squirrelly": "^9.0.0",
"storybook": "^7.4.6",
"storybook-dark-mode": "^3.0.1",
"stream-browserify": "^3.0.0",
Expand Down
23 changes: 8 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17251,6 +17251,13 @@ __metadata:
languageName: node
linkType: hard

"eta@npm:^3.2.0":
version: 3.2.0
resolution: "eta@npm:3.2.0"
checksum: f4aa8ff6b9a4adf3d5db83255793be0136bdbcf2341154ad64c019bacc04d69e10218e54764af572eb8ba016996b8cbac9dc7a6fc2e9eb5005a0323bab883692
languageName: node
linkType: hard

"etag@npm:~1.8.1":
version: 1.8.1
resolution: "etag@npm:1.8.1"
Expand Down Expand Up @@ -24979,6 +24986,7 @@ __metadata:
eslint-plugin-react: "npm:^7.23.1"
eslint-plugin-react-hooks: "npm:^4.2.0"
eslint-plugin-storybook: "npm:^0.6.15"
eta: "npm:^3.2.0"
eth-ens-namehash: "npm:^2.0.8"
eth-json-rpc-filters: "npm:^6.0.0"
eth-lattice-keyring: "npm:^0.12.4"
Expand Down Expand Up @@ -25098,7 +25106,6 @@ __metadata:
source-map: "npm:^0.7.4"
source-map-explorer: "npm:^2.4.2"
sprintf-js: "npm:^1.1.3"
squirrelly: "npm:^9.0.0"
storybook: "npm:^7.4.6"
storybook-dark-mode: "npm:^3.0.1"
stream-browserify: "npm:^3.0.0"
Expand Down Expand Up @@ -32243,20 +32250,6 @@ __metadata:
languageName: node
linkType: hard

"squirrelly@npm:9.0.0":
version: 9.0.0
resolution: "squirrelly@npm:9.0.0"
checksum: c0c0b7f3f6825a3e601baaf0c3848bc56d2d05482a3cf4d4cf4a01ee25312e775b0ffbcca7b8660c3ad5a3dd905fd5d34642d4324c36d0ed45c2bcb4de343002
languageName: node
linkType: hard

"squirrelly@patch:squirrelly@npm%3A9.0.0#./.yarn/patches/squirrelly-npm-9.0.0-3cf710c7bb.patch::locator=metamask-crx%40workspace%3A.":
version: 9.0.0
resolution: "squirrelly@patch:squirrelly@npm%3A9.0.0#./.yarn/patches/squirrelly-npm-9.0.0-3cf710c7bb.patch::version=9.0.0&hash=bf49f6&locator=metamask-crx%40workspace%3A."
checksum: 2b30969650de3350fa9db401af32633359a41b2500c10c8cf6f926f27c968cbedbbd3cb22b79a9f150f7e9d5ea0f31e1bccc2c2c851389d3d83e8347f19f9d6c
languageName: node
linkType: hard

"ssri@npm:^10.0.0":
version: 10.0.4
resolution: "ssri@npm:10.0.4"
Expand Down

0 comments on commit ffdf690

Please sign in to comment.