Skip to content

Commit

Permalink
fix: further improvements to /c/ paths in prescanner on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
starpit committed Apr 12, 2023
1 parent f467fa1 commit cb12724
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/builder/bin/prescan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if [ -z "$KUI_PRESCAN" ]; then
fi

echo "compiling plugin registry $CLIENT_HOME to ${KUI_PRESCAN-default location}"
MAIN=$(node -e "console.log(require(\"$CLIENT_HOME/package.json\".replace(/^\/c\//, \"c:/\")).main)")
MAIN=$(node -e "path=\"$CLIENT_HOME/package.json\"; if (process.platform === 'win32') path = path.replace(/^\/([a-zA-Z])\//, \"\$1:/\"); console.log(require(path).main)")
MAIN_PROXY=$(echo "$MAIN" | sed -E 's/\.min\.js/-proxy.min.js/')
if [ -f "$MAIN" ]
then KUI_HEADLESS=true node "$MAIN" -- kui internal scan
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"fs-extra": "^11.1.1",
"mkdirp": "^3.0.0",
"pretty-ms": "^8.0.0",
"slash": "^5.0.0",
"tmp": "^0.2.1",
"trie-search": "^1.4.1",
"uuid": "^9.0.0",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/plugins/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import Debug from 'debug'
const debug = Debug('core/plugins/scanner')

import slash from 'slash'
import { join } from 'path'

import { pluginRoot } from './plugins'
Expand Down Expand Up @@ -197,7 +198,7 @@ const topologicalSortForScan = async (
debug('resolving %s', route)
try {
const module = { route, path: pluginPaths[route] }
await loadPlugin(route, pluginPaths[route], scanCache)
await loadPlugin(route, slash(pluginPaths[route]), scanCache)
scanCache.flat.push(module)
delete pluginPaths[route]
} catch (err) {
Expand Down Expand Up @@ -273,7 +274,7 @@ export const scanForModules = async (dir: string, quiet = false, filter: Filter

await Promise.all(
modules.map(async module => {
const modulePath = path.join(moduleDir, module)
const modulePath = slash(path.join(moduleDir, module))
const name = (parentPath ? `${parentPath}/` : '') + module

try {
Expand Down

0 comments on commit cb12724

Please sign in to comment.