ember-try 3.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,295 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const CoreObject = require('core-object');
4
- const fs = require('fs-extra');
5
- const util = require('util');
6
- const copy = util.promisify(fs.copy);
7
- const path = require('path');
8
- const debug = require('debug')('ember-try:dependency-manager-adapter:npm');
9
- const rimraf = util.promisify(require('rimraf'));
10
- const chalk = require('chalk');
11
- const semver = require('semver');
12
-
13
- module.exports = CoreObject.extend({
14
- init() {
15
- this._super.apply(this, arguments);
16
- this.run = this.run || require('../utils/run');
17
- },
18
- useYarnCommand: false,
19
- yarnLock: 'yarn.lock',
20
- yarnLockBackupFileName: 'yarn.lock.ember-try',
21
- configKey: 'npm',
22
- packageJSON: 'package.json',
23
- packageJSONBackupFileName: 'package.json.ember-try',
24
- nodeModules: 'node_modules',
25
- nodeModulesBackupLocation: '.node_modules.ember-try',
26
- npmShrinkWrap: 'npm-shrinkwrap.json',
27
- npmShrinkWrapBackupFileName: 'npm-shrinkwrap.json.ember-try',
28
- packageLock: 'package-lock.json',
29
- packageLockBackupFileName: 'package-lock.json.ember-try',
30
-
31
- async setup(options) {
32
- if (!options) {
33
- options = {};
34
- }
35
-
36
- this._runYarnCheck(options.ui);
37
-
38
- return await this._backupOriginalDependencies();
39
- },
40
-
41
- async changeToDependencySet(depSet) {
42
- this.applyDependencySet(depSet);
43
-
44
- await this._install(depSet);
45
-
46
- let deps = Object.assign({}, depSet.dependencies, depSet.devDependencies);
47
- let currentDeps = Object.keys(deps).map((dep) => {
48
- return {
49
- name: dep,
50
- versionExpected: deps[dep],
51
- versionSeen: this._findCurrentVersionOf(dep),
52
- packageManager: this.useYarnCommand ? 'yarn' : 'npm',
53
- };
54
- });
55
-
56
- debug('Switched to dependencies: \n', currentDeps);
57
-
58
- return currentDeps;
59
- },
60
-
61
- async cleanup() {
62
- try {
63
- await this._restoreOriginalDependencies();
64
-
65
- debug('Remove backup package.json and node_modules');
66
-
67
- let cleanupTasks = [
68
- rimraf(path.join(this.cwd, this.packageJSONBackupFileName)),
69
- rimraf(path.join(this.cwd, this.nodeModulesBackupLocation)),
70
- ];
71
-
72
- if (fs.existsSync(path.join(this.cwd, this.yarnLockBackupFileName))) {
73
- cleanupTasks.push(rimraf(path.join(this.cwd, this.yarnLockBackupFileName)));
74
- }
75
-
76
- if (fs.existsSync(path.join(this.cwd, this.npmShrinkWrapBackupFileName))) {
77
- cleanupTasks.push(rimraf(path.join(this.cwd, this.npmShrinkWrapBackupFileName)));
78
- }
79
-
80
- if (fs.existsSync(path.join(this.cwd, this.packageLockBackupFileName))) {
81
- cleanupTasks.push(rimraf(path.join(this.cwd, this.packageLockBackupFileName)));
82
- }
83
-
84
- return await Promise.all(cleanupTasks);
85
- } catch (e) {
86
- console.log('Error cleaning up npm scenario:', e); // eslint-disable-line no-console
87
- }
88
- },
89
-
90
- _runYarnCheck(ui) {
91
- if (!this.useYarnCommand) {
92
- try {
93
- if (fs.statSync(path.join(this.cwd, this.yarnLock)).isFile()) {
94
- ui.writeLine(
95
- chalk.yellow(
96
- 'Detected a yarn.lock file. Add `useYarn: true` to your `config/ember-try.js` configuration file if you want to use Yarn to install npm dependencies.'
97
- )
98
- );
99
- }
100
- } catch (e) {
101
- // If no yarn.lock is found, no need to warn.
102
- }
103
- }
104
- },
105
-
106
- _findCurrentVersionOf(packageName) {
107
- let filename = path.join(this.cwd, this.nodeModules, packageName, this.packageJSON);
108
- if (fs.existsSync(filename)) {
109
- return JSON.parse(fs.readFileSync(filename)).version;
110
- } else {
111
- return null;
112
- }
113
- },
114
-
115
- async _install(depSet) {
116
- let mgrOptions = this.managerOptions || [];
117
- let cmd = this.useYarnCommand ? 'yarn' : 'npm';
118
-
119
- // buildManagerOptions overrides all default
120
- if (typeof this.buildManagerOptions === 'function') {
121
- mgrOptions = this.buildManagerOptions(depSet);
122
-
123
- if (!Array.isArray(mgrOptions)) {
124
- throw new Error('buildManagerOptions must return an array of options');
125
- }
126
- } else {
127
- if (this.useYarnCommand) {
128
- if (mgrOptions.indexOf('--no-lockfile') === -1) {
129
- mgrOptions = mgrOptions.concat(['--no-lockfile']);
130
- }
131
- // npm warns on incompatible engines
132
- // yarn errors, not a good experience
133
- if (mgrOptions.indexOf('--ignore-engines') === -1) {
134
- mgrOptions = mgrOptions.concat(['--ignore-engines']);
135
- }
136
- } else if (mgrOptions.indexOf('--no-shrinkwrap') === -1) {
137
- mgrOptions = mgrOptions.concat(['--no-shrinkwrap']);
138
- }
139
- }
140
-
141
- debug('Run npm/yarn install with options %s', mgrOptions);
142
-
143
- await this.run(cmd, [].concat(['install'], mgrOptions), { cwd: this.cwd });
144
-
145
- if (!this.useYarnCommand) {
146
- let res = await this.run('npm', ['--version'], { cwd: this.cwd, stdio: 'pipe' });
147
- let version = res.stdout;
148
- if (version.match(/^4./)) {
149
- debug('Running npm prune because version is %s', version);
150
- return await this.run(this.configKey, ['prune'], { cwd: this.cwd });
151
- }
152
-
153
- debug('Not running npm prune because version is %s', version);
154
- }
155
- },
156
-
157
- applyDependencySet(depSet) {
158
- debug('Changing to dependency set: %s', JSON.stringify(depSet));
159
-
160
- if (!depSet) {
161
- return;
162
- }
163
-
164
- let backupPackageJSON = path.join(this.cwd, this.packageJSONBackupFileName);
165
- let packageJSONFile = path.join(this.cwd, this.packageJSON);
166
- let packageJSON = JSON.parse(fs.readFileSync(backupPackageJSON));
167
- let newPackageJSON = this._packageJSONForDependencySet(packageJSON, depSet);
168
-
169
- debug('Write package.json with: \n', JSON.stringify(newPackageJSON));
170
-
171
- fs.writeFileSync(packageJSONFile, JSON.stringify(newPackageJSON, null, 2));
172
- },
173
-
174
- _packageJSONForDependencySet(packageJSON, depSet) {
175
- this._overridePackageJSONDependencies(packageJSON, depSet, 'dependencies');
176
- this._overridePackageJSONDependencies(packageJSON, depSet, 'devDependencies');
177
- this._overridePackageJSONDependencies(packageJSON, depSet, 'peerDependencies');
178
- this._overridePackageJSONDependencies(packageJSON, depSet, 'ember');
179
-
180
- if (this.useYarnCommand) {
181
- this._overridePackageJSONDependencies(packageJSON, depSet, 'resolutions');
182
- } else {
183
- this._overridePackageJSONDependencies(packageJSON, depSet, 'overrides');
184
- }
185
-
186
- return packageJSON;
187
- },
188
-
189
- _overridePackageJSONDependencies(packageJSON, depSet, kindOfDependency) {
190
- if (!depSet[kindOfDependency]) {
191
- return;
192
- }
193
-
194
- let packageNames = Object.keys(depSet[kindOfDependency]);
195
-
196
- packageNames.forEach((packageName) => {
197
- if (!packageJSON[kindOfDependency]) {
198
- packageJSON[kindOfDependency] = {};
199
- }
200
-
201
- let version = depSet[kindOfDependency][packageName];
202
- if (version === null) {
203
- delete packageJSON[kindOfDependency][packageName];
204
- } else {
205
- packageJSON[kindOfDependency][packageName] = version;
206
-
207
- // in npm we need to always add an override if the version is a pre-release
208
- if (
209
- !this.useYarnCommand &&
210
- (semver.prerelease(version) || /^https*:\/\/.*\.tg*z/.test(version))
211
- ) {
212
- if (!packageJSON.overrides) {
213
- packageJSON.overrides = {};
214
- }
215
-
216
- packageJSON.overrides[packageName] = `$${packageName}`;
217
- }
218
- }
219
- });
220
- },
221
-
222
- _restoreOriginalDependencies() {
223
- debug('Restoring original package.json and node_modules');
224
-
225
- let restoreTasks = [
226
- copy(
227
- path.join(this.cwd, this.packageJSONBackupFileName),
228
- path.join(this.cwd, this.packageJSON)
229
- ),
230
- ];
231
-
232
- let nodeModulesBackupLocation = path.join(this.cwd, this.nodeModulesBackupLocation);
233
- if (fs.existsSync(nodeModulesBackupLocation)) {
234
- restoreTasks.push(
235
- copy(nodeModulesBackupLocation, path.join(this.cwd, this.nodeModules), { clobber: true })
236
- );
237
- }
238
-
239
- let yarnLockBackupFileName = path.join(this.cwd, this.yarnLockBackupFileName);
240
- if (fs.existsSync(yarnLockBackupFileName)) {
241
- restoreTasks.push(copy(yarnLockBackupFileName, path.join(this.cwd, this.yarnLock)));
242
- }
243
-
244
- let npmShrinkWrapBackupFileName = path.join(this.cwd, this.npmShrinkWrapBackupFileName);
245
- if (fs.existsSync(npmShrinkWrapBackupFileName)) {
246
- restoreTasks.push(copy(npmShrinkWrapBackupFileName, path.join(this.cwd, this.npmShrinkWrap)));
247
- }
248
-
249
- let packageLockBackupFileName = path.join(this.cwd, this.packageLockBackupFileName);
250
- if (fs.existsSync(packageLockBackupFileName)) {
251
- restoreTasks.push(copy(packageLockBackupFileName, path.join(this.cwd, this.packageLock)));
252
- }
253
-
254
- return Promise.all(restoreTasks);
255
- },
256
-
257
- _backupOriginalDependencies() {
258
- debug('Backing up package.json and node_modules');
259
-
260
- let backupTasks = [
261
- copy(
262
- path.join(this.cwd, this.packageJSON),
263
- path.join(this.cwd, this.packageJSONBackupFileName)
264
- ),
265
- ];
266
-
267
- let nodeModulesPath = path.join(this.cwd, this.nodeModules);
268
- if (fs.existsSync(nodeModulesPath)) {
269
- backupTasks.push(
270
- copy(nodeModulesPath, path.join(this.cwd, this.nodeModulesBackupLocation), {
271
- clobber: true,
272
- })
273
- );
274
- }
275
-
276
- let yarnLockPath = path.join(this.cwd, this.yarnLock);
277
- if (fs.existsSync(yarnLockPath)) {
278
- backupTasks.push(copy(yarnLockPath, path.join(this.cwd, this.yarnLockBackupFileName)));
279
- }
280
-
281
- let npmShrinkWrapPath = path.join(this.cwd, this.npmShrinkWrap);
282
- if (fs.existsSync(npmShrinkWrapPath)) {
283
- backupTasks.push(
284
- copy(npmShrinkWrapPath, path.join(this.cwd, this.npmShrinkWrapBackupFileName))
285
- );
286
- }
287
-
288
- let packageLockPath = path.join(this.cwd, this.packageLock);
289
- if (fs.existsSync(packageLockPath)) {
290
- backupTasks.push(copy(packageLockPath, path.join(this.cwd, this.packageLockBackupFileName)));
291
- }
292
-
293
- return Promise.all(backupTasks);
294
- },
295
- });
3
+ const { LOCKFILE } = require('../utils/package-managers');
4
+ const { BaseAdapter } = require('./base');
5
+
6
+ module.exports = class NpmAdapter extends BaseAdapter {
7
+ defaultInstallOptions = ['--no-package-lock'];
8
+ lockfile = LOCKFILE.npm;
9
+ name = 'npm';
10
+ overridesKey = 'overrides';
11
+ };
@@ -1,172 +1,152 @@
1
1
  'use strict';
2
2
 
3
- const CoreObject = require('core-object');
4
3
  const fs = require('fs-extra');
5
- const path = require('path');
6
- const debug = require('debug')('ember-try:dependency-manager-adapter:pnpm');
4
+ const path = require('node:path');
5
+ const semver = require('semver');
6
+ const YAML = require('yaml');
7
+ const { LOCKFILE } = require('../utils/package-managers');
8
+ const { BaseAdapter } = require('./base');
7
9
 
8
- const PACKAGE_JSON = 'package.json';
9
- const PACKAGE_JSON_BACKUP = 'package.json.ember-try';
10
- const PNPM_LOCKFILE = 'pnpm-lock.yaml';
10
+ const WORKSPACE_YAML = 'pnpm-workspace.yaml';
11
11
 
12
- // Note: the upstream convention is to append `.ember-try` _after_ the file
13
- // extension, however this breaks syntax highlighting, so I've chosen to
14
- // insert it right before the file extension.
15
- const PNPM_LOCKFILE_BACKUP = 'pnpm-lock.ember-try.yaml';
12
+ module.exports = class PnpmAdapter extends BaseAdapter {
13
+ defaultInstallOptions = ['--no-lockfile', '--ignore-scripts'];
14
+ lockfile = LOCKFILE.pnpm;
15
+ name = 'pnpm';
16
+ overridesKey = 'pnpm.overrides';
16
17
 
17
- module.exports = CoreObject.extend({
18
- // This still needs to be `npm` because we're still reading the dependencies
19
- // from the `npm` key of the ember-try config.
20
- configKey: 'npm',
21
-
22
- init() {
23
- this._super.apply(this, arguments);
24
- this.run = this.run || require('../utils/run');
25
- },
18
+ pnpmVersion = null;
19
+ workspaceOverrides = null;
26
20
 
27
21
  async setup() {
28
- let pkg = path.join(this.cwd, PACKAGE_JSON);
29
- let pkgBackup = path.join(this.cwd, PACKAGE_JSON_BACKUP);
30
- debug(`Copying ${PACKAGE_JSON}`);
31
- await fs.copy(pkg, pkgBackup);
32
-
33
- let lockFile = path.join(this.cwd, PNPM_LOCKFILE);
34
- let lockFileBackup = path.join(this.cwd, PNPM_LOCKFILE_BACKUP);
35
- if (fs.existsSync(lockFile)) {
36
- debug(`Copying ${PNPM_LOCKFILE}`);
37
- await fs.copy(lockFile, lockFileBackup);
38
- }
39
- },
22
+ await this._throwOnResolutionMode();
23
+ await super.setup();
24
+ await this.backup.addFile(WORKSPACE_YAML);
25
+ }
40
26
 
41
- async changeToDependencySet(depSet) {
42
- await this.applyDependencySet(depSet);
27
+ async applyDependencySet(dependencySet) {
28
+ await super.applyDependencySet(dependencySet);
43
29
 
44
- await this._install(depSet);
45
-
46
- let deps = Object.assign({}, depSet.dependencies, depSet.devDependencies);
47
- let currentDeps = Object.keys(deps).map((dep) => {
48
- return {
49
- name: dep,
50
- versionExpected: deps[dep],
51
- versionSeen: this._findCurrentVersionOf(dep),
52
- packageManager: 'pnpm',
53
- };
54
- });
55
-
56
- debug('Switched to dependencies: \n', currentDeps);
57
-
58
- return currentDeps;
59
- },
30
+ if (this.workspaceOverrides !== null) {
31
+ this._writeWorkspaceOverrides(this.workspaceOverrides);
32
+ }
33
+ }
60
34
 
61
35
  async cleanup() {
62
- try {
63
- debug(`Restoring original ${PACKAGE_JSON}`);
64
- let pkg = path.join(this.cwd, PACKAGE_JSON);
65
- let pkgBackup = path.join(this.cwd, PACKAGE_JSON_BACKUP);
66
- await fs.copy(pkgBackup, pkg);
67
- await fs.remove(pkgBackup);
68
-
69
- debug(`Restoring original ${PNPM_LOCKFILE}`);
70
- let lockFile = path.join(this.cwd, PNPM_LOCKFILE);
71
- let lockFileBackup = path.join(this.cwd, PNPM_LOCKFILE_BACKUP);
72
- await fs.copy(lockFileBackup, lockFile);
73
- await fs.remove(lockFileBackup);
74
-
75
- await this._install();
76
- } catch (e) {
77
- console.log('Error cleaning up scenario:', e); // eslint-disable-line no-console
36
+ if (this.workspaceOverrides !== null) {
37
+ if (fs.existsSync(this.backup.pathForFile(WORKSPACE_YAML))) {
38
+ await this.backup.restoreFile(WORKSPACE_YAML);
39
+ } else {
40
+ await fs.remove(path.join(this.cwd, WORKSPACE_YAML));
41
+ }
78
42
  }
79
- },
80
43
 
81
- _findCurrentVersionOf(packageName) {
82
- let filename = path.join(this.cwd, 'node_modules', packageName, PACKAGE_JSON);
83
- if (fs.existsSync(filename)) {
84
- return JSON.parse(fs.readFileSync(filename)).version;
85
- } else {
86
- return null;
44
+ await super.cleanup();
45
+ }
46
+
47
+ _packageJSONForDependencySet(packageJSON, dependencySet) {
48
+ if (!this._readsWorkspaceSettings()) {
49
+ return super._packageJSONForDependencySet(packageJSON, dependencySet);
87
50
  }
88
- },
89
51
 
90
- async _install(depSet) {
91
- let mgrOptions = this.managerOptions || [];
52
+ // pnpm 11 and later ignore the `pnpm` field in package.json
53
+ const originalPnpmField = packageJSON.pnpm;
92
54
 
93
- // buildManagerOptions overrides all default
94
- if (typeof this.buildManagerOptions === 'function') {
95
- mgrOptions = this.buildManagerOptions(depSet);
55
+ packageJSON.pnpm = { overrides: { ...this._readWorkspaceOverrides() } };
96
56
 
97
- if (!Array.isArray(mgrOptions)) {
98
- throw new Error('buildManagerOptions must return an array of options');
99
- }
57
+ const result = super._packageJSONForDependencySet(packageJSON, dependencySet);
58
+
59
+ this.workspaceOverrides = result.pnpm.overrides;
60
+
61
+ if (originalPnpmField === undefined) {
62
+ delete result.pnpm;
100
63
  } else {
101
- if (!mgrOptions.includes('--no-lockfile')) {
102
- mgrOptions.push('--no-lockfile');
103
- }
64
+ result.pnpm = originalPnpmField;
104
65
  }
105
66
 
106
- // Note: We are explicitly *not* using `--no-lockfile` here, so that we
107
- // only have to resolve the dependencies that have actually changed.
108
-
109
- debug('Run pnpm install with options %s', mgrOptions);
67
+ return result;
68
+ }
110
69
 
111
- await this.run('pnpm', [].concat(['install'], mgrOptions), { cwd: this.cwd });
112
- },
70
+ _readsWorkspaceSettings() {
71
+ return this.pnpmVersion !== null && semver.satisfies(this.pnpmVersion, '>=11.0.0');
72
+ }
113
73
 
114
- async applyDependencySet(depSet) {
115
- debug('Changing to dependency set: %s', JSON.stringify(depSet));
74
+ _readWorkspaceDocument() {
75
+ const backupFile = this.backup.pathForFile(WORKSPACE_YAML);
116
76
 
117
- if (!depSet) {
118
- return;
77
+ if (fs.existsSync(backupFile)) {
78
+ return YAML.parseDocument(fs.readFileSync(backupFile, 'utf-8'));
119
79
  }
120
80
 
121
- let backupPackageJSON = path.join(this.cwd, PACKAGE_JSON_BACKUP);
122
- let packageJSONFile = path.join(this.cwd, PACKAGE_JSON);
123
- let packageJSON = JSON.parse(fs.readFileSync(backupPackageJSON));
124
- let newPackageJSON = this._packageJSONForDependencySet(packageJSON, depSet);
81
+ return new YAML.Document({});
82
+ }
125
83
 
126
- debug('Write package.json with: \n', JSON.stringify(newPackageJSON));
127
- fs.writeFileSync(packageJSONFile, JSON.stringify(newPackageJSON, null, 2));
84
+ _readWorkspaceOverrides() {
85
+ return this._readWorkspaceDocument().toJS()?.overrides ?? {};
86
+ }
128
87
 
129
- // We restore the original lockfile here, so that we always create a minimal
130
- // diff compared to the original locked dependency set.
88
+ _writeWorkspaceOverrides(overrides) {
89
+ const hasOverrides = Object.keys(overrides).length > 0;
131
90
 
132
- let lockFile = path.join(this.cwd, PNPM_LOCKFILE);
133
- let lockFileBackup = path.join(this.cwd, PNPM_LOCKFILE_BACKUP);
134
- if (fs.existsSync(lockFileBackup)) {
135
- debug(`Restoring original ${PNPM_LOCKFILE}`);
136
- await fs.copy(lockFileBackup, lockFile);
91
+ if (!hasOverrides && !fs.existsSync(this.backup.pathForFile(WORKSPACE_YAML))) {
92
+ return;
137
93
  }
138
- },
139
94
 
140
- _packageJSONForDependencySet(packageJSON, depSet) {
141
- this._overridePackageJSONDependencies(packageJSON, depSet, 'dependencies');
142
- this._overridePackageJSONDependencies(packageJSON, depSet, 'devDependencies');
143
- this._overridePackageJSONDependencies(packageJSON, depSet, 'peerDependencies');
144
- this._overridePackageJSONDependencies(packageJSON, depSet, 'ember');
95
+ const document = this._readWorkspaceDocument();
145
96
 
146
- // see https://pnpm.io/package_json#pnpmoverrides
147
- this._overridePackageJSONDependencies(packageJSON, depSet, 'overrides');
148
-
149
- return packageJSON;
150
- },
97
+ if (!hasOverrides) {
98
+ document.delete('overrides');
99
+ } else {
100
+ document.set('overrides', overrides);
101
+ }
151
102
 
152
- _overridePackageJSONDependencies(packageJSON, depSet, kindOfDependency) {
153
- if (!depSet[kindOfDependency]) {
154
- return;
103
+ fs.writeFileSync(path.join(this.cwd, WORKSPACE_YAML), document.toString());
104
+ }
105
+
106
+ /**
107
+ * pnpm versions 8.0.0 through 8.6.* have the `resolution-mode` setting inverted to
108
+ * `lowest-direct`, which breaks ember-try. This method throws a helpful error in the following
109
+ * case: pnpm version is within dangerous range and `pnpm config get resolution-mode` reports an
110
+ * empty value.
111
+ *
112
+ * @returns Promise<void>
113
+ */
114
+ async _throwOnResolutionMode() {
115
+ this.pnpmVersion = await this._getPnpmVersion();
116
+ let resolutionMode = await this._getResolutionMode();
117
+
118
+ if (this._isResolutionModeWrong(this.pnpmVersion, resolutionMode)) {
119
+ throw new Error(
120
+ 'You are using an old version of pnpm that uses wrong resolution mode that violates ember-try expectations. Please either upgrade pnpm or set `resolution-mode` to `highest` in `.npmrc`.',
121
+ );
155
122
  }
123
+ }
156
124
 
157
- let packageNames = Object.keys(depSet[kindOfDependency]);
125
+ async _getPnpmVersion() {
126
+ let result = await this.run('pnpm', ['--version'], { cwd: this.cwd, stdio: 'pipe' });
127
+ return result.stdout.split('\n')[0];
128
+ }
158
129
 
159
- for (let packageName of packageNames) {
160
- if (!packageJSON[kindOfDependency]) {
161
- packageJSON[kindOfDependency] = {};
162
- }
130
+ async _getResolutionMode() {
131
+ let result = await this.run('pnpm', ['config', 'get', 'resolution-mode'], {
132
+ cwd: this.cwd,
133
+ stdio: 'pipe',
134
+ });
163
135
 
164
- let version = depSet[kindOfDependency][packageName];
165
- if (version === null) {
166
- delete packageJSON[kindOfDependency][packageName];
167
- } else {
168
- packageJSON[kindOfDependency][packageName] = version;
169
- }
136
+ return result.stdout.split('\n')[0];
137
+ }
138
+
139
+ _isResolutionModeWrong(versionStr, resolutionMode) {
140
+ // The `resolution-mode` is not set explicitly, and the current pnpm version makes it default
141
+ // to `lowest-direct`
142
+ if (
143
+ !resolutionMode.length &&
144
+ semver.gte(versionStr, '8.0.0') &&
145
+ semver.lt(versionStr, '8.7.0')
146
+ ) {
147
+ return true;
170
148
  }
171
- },
172
- });
149
+
150
+ return false;
151
+ }
152
+ };