From 81db62227ccf93e558d0dc6bef148de93361b8bb Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Wed, 1 Sep 2021 17:20:19 +0100 Subject: [PATCH 1/3] chore(yarn-cling): rename test packages to real package names The tests for `yarn-cling` currently reference what were imaginary package names as placeholders; those package names have now been registered. While this has no practical impact, switching the package names to be ones we own just so there's no ambiguity. --- tools/yarn-cling/test/cling.test.ts | 16 ++++++++-------- .../node_modules/aws-cdk-lib/package.json | 4 ++++ .../package1/node_modules/aws-cdk/package.json | 7 +++++++ .../registrydependency1/package.json | 7 ------- .../registrydependency2/package.json | 4 ---- .../test/test-fixture/package1/package.json | 2 +- tools/yarn-cling/test/test-fixture/yarn.lock | 4 ++-- 7 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk-lib/package.json create mode 100644 tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk/package.json delete mode 100644 tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json delete mode 100644 tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json diff --git a/tools/yarn-cling/test/cling.test.ts b/tools/yarn-cling/test/cling.test.ts index 1628d2415a1ae..d4e069c51facb 100644 --- a/tools/yarn-cling/test/cling.test.ts +++ b/tools/yarn-cling/test/cling.test.ts @@ -13,12 +13,12 @@ test('generate lock for fixture directory', async () => { requires: true, version: '1.1.1', dependencies: { - package2: { + 'package2': { version: '2.2.2', }, - registrydependency1: { + 'aws-cdk': { dependencies: { - registrydependency2: { + 'aws-cdk-lib': { integrity: 'sha512-pineapple', resolved: 'https://registry.bla.com/stuff', version: '2.3.999', @@ -26,7 +26,7 @@ test('generate lock for fixture directory', async () => { }, integrity: 'sha512-banana', requires: { - registrydependency2: '^2.3.4', + 'aws-cdk-lib': '^2.3.4', }, resolved: 'https://registry.bla.com/stuff', version: '1.2.999', @@ -47,18 +47,18 @@ test('generate hoisted lock for fixture directory', async () => { requires: true, version: '1.1.1', dependencies: { - package2: { + 'package2': { version: '2.2.2', }, - registrydependency1: { + 'aws-cdk': { integrity: 'sha512-banana', requires: { - registrydependency2: '^2.3.4', + 'aws-cdk-lib': '^2.3.4', }, resolved: 'https://registry.bla.com/stuff', version: '1.2.999', }, - registrydependency2: { + 'aws-cdk-lib': { integrity: 'sha512-pineapple', resolved: 'https://registry.bla.com/stuff', version: '2.3.999', diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk-lib/package.json b/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk-lib/package.json new file mode 100644 index 0000000000000..2721d93a758df --- /dev/null +++ b/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk-lib/package.json @@ -0,0 +1,4 @@ +{ + "name": "aws-cdk-lib", + "version": "2.3.999" +} diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk/package.json b/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk/package.json new file mode 100644 index 0000000000000..f074216bccb3b --- /dev/null +++ b/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk/package.json @@ -0,0 +1,7 @@ +{ + "name": "aws-cdk", + "version": "1.2.999", + "dependencies": { + "aws-cdk-lib": "^2.3.4" + } +} diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json b/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json deleted file mode 100644 index 8ecbc5b50e2e6..0000000000000 --- a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "registrydependency1", - "version": "1.2.999", - "dependencies": { - "registrydependency2": "^2.3.4" - } -} diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json b/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json deleted file mode 100644 index 8b9d7f39ababd..0000000000000 --- a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "registrydependency2", - "version": "2.3.999" -} diff --git a/tools/yarn-cling/test/test-fixture/package1/package.json b/tools/yarn-cling/test/test-fixture/package1/package.json index 8edf6d46e6537..451eb217e0f7e 100644 --- a/tools/yarn-cling/test/test-fixture/package1/package.json +++ b/tools/yarn-cling/test/test-fixture/package1/package.json @@ -2,7 +2,7 @@ "name": "package1", "version": "1.1.1", "dependencies": { - "registrydependency1": "^1.2.3", + "aws-cdk": "^1.2.3", "package2": "2.2.2" } } diff --git a/tools/yarn-cling/test/test-fixture/yarn.lock b/tools/yarn-cling/test/test-fixture/yarn.lock index fda733502a052..bb94543e94422 100644 --- a/tools/yarn-cling/test/test-fixture/yarn.lock +++ b/tools/yarn-cling/test/test-fixture/yarn.lock @@ -1,9 +1,9 @@ -"registrydependency1@^1.2.3": +"aws-cdk@^1.2.3": version "1.2.999" resolved "https://registry.bla.com/stuff" integrity sha512-banana -"registrydependency2@^2.3.4": +"aws-cdk-lib@^2.3.4": version "2.3.999" resolved "https://registry.bla.com/stuff" integrity sha512-pineapple From 35adb22d70f0c64ca233449a2c89f0f01d51bf0e Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Wed, 1 Sep 2021 17:42:21 +0100 Subject: [PATCH 2/3] renaming package2 as well --- tools/yarn-cling/package.json | 2 +- tools/yarn-cling/test/cling.test.ts | 8 ++++---- .../test/test-fixture/{package2 => cdk}/package.json | 2 +- .../test/test-fixture/package1/node_modules/cdk | 1 + .../test/test-fixture/package1/node_modules/package2 | 1 - tools/yarn-cling/test/test-fixture/package1/package.json | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) rename tools/yarn-cling/test/test-fixture/{package2 => cdk}/package.json (52%) create mode 120000 tools/yarn-cling/test/test-fixture/package1/node_modules/cdk delete mode 120000 tools/yarn-cling/test/test-fixture/package1/node_modules/package2 diff --git a/tools/yarn-cling/package.json b/tools/yarn-cling/package.json index 52501bf50f83e..39eca48e32e8e 100644 --- a/tools/yarn-cling/package.json +++ b/tools/yarn-cling/package.json @@ -16,7 +16,7 @@ "build": "tsc", "watch": "tsc -w", "pkglint": "pkglint -f", - "test": "ln -sf ../../package2 test/test-fixture/package1/node_modules/ && jest", + "test": "ln -sf ../../cdk test/test-fixture/package1/node_modules/ && jest", "build+test+package": "yarn build+test", "build+test": "yarn build && yarn test", "build+extract": "yarn build", diff --git a/tools/yarn-cling/test/cling.test.ts b/tools/yarn-cling/test/cling.test.ts index d4e069c51facb..2cb74915b0987 100644 --- a/tools/yarn-cling/test/cling.test.ts +++ b/tools/yarn-cling/test/cling.test.ts @@ -13,7 +13,7 @@ test('generate lock for fixture directory', async () => { requires: true, version: '1.1.1', dependencies: { - 'package2': { + 'cdk': { version: '2.2.2', }, 'aws-cdk': { @@ -47,7 +47,7 @@ test('generate hoisted lock for fixture directory', async () => { requires: true, version: '1.1.1', dependencies: { - 'package2': { + 'cdk': { version: '2.2.2', }, 'aws-cdk': { @@ -77,10 +77,10 @@ test('fail when requires cannot be satisfied', async () => { package1: { version: '2.2.2', requires: { - package2: '^3.3.3', // <- this needs to be adjusted + cdk: '^3.3.3', // <- this needs to be adjusted }, }, - package2: { + cdk: { version: '4.4.4', }, }, diff --git a/tools/yarn-cling/test/test-fixture/package2/package.json b/tools/yarn-cling/test/test-fixture/cdk/package.json similarity index 52% rename from tools/yarn-cling/test/test-fixture/package2/package.json rename to tools/yarn-cling/test/test-fixture/cdk/package.json index d10f139d13944..8594e124f71b7 100644 --- a/tools/yarn-cling/test/test-fixture/package2/package.json +++ b/tools/yarn-cling/test/test-fixture/cdk/package.json @@ -1,4 +1,4 @@ { - "name": "package2", + "name": "cdk", "version": "2.2.2" } diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/cdk b/tools/yarn-cling/test/test-fixture/package1/node_modules/cdk new file mode 120000 index 0000000000000..7ce3fadc4aadf --- /dev/null +++ b/tools/yarn-cling/test/test-fixture/package1/node_modules/cdk @@ -0,0 +1 @@ +../../cdk \ No newline at end of file diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/package2 b/tools/yarn-cling/test/test-fixture/package1/node_modules/package2 deleted file mode 120000 index 8db12e196dfbd..0000000000000 --- a/tools/yarn-cling/test/test-fixture/package1/node_modules/package2 +++ /dev/null @@ -1 +0,0 @@ -../../package2 \ No newline at end of file diff --git a/tools/yarn-cling/test/test-fixture/package1/package.json b/tools/yarn-cling/test/test-fixture/package1/package.json index 451eb217e0f7e..f962d062fe2d2 100644 --- a/tools/yarn-cling/test/test-fixture/package1/package.json +++ b/tools/yarn-cling/test/test-fixture/package1/package.json @@ -3,6 +3,6 @@ "version": "1.1.1", "dependencies": { "aws-cdk": "^1.2.3", - "package2": "2.2.2" + "cdk": "2.2.2" } } From 00c6e460df9217304eb2903f22d19541d042283a Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Wed, 1 Sep 2021 17:57:09 +0100 Subject: [PATCH 3/3] why not. renaming package1 as well --- tools/yarn-cling/.gitignore | 4 ++-- tools/yarn-cling/package.json | 2 +- tools/yarn-cling/test/cling.test.ts | 12 ++++++------ .../node_modules/aws-cdk-lib/package.json | 0 .../node_modules/aws-cdk/package.json | 0 .../test-fixture/{package1 => jsii}/node_modules/cdk | 0 .../test-fixture/{package1 => jsii}/package.json | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) rename tools/yarn-cling/test/test-fixture/{package1 => jsii}/node_modules/aws-cdk-lib/package.json (100%) rename tools/yarn-cling/test/test-fixture/{package1 => jsii}/node_modules/aws-cdk/package.json (100%) rename tools/yarn-cling/test/test-fixture/{package1 => jsii}/node_modules/cdk (100%) rename tools/yarn-cling/test/test-fixture/{package1 => jsii}/package.json (81%) diff --git a/tools/yarn-cling/.gitignore b/tools/yarn-cling/.gitignore index 884f5381e01ab..bef31def37928 100644 --- a/tools/yarn-cling/.gitignore +++ b/tools/yarn-cling/.gitignore @@ -11,5 +11,5 @@ dist coverage nyc.config.js !.eslintrc.js -!test/test-fixture/package1/node_modules/ -junit.xml \ No newline at end of file +!test/test-fixture/jsii/node_modules/ +junit.xml diff --git a/tools/yarn-cling/package.json b/tools/yarn-cling/package.json index 39eca48e32e8e..9d86cc671b4d4 100644 --- a/tools/yarn-cling/package.json +++ b/tools/yarn-cling/package.json @@ -16,7 +16,7 @@ "build": "tsc", "watch": "tsc -w", "pkglint": "pkglint -f", - "test": "ln -sf ../../cdk test/test-fixture/package1/node_modules/ && jest", + "test": "ln -sf ../../cdk test/test-fixture/jsii/node_modules/ && jest", "build+test+package": "yarn build+test", "build+test": "yarn build && yarn test", "build+extract": "yarn build", diff --git a/tools/yarn-cling/test/cling.test.ts b/tools/yarn-cling/test/cling.test.ts index 2cb74915b0987..f56e98f535f91 100644 --- a/tools/yarn-cling/test/cling.test.ts +++ b/tools/yarn-cling/test/cling.test.ts @@ -3,13 +3,13 @@ import { checkRequiredVersions, generateShrinkwrap } from '../lib'; test('generate lock for fixture directory', async () => { const lockFile = await generateShrinkwrap({ - packageJsonFile: path.join(__dirname, 'test-fixture', 'package1', 'package.json'), + packageJsonFile: path.join(__dirname, 'test-fixture', 'jsii', 'package.json'), hoist: false, }); expect(lockFile).toEqual({ lockfileVersion: 1, - name: 'package1', + name: 'jsii', requires: true, version: '1.1.1', dependencies: { @@ -37,13 +37,13 @@ test('generate lock for fixture directory', async () => { test('generate hoisted lock for fixture directory', async () => { const lockFile = await generateShrinkwrap({ - packageJsonFile: path.join(__dirname, 'test-fixture', 'package1', 'package.json'), + packageJsonFile: path.join(__dirname, 'test-fixture', 'jsii', 'package.json'), hoist: true, }); expect(lockFile).toEqual({ lockfileVersion: 1, - name: 'package1', + name: 'jsii', requires: true, version: '1.1.1', dependencies: { @@ -70,11 +70,11 @@ test('generate hoisted lock for fixture directory', async () => { test('fail when requires cannot be satisfied', async () => { const lockFile = { lockfileVersion: 1, - name: 'package1', + name: 'jsii', requires: true, version: '1.1.1', dependencies: { - package1: { + jsii: { version: '2.2.2', requires: { cdk: '^3.3.3', // <- this needs to be adjusted diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk-lib/package.json b/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk-lib/package.json similarity index 100% rename from tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk-lib/package.json rename to tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk-lib/package.json diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk/package.json b/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk/package.json similarity index 100% rename from tools/yarn-cling/test/test-fixture/package1/node_modules/aws-cdk/package.json rename to tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk/package.json diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/cdk b/tools/yarn-cling/test/test-fixture/jsii/node_modules/cdk similarity index 100% rename from tools/yarn-cling/test/test-fixture/package1/node_modules/cdk rename to tools/yarn-cling/test/test-fixture/jsii/node_modules/cdk diff --git a/tools/yarn-cling/test/test-fixture/package1/package.json b/tools/yarn-cling/test/test-fixture/jsii/package.json similarity index 81% rename from tools/yarn-cling/test/test-fixture/package1/package.json rename to tools/yarn-cling/test/test-fixture/jsii/package.json index f962d062fe2d2..8508d1f52fc9e 100644 --- a/tools/yarn-cling/test/test-fixture/package1/package.json +++ b/tools/yarn-cling/test/test-fixture/jsii/package.json @@ -1,5 +1,5 @@ { - "name": "package1", + "name": "jsii", "version": "1.1.1", "dependencies": { "aws-cdk": "^1.2.3",