apache / apache/cordova-electron
During creation, persist current platform version in created project
- Dominant language
- JavaScript
- Stars
- 135
- Forks
- 60
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 5
Description
# Feature Request
## Motivation Behind Feature
Up until recently we copied all our Node.js platform tools to the `/cordova` folder on project creation and loaded them from there. Now we don't do that anymore and load the tools directly from `node_modules` instead. That's great and it simplifies a lot of things for us.
However, there is one drawback: Previously a generated platform project always used the version of the tools it was generated with. Now the version of the tools can change after a project has been created. In itself this is not a problem, just something to watch out for. Our CLI should just check that the tooling used is compatible with the project structure.
The real problem is, that there is no easy way to know with which version of the platform a given project was created. Previously that could be determined with the `cordova/version` script, but that outputs the version of the currently used tools now.
## Feature Description
For above reasons, we should have an easy and standardized way of determining the version of a platform that a given project was initialized with. IMO this would be best accomplished by writing out the currently used platform version into some file in the platform project upon project creation.
- The file format should be easy to parse for us. I'm thinking either plain text or JSON.
- It should not be a JavaScript binary (like `version` is now) to avoid the overhead of spawning a subprocess.
- It should neither be a node module, since they are cached by Node.js' module system which can lead to wrong values being reported if the file is required multiple times during the life time of a process.
- We _could_ include that information in the existing `PlatformJson` although all existing information in that file seems to be related to plugin management only, which is a different concern.
The file could and possibly should also include the name of the platform. This way, our CLI could determine the platform API to load for a given platform project from latter's contents instead of e.g. it's folder name.
## Alternatives or Workarounds
Detect compatibility of tools and project-on-disk by examining the files on disk and figuring out if the layout is as expected.
Contributor guide
Research direction
Start by reviewing the existing cordova/version script, PlatformJson, and the project-creation flow that currently loads tools from node_modules. Decide where the platform version and optional platform name should be persisted, then define how the CLI will parse them and verify compatibility with the generated project structure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100