question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move platform.json in accessible place

See original GitHub issue

What are you trying to achieve?

I want programmatically to check sharp installed platform in node_modules. The only place that show this is platform.json A1D37C38-CC06-4DAF-85E0-68445D3B1DDF

to check is it right sharp platform installed in node_modules its need to write function like this:

function checkInstalledSharpPlatform(targetPlatform, arch) {
 let shrapPath = require.resolve('sharp');
 shrapPath = path.join(shrapPath,'..','..','vendor','8.11.3','darwin-arm64v8','platform.json');

 if (!fs.existsSync(shrapPath)) {
      return false;
 }
 const data = fs.readFileSync(shrapPath, 'utf8');
 return data === '"' + targetPlatform + '-' + arch + '"';
}

but this function is not robust (8.11.3 folder or darwin-arm64v8 will be changed in the next sharp versions). Can we have platform.json in better place? (like node_modules/sharp/platform.json)

Have you searched for similar feature requests? YES

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
lovellcommented, Dec 12, 2021

Added as sharp.vendor via commit https://github.com/lovell/sharp/commit/3da258f6fb1446bc8596070d06119e31c621a073

Example output:

{ current: 'linux-x64', installed: [ 'linux-x64', 'win32-ia32' ] }

This will be in v0.30.0.

0reactions
lovellcommented, Feb 1, 2022

v0.30.0 now available with this feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading JSON data from Cloud Storage | BigQuery
You can load newline delimited JSON data from Cloud Storage into a new table or partition, or append to or overwrite an existing...
Read more >
Working with JSON in Swift - Swift Blog - Apple Developer
You can use the Foundation framework's JSONSerialization class to convert JSON into Swift data types like Dictionary, Array, String, Number, and ...
Read more >
User and Workspace Settings - Visual Studio Code
Depending on your platform, the user settings file is located here: Windows %APPDATA%\Code\User\settings.json; macOS $HOME/Library/Application\ Support/Code/ ...
Read more >
Semi-Structured JSON Data Handling Automation in Snowflake
This requires some technical skills, however, along with knowledge about the JSON structure being queried. So, many organizations deploy views ...
Read more >
3+ Ways for Reading Local JSON Files with Angular 15
Anything you place in the assets folder in the Angular app will be accessible in the browser by default, and you may even...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found