creyD/prettier_action

package-lock.json getting deleted

Closed this issue · 3 comments

I'm noticing that this prettier action is deleting my package-lock.json file. (Note that runny prettier via npx doesn't do this)

My action.yml

name: Do Prettier
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Prettify code
        uses: creyD/prettier_action@v4.0
        with:
          prettier_options: --write .

my .prettierrc.json

{
  "singleQuote": true,
  "printWidth": 120
}

my .prettierignore

package-lock.json
*.html
*.min.js

Example commit where package-lock.json gets removed

Essentially this is deleting the package-lock.json and then committing those changes.

if [ -f 'package-lock.json' ]; then
  git reset --hard package-lock.json || rm package-lock.json

I ended up just doing something like this

  - uses: actions/setup-node@v2
    with:
      node-version: '16'
  - run: npm i
  - run: npx prettier --check .
creyD commented

This is now merged, thanks for your contribution!