Following all files copy operation to working directory in cli process, theme name injection into theme/style.css isn't working as expected leaving the placeholder $cwpt string un-replaced.
The issue comes from concurrent operation that happened in the line below
https://github.com/babblebey/wp-theme/blob/d60df48fb35f08b4becdf9553e574dc91f9c57d9/cli/index.js#L71-L75
...where the injectThemeName can be assumed to have done its phase of the operation of replacing the appropriate placeholder, but ends up getting overwritten by the injectCSSFramework operation, due to the fact that they at some point might be working with stale/outdated content from the styleCssContent.
Suggested Fix
Allow newer reading of style.css file content, doing away with the const styleCssContent = fs.readFileSync(styleCssFile, "utf-8"); variable definition which is bound to hold the content at a certain state that can quickly become stale.
This could be to just ready the file directly as argument when running the inject utilities.. i.e.
injectThemeName(styleCssFile, fs.readFileSync(styleCssFile, "utf-8"), themeName);
injectCSSFramework(styleCssFile, fs.readFileSync(styleCssFile, "utf-8"), cssFramework);
this way, the file is re-read at the certain state it's become after the first injection operation.
Following all files copy operation to working directory in
cliprocess, theme name injection intotheme/style.cssisn't working as expected leaving the placeholder$cwptstring un-replaced.The issue comes from concurrent operation that happened in the line below
https://github.com/babblebey/wp-theme/blob/d60df48fb35f08b4becdf9553e574dc91f9c57d9/cli/index.js#L71-L75
...where the
injectThemeNamecan be assumed to have done its phase of the operation of replacing the appropriate placeholder, but ends up getting overwritten by theinjectCSSFrameworkoperation, due to the fact that they at some point might be working with stale/outdated content from thestyleCssContent.Suggested Fix
Allow newer reading of
style.cssfile content, doing away with theconst styleCssContent = fs.readFileSync(styleCssFile, "utf-8");variable definition which is bound to hold the content at a certain state that can quickly become stale.This could be to just ready the file directly as argument when running the inject utilities.. i.e.
this way, the file is re-read at the certain state it's become after the first injection operation.