moonrepo / moon

A build system and monorepo management tool for the web ecosystem, written in Rust.
https://moonrepo.dev/moon
MIT License
2.85k stars 155 forks source link

[bug] moon does not keep formatting of package.json when updating toolchain version. #1521

Closed minht11 closed 2 months ago

minht11 commented 3 months ago

Describe the bug

I have my package.json indented with tabs, but moon reformats it using spaces when I update toolchain.yml node/pnpm versions.

Expected behavior

Keep the same formatting and only update version numbers.

Screenshots

Environment

  System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1
    Memory: 52.05 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.proto/shims/node
    pnpm: 9.4.0 - ~/.proto/shims/pnpm
    bun: 0.8.1 - /opt/homebrew/bin/bun
  Managers:
    Cargo: 1.74.1 - ~/.cargo/bin/cargo
    Homebrew: 4.3.3 - /opt/homebrew/bin/brew
    pip3: 22.0.3 - /Library/Frameworks/Python.framework/Versions/3.10/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 15.0.0 - /usr/bin/gcc
    Git: 2.39.2 - /opt/homebrew/bin/git
    Clang: 15.0.0 - /usr/bin/clang
    Curl: 8.6.0 - /usr/bin/curl
    OpenSSL: 3.2.1 - /opt/homebrew/bin/openssl
  Servers:
    Apache: 2.4.58 - /usr/sbin/apachectl
  Virtualization:
    Docker: 26.1.3 - /usr/local/bin/docker
    Docker Compose: 2.27.1 - /usr/local/bin/docker-compose
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
    Android SDK:
      API Levels: 32
      Build Tools: 30.0.3, 32.0.0, 32.1.0
      System Images: android-32 | Google APIs ARM 64 v8a
  IDEs:
    Vim: 9.0 - /usr/bin/vim
    Xcode: 15.4/15F31d - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Go: 1.17.7 - /usr/local/go/bin/go
    Perl: 5.34.1 - /usr/bin/perl
    Python3: 3.10.2 - /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
    Ruby: 2.6.10 - /usr/bin/ruby
    Rust: 1.74.1 - /Users/justas/.cargo/bin/rustc
  Databases:
    PostgreSQL: 14.7 - /opt/homebrew/bin/postgres
    SQLite: 3.43.2 - /usr/bin/sqlite3
  Browsers:
    Brave Browser: 123.1.64.116
    Chrome: 126.0.6478.114
    Chrome Canary: 128.0.6555.0
    Edge: 126.0.2592.68
    Safari: 17.5
milesj commented 3 months ago

@minht11 Does editor config solve this? https://moonrepo.dev/docs/faq#how-to-stop-moon-formatting-json-and-yaml-files

minht11 commented 3 months ago

It does.

Though bit annoying that another config file is needed, (I use biome) but it works.

So I guess this would be a feature request to improve formatting if no .editorconfig is present. I am sure it is not trivial, but at least simple cases tabs/spaces should be possible?

milesj commented 3 months ago

I'll look into. It's not impossible, probably just non-trivial.

milesj commented 3 months ago

Looking into this here https://github.com/moonrepo/starbase/pull/85 Will maybe land in the next version.

milesj commented 2 months ago

Landed in 1.27.