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(patch): fix macos notifier default #2502

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"verdaccio": true,
"**/pnp.*": true,
"**/node_modules": true,
"**/.budfiles/**/*": true
"**/.storage": true
},
"prettier.configPath": "config/prettier.config.js",
"prettier.ignorePath": "config/.prettierignore",
Expand Down
16 changes: 15 additions & 1 deletion sources/@roots/bud-framework/src/notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {fileURLToPath} from 'node:url'
import isEmpty from '@roots/bud-support/lodash/isEmpty'
import isString from '@roots/bud-support/lodash/isString'
import isUndefined from '@roots/bud-support/lodash/isUndefined'
import logger from '@roots/bud-support/logger'
import {open, openEditor} from '@roots/bud-support/open'

/**
Expand Down Expand Up @@ -139,7 +140,20 @@ export class Notifier {
* True if notifications are enabled
*/
public get notificationsEnabled(): boolean {
return this.app?.context.notify === true
if (this.app?.context.notify === true) {
logger.scope(`notifier`).log(`Notifications enabled`)
return true
}

if (
this.app?.context.notify === undefined &&
platform() === `darwin`
) {
logger.scope(`notifier`).log(`Notifications enabled (macos default)`)
return true
}

return false
}

/**
Expand Down
48 changes: 48 additions & 0 deletions sources/@roots/bud/test/cli-flag-minimize/flag-minimize.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {path} from '@repo/constants'
import {execa} from 'execa'
import fs from 'fs-jetpack'
import {expect, test} from 'vitest'

test(`--minimize`, async () => {
await fs.removeAsync(
path(`sources/@roots/bud/test/cli-flag-minimize/project/dist`),
)

await execa(`yarn`, [
`workspace`,
`@tests/minimize-flag`,
`run`,
`bud`,
`build`,
`--no-minimize`,
])

expect(
await fs.readAsync(
path(
`sources/@roots/bud/test/cli-flag-minimize/project/dist/js/main.js`,
),
),
).toMatch(/\n/)

await fs.removeAsync(
path(`sources/@roots/bud/test/cli-flag-minimize/project/dist`),
)

await execa(`yarn`, [
`workspace`,
`@tests/minimize-flag`,
`run`,
`bud`,
`build`,
`--minimize`,
])

expect(
await fs.readAsync(
path(
`sources/@roots/bud/test/cli-flag-minimize/project/dist/js/main.js`,
),
),
).not.toMatch(/\n/)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@tests/minimize-flag",
"private": true,
"type": "module",
"devDependencies": {
"@roots/bud": "workspace:*"
}
}
Empty file.
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11515,6 +11515,14 @@ __metadata:
languageName: unknown
linkType: soft

"@tests/minimize-flag@workspace:sources/@roots/bud/test/cli-flag-minimize/project":
version: 0.0.0-use.local
resolution: "@tests/minimize-flag@workspace:sources/@roots/bud/test/cli-flag-minimize/project"
dependencies:
"@roots/bud": "workspace:*"
languageName: unknown
linkType: soft

"@tests/project@workspace:tests/util/project":
version: 0.0.0-use.local
resolution: "@tests/project@workspace:tests/util/project"
Expand Down
Loading