Skip to content

Commit

Permalink
Yarn v3 (MetaMask#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 authored Jan 10, 2023
1 parent 60bb347 commit 5e13cc5
Show file tree
Hide file tree
Showing 9 changed files with 6,527 additions and 3,819 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* text=auto

yarn.lock linguist-generated=false

# yarn v3
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
/.yarn/releases/** binary
/.yarn/plugins/** binary
5 changes: 2 additions & 3 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Get Yarn cache directory
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn cache dir)"
run: echo "::set-output name=YARN_CACHE_DIR::$(yarn config get cacheFolder)"
id: yarn-cache-dir
- name: Get Yarn version
run: echo "::set-output name=YARN_VERSION::$(yarn --version)"
Expand All @@ -29,8 +29,7 @@ jobs:
with:
path: ${{ steps.yarn-cache-dir.outputs.YARN_CACHE_DIR }}
key: yarn-cache-${{ runner.os }}-${{ steps.yarn-version.outputs.YARN_VERSION }}-${{ hashFiles('yarn.lock') }}
- run: yarn --frozen-lockfile
- run: yarn allow-scripts
- run: yarn --immutable
- run: yarn lint
- run: yarn test
- name: Validate RC changelog
Expand Down
69 changes: 16 additions & 53 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,58 +1,21 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

node_modules
package-lock.json
# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
# Jest
/coverage

# Yarn Integrity file
.yarn-integrity
# yarn v3 (w/o zero-install)
# See: https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# dotenv environment variables file
.env
# logs
yarn-debug.log*
yarn-error.log*
9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-allow-scripts",
factory: function (require) {
var plugin=(()=>{var a=Object.create,l=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var u=e=>l(e,"__esModule",{value:!0});var f=e=>{if(typeof require!="undefined")return require(e);throw new Error('Dynamic require of "'+e+'" is not supported')};var g=(e,o)=>{for(var r in o)l(e,r,{get:o[r],enumerable:!0})},m=(e,o,r)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of s(o))!c.call(e,t)&&t!=="default"&&l(e,t,{get:()=>o[t],enumerable:!(r=i(o,t))||r.enumerable});return e},x=e=>m(u(l(e!=null?a(p(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var k={};g(k,{default:()=>d});var n=x(f("@yarnpkg/shell")),y={hooks:{afterAllInstalled:async()=>{let e=await(0,n.execute)("yarn run allow-scripts");e!==0&&process.exit(e)}}},d=y;return k;})();
return plugin;
}
};
823 changes: 823 additions & 0 deletions .yarn/releases/yarn-3.3.1.cjs

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
enableScripts: false

enableTelemetry: 0

logFilters:
- code: YN0004
level: discard

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-allow-scripts.cjs
spec: "https://raw.githubusercontent.com/LavaMoat/LavaMoat/main/packages/yarn-plugin-allow-scripts/bundles/@yarnpkg/plugin-allow-scripts.js"

yarnPath: .yarn/releases/yarn-3.3.1.cjs
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ there are a few others:

- Install [Node.js](https://nodejs.org) version 14
- If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm use` will automatically choose the right node version for you.
- Install [Yarn v1](https://yarnpkg.com/en/docs/install)
- Run `yarn setup` to install dependencies and run any requried post-install scripts
- Install [Yarn v3](https://yarnpkg.com/getting-started/install)
- Run `yarn install` to install dependencies and run any required post-install scripts
- **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.

### Testing and Linting
Expand Down
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
"index.js"
],
"scripts": {
"setup": "yarn install && yarn allow-scripts",
"test": "mocha",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' --ignore-path .gitignore",
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' '!.yarnrc.yml' --ignore-path .gitignore --no-error-on-unmatched-pattern",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write"
},
Expand All @@ -42,7 +41,7 @@
},
"devDependencies": {
"@ethereumjs/common": "^2.4.0",
"@lavamoat/allow-scripts": "^1.0.6",
"@lavamoat/allow-scripts": "^2.3.0",
"@metamask/auto-changelog": "^3.0.0",
"@metamask/eslint-config": "^8.0.0",
"@metamask/eslint-config-mocha": "^8.0.0",
Expand Down Expand Up @@ -72,7 +71,15 @@
"core-js": false,
"blake-hash": false,
"tiny-secp256k1": false,
"protobufjs": false
"protobufjs": false,
"ethereumjs-tx>ethereumjs-util>keccak": false,
"ethereumjs-util>ethereum-cryptography>keccak": false,
"ethereumjs-util>ethereum-cryptography>secp256k1": false,
"hdkey>secp256k1": false,
"trezor-connect>@trezor/transport>protobufjs": false,
"trezor-connect>@trezor/utxo-lib>blake-hash": false,
"trezor-connect>@trezor/utxo-lib>tiny-secp256k1": false
}
}
},
"packageManager": "yarn@3.3.1"
}
Loading

0 comments on commit 5e13cc5

Please sign in to comment.