def run(names): if not os.path.exists("src"): # os.system("mkdir src") generate.run() exit() if not len(names): names = input("please type fragments names : ").split(" ") if not len(names): exit() if not os.path.exists("src/fragments"): os.system("mkdir src/fragments") os.system("touch src/fragments/index.js") for name in names: if name == name.capitalize(): lname = name.lower() print(lname) if not os.path.exists("src/fragments/%s" % lname): os.system("mkdir src/fragments/%s" % lname) os.system("mkdir src/fragments/%s/core" % lname) os.system("touch src/fragments/%s/core/index.js" % lname) os.system("touch src/fragments/%s/core/style.js" % lname) utils.add_import(name, "./%s" % lname, "src/fragments/%s/index.js" % lname) utils.add_import(name, "./%s" % lname, "src/fragments/index.js") fs = open("src/fragments/%s/%s.js" % (lname, lname), "w") fs.write(utils.create_component(name)) fs.close() print("start") print(names)
def run(args): if not os.path.exists("src"): # os.system("mkdir src") generate.run() exit() if not len(args): fn = input("please type parent fragment name : ").lower() if not os.path.exists("src/fragments/%s" % fn): exit() else: fn = args[0] if not len(args[1:]): names = input("please type core components names : ").split(" ") if not len(names): exit() else: names = args[1:] for name in names: if name == name.capitalize(): lname = name.lower() utils.add_import(name, "./%s" % lname, "src/fragments/%s/core/index.js" % fn) fs = open("src/fragments/%s/core/%s.js" % (fn, lname), "w") fs.write(utils.create_component(name)) fs.close()
def run(names): if not os.path.exists("src"): # os.system("mkdir src") generate.run() exit() if not len(names): names = input("please type constants names : ").split(" ") if not len(names): exit() if not os.path.exists("src/constants"): os.system("mkdir src/constants") os.system("touch src/constants/index.js") for name in names: utils.add_import(name, "./%s" % name, "src/constants/index.js") os.system("touch src/constants/%s.js" % name) fs = open("src/constants/%s.js" % name, "w") fs.write("export const %s" % name) fs.close()
def run(): useNameIE = False nameIE = "" packege = {} os.system("mkdir src") value = input("use name import/export ? [Y/n] : ") if value.lower() != "n": useNameIE = True nameIE = config.nameIE + "/" with open("package.json", "r") as read_file: packege = json.load(read_file) packege["dependencies"]["@babel/plugin-syntax-object-rest-spread"] = '^7.8.3' print("-" * 40) for _type in types: value = input("create %s ? [Y/n] : " % _type) if value.lower() != "n": os.system("mkdir src/%s" % _type) os.system("touch src/%s/index.js" % _type) if _type == "contexts": fs = open("src/contexts/contextProvider.js", "w") fs.write(config.context) fs.close() utils.add_import("ContextProvider", "./contextProvider", "src/contexts/index.js") if useNameIE: packege["dependencies"][nameIE + _type] = "file:./src/" + _type print("-" * 40) if useNameIE: fs = open("package.json", "w") fs.write(json.dumps(packege)) fs.close()