ccxt-with-rest-api-type
Advanced tools
Comparing version
{ | ||
"name": "ccxt-with-rest-api-type", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"license": "MIT", | ||
@@ -10,3 +10,3 @@ "type": "module", | ||
"build": "tsup src/cli/index.ts --onSuccess \"node dist/index.cjs\"", | ||
"postbuild": "rm -rf dist/index.cjs && mv dist/import.js dist/index.js" | ||
"postbuild": "rm -rf dist/index.cjs dist/index.js && mv src/index.ts dist/index.ts" | ||
}, | ||
@@ -13,0 +13,0 @@ "dependencies": { |
@@ -9,10 +9,10 @@ import ccxt from "ccxt"; | ||
(async () => { | ||
const writeIndexStream = fs.createWriteStream(path.resolve(__dirname, `./import.js`)); | ||
const writeIndexStream = fs.createWriteStream(path.resolve(__dirname, `../src/index.ts`)); | ||
exchanges.forEach(async (exchange, index)=>{ | ||
const writeStream = fs.createWriteStream(path.resolve(__dirname, `./types/${exchange}.d.ts`)); | ||
const writeStream = fs.createWriteStream(path.resolve(__dirname, `./types/${exchange}.ts`)); | ||
const exchangeInstance = new ccxt[exchange](); | ||
const restApi = await defineRestApi(exchangeInstance.api, "request", []); | ||
writeStream.write(`import {${exchange} as Type} from 'ccxt';\nexport class ${exchange}RestApiType extends Type {\n\t${Object.keys(restApi).map(method => `${method}: (params:{}, context?:{}) => Promise<any>;`).join('\n\t')}\n}`); | ||
writeStream.write(`import {${exchange} as Type} from 'ccxt';\nexport interface ${exchange}RestApiType extends Type {\n\t${Object.keys(restApi).map(method => `${method}: (params:{}, context?:{}) => Promise<any>;`).join('\n\t')}\n}`); | ||
writeStream.end(); | ||
writeIndexStream.write(`export {${exchange}RestApiType} from './types/${exchange}';\n`) | ||
writeIndexStream.write(`export type {${exchange}RestApiType} from './types/${exchange}';\n`) | ||
console.log("exchange", exchange, index+1, ccxt.exchanges.length, Object.keys(restApi).length) | ||
@@ -19,0 +19,0 @@ }) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
735944
0.15%126
-0.79%1
Infinity%