Skip to content

Commit

Permalink
make pnpm install less noisy (#3799)
Browse files Browse the repository at this point in the history
  • Loading branch information
adghayes authored Aug 10, 2023
1 parent 7668dbe commit ca30d95
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 85 deletions.
77 changes: 12 additions & 65 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
hooks: {
readPackage,
},
}
};

/**
* @typedef {object} Package
Expand All @@ -28,96 +28,43 @@ module.exports = {
* @returns {Package}
*/
function readPackage(pkg, context) {
if (pkg.name === 'any-observable') {
// Error: Cannot find any-observable implementation nor global.Observable. You must install polyfill or call require("any-observable/register") with your preferred implementation, e.g. require("any-observable/register")('rxjs') on application load prior to any require("any-observable").
pkg.dependencies = {
...pkg.dependencies,
rxjs: '*',
}
context.log('any-observable implicitly depends on rxjs')
}

if (pkg.name === 'fetch-mock') {
// Cannot find module 'node-fetch' from 'server.js'
pkg.dependencies = {
...pkg.dependencies,
'node-fetch': '*',
}
context.log('fetch-mock implicitly depends on node-fetch')
};
context.log('fetch-mock implicitly depends on node-fetch');
}

if (pkg.name === 'react-idle-timer') {
// Cannot find module 'prop-types' from 'index.min.js'
pkg.dependencies = {
...pkg.dependencies,
'prop-types': '*',
}
context.log('react-idle-timer implicitly depends on prop-types')
}

if (pkg.name === 'styled-components') {
// Cannot find module 'react-is' from '../../node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/styled-components/dist/styled-components.cjs.js'
pkg.dependencies = {
...pkg.dependencies,
'react-is': '*',
}
context.log('styled-components implicitly depends on react-is')
}

if (pkg.name === '@votingworks/qrcode.react') {
// JSX element class does not support attributes because it does not have a 'props' property.
pkg.dependencies = {
...pkg.dependencies,
'@types/react': '*',
}
context.log('@votingworks/qrcode.react implicitly depends on @types/react')
};
context.log('react-idle-timer implicitly depends on prop-types');
}

if (pkg.name === 'react-idle-timer') {
// JSX element class does not support attributes because it does not have a 'props' property.
pkg.dependencies = {
...pkg.dependencies,
'@types/react': '*',
}
context.log('react-idle-timer implicitly depends on @types/react')
};
context.log('react-idle-timer implicitly depends on @types/react');
}

if (pkg.name === '@typescript-eslint/utils') {
// Cannot find module '@typescript-eslint/parser'
pkg.dependencies = {
...pkg.dependencies,
'@typescript-eslint/parser': '*',
}
context.log('eslint-module-utils requires the parser named in the eslint config, @typescript-eslint/parser')
}

if (pkg.name === 'jest-circus') {
// Cannot find module 'prettier'
pkg.dependencies = {
...pkg.dependencies,
'prettier': '*',
}
context.log('jest-circus requires prettier to format code for inline snapshots')
}

if (pkg.name === '@testing-library/user-event') {
// Cannot find module '@testing-library/dom'
pkg.dependencies = {
...pkg.dependencies,
'@testing-library/dom': '*',
}
context.log('@testing-library/user-event requires @testing-library/dom')
}

if (/^\^?4\.2\./.test(pkg.dependencies['graceful-fs'])) {
// Object prototype may only be an Object or null: undefined
// Caused by https://github.com/isaacs/node-graceful-fs/commit/c55c1b8cb32510f92bd33d7c833364ecd3964dea
//
// Also avoids the issue fixed by https://github.com/isaacs/node-graceful-fs/pull/220
// where jest thinks it cannot find `ts-jest`.
pkg.dependencies['graceful-fs'] = '4.2.10'
context.log(`${pkg.name}@${pkg.version} may use Object.setPrototypeOf with fs.read, which is undefined in the browser, which crashes`)
};
context.log(
'eslint-module-utils requires the parser named in the eslint config, @typescript-eslint/parser'
);
}

return pkg
return pkg;
}
2 changes: 0 additions & 2 deletions libs/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@
"devDependencies": {
"@types/jest": "^29.5.3",
"eslint-plugin-vx": "workspace:*",
"fetch-mock": "^9.10.7",
"is-ci-cli": "^2.2.0",
"jest": "^29.6.2",
"jest-fetch-mock": "^3.0.3",
"jest-junit": "^16.0.0",
"jest-watch-typeahead": "^2.2.2",
"lint-staged": "^11.0.0",
Expand Down
1 change: 0 additions & 1 deletion libs/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"@votingworks/test-utils": "workspace:*",
"esbuild-runner": "^2.2.1",
"eslint-plugin-vx": "workspace:*",
"fetch-mock": "^9.11.0",
"is-ci-cli": "^2.2.0",
"jest": "^29.6.2",
"jest-junit": "^16.0.0",
Expand Down
1 change: 0 additions & 1 deletion libs/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"esbuild-runner": "^2.2.1",
"eslint-plugin-vx": "workspace:*",
"fast-check": "2.23.2",
"fetch-mock": "^9.9.0",
"fs-extra": "^10.0.0",
"is-ci-cli": "^2.2.0",
"jest": "^29.6.2",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"pnpm": {
"overrides": {
"@types/eslint": "8.4.1",
"typescript": "4.6.3"
"typescript": "4.6.3",
"graceful-fs": "^4.2.9"
}
}
}
19 changes: 4 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca30d95

Please sign in to comment.