@@ -42,20 +42,17 @@ def booststrap_components(components_source):
42
42
status = proc .poll ()
43
43
44
44
if err :
45
- print (err .decode (), file = sys .stderr )
45
+ print (( "🛑 " if status else "" ) + err .decode (), file = sys .stderr )
46
46
47
- if status == 0 :
47
+ if status or not out :
48
48
print (
49
- "🟢 Finished installing npm dependencies for the following component packages: {} (status={}) 🟢" .format (
50
- source_glob , status
51
- ),
49
+ "🚨 Failed installing npm dependencies for component packages: {source_glob} (status={status}) 🚨" ,
52
50
file = sys .stderr ,
53
51
)
54
- if not out :
52
+ sys .exit (1 )
53
+ else :
55
54
print (
56
- "Failed installing npm dependencies for the following component packages {} (status={})" .format (
57
- source_glob , status
58
- ),
55
+ f"🟢 Finished installing npm dependencies for component packages: { source_glob } 🟢" ,
59
56
file = sys .stderr ,
60
57
)
61
58
@@ -82,13 +79,11 @@ def build_components(components_source):
82
79
status = proc .poll ()
83
80
84
81
if err :
85
- print (err .decode (), file = sys .stderr )
82
+ print (( "🛑 " if status else "" ) + err .decode (), file = sys .stderr )
86
83
87
- if not out :
84
+ if status or not out :
88
85
print (
89
- "🟢 Finished updating the following component packages {} (status={}) 🟢" .format (
90
- source_glob , status
91
- ),
86
+ f"🚨 Finished updating component packages: { source_glob } (status={ status } ) 🚨" ,
92
87
file = sys .stderr ,
93
88
)
94
89
sys .exit (1 )
@@ -117,21 +112,18 @@ def build_components(components_source):
117
112
118
113
if not os .path .exists (build_directory ):
119
114
print (
120
- "Could not locate build artifacts. Check that the npm build process completed successfully for the given package: {}" . format (
121
- package
122
- )
115
+ "🚨 Could not locate build artifacts."
116
+ + " Check that the npm build process completed"
117
+ + f" successfully for package: { package } 🚨"
123
118
)
119
+ sys .exit (1 )
124
120
else :
125
- print ("🚚 Moving build artifacts from " + build_directory + " to Dash 🚚" )
121
+ print (f "🚚 Moving build artifacts from { build_directory } to Dash 🚚" )
126
122
shutil .rmtree (dest_path )
127
123
shutil .copytree (build_directory , dest_path )
128
124
with open (os .path .join (dest_path , ".gitkeep" ), "w" ):
129
125
pass
130
- print (
131
- "🟢 Finished moving build artifacts from "
132
- + build_directory
133
- + " to Dash 🟢"
134
- )
126
+ print (f"🟢 Finished moving build artifacts from { build_directory } to Dash 🟢" )
135
127
136
128
137
129
def cli ():
@@ -143,7 +135,9 @@ def cli():
143
135
)
144
136
parser .add_argument (
145
137
"components_source" ,
146
- help = "A glob string that matches the Dash component libraries to be updated (eg.'dash-table' // 'dash-core-components|dash-html-components' // 'all'). The default argument is 'all'." ,
138
+ help = "A glob string that matches the Dash component libraries to be updated"
139
+ " (eg.'dash-table' // 'dash-core-components|dash-html-components' // 'all')."
140
+ " The default argument is 'all'." ,
147
141
default = "all" ,
148
142
)
149
143
@@ -153,4 +147,5 @@ def cli():
153
147
build_components (args .components_source )
154
148
155
149
156
- cli ()
150
+ if __name__ == "__main__" :
151
+ cli ()
0 commit comments