Skip to content

Commit fcf8be4

Browse files
committed
fix _SCRIPT_USER and _FULL_SCRIPT_NAME not being replaced properly in some cases
1 parent 68c6009 commit fcf8be4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/push.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ export async function push(
233233
`scripts/${scriptName}.js`
234234
),
235235
minifiedCode
236-
.replace(new RegExp(`$${uniqueID}$SCRIPT_USER$`, `g`), user)
237-
.replace(new RegExp(`$${uniqueID}$FULL_SCRIPT_NAME$`, `g`), `${user}.${scriptName}`)
236+
.replace(new RegExp(`\\$${uniqueID}\\$SCRIPT_USER\\$`, `g`), user)
237+
.replace(new RegExp(`\\$${uniqueID}\\$FULL_SCRIPT_NAME\\$`, `g`), `${user}.${scriptName}`)
238238
)
239239
))
240240

@@ -286,8 +286,8 @@ export async function push(
286286
`scripts/${scriptName}.js`
287287
),
288288
minifiedCode
289-
.replace(new RegExp(`$${uniqueID}$SCRIPT_USER$`, `g`), user)
290-
.replace(new RegExp(`$${uniqueID}$FULL_SCRIPT_NAME$`, `g`), `${user}.${scriptName}`)
289+
.replace(new RegExp(`\\$${uniqueID}\\$SCRIPT_USER\\$`, `g`), user)
290+
.replace(new RegExp(`\\$${uniqueID}\\$FULL_SCRIPT_NAME\\$`, `g`), `${user}.${scriptName}`)
291291
)
292292
))
293293

src/watch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ export function watch(
165165
await Promise.all(usersToPushTo.map(user => writeFilePersistent(
166166
resolvePath(hackmudDirectory, user, `scripts/${scriptName}.js`),
167167
minifiedCode
168-
.replace(new RegExp(`$${uniqueID}$SCRIPT_USER$`, `g`), user)
169-
.replace(new RegExp(`$${uniqueID}$FULL_SCRIPT_NAME$`, `g`), `${user}.${scriptName}`)
168+
.replace(new RegExp(`\\$${uniqueID}\\$SCRIPT_USER\\$`, `g`), user)
169+
.replace(new RegExp(`\\$${uniqueID}\\$FULL_SCRIPT_NAME\\$`, `g`), `${user}.${scriptName}`)
170170
)))
171171

172172
onPush?.({

0 commit comments

Comments
 (0)