Open timbrinded opened 1 week ago
TBH this code can almost entirely be ripped out. I've rewritten the test spec as a normal script, and just run it with tsx.
// Copyright 2017-2024 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import fs from 'node:fs';
import { objectSpread } from '@polkadot/util';
import chain from './chain/index.js';
import spec from './spec/index.js';
const specEntries = Object.entries(spec);
const chainEntries = Object.entries(chain);
const typesBundle: { chain: Record<string, unknown>, spec: Record<string, unknown> } = { chain: {}, spec: {} };
// Process specs
for (const [k, v] of specEntries) {
const value = objectSpread<{ derives: unknown }>({}, v);
delete value.derives;
typesBundle.spec[k] = value;
}
// Process chains
for (const [k, v] of chainEntries) {
const value = objectSpread<{ derives: unknown }>({}, v);
delete value.derives;
typesBundle.chain[k] = value;
}
// Generate the typesBundle.ts file
const content = `// Copyright 2017-2024 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
// Do not edit, auto-generated by @polkadot/apps-config
import type { OverrideBundleType } from '@polkadot/types/types';
/* eslint-disable quotes */
/* eslint-disable quote-props */
/* eslint-disable sort-keys */
export const typesBundle = ${JSON.stringify(typesBundle, null, 2)} as unknown as OverrideBundleType;
`;
fs.writeFileSync('packages/apps-config/src/api/typesBundle.ts', content);
console.log('typesBundle.ts has been generated successfully.');
run with: yarn tsx packages/apps-config/src/api/bundleGen.ts
I'm submitting a ...
What is the current behavior and expected behavior?
In developing the storage hub chain, we have been testing against a pre-release typesbundle. The PolkadotJS app has been rejecting latest versions of the storage-hub.
The
@polkadot/dev
process is very idiosyncratic so not apparent what is failing or why.So that latest runtimeApi and RPC methods can be used on the FE
Package:
@storagehub/types-bundle
:0.1.4
Node 20 & 22
Version:
Environment:
Language: