def copy_app_template(app_name, to_path):
path = os.path.dirname(os.path.abspath(__file__))
source_dir = os.path.join(path, '../../../app-template/')
ignore_func = shutil.ignore_patterns('.DS_Store', 'Thumbs.db')
shutil.copytree(source_dir, to_path, ignore=ignore_func)
# Replace the app name placeholder
index_path = os.path.join(to_path, 'index.js')
s = open(index_path, 'r').read().replace('{{app_name}}', app_name)
with open(index_path, 'w') as fp:
fp.write(s)
评论列表
文章目录