@@ -39,6 +39,7 @@ const Methods = (() => {
3939
4040 const customThemeExists = async ( customThemePath ) => {
4141 try {
42+ console . log ( '== customThemeExists ==' )
4243 return await atomicFS . stat ( customThemePath )
4344 } catch {
4445 return false
@@ -48,11 +49,14 @@ const Methods = (() => {
4849 const refreshCustomTheme = async ( customThemePath ) => {
4950 const backupKeepDir = async ( keepPath ) => {
5051 try {
52+ console . log ( '== backupKeepDir 1 ==' )
5153 if ( await atomicFS . stat ( keepPath ) ) {
54+ console . log ( '== backupKeepDir 2 ==' )
5255 const tempPath = await atomicFS . mkdtemp (
5356 join ( tmpdir ( ) , 'writ-theme-keep' )
5457 )
5558 Debug . debugLog ( 'refresh theme temp dir' , tempPath )
59+ console . log ( '== backupKeepDir 3 ==' )
5660 await atomicFS . cp ( keepPath , tempPath )
5761 return tempPath
5862 }
@@ -63,6 +67,7 @@ const Methods = (() => {
6367 }
6468
6569 const applyKeepOverrides = async ( keepBackupPath , themePath ) => {
70+ console . log ( '== applyKeepOverrides 1==' )
6671 const entries = await atomicFS . readdirRecursive ( keepBackupPath )
6772
6873 await Promise . all (
@@ -73,6 +78,7 @@ const Methods = (() => {
7378 entry . parentPath . replace ( keepBackupPath , '' ) ,
7479 entry . name
7580 )
81+ console . log ( '== applyKeepOverrides 2 ==' )
7682 return atomicFS . cp (
7783 join ( keepBackupPath , relativePath ) ,
7884 join ( themePath , relativePath )
@@ -94,7 +100,9 @@ const Methods = (() => {
94100 } )
95101
96102 if ( keepBackupPath ) {
103+ console . log ( '== refreshCustomTheme 1 ==' )
97104 await atomicFS . mkdir ( join ( tempPath , KEEP_PATH ) )
105+ console . log ( '== refreshCustomTheme 2 ==' )
98106 await atomicFS . cp ( keepBackupPath , join ( tempPath , KEEP_PATH ) )
99107 await applyKeepOverrides ( keepBackupPath , tempPath )
100108 }
@@ -104,12 +112,14 @@ const Methods = (() => {
104112 throw e
105113 } finally {
106114 if ( keepBackupPath ) {
115+ console . log ( '== refreshCustomTheme 3 ==' )
107116 await atomicFS . rm ( keepBackupPath )
108117 }
109118 }
110119 }
111120
112121 const collectCustomizerPaths = async ( customThemePath ) => {
122+ console . log ( '== collectCustomizerPaths ==' )
113123 const paths = await atomicFS . readdir ( customThemePath )
114124 const customizerPaths = paths . filter ( p => {
115125 return p . endsWith ( '.css' ) || p . endsWith ( '.js' )
@@ -119,13 +129,19 @@ const Methods = (() => {
119129
120130 const copyCommonResources = ( targetPath ) => {
121131 return Promise . all ( [
122- atomicFS . cp (
123- join ( __dirname , 'common' , PARTIALS . from ) ,
124- join ( targetPath , PARTIALS . to )
132+ (
133+ console . log ( '== copyCommonResources 1 ==' ) ,
134+ atomicFS . cp (
135+ join ( __dirname , 'common' , PARTIALS . from ) ,
136+ join ( targetPath , PARTIALS . to )
137+ )
125138 ) ,
126- atomicFS . cp (
127- join ( __dirname , 'common' , TEMPLATE_HELPERS . from ) ,
128- join ( targetPath , PARTIALS . to , TEMPLATE_HELPERS . to )
139+ (
140+ console . log ( '== copyCommonResources 2 ==' ) ,
141+ atomicFS . cp (
142+ join ( __dirname , 'common' , TEMPLATE_HELPERS . from ) ,
143+ join ( targetPath , PARTIALS . to , TEMPLATE_HELPERS . to )
144+ )
129145 )
130146 ] )
131147 }
@@ -134,17 +150,26 @@ const Methods = (() => {
134150 const { theme } = Settings . getSettings ( )
135151 const themeSrcPath = join ( __dirname , '..' , '..' , 'packages' , `theme-${ theme } ` )
136152 return Promise . all ( [
137- atomicFS . cp (
138- join ( themeSrcPath , ASSETS ) ,
139- join ( customThemePath , ASSETS , theme )
153+ (
154+ console . log ( '== copyBaseThemeResources 1 ==' ) ,
155+ atomicFS . cp (
156+ join ( themeSrcPath , ASSETS ) ,
157+ join ( customThemePath , ASSETS , theme )
158+ )
140159 ) ,
141- atomicFS . cp (
142- join ( themeSrcPath , PARTIALS . from ) ,
143- join ( customThemePath , PARTIALS . to )
160+ (
161+ console . log ( '== copyBaseThemeResources 2 ==' ) ,
162+ atomicFS . cp (
163+ join ( themeSrcPath , PARTIALS . from ) ,
164+ join ( customThemePath , PARTIALS . to )
165+ )
144166 ) ,
145- atomicFS . cp (
146- join ( themeSrcPath , THEME_SETTINGS ) ,
147- join ( customThemePath , THEME_SETTINGS )
167+ (
168+ console . log ( '== copyBaseThemeResources 3 ==' ) ,
169+ atomicFS . cp (
170+ join ( themeSrcPath , THEME_SETTINGS ) ,
171+ join ( customThemePath , THEME_SETTINGS )
172+ )
148173 )
149174 ] ) . then ( ( ) => {
150175 State . customizers . push ( THEME_SETTINGS )
@@ -154,13 +179,15 @@ const Methods = (() => {
154179 }
155180
156181 const copyCustomizers = async ( customThemePath ) => {
182+ console . log ( '== copyCustomizers 1 ==' )
157183 const paths = await atomicFS . readdir ( join ( __dirname , 'customizers' ) )
158184 const customizers = paths . filter ( p => {
159185 return p . endsWith ( '.css' ) || p . endsWith ( '.js' )
160186 } )
161187 State . customizers . push ( ...customizers )
162188 return Promise . all (
163189 paths . map ( path => {
190+ console . log ( '== copyCustomizers 2 ==' )
164191 return atomicFS . cp (
165192 join ( __dirname , 'customizers' , path ) ,
166193 join ( customThemePath , path )
@@ -171,12 +198,19 @@ const Methods = (() => {
171198
172199 const makeCustomThemeDirectory = async ( customThemePath , options = { } ) => {
173200 if ( ! options . skipContainer ) {
201+ console . log ( '== makeCustomThemeDirectory 1 ==' )
174202 await atomicFS . mkdir ( customThemePath )
175203 }
176204
177205 await Promise . all ( [
178- atomicFS . mkdir ( join ( customThemePath , ASSETS ) ) ,
179- atomicFS . mkdir ( join ( customThemePath , PARTIALS . to ) )
206+ (
207+ console . log ( '== makeCustomThemeDirectory 2 ==' ) ,
208+ atomicFS . mkdir ( join ( customThemePath , ASSETS ) )
209+ ) ,
210+ (
211+ console . log ( '== makeCustomThemeDirectory 3 ==' ) ,
212+ atomicFS . mkdir ( join ( customThemePath , PARTIALS . to ) )
213+ )
180214 ] )
181215
182216 await copyCommonResources ( customThemePath )
0 commit comments