Closed
Description
I noticed that in our fork of ast-grep-angular
, the prebuilds for x64 reside in a dir named X64
(capital X) instead of x64
(lower case x) .
https://www.npmjs.com/package/@codemod.com/ast-grep-lang-angular/v/0.0.2?activeTab=code
Should we update the post install script to search for multiple possible dirs instead of just looking at x64
?
My solution for now has been to patch setup-lang:
@@ -67,14 +67,20 @@ const ARCH_MAP: Record<string, string> = {
*/
function resolvePrebuild(dir: string) {
const os = PLATFORM_MAP[process.platform]
- const arch = ARCH_MAP[process.arch]
- const prebuild = path.join(dir, 'prebuilds', `prebuild-${os}-${arch}`, 'parser.so')
- if (!os || !arch || !fs.existsSync(prebuild)) {
- log(`no prebuild for ${os} ${arch}`)
+ const archs = ARCH_MAP[process.arch]
+ if (!os || archs?.length === 0) {
+ log(`os or arch not found ${os} ${archs}`)
return undefined
}
- log(`found prebuild for ${os} ${arch}`)
- return prebuild
+
+ for (const arch of archs) {
+ const prebuild = path.join(dir, 'prebuilds', `prebuild-${os}-${arch}`, 'parser.so')
+ if (fs.existsSync(prebuild)) {
+ return prebuild
+ }
+ }
+ log(`no prebuild found for ${os} ${archs}`)
+ return undefined
}
Metadata
Assignees
Labels
No labels
Activity