Use import.meta.url instead of process.cwd() (#5675)

* Use import.meta.url instead of process.cwd()

* Bump dev
This commit is contained in:
Jaco
2023-06-16 09:45:32 +03:00
committed by GitHub
parent 56fb5c9985
commit 61a8b4041e
17 changed files with 139 additions and 144 deletions
@@ -5,6 +5,7 @@
import { TypeRegistry } from '@polkadot/types';
import { getTypeDef, TypeDefInfo } from '@polkadot/types-create';
import { stringify } from '@polkadot/util';
describe('getTypeDef', (): void => {
it('maps empty tuples to empty tuple', (): void => {
@@ -439,7 +440,7 @@ describe('getTypeDef', (): void => {
it('creates a nested enum with tuple/struct', (): void => {
expect(
getTypeDef(JSON.stringify({
getTypeDef(stringify({
_enum: {
A: 'u32',
B: '(u32, bool)',
@@ -513,7 +514,7 @@ describe('getTypeDef', (): void => {
it('creates a nested struct with struct/tuple', (): void => {
expect(
getTypeDef(JSON.stringify({
getTypeDef(stringify({
a: 'u32',
b: '(u32, bool)',
c: {
+2 -2
View File
@@ -5,7 +5,7 @@ import type { AnyString } from '@polkadot/types-codec/types';
import type { TypeDef } from '@polkadot/types-create/types';
import { sanitize } from '@polkadot/types-codec';
import { isNumber, isString, objectSpread } from '@polkadot/util';
import { isNumber, isString, objectSpread, stringify } from '@polkadot/util';
import { TypeDefInfo } from '../types/index.js';
import { typeSplit } from './typeSplit.js';
@@ -36,7 +36,7 @@ const KNOWN_INTERNALS = ['_alias', '_fallback'];
function getTypeString (typeOrObj: any): string {
return isString(typeOrObj)
? typeOrObj.toString()
: JSON.stringify(typeOrObj);
: stringify(typeOrObj);
}
function isRustEnum (details: Record<string, string> | Record<string, number>): details is Record<string, string> {