Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue-5280 Ensure save flags update package.json #7233

Open
wants to merge 6 commits into
base: latest
Choose a base branch
from
Prev Previous commit
Next Next commit
[#5280] Allow --no-save to prevent other save flags from overwriting …
…save
  • Loading branch information
ficocelliguy committed Mar 5, 2024
commit 7db7c477ed84a2b325c95c59c23878c9af7f7ac9
3 changes: 2 additions & 1 deletion workspaces/config/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ class Config {

// Only set 'save' to true if a saveType has been specified
// and if 'save' is false due to non-default config
if (!this.isDefault('save') && this.#flatOptions.saveType) {
if (!this.isDefault('save') && this.#flatOptions.saveType
&& !this.argv?.includes('--no-save')) {
this.#flatOptions.save = true
}
this.#flatOptions.nodeBin = this.execPath
Expand Down
6 changes: 3 additions & 3 deletions workspaces/config/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -944,9 +944,9 @@ t.test('manages the save flag when flat is retrieved', t => {
const c = await buildConfig(['--no-save'], true)
t.equal(c.flat.save, false)
})
t.test('overwrites save if --no-save is present and also a save flag', async t => {
const c = await buildConfig(['--save-prod', '--no-save'], false)
t.equal(c.flat.save, true)
t.test('oes not overwrite save --no-save is present in addition to save flag', async t => {
const c = await buildConfig(['--save-prod', '--no-save'], true)
t.equal(c.flat.save, false)
})
t.end()
})
Expand Down