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

PHP detected on node project because node_modules directory is scanned #2400

Open
dr-BEat opened this issue Apr 2, 2024 · 2 comments
Open

Comments

@dr-BEat
Copy link

dr-BEat commented Apr 2, 2024

I recently noticed that my Azure Static Web App project which uses node and typescript gets detected as node and PHP.

---Oryx build logs---
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues
Oryx Version: 0.2.20231128.3, Commit: 0b76566110f0db32097b869761e056fd9b01848d, ReleaseTagName: 20231128.3
Build Operation ID: 2c7aaad437699c9d
Repository Commit : ...
OS Type           : bullseye
Image Type        : jamstack
Detecting platforms...
Detected following platforms:
  nodejs: 18.19.1
  php: 8.0.30
Version '8.0.30' of platform 'php' is not installed. Generating script to install it...

After some investigation I found that the npm package flatted ships some php (and other languages) files. Which trigger the PhpPlatformDetector to report the whole project as being PHP.
While it can be discussed if PHP files should be part of a node package the much much larger issue is that Oryx is scanning the usually quite large node_modules folder in projects.
And not once, but for every single IPlatformDetector implementation at least once. That is a colossal waste of time.

There is no way to exclude the node_modules folder from these searches either.

Am I missing something? This seems like a huge oversight.

@dr-BEat
Copy link
Author

dr-BEat commented Apr 3, 2024

I worked around this issue by adding a postinstall script to my package.json to delete the offending php file from the node_modules folder after install.

{
  "scripts": {
    ...
    "postinstall": "rimraf node_modules/flatted/php"
    ...
  }
}

Maybe this helps somebody.

@surenderssm
Copy link
Member

We appreciate your insight, @dr-BEat. Your analysis is accurate and we’re currently exploring this area. Anticipate improvements in the near future.

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

No branches or pull requests

2 participants