Skip to content

Commit

Permalink
fix(build): always use native slashes when merging manifest plugins
Browse files Browse the repository at this point in the history
Simply because that's the syntax that Node expects for imports in non-Windows platforms. This ensures that they're always native to the host being run on.

Yay for portability!
  • Loading branch information
Pkmmte committed Oct 7, 2023
1 parent ba7fe09 commit 28a6d82
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-flies-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@roboplay/robo.js': patch
---

fix(build): always use native slashes when merging manifest plugins
10 changes: 8 additions & 2 deletions packages/robo/src/cli/utils/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,31 @@ export async function loadManifest(name = '', basePath = ''): Promise<Manifest>

Object.keys(manifest.api ?? {}).forEach((key) => {
manifest.api[key].__auto = true
manifest.api[key].__path = manifest.api[key].__path.replaceAll('\\', path.sep)
manifest.api[key].__plugin = {
name,
path: basePath
}
})
Object.keys(manifest.commands).forEach((key) => {
manifest.commands[key].__auto = true
manifest.commands[key].__path = manifest.commands[key].__path.replaceAll('\\', path.sep)
manifest.commands[key].__plugin = {
name,
path: basePath
}
})
Object.keys(manifest.context?.message ?? {}).forEach((key) => {
manifest.context.message[key].__auto = true
manifest.context.message[key].__path = manifest.context.message[key].__path.replaceAll('\\', path.sep)
manifest.context.message[key].__plugin = {
name,
path: basePath
}
})
Object.keys(manifest.context?.user ?? {}).forEach((key) => {
manifest.context.user[key].__auto = true
manifest.context.user[key].__path = manifest.context.user[key].__path.replaceAll('\\', path.sep)
manifest.context.user[key].__plugin = {
name,
path: basePath
Expand All @@ -243,12 +247,14 @@ export async function loadManifest(name = '', basePath = ''): Promise<Manifest>
Object.keys(manifest.events).forEach((key) => {
manifest.events[key] = manifest.events[key].map((eventConfig) => ({
...pluginInfo,
...eventConfig
...eventConfig,
__path: eventConfig.__path.replaceAll('\\', path.sep)
}))
})
manifest.middleware = manifest.middleware?.map((middleware) => ({
...pluginInfo,
...middleware
...middleware,
__path: middleware.__path.replaceAll('\\', path.sep)
}))
}

Expand Down
1 change: 1 addition & 0 deletions packages/robo/src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export async function loadConfig(file = 'robo'): Promise<Config> {
// Load plugin files when using "/config" directory
if (configPath.includes(path.sep + 'config' + path.sep)) {
logger.debug('Scanning for plugin files...')
config.plugins = config.plugins ?? []

await scanPlugins(fileURLToPath(configPath), (plugin, pluginConfig) => {
// Remove existing plugin config if it exists
Expand Down

1 comment on commit 28a6d82

@vercel
Copy link

@vercel vercel bot commented on 28a6d82 Oct 7, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.