Add @netlify/heuristics package
See original GitHub issueWe need a nice way to figure out different information about a project from its source code.
@netlify/heuristics
(working title) would be the module that detects what kind of a project the repo is, including:
- The type of static generator used
- The functions setup (what runtime JS or Go)
- What binaries are used in the
build.command
See https://github.com/netlify/netlify-build/tree/master/packages/%40netlify-build/src/heuristics - If
nvmrc
is set what version of node does this project expect - Is there a
requirements.txt
file to indication its a python based project - Information (if available) on what the remove git provider is, github/gitlab/bitbucket.
Any information that we need to:
- Use in the scaffolding flow
- Use in netlify dev
- Use in netlify build. Plugins might want to have this heuristic information
Currently there is https://github.com/netlify/cli/tree/master/src/detectors living in the CLI and https://github.com/netlify/netlify-build/tree/master/packages/%40netlify-build/src/heuristics inside the build package.
Todo:
- Extract this into a package in this repo
- Include & potentially refactor detectors
- Include additional information we have access to listed above & any other ideas that we think would be handy for consumers (in build, build plugins, & netlify dev)
- Use dependency in CLI
Notes: https://github.com/netlify/cli/tree/master/src/detectors is using alot of sync calls and the API might need to be revisited to avoid false positives.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
netlify-setup-heuristics - npm
This module lets CLI tools and UIs on top of netlify run heuristics to automatically guess the continuous deployment settings based on the ......
Read more >️ [DEPRECATED] Setup heuristics used by netlify-cli and ...
This module lets CLI tools and UIs on top of netlify run heuristics to automatically guess the continuous deployment settings based on the...
Read more >Netlify Dev
Netlify Dev brings the power of Netlify's Edge Logic layer, serverless functions and add-on ecosystem to your local machine. It runs Netlify's production ......
Read more >Manage build dependencies | Netlify Docs
Specify dependencies for your project so that our platform can install required languages and software before running a build.
Read more >A Step-by-Step Guide: Assemble on Netlify
Netlify will use the information in package.json to identify which ... also uses package.json to know which uninstalled dependencies to add ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Super late here, but good point @lesliecdubs. Ideally we wouldn’t have two different implementations of the same logic. Want to start exploring CLI and UI parity and code reuse more.
FYI in case this is useful, we already have some very basic heuristics set up in the app. As swyx mentioned, we only use them right now to detect a user’s build command and publish folder in the “create a new site” flow once a repo is linked.
https://github.com/netlify/netlify-react-ui/blob/master/src/lib/heuristics/automation.js