diff --git a/packages/jsii-rosetta/lib/jsii/assemblies.ts b/packages/jsii-rosetta/lib/jsii/assemblies.ts index 68c63cd855..dcc3a24c37 100644 --- a/packages/jsii-rosetta/lib/jsii/assemblies.ts +++ b/packages/jsii-rosetta/lib/jsii/assemblies.ts @@ -1,5 +1,4 @@ import * as spec from '@jsii/spec'; -import * as crypto from 'crypto'; import * as fs from 'fs-extra'; import * as path from 'path'; @@ -18,9 +17,6 @@ import { enforcesStrictMode } from '../strict'; import { LanguageTablet, DEFAULT_TABLET_NAME } from '../tablets/tablets'; import { fmap, mkDict, sortBy } from '../util'; -// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports -const sortJson = require('sort-json'); - /** * The JSDoc tag users can use to associate non-visible metadata with an example * @@ -216,14 +212,16 @@ export async function replaceAssembly(assembly: spec.Assembly, directory: string } /** - * This function is copied from `packages/jsii/lib/assembler.ts`. - * We should make sure not to change one without changing the other as well. + * Replaces the old fingerprint with '***********'. + * + * @rmuller says fingerprinting is useless, as we do not actually check + * if an assembly is changed. Instead of keeping the old (wrong) fingerprint + * or spending extra time calculating a new fingerprint, we replace with '**********' + * that demonstrates the fingerprint has changed. */ function _fingerprint(assembly: spec.Assembly): spec.Assembly { - delete (assembly as any).fingerprint; - assembly = sortJson(assembly); - const fingerprint = crypto.createHash('sha256').update(JSON.stringify(assembly)).digest('base64'); - return { ...assembly, fingerprint }; + assembly.fingerprint = '*'.repeat(10); + return assembly; } export interface TypeLookupAssembly { diff --git a/packages/jsii/lib/assembler.ts b/packages/jsii/lib/assembler.ts index fad2c3090c..1e4bd4a20c 100644 --- a/packages/jsii/lib/assembler.ts +++ b/packages/jsii/lib/assembler.ts @@ -2,7 +2,6 @@ import * as spec from '@jsii/spec'; import { PackageJson } from '@jsii/spec'; import * as Case from 'case'; import * as chalk from 'chalk'; -import * as crypto from 'crypto'; // eslint-disable-next-line @typescript-eslint/no-require-imports import deepEqual = require('deep-equal'); import * as fs from 'fs-extra'; @@ -32,9 +31,6 @@ import { Validator } from './validator'; import { SHORT_VERSION, VERSION } from './version'; import { enabledWarnings } from './warnings'; -// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports -const sortJson = require('sort-json'); - const LOG = log4js.getLogger('jsii/assembler'); /** @@ -2865,14 +2861,17 @@ interface SubmoduleSpec { readonly readme?: spec.ReadMe; } +/** + * Replaces the old fingerprint with '***********'. + * + * @rmuller says fingerprinting is useless, as we do not actually check + * if an assembly is changed. Instead of keeping the old (wrong) fingerprint + * or spending extra time calculating a new fingerprint, we replace with '**********' + * that demonstrates the fingerprint has changed. + */ function _fingerprint(assembly: spec.Assembly): spec.Assembly { - delete assembly.fingerprint; - assembly = sortJson(assembly); - const fingerprint = crypto - .createHash('sha256') - .update(JSON.stringify(assembly)) - .digest('base64'); - return { ...assembly, fingerprint }; + assembly.fingerprint = '*'.repeat(10); + return assembly; } function _isAbstract(