Skip to content

Commit ebbb4c7

Browse files
committed
[vue3] publish script
1 parent e3325cc commit ebbb4c7

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

publish.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# encoding=utf8
2+
3+
import subprocess
4+
import platform
5+
6+
NPM_REPOSITORY="https://registry.npmjs.org"
7+
NPM_REPOSITORY_MIRROR="https://registry.npmmirror.com"
8+
NODE_VERSION = 18
9+
ENCODING = "gbk" if platform.system().lower() == 'windows' else 'utf-8'
10+
11+
def execute(command, with_result = False,encoding = ENCODING):
12+
print(f"calling: {command}")
13+
if with_result:
14+
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, encoding=encoding)
15+
stdout,stderr = p.communicate()
16+
if p.returncode == 0:
17+
return stdout
18+
else:
19+
raise Exception(f"exit with {p.returncode}, stderr: {stderr}")
20+
else:
21+
subprocess.call(command, shell=True, encoding=encoding)
22+
23+
if __name__ == '__main__':
24+
registry = execute(f'npm config get registry', with_result=True)
25+
node_version = execute(f'node -v', with_result=True)
26+
try:
27+
execute(f'nvm use {NODE_VERSION}')
28+
execute(f'pnpm install')
29+
execute(f'pnpm run build')
30+
execute(f'npm config set registry {NPM_REPOSITORY}')
31+
execute(f'npm publish')
32+
finally:
33+
execute(f'nvm use {node_version}')
34+
execute(f'npm config set registry {registry}')

src/Terminal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ defineExpose({
19621962

19631963
<template>
19641964
<div :class="'t-container ' + (isActive ? '' : 't-disable-select')"
1965-
:id="`t-${getName()}`"
1965+
:id="`t-${parseNameHtmlSafely(getName())}`"
19661966
:style="containerStyle"
19671967
ref="terminalContainerRef">
19681968
<div v-if="draggable">

test/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const testInputValue = ref("")
4343
const terminals = ref<Array<any>>([
4444
{
4545
show: true,
46-
name: 'terminal-test',
46+
name: 'terminal-test [default]',
4747
context: '/vue-web-terminal/test<br/>123/阿里云/2',
4848
dragConf: {
4949
width: "60%",

0 commit comments

Comments
 (0)