10.1.3: Remove wrong .module specifier in typegen (#5541)

* Remove wrong .module specifier in typegen

* 10.1.3

* Reset

* Revert "10.1.3"

This reverts commit 1c6d8ff0720a8c221fe30e4cca17c5211262ef09.

* Rebump 10.1.3
This commit is contained in:
Jaco
2023-03-15 12:30:50 +02:00
committed by GitHub
parent 254e218a7b
commit 48d2dbd885
20 changed files with 330 additions and 299 deletions
+14 -8
View File
@@ -23,12 +23,12 @@ async function generate (metaHex: HexString, pkg: string | undefined, output: st
if (pkg) {
try {
const defPath = assertFile(path.join(outputPath, 'definitions.ts'));
const defCont = await import(defPath) as { module: any };
const defCont = await import(
assertFile(path.join(outputPath, 'definitions.ts'))
) as Record<string, any>;
extraTypes = {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
[pkg]: defCont.module
[pkg]: defCont
};
} catch (error) {
console.error('ERROR: No custom definitions found:', (error as Error).message);
@@ -36,12 +36,13 @@ async function generate (metaHex: HexString, pkg: string | undefined, output: st
}
try {
const lookPath = assertFile(path.join(outputPath, 'lookup.ts'));
const lookCont = await import(lookPath) as { module: { default: DefinitionsTypes } };
const lookCont = await import(
assertFile(path.join(outputPath, 'lookup.ts'))
) as { default: DefinitionsTypes };
customLookupDefinitions = {
rpc: {},
types: lookCont.module.default
types: lookCont.default
};
} catch (error) {
console.error('ERROR: No lookup definitions found:', (error as Error).message);
@@ -113,5 +114,10 @@ async function mainPromise (): Promise<void> {
}
export function main (): void {
mainPromise().catch(() => process.exit(1));
mainPromise().catch((error) => {
console.error();
console.error(error);
console.error();
process.exit(1);
});
}
+9 -2
View File
@@ -40,9 +40,11 @@ async function mainPromise (): Promise<void> {
let userDefs: Record<string, any> = {};
try {
userDefs = await import(
const defCont = await import(
assertFile(path.join(inputPath, 'definitions.ts'))
) as Record<string, any>;
userDefs = defCont;
} catch (error) {
console.error('ERROR: Unable to load user definitions:', (error as Error).message);
}
@@ -95,5 +97,10 @@ async function mainPromise (): Promise<void> {
}
export function main (): void {
mainPromise().catch(() => process.exit(1));
mainPromise().catch((error) => {
console.error();
console.error(error);
console.error();
process.exit(1);
});
}