-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { readFile, writeFile } from 'node:fs/promises'; | ||
|
||
// This script patches the SDK | ||
// * for the missing import type assertions when importing JSON inside | ||
// * for the jsonld-signatures being CommonJS | ||
|
||
{ | ||
const fileName = | ||
'/app/node_modules/@kiltprotocol/vc-export/lib/esm/vc-js/context/index.js'; | ||
const text = await readFile(fileName, { encoding: 'utf-8' }); | ||
const patched = text.replace( | ||
`import context from './context.json'`, | ||
`import context from './context.json' assert { type: 'json' }`, | ||
); | ||
await writeFile(fileName, patched); | ||
} | ||
|
||
{ | ||
const fileName = | ||
'/app/node_modules/@kiltprotocol/vc-export/lib/esm/vc-js/suites/KiltAbstractSuite.js'; | ||
const text = await readFile(fileName, { encoding: 'utf-8' }); | ||
const patched = text | ||
.replace( | ||
`import { suites, } from 'jsonld-signatures'`, | ||
`import jsonldSignatures from 'jsonld-signatures'`, | ||
) | ||
.replace( | ||
`extends suites.LinkedDataProof`, | ||
`extends jsonldSignatures.suites.LinkedDataProof`, | ||
); | ||
await writeFile(fileName, patched); | ||
} |