diff --git a/script/crypto-assets-importer/importers/ethereum-plugins.js b/script/crypto-assets-importer/importers/ethereum-plugins.js index 9cc2f8c50..236fa4a55 100644 --- a/script/crypto-assets-importer/importers/ethereum-plugins.js +++ b/script/crypto-assets-importer/importers/ethereum-plugins.js @@ -1,4 +1,5 @@ const path = require("path"); +const fs = require('fs'); const isEqual = require("lodash/isEqual"); const { readFileJSON } = require("../utils"); @@ -34,6 +35,11 @@ module.exports = { outputTemplate: (data) => JSON.stringify(data, null, 2), + shouldLoad: ({ folder, id }) => { + const b2cFilePath = path.join(folder, id, "b2c.json"); + return fs.existsSync(b2cFilePath); + }, + loader: async ({ signatureFolder, folder, id }) => { const [signatures, bare] = await Promise.all([ readFileJSON(path.join(signatureFolder, id, "b2c_signatures.json")), diff --git a/script/crypto-assets-importer/index.js b/script/crypto-assets-importer/index.js index 24797b684..6d381fe5a 100644 --- a/script/crypto-assets-importer/index.js +++ b/script/crypto-assets-importer/index.js @@ -34,9 +34,10 @@ axios const folder = path.join(inputFolder, "assets", p); const signatureFolder = path.join(inputFolder, "signatures/prod/", p); const items = fs.readdirSync(folder); + const shouldLoad = ((id) => imp.shouldLoad ? imp.shouldLoad({ folder, id }) : !id.endsWith(".json")); return promiseAllBatched( 50, - items.sort().filter((a) => !a.endsWith(".json")), + items.sort().filter(shouldLoad), (id) => Promise.resolve() .then(() => imp.loader({ signatureFolder, folder, id }))