ionic-team / ionic-team/ionic-cli
Package.json is being modified after ionic cordova build android
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 682
- PR merge metrics
- No merged PRs in 30d
Description
**Description:**
I work in a windows environment with vscode where all files need to end with `CRLF `, so this configs are made:
* `.editorconfig` the `end_of_line` property is set to `crlf`
* `git` uses crlf
* `.prettierrc` has `"endOfLine": "crlf"`
* vscode config has `"files.eol": "\r\n"` and `"prettier.endOfLine": "crlf"`
All work as expected except for when you build (or run) the project on device. Just after lint is complete and `ionic-cli` prints `> cordova build android` the `package.json` file is edited and stripped from the last empty line. That leads git say changes where made and the tree is not clean.
**Steps to Reproduce:**
* Make a new Ionic project
* Set eol to crlf
* Add platform Android
* Make sure `package.json` has a empty new line in the end.
* Run `ionic cordova build android`
**Output:**

**My `ionic info`:**
```
Ionic:
ionic (Ionic CLI) : 4.6.0 (C:\Users\myUser\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.1
Cordova:
cordova (Cordova CLI) : not installed
Cordova Platforms : android 7.0.0
Cordova Plugins : cordova-plugin-ionic-webview 1.2.1, (and 22 other plugins)
System:
Android SDK Tools : 26.1.1 (C:\Users\myUser\AppData\Local\Android\sdk)
NodeJS : v10.14.1 (C:\Program Files\nodejs\node.exe)
npm : 6.5.0
OS : Windows 10
```
Contributor guide
Research direction
Reproduce the change by creating an Ionic project with CRLF settings and an empty final line in package.json, then run ionic cordova build android and inspect the file after lint and the Cordova build begins. Trace the package.json handling in that command path and add regression coverage; done means the build preserves the file's line endings and trailing empty line so git reports a clean tree.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100