Split generation scripts into @polkadot/typegen (#1875)

* Split generation scripts into @polkadot/typegen

* Remove moved files

* CC overrides

* interfaces typo

* Cleanup imports

* Some import combinations

* Updates

* Generation updates

* Cleanups, split js wrapper & ts logic

* Rename jiggle 1

* Rename jiggle 2

* Style cleanups

* Expose enry function for scripts

* Typo

* Update script copy & include locations

* CC exclude location

* Minor adjustments

* argv parsing into main
This commit is contained in:
Jaco Greeff
2020-02-17 08:09:59 +01:00
committed by GitHub
parent fd7b38e781
commit 8a152ea4c0
38 changed files with 909 additions and 547 deletions
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env node
// Copyright 2017-2020 @polkadot/typegen authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable @typescript-eslint/no-var-requires */
let main;
try {
main = require('../extractChain').default;
} catch (error) {
require('@babel/register')({
extensions: ['.js', '.ts'],
plugins: [
['module-resolver', {
alias: {
'^@polkadot/api-derive(.*)': './packages/api-derive/src\\1',
'^@polkadot/metadata(.*)': './packages/metadata/src\\1',
'^@polkadot/api(.*)': './packages/api/src/\\1',
'^@polkadot/jsonrpc(.*)': './packages/jsonrpc/src\\1',
'^@polkadot/rpc-core(.*)': './packages/rpc-core/src\\1',
'^@polkadot/rpc-provider(.*)': './packages/rpc-provider/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
]
});
main = require('../src/extractChain.ts').default;
}
main();
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env node
// Copyright 2017-2020 @polkadot/typegen authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable @typescript-eslint/no-var-requires */
let main;
try {
main = require('../fromChain').default;
} catch (error) {
require('@babel/register')({
extensions: ['.js', '.ts'],
plugins: [
['module-resolver', {
alias: {
'^@polkadot/metadata(.*)': './packages/metadata/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
]
});
main = require('../src/fromChain').default;
}
main();
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env node
// Copyright 2017-2020 @polkadot/typegen authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable @typescript-eslint/no-var-requires */
let main;
try {
main = require('../fromDefs').default;
} catch (error) {
require('@babel/register')({
extensions: ['.js', '.ts'],
plugins: [
['module-resolver', {
alias: {
'^@polkadot/metadata(.*)': './packages/metadata/src\\1',
'^@polkadot/typegen(.*)': './packages/typegen/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
]
});
main = require('../sr/fromDefs.ts').default;
}
main();
@@ -0,0 +1,28 @@
#!/usr/bin/env node
// Copyright 2017-2020 @polkadot/typegen authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable @typescript-eslint/no-var-requires */
let main;
try {
main = require('../interfacesTs').default;
} catch (error) {
require('@babel/register')({
extensions: ['.js', '.ts'],
plugins: [
['module-resolver', {
alias: {
'^@polkadot/jsonrpc(.*)': './packages/jsonrpc/src\\1',
'^@polkadot/metadata(.*)': './packages/metadata/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
]
});
main = require('../src/interfacesTs.ts').default;
}
main();
@@ -0,0 +1,28 @@
#!/usr/bin/env node
// Copyright 2017-2020 @polkadot/typegen authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
/* eslint-disable @typescript-eslint/no-var-requires */
let main;
try {
main = require('../metadataMd').default;
} catch (error) {
require('@babel/register')({
extensions: ['.js', '.ts'],
plugins: [
['module-resolver', {
alias: {
'^@polkadot/jsonrpc(.*)': './packages/jsonrpc/src\\1',
'^@polkadot/metadata(.*)': './packages/metadata/src\\1',
'^@polkadot/types(.*)': './packages/types/src\\1'
}
}]
]
});
main = require('../src/metadataMd.ts').default;
}
main();