10 Star 206 Fork 60

beifengtz/vue-web-terminal

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
publish.py 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
beifengtz 提交于 2024-10-22 15:05 . [vue3] publish 3.3.2
# encoding=utf8
import subprocess
import platform
NPM_REPOSITORY="https://registry.npmjs.org"
NPM_REPOSITORY_MIRROR="https://registry.npmmirror.com"
NODE_VERSION = 18
ENCODING = "gbk" if platform.system().lower() == 'windows' else 'utf-8'
def execute(command, with_result = False,encoding = ENCODING):
print(f"[calling]: {command}")
if with_result:
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding=encoding)
stdout,stderr = p.communicate()
if p.returncode == 0:
return stdout
else:
raise Exception(f"exit with {p.returncode}, stderr: {stderr}")
else:
returncode = subprocess.call(command, shell=True, encoding=encoding)
if returncode != 0:
raise Exception(f"exit with {returncode}")
if __name__ == '__main__':
registry = execute(f'npm config get registry', with_result=True)
node_version = execute(f'node -v', with_result=True)
if not node_version.startswith(f'v{NODE_VERSION}'):
raise Exception(f'Node version must be {NODE_VERSION}')
try:
execute(f'pnpm install')
execute(f'pnpm run build')
execute(f'npm config set registry {NPM_REPOSITORY}')
execute(f'npm publish')
finally:
execute(f'npm config set registry {registry}')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/tzfun/vue-web-terminal.git
git@gitee.com:tzfun/vue-web-terminal.git
tzfun
vue-web-terminal
vue-web-terminal
vue3

搜索帮助

0d507c66 1850385 C8b1a773 1850385