Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use dotRelative glob option #379

Merged
merged 1 commit into from
Mar 7, 2023
Merged

Conversation

richardlau
Copy link
Member

@richardlau richardlau requested a review from a team as a code owner March 7, 2023 17:38
@richardlau
Copy link
Member Author

Difference with #378 is if absolute paths are used in process.env.SCRIPTS (which AFAICT we are not setting on the server) -- #378 will always append the leading ./.

const scriptsToLoad = process.env.SCRIPTS || './scripts/**/*.js'

@@ -10,7 +10,7 @@ const scriptsToLoad = process.env.SCRIPTS || './scripts/**/*.js'
const { app, events } = require('./app')

// load all the files in the scripts folder
globSync(scriptsToLoad).forEach((file) => {
globSync(scriptsToLoad, { dotRelative: true }).forEach((file) => {
logger.info('Loading:', file)
require(file)(app, events)
Copy link
Member

@Trott Trott Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why it's not showing up in this diff, but this line is currently:

require(`./${file}`)(app, events)

and will need to be adjusted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rebase the pr branch against main?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased and updated.

@richardlau richardlau force-pushed the richardlau-globsync-dotrelative branch from b48e4c0 to 8ce328d Compare March 7, 2023 17:57
@Trott
Copy link
Member

Trott commented Mar 7, 2023

Tested locally (since server.js isn't covered by the tests) and it works.

@Trott Trott merged commit e58ede6 into main Mar 7, 2023
@richardlau richardlau deleted the richardlau-globsync-dotrelative branch March 7, 2023 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants