Skip to content

Commit 12e2ddb

Browse files
committed
required code changes
1 parent 2633630 commit 12e2ddb

File tree

30 files changed

+16
-75
lines changed

30 files changed

+16
-75
lines changed

packages/@aws-cdk/cloud-assembly-schema/test/integ-tests.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('Integration test', () => {
2727
notificationArns: ['arn1', 'arn2'],
2828
execute: true,
2929
parameters: {
30-
MYPARAM: 'Value',
30+
'MYPARAM': 'Value',
3131
'Stack1:OtherParam': 'OtherValue',
3232
},
3333
usePreviousParameters: true,

packages/@aws-cdk/node-bundle/src/api/_attributions.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export interface AttributionsProps {
4848
* `Attributions` represents an attributions file containing third-party license information.
4949
*/
5050
export class Attributions {
51-
5251
private readonly packageDir: string;
5352
private readonly packageName: string;
5453
private readonly dependencies: Package[];
@@ -79,7 +78,6 @@ export class Attributions {
7978
* This method never throws. The Caller is responsible for inspecting the report returned and act accordinagly.
8079
*/
8180
public validate(): ViolationsReport {
82-
8381
const violations: Violation[] = [];
8482
const relNoticePath = path.relative(this.packageDir, this.filePath);
8583

@@ -124,7 +122,6 @@ export class Attributions {
124122
}
125123

126124
private render(attributions: Map<string, Attribution>): string {
127-
128125
const content = [];
129126

130127
if (attributions.size > 0) {
@@ -152,11 +149,9 @@ export class Attributions {
152149
// endings, so we standardize to LF.
153150
.map(l => l.replace(/\r\n/g, '\n'))
154151
.join('\n');
155-
156152
}
157153

158154
private generateAttributions(): Map<string, Attribution> {
159-
160155
if (this.dependencies.length === 0) {
161156
return new Map();
162157
}
@@ -216,7 +211,6 @@ export class Attributions {
216211

217212
return attributions;
218213
}
219-
220214
}
221215

222216
/**

packages/@aws-cdk/node-bundle/src/api/bundle.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ export interface Externals {
176176
* Bundle class to validate and pack nodejs bundles.
177177
*/
178178
export class Bundle {
179-
180179
private readonly manifest: any;
181180
private readonly noticePath: string;
182181

@@ -239,7 +238,6 @@ export class Bundle {
239238
* returned report and act accordingly.
240239
*/
241240
public validate(options: BundleValidateOptions = {}): ViolationsReport {
242-
243241
const fix = options.fix ?? false;
244242

245243
// first validate
@@ -270,7 +268,6 @@ export class Bundle {
270268
* Returns the temp directory location.
271269
*/
272270
public write(): string {
273-
274271
const target = fs.mkdtempSync(path.join(os.tmpdir(), 'bundle-write-'));
275272

276273
// we definitely don't need these directories in the package
@@ -302,7 +299,6 @@ export class Bundle {
302299
* Returns the location of the tarball.
303300
*/
304301
public pack(options: BundlePackOptions = {}): string {
305-
306302
const target = options.target ?? this.packageDir;
307303

308304
const report = this.validate();
@@ -324,7 +320,6 @@ export class Bundle {
324320
console.log('Writing bundle');
325321
const bundleDir = this.write();
326322
try {
327-
328323
if (this.test) {
329324
const command = `${path.join(bundleDir, this.test)}`;
330325
console.log(`Running sanity test: ${command}`);
@@ -385,7 +380,6 @@ export class Bundle {
385380
}
386381

387382
private findExternalDependencyVersion(name: string): string {
388-
389383
const versions = new Set<string>();
390384

391385
// external dependencies will not exist in the dependencies list
@@ -418,7 +412,6 @@ export class Bundle {
418412
}
419413

420414
private closestPackagePath(fdp: string): string {
421-
422415
if (fs.existsSync(path.join(fdp, 'package.json'))) {
423416
return fdp;
424417
}
@@ -437,7 +430,6 @@ export class Bundle {
437430
}
438431

439432
private esbuild(): esbuild.BuildResult {
440-
441433
const bundle = esbuild.buildSync({
442434
entryPoints: this.entryPoints,
443435
bundle: true,
@@ -506,7 +498,6 @@ export class Bundle {
506498
}
507499

508500
private addExternals(manifest: any) {
509-
510501
// external dependencies should be specified as runtime dependencies
511502
for (const external of this.externals.dependencies ?? []) {
512503
const version = this.findExternalDependencyVersion(external);
@@ -520,7 +511,6 @@ export class Bundle {
520511
manifest.optionalDependencies = manifest.optionalDependencies ?? {};
521512
manifest.optionalDependencies[external] = version;
522513
}
523-
524514
}
525515

526516
private removeDependencies(manifest: any) {
@@ -551,7 +541,6 @@ export class Bundle {
551541
}
552542

553543
function longestCommonParent(paths: string[]) {
554-
555544
function _longestCommonParent(p1: string, p2: string): string {
556545
const dirs1 = p1.split(path.sep);
557546
const dirs2 = p2.split(path.sep);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export * from './bundle';
2-
export * from './violation';
2+
export * from './violation';

packages/@aws-cdk/node-bundle/src/api/violation.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export interface Violation {
6363
* Report encapsulating a list of violations.
6464
*/
6565
export class ViolationsReport {
66-
6766
constructor(private readonly _violations: Violation[]) {}
6867

6968
/**
@@ -92,5 +91,4 @@ export class ViolationsReport {
9291
}
9392
return summary.join('\n');
9493
}
95-
9694
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './api';
1+
export * from './api';

packages/@aws-cdk/node-bundle/test/_package.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export interface PackageOptions {
3434
* Generate packages for test scenarios.
3535
*/
3636
export class Package {
37-
3837
/**
3938
* Create a package.
4039
*/
@@ -47,7 +46,7 @@ export class Package {
4746

4847
if (options.licenses?.length === 1) {
4948
manifest.license = options.licenses[0];
50-
};
49+
}
5150

5251
if (options.licenses && options.licenses.length > 1) {
5352
manifest.licenses = options.licenses!.map(l => ({ type: l }));
@@ -159,5 +158,4 @@ export class Package {
159158
}
160159
fs.removeSync(this.dir);
161160
}
162-
163-
}
161+
}

packages/@aws-cdk/node-bundle/test/api/bundle.test.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Bundle } from '../../src';
44
import { Package } from '../_package';
55

66
test('validate', () => {
7-
87
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'], circular: true });
98
const dep1 = pkg.addDependency({ name: 'dep1', licenses: ['INVALID'] });
109
const dep2 = pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0', 'MIT'] });
@@ -31,7 +30,6 @@ test('validate', () => {
3130
});
3231

3332
test('write', () => {
34-
3533
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'] });
3634
pkg.addDependency({ name: 'dep1', licenses: ['MIT'] });
3735
pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0'] });
@@ -58,11 +56,9 @@ test('write', () => {
5856
const manifest = fs.readJSONSync(path.join(bundleDir, 'package.json'));
5957

6058
expect(manifest.dependencies).toEqual({});
61-
6259
});
6360

6461
test('pack', () => {
65-
6662
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'] });
6763
const dep1 = pkg.addDependency({ name: 'dep1', licenses: ['MIT'] });
6864
const dep2 = pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0'] });
@@ -95,11 +91,9 @@ test('pack', () => {
9591

9692
const tarball = path.join(pkg.dir, `${pkg.name}-${pkg.version}.tgz`);
9793
expect(fs.existsSync(tarball)).toBeTruthy();
98-
9994
});
10095

10196
test('validate and fix', () => {
102-
10397
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'] });
10498
pkg.addDependency({ name: 'dep1', licenses: ['MIT'] });
10599
pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0'] });
@@ -125,11 +119,9 @@ test('validate and fix', () => {
125119
bundle.pack();
126120
const tarball = path.join(pkg.dir, `${pkg.name}-${pkg.version}.tgz`);
127121
expect(fs.existsSync(tarball)).toBeTruthy();
128-
129122
});
130123

131124
test('write ignores only .git and node_modules directories', () => {
132-
133125
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'] });
134126
pkg.addDependency({ name: 'dep1', licenses: ['MIT'] });
135127
pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0'] });
@@ -153,5 +145,4 @@ test('write ignores only .git and node_modules directories', () => {
153145

154146
expect(fs.existsSync(path.join(bundleDir, '.gitignore'))).toBeTruthy();
155147
expect(fs.existsSync(path.join(bundleDir, 'node_modules_file'))).toBeTruthy();
156-
157148
});

packages/@aws-cdk/node-bundle/test/cli.test.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Package } from './_package';
55
import { cliMain } from '../src/cli-main';
66

77
test('validate', async () => {
8-
98
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'], circular: true });
109
const dep1 = pkg.addDependency({ name: 'dep1', licenses: ['INVALID'] });
1110
const dep2 = pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0', 'MIT'] });
@@ -32,11 +31,9 @@ test('validate', async () => {
3231
]);
3332
expect(violations).toEqual(expected);
3433
}
35-
3634
});
3735

3836
test('write', async () => {
39-
4037
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'] });
4138
pkg.addDependency({ name: 'dep1', licenses: ['MIT'] });
4239
pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0'] });
@@ -63,11 +60,9 @@ test('write', async () => {
6360
const manifest = fs.readJSONSync(path.join(bundleDir, 'package.json'));
6461

6562
expect(manifest.dependencies).toEqual({});
66-
6763
});
6864

6965
test('validate and fix', async () => {
70-
7166
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'] });
7267
pkg.addDependency({ name: 'dep1', licenses: ['MIT'] });
7368
pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0'] });
@@ -97,11 +92,9 @@ test('validate and fix', async () => {
9792
await run(['pack']);
9893
const tarball = path.join(pkg.dir, `${pkg.name}-${pkg.version}.tgz`);
9994
expect(fs.existsSync(tarball)).toBeTruthy();
100-
10195
});
10296

10397
test('pack', async () => {
104-
10598
const pkg = Package.create({ name: 'consumer', licenses: ['Apache-2.0'] });
10699
const dep1 = pkg.addDependency({ name: 'dep1', licenses: ['MIT'] });
107100
const dep2 = pkg.addDependency({ name: 'dep2', licenses: ['Apache-2.0'] });
@@ -134,7 +127,6 @@ test('pack', async () => {
134127

135128
const tarball = path.join(pkg.dir, `${pkg.name}-${pkg.version}.tgz`);
136129
expect(fs.existsSync(tarball)).toBeTruthy();
137-
138130
});
139131

140132
async function runCliMain(cwd: string, command: string[]): Promise<string> {
@@ -155,4 +147,4 @@ async function runCliMain(cwd: string, command: string[]): Promise<string> {
155147
process.chdir(curdir);
156148
spy.mockRestore();
157149
}
158-
}
150+
}

packages/@aws-cdk/yarn-cling/lib/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,6 @@ export function checkRequiredVersions(root: PackageLock | PackageLockPackage) {
250250
function recurse(entry: PackageLock | PackageLockPackage, parentChain: PackageLockEntry[]) {
251251
// On the root, 'requires' is the value 'true', for God knows what reason. Don't care about those.
252252
if (typeof entry.requires === 'object') {
253-
254253
// For every 'requires' dependency, find the version it actually got resolved to and compare.
255254
for (const [name, range] of Object.entries(entry.requires)) {
256255
const resolvedPackage = findResolved(name, [entry, ...parentChain]);

0 commit comments

Comments
 (0)