Augment naming
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import yargs from 'yargs';
|
||||
import getWSClass from '@polkadot/rpc-provider/ws/getWSClass';
|
||||
@@ -21,18 +20,17 @@ function generate (metaHex: string, pkg: string | undefined, output: string, isS
|
||||
const extraTypes = pkg
|
||||
? { [pkg]: require(path.join(process.cwd(), output, 'definitions')) }
|
||||
: {};
|
||||
const hasRegistry = fs.existsSync(path.join(process.cwd(), output, 'augment-types.ts'));
|
||||
|
||||
generateConst(path.join(process.cwd(), output, 'augment-consts.ts'), metaHex, extraTypes, isStrict);
|
||||
generateQuery(path.join(process.cwd(), output, 'augment-query.ts'), metaHex, extraTypes, isStrict);
|
||||
generateTx(path.join(process.cwd(), output, 'augment-tx.ts'), metaHex, extraTypes, isStrict);
|
||||
generateConst(path.join(process.cwd(), output, 'augment-api-consts.ts'), metaHex, extraTypes, isStrict);
|
||||
generateQuery(path.join(process.cwd(), output, 'augment-api-query.ts'), metaHex, extraTypes, isStrict);
|
||||
generateTx(path.join(process.cwd(), output, 'augment-api-tx.ts'), metaHex, extraTypes, isStrict);
|
||||
|
||||
writeFile(path.join(process.cwd(), output, 'augment.ts'), (): string =>
|
||||
writeFile(path.join(process.cwd(), output, 'augment-api.ts'), (): string =>
|
||||
[
|
||||
HEADER,
|
||||
...[
|
||||
'@polkadot/api/augment/rpc',
|
||||
...['consts', 'query', hasRegistry ? 'types' : '', 'tx'].filter((key) => !!key).map((key) => `./augment-${key}`)
|
||||
...['consts', 'query', 'tx'].filter((key) => !!key).map((key) => `./augment-api-${key}`)
|
||||
].map((path) => `import '${path}';\n`)
|
||||
].join('')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user