@@ -53,6 +53,7 @@ const EMPTY_SHADER_NAME = "IsaacScript-RenderAboveHUD";
5353
5454export async function prepareCustomStages (
5555 packageManager : PackageManager ,
56+ isaacScriptCommonDev : boolean | undefined ,
5657 verbose : boolean ,
5758) : Promise < void > {
5859 const customStagesTSConfig = await getCustomStagesFromTSConfig ( ) ;
@@ -64,7 +65,11 @@ export async function prepareCustomStages(
6465
6566 copyCustomStageFilesToProject ( ) ;
6667 await insertEmptyShader ( ) ;
67- await fillCustomStageMetadata ( customStagesTSConfig , packageManager ) ;
68+ await fillCustomStageMetadata (
69+ customStagesTSConfig ,
70+ packageManager ,
71+ isaacScriptCommonDev ,
72+ ) ;
6873 combineCustomStageXMLs ( customStagesTSConfig , verbose ) ;
6974}
7075
@@ -215,13 +220,31 @@ async function insertEmptyShader() {
215220async function fillCustomStageMetadata (
216221 customStagesTSConfig : readonly CustomStageTSConfig [ ] ,
217222 packageManager : PackageManager ,
223+ isaacScriptCommonDev : boolean | undefined ,
218224) {
219225 validateMetadataLuaFileExists ( packageManager ) ;
220226
221227 const customStages = await getCustomStagesWithMetadata ( customStagesTSConfig ) ;
222228 const customStagesLua = await convertCustomStagesToLua ( customStages ) ;
223229 writeFile ( METADATA_LUA_PATH , customStagesLua ) ;
224230 console . log ( `Wrote custom stage metadata to: ${ METADATA_LUA_PATH } ` ) ;
231+
232+ // In development, the "isaacscript-common" directory will be linked to the "isaacscript"
233+ // repository. However, even though the directory is soft-linked, writing to the above path will
234+ // not propagate it correctly. Thus, we must also explicitly write it to the development path.
235+ if ( isaacScriptCommonDev === true ) {
236+ const METADATA_LUA_PATH_DEV = path . resolve (
237+ CWD ,
238+ ".." ,
239+ "isaacscript" ,
240+ "packages" ,
241+ "isaacscript-common" ,
242+ "dist" ,
243+ "customStageMetadata.lua" ,
244+ ) ;
245+ writeFile ( METADATA_LUA_PATH_DEV , customStagesLua ) ;
246+ console . log ( `Wrote custom stage metadata to: ${ METADATA_LUA_PATH_DEV } ` ) ;
247+ }
225248}
226249
227250function validateMetadataLuaFileExists ( packageManager : PackageManager ) {
0 commit comments