@next-core/brick-container 2.92.13 → 2.92.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dll.2dbc409f.js → dll.49bfc5a1.js} +3 -3
- package/dist/{dll.2dbc409f.js.map → dll.49bfc5a1.js.map} +1 -1
- package/dist/icons--app.e260ee01.js +2 -0
- package/dist/icons--app.e260ee01.js.map +1 -0
- package/dist/{icons--blueprint.b919cbd0.js → icons--blueprint.eca3f4f3.js} +2 -2
- package/dist/{icons--blueprint.b919cbd0.js.map → icons--blueprint.eca3f4f3.js.map} +1 -1
- package/dist/icons--colored-big-screen.3339d4ea.js +2 -0
- package/dist/{icons--colored-big-screen.45fd7669.js.map → icons--colored-big-screen.3339d4ea.js.map} +1 -1
- package/dist/icons--common.8aad58d7.js +2 -0
- package/dist/icons--common.8aad58d7.js.map +1 -0
- package/dist/icons--second-menu.eed3b5c2.js +2 -0
- package/dist/icons--second-menu.eed3b5c2.js.map +1 -0
- package/dist/icons--third-menu.42990264.js +2 -0
- package/dist/icons--third-menu.42990264.js.map +1 -0
- package/dist/index.html +1 -1
- package/dist/{main.3d40396a54d8742dbe0a.js → main.1982087ec67993c14f7b.js} +2 -2
- package/dist/{main.3d40396a54d8742dbe0a.js.map → main.1982087ec67993c14f7b.js.map} +1 -1
- package/dist/preview.html +1 -1
- package/package.json +7 -7
- package/tools/link_static_file.py +93 -27
- package/dist/icons--app.6d4fa8d1.js +0 -2
- package/dist/icons--app.6d4fa8d1.js.map +0 -1
- package/dist/icons--colored-big-screen.45fd7669.js +0 -2
- package/dist/icons--common.bd735122.js +0 -2
- package/dist/icons--common.bd735122.js.map +0 -1
- package/dist/icons--second-menu.8fedfd9a.js +0 -2
- package/dist/icons--second-menu.8fedfd9a.js.map +0 -1
- package/dist/icons--third-menu.562e10b3.js +0 -2
- package/dist/icons--third-menu.562e10b3.js.map +0 -1
package/dist/preview.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="zh-CN" data-theme="light" data-mode="default"><head><meta charset="utf-8"/><base href="<!--# echo var='base_href' default='/' -->"/><script>window.DEVELOPER_PREVIEW = true;</script><link href="preview.d7c580cd31a9c96a53f7.css" rel="stylesheet"></head><body><div id="preview-root"><div id="main-mount-point"></div><div id="bg-mount-point" style="display: none"></div><div id="portal-mount-point"></div></div><script src="dll.
|
|
1
|
+
<!doctype html><html lang="zh-CN" data-theme="light" data-mode="default"><head><meta charset="utf-8"/><base href="<!--# echo var='base_href' default='/' -->"/><script>window.DEVELOPER_PREVIEW = true;</script><link href="preview.d7c580cd31a9c96a53f7.css" rel="stylesheet"></head><body><div id="preview-root"><div id="main-mount-point"></div><div id="bg-mount-point" style="display: none"></div><div id="portal-mount-point"></div></div><script src="dll.49bfc5a1.js"></script><script src="polyfill.5f60d909121d6c84d42d.js"></script><script src="preview.16f41cd133904776f25f.js"></script></body></html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/brick-container",
|
|
3
|
-
"version": "2.92.
|
|
3
|
+
"version": "2.92.15",
|
|
4
4
|
"description": "Brick Container Server",
|
|
5
5
|
"homepage": "https://github.com/easyops-cn/next-core/tree/master/packages/brick-container",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
"ws": "^8.11.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@next-core/brick-dll": "^2.45.
|
|
45
|
-
"@next-core/brick-icons": "^2.33.
|
|
44
|
+
"@next-core/brick-dll": "^2.45.67",
|
|
45
|
+
"@next-core/brick-icons": "^2.33.29",
|
|
46
46
|
"@next-core/custom-antd-styles": "^1.26.2",
|
|
47
47
|
"@next-core/illustrations": "^0.11.27",
|
|
48
48
|
"@next-core/less-plugin-css-variables": "^0.2.8",
|
|
49
49
|
"@next-core/theme": "^1.4.4",
|
|
50
50
|
"@next-core/webpack-config-factory": "^2.23.0",
|
|
51
|
-
"@next-dll/ace": "^2.0.
|
|
51
|
+
"@next-dll/ace": "^2.0.722",
|
|
52
52
|
"@next-dll/d3": "^2.0.80",
|
|
53
53
|
"@next-dll/echarts": "^2.0.81",
|
|
54
|
-
"@next-dll/editor-bricks-helper": "^0.38.
|
|
55
|
-
"@next-dll/react-dnd": "^0.1.
|
|
54
|
+
"@next-dll/editor-bricks-helper": "^0.38.67",
|
|
55
|
+
"@next-dll/react-dnd": "^0.1.660",
|
|
56
56
|
"babel-loader": "^8.3.0",
|
|
57
57
|
"clean-webpack-plugin": "^4.0.0",
|
|
58
58
|
"copy-webpack-plugin": "^6.4.1",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"webpack-dev-server": "^4.11.1",
|
|
74
74
|
"webpack-merge": "^5.8.0"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "680e8ca98a5f54f2833431657f9968d24f85336f"
|
|
77
77
|
}
|
|
@@ -5,6 +5,7 @@ import traceback
|
|
|
5
5
|
import yaml
|
|
6
6
|
import sys
|
|
7
7
|
import errno
|
|
8
|
+
import shutil
|
|
8
9
|
|
|
9
10
|
reload(sys)
|
|
10
11
|
sys.setdefaultencoding('utf-8')
|
|
@@ -19,7 +20,8 @@ _MICRO_APPS_FOLDER = "micro-apps"
|
|
|
19
20
|
|
|
20
21
|
# 公共路径
|
|
21
22
|
_INSTALL_BASE_PATH = "/usr/local/easyops"
|
|
22
|
-
_DEPENDENCIES_LOCK_BASE_PATH = os.path.join(
|
|
23
|
+
_DEPENDENCIES_LOCK_BASE_PATH = os.path.join(
|
|
24
|
+
_INSTALL_BASE_PATH, _APPLICATIONS_SA_FOLDER, "dependencies_lock")
|
|
23
25
|
|
|
24
26
|
|
|
25
27
|
def init_dependencies_lock_dir():
|
|
@@ -34,10 +36,12 @@ def init_dependencies_lock_dir():
|
|
|
34
36
|
|
|
35
37
|
# 初始化子目录 bricks、templates、core、micro_apps
|
|
36
38
|
bricks_path = os.path.join(_DEPENDENCIES_LOCK_BASE_PATH, _BRICKS_FOLDER)
|
|
37
|
-
templates_path = os.path.join(
|
|
39
|
+
templates_path = os.path.join(
|
|
40
|
+
_DEPENDENCIES_LOCK_BASE_PATH, _TEMPLATES_FOLDER)
|
|
38
41
|
|
|
39
42
|
core_path = os.path.join(_DEPENDENCIES_LOCK_BASE_PATH, _CORE_FOLDER)
|
|
40
|
-
micro_apps_path = os.path.join(
|
|
43
|
+
micro_apps_path = os.path.join(
|
|
44
|
+
_DEPENDENCIES_LOCK_BASE_PATH, _MICRO_APPS_FOLDER)
|
|
41
45
|
|
|
42
46
|
paths = [bricks_path, templates_path, core_path, micro_apps_path]
|
|
43
47
|
for path in paths:
|
|
@@ -90,9 +94,11 @@ def build_dependencies_path_tree(dependencies):
|
|
|
90
94
|
dependency_type = name
|
|
91
95
|
|
|
92
96
|
# /usr/local/easyops/applications_sa/dependencies_lock templates general-list 1.30.0
|
|
93
|
-
link_path_base = os.path.join(
|
|
97
|
+
link_path_base = os.path.join(
|
|
98
|
+
_DEPENDENCIES_LOCK_BASE_PATH, dependency_type, un_suffix_name, actual_version)
|
|
94
99
|
if un_suffix_name == _BRICK_NEXT_FOLDER:
|
|
95
|
-
link_path_base = os.path.join(
|
|
100
|
+
link_path_base = os.path.join(
|
|
101
|
+
_DEPENDENCIES_LOCK_BASE_PATH, dependency_type, actual_version)
|
|
96
102
|
|
|
97
103
|
dependency = {}
|
|
98
104
|
# 直接在这里记录路径
|
|
@@ -110,7 +116,8 @@ def build_dependencies_path_tree(dependencies):
|
|
|
110
116
|
|
|
111
117
|
|
|
112
118
|
def read_dependencies_yaml(install_app_path):
|
|
113
|
-
dependencies_yaml_path = os.path.join(
|
|
119
|
+
dependencies_yaml_path = os.path.join(
|
|
120
|
+
install_app_path, "dependencies", "micro_app_dependencies.yaml")
|
|
114
121
|
print u"dependencies_yaml_path: {}".format(dependencies_yaml_path)
|
|
115
122
|
dependencies_fp = open(dependencies_yaml_path, "r")
|
|
116
123
|
data = yaml.load(dependencies_fp)
|
|
@@ -129,7 +136,6 @@ def get_static_file_map(path):
|
|
|
129
136
|
for filename in files:
|
|
130
137
|
file_path = os.path.join(root, filename)
|
|
131
138
|
if os.path.islink(file_path):
|
|
132
|
-
print u"current file is link: {}".format(file_path)
|
|
133
139
|
continue
|
|
134
140
|
file_map[root].append(filename)
|
|
135
141
|
|
|
@@ -142,7 +148,8 @@ def link_install_app_static_file(install_app_path, plugin_name, app_version):
|
|
|
142
148
|
if not os.path.exists(current_app_path):
|
|
143
149
|
print u"current app path: {} not exist".format(current_app_path)
|
|
144
150
|
return
|
|
145
|
-
current_app_path_public = os.path.join(
|
|
151
|
+
current_app_path_public = os.path.join(
|
|
152
|
+
_DEPENDENCIES_LOCK_BASE_PATH, _MICRO_APPS_FOLDER, plugin_name, version)
|
|
146
153
|
if not os.path.exists(current_app_path_public):
|
|
147
154
|
os.makedirs(current_app_path_public)
|
|
148
155
|
|
|
@@ -151,17 +158,19 @@ def link_install_app_static_file(install_app_path, plugin_name, app_version):
|
|
|
151
158
|
static_file_map = get_static_file_map(current_app_path)
|
|
152
159
|
print u"---------------------------------------------"
|
|
153
160
|
for file_path_base, files in static_file_map.items():
|
|
154
|
-
_link_static_file(files, file_path_base,
|
|
161
|
+
_link_static_file(files, file_path_base,
|
|
162
|
+
current_app_path, current_app_path_public)
|
|
155
163
|
|
|
156
164
|
print u"---------------------------------------------"
|
|
157
165
|
print u"\n\n"
|
|
158
166
|
|
|
159
167
|
|
|
160
168
|
# 硬链
|
|
161
|
-
def link_dependency_static_file(install_app_path, app_version):
|
|
169
|
+
def link_dependency_static_file(install_app_path, app_id, app_version, is_sa_na_dep_dir_present):
|
|
162
170
|
dependency_apps = read_dependencies_yaml(install_app_path)
|
|
163
171
|
# 依赖的路径树
|
|
164
|
-
dependencies_path_tree = build_dependencies_path_tree(
|
|
172
|
+
dependencies_path_tree = build_dependencies_path_tree(
|
|
173
|
+
dependency_apps) # type: dict
|
|
165
174
|
# 区分版本
|
|
166
175
|
for dependency_name, dependency_info in dependencies_path_tree.items():
|
|
167
176
|
dependency_type = dependency_info["dependency_type"]
|
|
@@ -176,27 +185,74 @@ def link_dependency_static_file(install_app_path, app_version):
|
|
|
176
185
|
dependency_dir_inside_base = os.path.join(install_app_path, "versions",
|
|
177
186
|
app_version, "webroot", "-", _CORE_FOLDER)
|
|
178
187
|
|
|
179
|
-
|
|
180
|
-
|
|
188
|
+
# 如果sa-na目录下没有bricks/template/core目录(说明是体积精简),从dependencies_lock 硬链到sa-na目录
|
|
189
|
+
# 否则, 从sa-na硬链接到dependencies_lock下
|
|
190
|
+
if is_sa_na_dep_dir_present:
|
|
191
|
+
static_file_map = get_static_file_map(dependency_dir_inside_base)
|
|
192
|
+
for file_path_base, files in static_file_map.items():
|
|
193
|
+
_link_static_file(
|
|
194
|
+
files, file_path_base, dependency_dir_inside_base, dependency_dir_public)
|
|
195
|
+
else:
|
|
196
|
+
try:
|
|
197
|
+
static_file_map = get_static_file_map(dependency_dir_public)
|
|
198
|
+
for file_path_base, files in static_file_map.items():
|
|
199
|
+
_link_static_file_to_sa_na(
|
|
200
|
+
files, file_path_base, dependency_dir_inside_base, dependency_dir_public)
|
|
201
|
+
except Exception as e:
|
|
202
|
+
# sa-na下bricks/core/templates目录为空(即体积精简才会走到else) 如果link了一半报错,要删除sa-na下的公共依赖目录, 保证下次还能link
|
|
203
|
+
webroot_dir = os.path.join(
|
|
204
|
+
install_app_path, "versions", app_version, "webroot", "-")
|
|
205
|
+
remove_sa_na_deps_dir(webroot_dir)
|
|
206
|
+
raise RuntimeError(
|
|
207
|
+
"stanalone-na size optimization: handle standalone-na:{} dependencies info err: {}...".format(app_id, e))
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _link_static_file_to_sa_na(files, file_path_base, dependency_dir_inside_base, dependency_dir_public):
|
|
211
|
+
for filename in files:
|
|
212
|
+
file_path = os.path.join(file_path_base, filename)
|
|
213
|
+
link_file_path = file_path.replace(
|
|
214
|
+
dependency_dir_public, dependency_dir_inside_base)
|
|
215
|
+
link_file_path_base = os.path.dirname(link_file_path)
|
|
181
216
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
217
|
+
try:
|
|
218
|
+
if not os.path.exists(link_file_path_base):
|
|
219
|
+
os.makedirs(link_file_path_base)
|
|
220
|
+
|
|
221
|
+
# 创建硬链接, src存在, dst不存在
|
|
222
|
+
if not os.path.exists(link_file_path):
|
|
223
|
+
print("link src: {} dst: {}".format(file_path, link_file_path))
|
|
224
|
+
os.link(file_path, link_file_path)
|
|
225
|
+
else:
|
|
226
|
+
print("hard link already exists for {}".format(link_file_path))
|
|
227
|
+
|
|
228
|
+
except Exception as e:
|
|
229
|
+
raise RuntimeError("link file(src:{} dst: {}) err: {}".format(
|
|
230
|
+
file_path, link_file_path, e))
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def remove_sa_na_deps_dir(webroot_dir):
|
|
234
|
+
deps_dir = [
|
|
235
|
+
os.path.join(webroot_dir, _BRICKS_FOLDER),
|
|
236
|
+
os.path.join(webroot_dir, _TEMPLATES_FOLDER),
|
|
237
|
+
os.path.join(webroot_dir, _CORE_FOLDER)
|
|
238
|
+
]
|
|
239
|
+
for dep_dir in deps_dir:
|
|
240
|
+
if os.path.exists(dep_dir):
|
|
241
|
+
# 目录非空也要删除
|
|
242
|
+
shutil.rmtree(dep_dir)
|
|
185
243
|
|
|
186
244
|
|
|
187
245
|
def _link_static_file(files, file_path_base, dependency_dir_inside_base, dependency_dir_public):
|
|
188
|
-
print "\tfile count: {}".format(len(files))
|
|
189
246
|
for filename in files:
|
|
190
247
|
file_path = os.path.join(file_path_base, filename)
|
|
191
248
|
file_path_backup = file_path + ".back"
|
|
192
249
|
|
|
193
|
-
link_file_path = file_path.replace(
|
|
250
|
+
link_file_path = file_path.replace(
|
|
251
|
+
dependency_dir_inside_base, dependency_dir_public)
|
|
194
252
|
link_file_path_base = link_file_path.replace(filename, "")
|
|
195
253
|
|
|
196
|
-
print u"\t\tfile_path: ", file_path
|
|
197
|
-
print u"\t\tlink_file_path: ", link_file_path
|
|
198
|
-
|
|
199
254
|
try:
|
|
255
|
+
|
|
200
256
|
if not os.path.exists(link_file_path_base):
|
|
201
257
|
os.makedirs(link_file_path_base)
|
|
202
258
|
# 先备份文件
|
|
@@ -222,6 +278,16 @@ def _link_static_file(files, file_path_base, dependency_dir_inside_base, depende
|
|
|
222
278
|
os.remove(file_path_backup)
|
|
223
279
|
|
|
224
280
|
|
|
281
|
+
def check_standalone_na_dep_dir(install_app_path, app_version):
|
|
282
|
+
bricks_dir = os.path.join(
|
|
283
|
+
install_app_path, "versions", app_version, "webroot", "-", _BRICKS_FOLDER)
|
|
284
|
+
templates_dir = os.path.join(
|
|
285
|
+
install_app_path, "versions", app_version, "webroot", "-", _TEMPLATES_FOLDER)
|
|
286
|
+
core_dir = os.path.join(install_app_path, "versions",
|
|
287
|
+
app_version, "webroot", "-", _CORE_FOLDER)
|
|
288
|
+
return os.path.exists(bricks_dir) and os.path.exists(templates_dir) and os.path.exists(core_dir)
|
|
289
|
+
|
|
290
|
+
|
|
225
291
|
if __name__ == "__main__":
|
|
226
292
|
if len(sys.argv) < 4:
|
|
227
293
|
print u"Usage: ./symlink_dependencies.py $install_path $plugin_name $version, Got: {}".format(sys.argv)
|
|
@@ -230,16 +296,16 @@ if __name__ == "__main__":
|
|
|
230
296
|
plugin_name = sys.argv[2]
|
|
231
297
|
version = sys.argv[3]
|
|
232
298
|
|
|
233
|
-
"""
|
|
234
|
-
本地测试实例:
|
|
235
|
-
python2 symlink_dependencies.py /usr/local/easyops/applications_sa/easy-agile-standalone-NA 1.0.13
|
|
236
|
-
"""
|
|
237
|
-
|
|
238
299
|
# must init
|
|
239
300
|
init_dependencies_lock_dir()
|
|
240
301
|
|
|
241
302
|
# 硬链当前APP
|
|
242
303
|
link_install_app_static_file(install_path, plugin_name, version)
|
|
243
304
|
|
|
305
|
+
# 通过判断standalone-na目录下是否存在bricks/core/templates目录来判断是否需要体积精简
|
|
306
|
+
is_sa_na_dep_dir_present = check_standalone_na_dep_dir(
|
|
307
|
+
install_path, version)
|
|
308
|
+
|
|
244
309
|
# 硬链依赖APP
|
|
245
|
-
link_dependency_static_file(
|
|
310
|
+
link_dependency_static_file(
|
|
311
|
+
install_path, plugin_name, version, is_sa_na_dep_dir_present)
|