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UAAU,IAAW,SAAU,GACvE,GAAI,EAAO,OAAO,QAAQ,IAAI,GAC9B,GACJ,GAAC,GAEb,IAGJ,QAAQ,IAAI,GAAU,MAAK,KAAQ,GAAQ,GAAG,IAIhD,IAAM,UAER,UADoB,sBAGhB,OADA,QAAQ,IAAI,qFAAqF,MAC1F,QAEL,qBACA,wBACA,kBACN,QAAQ,IAAI,WAAU,EAE1B","file":"/npm/create-smart-contract@1.1.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/create-smart-contract@1.1.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","#!/usr/bin/env node\nlet shell = require('shelljs')\nlet colors = require('colors')\nlet fs = require('fs')\nlet appName = process.argv[2]\nlet appDirectory = `${process.cwd()}/${appName}`\nlet templates = require('./templates/templates.js')\n\n\nconst createDirectory = () => {\n    if (appName) {\n        if (!fs.existsSync(appName)) {\n            fs.mkdirSync(appName);\n        }\n    }\n    else {\n        console.log(\"\\nNo app name was provided.\".red)\n        console.log(\"\\nProvide an app name in the following format: \")\n        console.log(\"\\ncreate-smart-contract \", \"app-name\\n\".cyan)\n        process.exit()\n    }\n}\nconst cdIntoNewApp = () => {\n    return new Promise(resolve => {\n        shell.cd(appDirectory)\n        // process.chdir(appDirectory)\n        resolve()\n    })\n}\nconst createSmartContract = () => {\n    return new Promise(resolve => {\n        if (appName) {\n            shell.exec(`truffle init ${appName}`, () => {\n                console.log(\"Init truffle\")\n                shell.exec('npm init --yes')\n                resolve(true)\n            })\n        } else {\n            console.log(\"\\nNo app name was provided.\".red)\n            console.log(\"\\nProvide an app name in the following format: \")\n            console.log(\"\\ncreate-react-redux-router-app \", \"app-name\\n\".cyan)\n            resolve(false)\n        }\n    })\n}\n\nconst installPackages = () => {\n    return new Promise(resolve => {\n        console.log(\"\\nInstalling hardhat, @openzeppelin/contracts, @truffle/hdwallet-provider, chai, solidity-docgen, truffle, @nomiclabs/hardhat-ethers, @nomiclabs/hardhat-truffle5, @nomiclabs/hardhat-waffle, @nomiclabs/hardhat-web3, eth-gas-reporter, ethereum-waffle, ethers, mocha, prettier, prettier-plugin-solidity, solc-0.7, solidity-coverage, truffle-assertions and web3\\n\".cyan)\n        shell.exec(`npm install --save-dev hardhat @openzeppelin/contracts @truffle/hdwallet-provider chai solidity-docgen truffle @nomiclabs/hardhat-ethers @nomiclabs/hardhat-truffle5 @nomiclabs/hardhat-waffle @nomiclabs/hardhat-web3 eth-gas-reporter ethereum-waffle ethers mocha prettier prettier-plugin-solidity solidity-coverage truffle-assertions web3 solc-0.7@npm:solc@^0.7.0`, () => {\n            console.log(\"\\nFinished installing packages\\n\".green)\n            resolve()\n        })\n    })\n}\n\nconst updateTemplates = () => {\n    return new Promise(resolve => {\n        let promises = []\n        Object.keys(templates).forEach((fileName, i) => {\n            switch (fileName) {\n                case 'package':\n                    promises[i] = new Promise(res => {\n                        let package = JSON.parse(templates[fileName])\n                        package['name'] = appName\n                        let data = JSON.stringify(package);\n                        fs.writeFile(`${appDirectory}/${fileName}`, data, function (err) {\n                            if (err) { return console.log(err) }\n                            res()\n                        })\n                    })\n                    break\n                default:\n                    promises[i] = new Promise(res => {\n                        fs.writeFile(`${appDirectory}/${fileName}`, templates[fileName], function (err) {\n                            if (err) { return console.log(err) }\n                            res()\n                        })\n                    })\n            }\n        })\n\n        Promise.all(promises).then(() => { resolve() })\n    })\n}\n\nconst run = async () => {\n    let success = await createSmartContract()\n    if (!success) {\n        console.log('Something went wrong while trying to create a new React app using create-react-app'.red)\n        return false;\n    }\n    await cdIntoNewApp()\n    await updateTemplates()\n    await installPackages()\n    console.log(\"All done\")\n}\nrun() "]}