Skip to content

Commit 80587e6

Browse files
committed
Drop support for --no-shrinkwrap
1 parent b6f51aa commit 80587e6

8 files changed

Lines changed: 11 additions & 51 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ module.exports = async function() {
109109
/*
110110
`npmOptions` - options to be passed to `npm`.
111111
*/
112-
npmOptions: ['--loglevel=silent', '--no-shrinkwrap=true'],
112+
npmOptions: ['--loglevel=silent'],
113113
/*
114114
If set to true, the `versionCompatibility` key under `ember-addon` in `package.json` will be used to
115115
automatically generate scenarios that will deep merge with any in this configuration file.
@@ -218,7 +218,7 @@ If you include `usePnpm: true` in your `ember-try` config, all npm scenarios wil
218218

219219
##### A note on npm scenarios with lockfiles
220220

221-
Lockfiles are ignored by `ember-try`. (`yarn` will run with `--no-lockfile` and `npm` will be run with `--no-shrinkwrap` and `pnpm` will be run with `--no-lockfile`).
221+
Lockfiles are ignored by `ember-try`. (`yarn` will run with `--no-lockfile` and `npm` will be run with `--no-package-lock` and `pnpm` will be run with `--no-lockfile`).
222222
When testing various scenarios, it's important to "float" dependencies so that the scenarios are run with the latest satisfying versions of dependencies a user of the project would get.
223223

224224
##### Workspaces

lib/dependency-manager-adapters/npm.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ module.exports = CoreObject.extend({
2121
configKey: 'npm',
2222
packageJSON: 'package.json',
2323
packageJSONBackupFileName: 'package.json.ember-try',
24-
npmShrinkWrap: 'npm-shrinkwrap.json',
25-
npmShrinkWrapBackupFileName: 'npm-shrinkwrap.json.ember-try',
2624
packageLock: 'package-lock.json',
2725
packageLockBackupFileName: 'package-lock.json.ember-try',
2826

@@ -68,10 +66,6 @@ module.exports = CoreObject.extend({
6866
cleanupTasks.push(rimraf(path.join(this.cwd, this.yarnLockBackupFileName)));
6967
}
7068

71-
if (fs.existsSync(path.join(this.cwd, this.npmShrinkWrapBackupFileName))) {
72-
cleanupTasks.push(rimraf(path.join(this.cwd, this.npmShrinkWrapBackupFileName)));
73-
}
74-
7569
if (fs.existsSync(path.join(this.cwd, this.packageLockBackupFileName))) {
7670
cleanupTasks.push(rimraf(path.join(this.cwd, this.packageLockBackupFileName)));
7771
}
@@ -128,8 +122,8 @@ module.exports = CoreObject.extend({
128122
if (mgrOptions.indexOf('--ignore-engines') === -1) {
129123
mgrOptions = mgrOptions.concat(['--ignore-engines']);
130124
}
131-
} else if (mgrOptions.indexOf('--no-shrinkwrap') === -1) {
132-
mgrOptions = mgrOptions.concat(['--no-shrinkwrap']);
125+
} else if (mgrOptions.indexOf('--no-package-lock') === -1) {
126+
mgrOptions = mgrOptions.concat(['--no-package-lock']);
133127
}
134128
}
135129

@@ -218,11 +212,6 @@ module.exports = CoreObject.extend({
218212
restoreTasks.push(copy(yarnLockBackupFileName, path.join(this.cwd, this.yarnLock)));
219213
}
220214

221-
let npmShrinkWrapBackupFileName = path.join(this.cwd, this.npmShrinkWrapBackupFileName);
222-
if (fs.existsSync(npmShrinkWrapBackupFileName)) {
223-
restoreTasks.push(copy(npmShrinkWrapBackupFileName, path.join(this.cwd, this.npmShrinkWrap)));
224-
}
225-
226215
let packageLockBackupFileName = path.join(this.cwd, this.packageLockBackupFileName);
227216
if (fs.existsSync(packageLockBackupFileName)) {
228217
restoreTasks.push(copy(packageLockBackupFileName, path.join(this.cwd, this.packageLock)));
@@ -246,13 +235,6 @@ module.exports = CoreObject.extend({
246235
backupTasks.push(copy(yarnLockPath, path.join(this.cwd, this.yarnLockBackupFileName)));
247236
}
248237

249-
let npmShrinkWrapPath = path.join(this.cwd, this.npmShrinkWrap);
250-
if (fs.existsSync(npmShrinkWrapPath)) {
251-
backupTasks.push(
252-
copy(npmShrinkWrapPath, path.join(this.cwd, this.npmShrinkWrapBackupFileName))
253-
);
254-
}
255-
256238
let packageLockPath = path.join(this.cwd, this.packageLock);
257239
if (fs.existsSync(packageLockPath)) {
258240
backupTasks.push(copy(packageLockPath, path.join(this.cwd, this.packageLockBackupFileName)));

smoke-test-app/.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
# ember-try
2020
/bower.json.ember-try
21-
/npm-shrinkwrap.json.ember-try
2221
/package.json.ember-try
2322
/package-lock.json.ember-try
2423
/yarn.lock.ember-try

smoke-test-app/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222

2323
# ember-try
2424
/bower.json.ember-try
25-
/npm-shrinkwrap.json.ember-try
2625
/package.json.ember-try
2726
/package-lock.json.ember-try
2827
/yarn.lock.ember-try

smoke-test-app/.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
# ember-try
3434
/bower.json.ember-try
35-
/npm-shrinkwrap.json.ember-try
3635
/package.json.ember-try
3736
/package-lock.json.ember-try
3837
/yarn.lock.ember-try

smoke-test-app/.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
# ember-try
2020
/bower.json.ember-try
21-
/npm-shrinkwrap.json.ember-try
2221
/package.json.ember-try
2322
/package-lock.json.ember-try
2423
/yarn.lock.ember-try

test/dependency-manager-adapters/npm-adapter-test.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ describe('npmAdapter', () => {
4040
});
4141
});
4242

43-
it('backs up the yarn.lock file, npm-shrinkwrap.json and package-lock.json if they exist', async () => {
43+
it('backs up the yarn.lock file and package-lock.json if they exist', async () => {
4444
fs.mkdirSync('node_modules');
4545
writeJSONFile('package.json', { originalPackageJSON: true });
4646
writeJSONFile('yarn.lock', { originalYarnLock: true });
47-
writeJSONFile('npm-shrinkwrap.json', { originalNpmShrinkWrap: true });
4847
writeJSONFile('package-lock.json', { originalPackageLock: true });
4948

5049
let adapter = new NpmAdapter({ cwd: tmpdir });
@@ -56,9 +55,6 @@ describe('npmAdapter', () => {
5655
assertFileContainsJSON(path.join(tmpdir, 'yarn.lock.ember-try'), {
5756
originalYarnLock: true,
5857
});
59-
assertFileContainsJSON(path.join(tmpdir, 'npm-shrinkwrap.json.ember-try'), {
60-
originalNpmShrinkWrap: true,
61-
});
6258
assertFileContainsJSON(path.join(tmpdir, 'package-lock.json.ember-try'), {
6359
originalPackageLock: true,
6460
});
@@ -73,7 +69,7 @@ describe('npmAdapter', () => {
7369
let stubbedRun = generateMockRun(
7470
[
7571
{
76-
command: 'npm install --no-shrinkwrap',
72+
command: 'npm install --no-package-lock',
7773
callback(command, args, opts) {
7874
runCount++;
7975
expect(opts).to.have.property('cwd', tmpdir);
@@ -99,7 +95,7 @@ describe('npmAdapter', () => {
9995
let stubbedRun = generateMockRun(
10096
[
10197
{
102-
command: 'npm install --no-optional --no-shrinkwrap',
98+
command: 'npm install --no-optional --no-package-lock',
10399
callback() {
104100
runCount++;
105101
return RSVP.resolve();
@@ -284,13 +280,11 @@ describe('npmAdapter', () => {
284280
assertFileContainsJSON(path.join(tmpdir, 'package.json'), { originalPackageJSON: true });
285281
});
286282

287-
it('replaces the yarn.lock, npm-shrinkwrap.json and package-lock.json with the backed up version if they exist', async () => {
283+
it('replaces the yarn.lock and package-lock.json with the backed up version if they exist', async () => {
288284
writeJSONFile('package.json.ember-try', { originalPackageJSON: true });
289285
writeJSONFile('package.json', { originalPackageJSON: false });
290286
writeJSONFile('yarn.lock.ember-try', { originalYarnLock: true });
291287
writeJSONFile('yarn.lock', { originalYarnLock: false });
292-
writeJSONFile('npm-shrinkwrap.json.ember-try', { originalNpmShrinkWrap: true });
293-
writeJSONFile('npm-shrinkwrap.json', { originalNpmShrinkWrap: false });
294288
writeJSONFile('package-lock.json.ember-try', { originalPackageLock: true });
295289
writeJSONFile('package-lock.json', { originalPackageLock: false });
296290

@@ -299,9 +293,6 @@ describe('npmAdapter', () => {
299293

300294
assertFileContainsJSON(path.join(tmpdir, 'package.json'), { originalPackageJSON: true });
301295
assertFileContainsJSON(path.join(tmpdir, 'yarn.lock'), { originalYarnLock: true });
302-
assertFileContainsJSON(path.join(tmpdir, 'npm-shrinkwrap.json'), {
303-
originalNpmShrinkWrap: true,
304-
});
305296
assertFileContainsJSON(path.join(tmpdir, 'package-lock.json'), {
306297
originalPackageLock: true,
307298
});
@@ -314,7 +305,7 @@ describe('npmAdapter', () => {
314305
let stubbedRun = generateMockRun(
315306
[
316307
{
317-
command: 'npm install --no-shrinkwrap',
308+
command: 'npm install --no-package-lock',
318309
callback() {
319310
runCount++;
320311
return Promise.resolve();

test/dependency-manager-adapters/workspace-adapter-test.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ describe('workspaceAdapter', () => {
7171
});
7272
});
7373

74-
it('backs up the yarn.lock file, npm-shrinkwrap.json and package-lock.json if they exist', () => {
74+
it('backs up the yarn.lock file and package-lock.json if they exist', () => {
7575
fs.ensureDirSync('packages/test/node_modules');
7676

7777
writeJSONFile('packages/test/package.json', { originalPackageJSON: true });
7878
writeJSONFile('packages/test/yarn.lock', { originalYarnLock: true });
79-
writeJSONFile('packages/test/npm-shrinkwrap.json', { originalNpmShrinkWrap: true });
8079
writeJSONFile('packages/test/package-lock.json', { originalPackageLock: true });
8180
return new WorkspaceAdapter({
8281
cwd: tmpdir,
@@ -90,9 +89,6 @@ describe('workspaceAdapter', () => {
9089
assertFileContainsJSON(path.join(tmpdir, 'packages/test/yarn.lock.ember-try'), {
9190
originalYarnLock: true,
9291
});
93-
assertFileContainsJSON(path.join(tmpdir, 'packages/test/npm-shrinkwrap.json.ember-try'), {
94-
originalNpmShrinkWrap: true,
95-
});
9692
assertFileContainsJSON(path.join(tmpdir, 'packages/test/package-lock.json.ember-try'), {
9793
originalPackageLock: true,
9894
});
@@ -273,12 +269,11 @@ describe('workspaceAdapter', () => {
273269
});
274270
});
275271

276-
it('replaces the yarn.lock, npm-shrinkwrap.json and package-lock.json with the backed up version if they exist', () => {
272+
it('replaces the yarn.lock and package-lock.json with the backed up version if they exist', () => {
277273
fs.ensureDirSync('packages/test/node_modules');
278274

279275
writeJSONFile('packages/test/package.json', { originalPackageJSON: true });
280276
writeJSONFile('packages/test/yarn.lock', { originalYarnLock: true });
281-
writeJSONFile('packages/test/npm-shrinkwrap.json', { originalNpmShrinkWrap: true });
282277
writeJSONFile('packages/test/package-lock.json', { originalPackageLock: true });
283278

284279
let workspaceAdapter = new WorkspaceAdapter({
@@ -292,7 +287,6 @@ describe('workspaceAdapter', () => {
292287
.then(() => {
293288
writeJSONFile('packages/test/package.json', { originalPackageJSON: false });
294289
writeJSONFile('packages/test/yarn.lock', { originalYarnLock: false });
295-
writeJSONFile('packages/test/npm-shrinkwrap.json', { originalNpmShrinkWrap: false });
296290
writeJSONFile('packages/test/package-lock.json', { originalPackageLock: false });
297291

298292
return workspaceAdapter.cleanup();
@@ -304,9 +298,6 @@ describe('workspaceAdapter', () => {
304298
assertFileContainsJSON(path.join(tmpdir, 'packages/test/yarn.lock'), {
305299
originalYarnLock: true,
306300
});
307-
assertFileContainsJSON(path.join(tmpdir, 'packages/test/npm-shrinkwrap.json'), {
308-
originalNpmShrinkWrap: true,
309-
});
310301
assertFileContainsJSON(path.join(tmpdir, 'packages/test/package-lock.json'), {
311302
originalPackageLock: true,
312303
});

0 commit comments

Comments
 (0)