Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(npm)!: separate npm, pnpm, yarn managers #24106

Closed
wants to merge 38 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8fde02b
feat(23779)!: drop lerna support
rarkins Aug 17, 2023
eefb45d
copy npm to pnpm, yarn
rarkins Aug 24, 2023
308dcad
Massage test names
rarkins Aug 24, 2023
ddd0135
Detect based on lock file
rarkins Aug 24, 2023
5b50e3f
fix names
rarkins Aug 24, 2023
08ca367
fix extract tests
rarkins Aug 24, 2023
7fa85b4
fix
rarkins Aug 25, 2023
6b5efca
drop global detect
rarkins Aug 25, 2023
93ed9cc
remove npm and yarn logic from pnpm
rarkins Aug 25, 2023
2fae60e
Remove npm/pnpm from yarn
rarkins Aug 25, 2023
3d2110b
Remove obsolete snapshots
rarkins Aug 26, 2023
7449286
Deduplicate package.json files
rarkins Aug 26, 2023
5156cad
matchManagers
rarkins Aug 27, 2023
867afc7
manager config merging
rarkins Aug 27, 2023
9880c24
enabledManagers
rarkins Aug 27, 2023
1c89f34
feat(lerna)!: remove explicit lerna support (#23907)
rarkins Aug 27, 2023
88d2b37
Merge branch 'v37' into feat/5607-separate-npm
rarkins Aug 27, 2023
9c5e4fb
feat(lerna)!: remove explicit lerna support (#23907)
rarkins Aug 27, 2023
2ffac2a
Merge branch 'v37' into feat/5607-separate-npm
rarkins Aug 27, 2023
858af0e
fix types
rarkins Aug 27, 2023
8737784
feat(lerna)!: remove explicit lerna support (#23907)
rarkins Aug 27, 2023
078a0f6
Merge branch 'v37' into feat/5607-separate-npm
rarkins Aug 28, 2023
1f6e49f
Merge branch 'v37' into feat/5607-separate-npm
rarkins Sep 1, 2023
d60948d
Update lib/config/index.spec.ts
rarkins Sep 1, 2023
ee2e502
fix error
rarkins Sep 1, 2023
a273d6a
simplify, get tests passing
rarkins Sep 1, 2023
72923a8
simplify
rarkins Sep 1, 2023
48971d8
refactor npm extract
rarkins Sep 1, 2023
49cc6e0
common
rarkins Sep 2, 2023
804336c
refactor extract
rarkins Sep 2, 2023
da67068
postExtractPackageFile
rarkins Sep 2, 2023
c90920b
refactor to common
rarkins Sep 2, 2023
5967f44
No pnpm npmLock
rarkins Sep 2, 2023
74dda7b
simplify pnpm extract
rarkins Sep 2, 2023
bbe6880
simplify yarn extract
rarkins Sep 2, 2023
e7fcd70
npm monorepo
rarkins Sep 2, 2023
45d944a
refactor
rarkins Sep 3, 2023
111be9a
pnpm extract
rarkins Sep 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/config/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ describe('config/index', () => {
]);
});

it('falls back from yarn to npm', () => {
const parentConfig = { ...defaultConfig };
expect(getManagerConfig(parentConfig, 'yarn').fileMatch).toEqual([
'(^|/)yarn\\.lock$',
]);
});

it('filterConfig()', () => {
const parentConfig = { ...defaultConfig };
const config = filterConfig(parentConfig, 'pr');
Expand Down
8 changes: 8 additions & 0 deletions lib/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ export function getManagerConfig(
managerConfig.categories = categories;
}
// TODO: fix types #22198
// Special handling for npm, pnpm, yarn
const alternativeNpmManagers = ['pnpm', 'yarn'];
if (alternativeNpmManagers.includes(manager)) {
// merge npm config first
managerConfig = mergeChildConfig(managerConfig, config.npm as any);
// We don't want to merge fileMatch
delete managerConfig.fileMatch;
}
managerConfig = mergeChildConfig(managerConfig, config[manager] as any);
for (const i of allManagersList) {
delete managerConfig[i];
Expand Down
4 changes: 4 additions & 0 deletions lib/modules/manager/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import * as pipCompile from './pip-compile';
import * as pip_requirements from './pip_requirements';
import * as pip_setup from './pip_setup';
import * as pipenv from './pipenv';
import * as pnpm from './pnpm';
import * as poetry from './poetry';
import * as preCommit from './pre-commit';
import * as pub from './pub';
Expand All @@ -84,6 +85,7 @@ import * as travis from './travis';
import type { ManagerApi } from './types';
import * as velaci from './velaci';
import * as woodpecker from './woodpecker';
import * as yarn from './yarn';

const api = new Map<string, ManagerApi>();
export default api;
Expand Down Expand Up @@ -155,6 +157,7 @@ api.set('pip-compile', pipCompile);
api.set('pip_requirements', pip_requirements);
api.set('pip_setup', pip_setup);
api.set('pipenv', pipenv);
api.set('pnpm', pnpm);
api.set('poetry', poetry);
api.set('pre-commit', preCommit);
api.set('pub', pub);
Expand All @@ -173,3 +176,4 @@ api.set('tflint-plugin', tflintPlugin);
api.set('travis', travis);
api.set('velaci', velaci);
api.set('woodpecker', woodpecker);
api.set('yarn', yarn);
52 changes: 16 additions & 36 deletions lib/modules/manager/npm/extract/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() catches invalid
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": undefined,
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": undefined,
Expand Down Expand Up @@ -128,16 +126,13 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts engine
"npm": "^8.0.0",
"pnpm": "^1.2.0",
"vscode": ">=1.49.3",
"yarn": "disabled",
},
"managerData": {
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": undefined,
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": undefined,
Expand Down Expand Up @@ -311,10 +306,8 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts non-np
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": undefined,
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": undefined,
Expand Down Expand Up @@ -357,10 +350,8 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts npm pa
"hasPackageManager": false,
"npmLock": "package-lock.json",
"packageJsonName": undefined,
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": undefined,
Expand Down Expand Up @@ -388,10 +379,8 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts packag
"hasPackageManager": true,
"npmLock": undefined,
"packageJsonName": undefined,
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": undefined,
Expand Down Expand Up @@ -455,15 +444,16 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts volta
],
"extractedConstraints": {
"node": "8.9.2",
"npm": "5.9.0",
"pnpm": "6.11.2",
"yarn": "1.12.3",
},
"managerData": {
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": undefined,
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": undefined,
Expand Down Expand Up @@ -511,10 +501,8 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() extracts volta
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": undefined,
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": undefined,
Expand Down Expand Up @@ -642,12 +630,10 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() finds a lock fi
"extractedConstraints": {},
"managerData": {
"hasPackageManager": false,
"npmLock": undefined,
"npmLock": "package-lock.json",
"packageJsonName": "renovate",
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": "yarn.lock",
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": "1.0.0",
Expand Down Expand Up @@ -777,10 +763,8 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() returns an arra
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": "renovate",
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": "1.0.0",
Expand Down Expand Up @@ -892,10 +876,8 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() returns an arra
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": "renovate",
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": [],
"yarnLock": undefined,
"yarnZeroInstall": false,
},
"npmrc": undefined,
"packageFileVersion": "1.0.0",
Expand Down Expand Up @@ -1025,13 +1007,11 @@ exports[`modules/manager/npm/extract/index .extractPackageFile() sets skipInstal
"hasPackageManager": false,
"npmLock": undefined,
"packageJsonName": "renovate",
"pnpmShrinkwrap": undefined,
"shrinkwrapJson": undefined,
"workspacesPackages": undefined,
"yarnLock": "yarn.lock",
"yarnZeroInstall": true,
},
"npmrc": undefined,
"packageFileVersion": "1.0.0",
"skipInstalls": false,
"skipInstalls": true,
}
`;
Loading