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

[alpha] #2177

Draft
wants to merge 43 commits into
base: beta-4.58.1
Choose a base branch
from
Draft

[alpha] #2177

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2eb5c2e
retire old use of `pnpm` and code references
bwp91 Sep 8, 2024
6127d14
update `@homebridge/hap-client` to v2
bwp91 Sep 8, 2024
10f409a
add theme and language to main settings page
bwp91 Sep 8, 2024
6d310ad
change menu to a sidebar
bwp91 Sep 8, 2024
b1c120a
consistent code lint across the server and ui components
bwp91 Sep 9, 2024
2de24f1
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 10, 2024
1d11cd5
fix lint
bwp91 Sep 10, 2024
58f078d
use `vitest` for testing
bwp91 Sep 10, 2024
328ee8e
no longer use `webpack`
bwp91 Sep 12, 2024
7633226
update dependencies, overrides, updated lint
bwp91 Sep 13, 2024
0af2c2b
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 13, 2024
1bba2b2
allow a `Debug Mode` setting per child bridge
bwp91 Sep 13, 2024
4ac5cee
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 13, 2024
70d6b18
increase width of notifications to `100%` on mobile devices
bwp91 Sep 13, 2024
1b5262d
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 13, 2024
f66bedf
increase width of notifications to `100%` on mobile devices
bwp91 Sep 13, 2024
1225c24
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 14, 2024
a149867
`.toPromise()` is deprecated, change to `firstValueFrom()`
bwp91 Sep 14, 2024
66fa249
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 14, 2024
e9e6aa2
fix deprecated `.subscribe()` signature
bwp91 Sep 14, 2024
f8cfa91
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 14, 2024
2a23427
Update pl.json (#2181)
mkz212 Sep 14, 2024
98a27ac
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 15, 2024
0b73c69
fix some styles on smaller screeners
bwp91 Sep 15, 2024
3ef5643
HB2 plugins: also check for `>=2` from `engines.homebridge`
bwp91 Sep 15, 2024
3023f9e
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 15, 2024
8639f3a
layout fix
bwp91 Sep 15, 2024
a1ecbdf
Merge branch 'latest' into beta-4.58.1
bwp91 Sep 17, 2024
b4a46bc
hide settings section description on collapse
bwp91 Sep 17, 2024
59bef53
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 17, 2024
976bc1a
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 19, 2024
f0cd4e4
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 21, 2024
995471f
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 21, 2024
a644cb5
lang
bwp91 Sep 21, 2024
5dfb1a6
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 22, 2024
fc749de
offer to set up a child bridge immediately after configuring a new pl…
bwp91 Sep 22, 2024
0de1fe3
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 22, 2024
d422a1f
Update pl.json (#2189)
mkz212 Sep 22, 2024
0ca0799
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 22, 2024
00bfcc0
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 22, 2024
2a3ff45
update
bwp91 Sep 22, 2024
92d92f5
Merge branch 'beta-4.58.1' into alpha-4.58.1
bwp91 Sep 23, 2024
46163f2
reset
bwp91 Sep 23, 2024
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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to `homebridge-config-ui-x` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/).

## ALPHA

### UI Changes

- change menu to a sidebar
- add theme and language to main settings page

### Other Changes

- retire old use of `pnpm` and code references
- update `@homebridge/hap-client` to v2

### Homebridge Dependencies

- `@homebridge/hap-client` @ `v2.0.2`
- `@homebridge/node-pty-prebuilt-multiarch` @ `v0.11.14`
- `@homebridge/plugin-ui-utils` @ `v1.0.3`

## BETA

### UI Changes
Expand Down
21 changes: 16 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"@fastify/helmet": "11.1.1",
"@fastify/multipart": "8.3.0",
"@fastify/static": "7.0.4",
"@homebridge/hap-client": "1.10.2",
"@homebridge/hap-client": "2.0.2",
"@homebridge/node-pty-prebuilt-multiarch": "0.11.14",
"@nestjs/axios": "3.0.3",
"@nestjs/common": "10.4.3",
Expand Down Expand Up @@ -147,11 +147,6 @@
"unplugin-swc": "^1.5.1",
"vitest": "^2.1.1"
},
"overrides": {
"@homebridge/hap-client": {
"axios": "1.7.7"
}
},
"maintainers": [
{
"email": "bwp91@icloud.com",
Expand Down
10 changes: 2 additions & 8 deletions src/bin/hb-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ export class HomebridgeServiceHelper {
}

/**
* Install / Remove a plugin using pnpm (supported platforms only)
* Install / Remove a plugin (supported platforms only)
*/
private async npmPluginManagement(args: any[]) {
if (!this.enableHbServicePluginManagement) {
Expand Down Expand Up @@ -1361,13 +1361,7 @@ export class HomebridgeServiceHelper {
this.logger(`Path does not exist: "${cwd}"`, 'fail')
}

let cmd: string

if (process.env.UIX_USE_PNPM === '1') {
cmd = `pnpm -C "${cwd}" ${action} ${target.name}`
} else {
cmd = `npm --prefix "${cwd}" ${action} ${target.name}`
}
let cmd: string = `npm --prefix "${cwd}" ${action} ${target.name}`

if (action === 'add') {
cmd += `@${target.version}`
Expand Down
67 changes: 25 additions & 42 deletions src/bin/platforms/darwin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,50 +112,33 @@ export class DarwinInstaller extends BasePlatform {

const targetNodeVersion = execSync('node -v').toString('utf8').trim()

if (this.isPackage() && process.env.UIX_USE_PNPM === '1' && process.env.UIX_CUSTOM_PLUGIN_PATH) {
// pnpm+package mode
const cwd = dirname(process.env.UIX_CUSTOM_PLUGIN_PATH)

if (!await pathExists(cwd)) {
this.hbService.logger(`Path does not exist: "${cwd}"`, 'fail')
process.exit(1)
}

execSync(`pnpm -C "${cwd}" rebuild`, {
cwd,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt plugins in ${process.env.UIX_CUSTOM_PLUGIN_PATH} for Node.js ${targetNodeVersion}.`, 'succeed')
} else {
// normal global npm setups
const npmGlobalPath = execSync('/bin/echo -n "$(npm -g prefix)/lib/node_modules"', {
env: Object.assign({
npm_config_loglevel: 'silent',
npm_update_notifier: 'false',
}, process.env),
}).toString('utf8')

execSync('npm rebuild --unsafe-perm', {
cwd: process.env.UIX_BASE_PATH,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt homebridge-config-ui-x for Node.js ${targetNodeVersion}.`, 'succeed')

if (all === true) {
// rebuild all modules
try {
execSync('npm rebuild --unsafe-perm', {
cwd: npmGlobalPath,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt plugins in ${npmGlobalPath} for Node.js ${targetNodeVersion}.`, 'succeed')
} catch (e) {
this.hbService.logger('Could not rebuild all modules - check Homebridge logs.', 'warn')
}
const npmGlobalPath = execSync('/bin/echo -n "$(npm -g prefix)/lib/node_modules"', {
env: Object.assign({
npm_config_loglevel: 'silent',
npm_update_notifier: 'false',
}, process.env),
}).toString('utf8')

execSync('npm rebuild --unsafe-perm', {
cwd: process.env.UIX_BASE_PATH,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt homebridge-config-ui-x for Node.js ${targetNodeVersion}.`, 'succeed')

if (all === true) {
// rebuild all modules
try {
execSync('npm rebuild --unsafe-perm', {
cwd: npmGlobalPath,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt plugins in ${npmGlobalPath} for Node.js ${targetNodeVersion}.`, 'succeed')
} catch (e) {
this.hbService.logger('Could not rebuild all modules - check Homebridge logs.', 'warn')
}

await this.setNpmPermissions(npmGlobalPath)
}

await this.setNpmPermissions(npmGlobalPath)
} catch (e) {
console.error(e.toString())
this.hbService.logger('ERROR: Failed Operation', 'fail')
Expand Down
61 changes: 22 additions & 39 deletions src/bin/platforms/linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,46 +199,29 @@ export class LinuxInstaller extends BasePlatform {

const targetNodeVersion = execSync('node -v').toString('utf8').trim()

if (this.isPackage() && process.env.UIX_USE_PNPM === '1' && process.env.UIX_CUSTOM_PLUGIN_PATH) {
// pnpm+package mode
const cwd = dirname(process.env.UIX_CUSTOM_PLUGIN_PATH)

if (!await pathExists(cwd)) {
this.hbService.logger(`Path does not exist: "${cwd}"`, 'fail')
process.exit(1)
}
const npmGlobalPath = execSync('/bin/echo -n "$(npm -g prefix)/lib/node_modules"', {
env: Object.assign({
npm_config_loglevel: 'silent',
npm_update_notifier: 'false',
}, process.env),
}).toString('utf8')

execSync('npm rebuild --unsafe-perm', {
cwd: process.env.UIX_BASE_PATH,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt homebridge-config-ui-x for Node.js ${targetNodeVersion}.`, 'succeed')

execSync(`pnpm -C "${cwd}" rebuild`, {
cwd,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt plugins in ${process.env.UIX_CUSTOM_PLUGIN_PATH} for Node.js ${targetNodeVersion}.`, 'succeed')
} else {
// normal global npm setups
const npmGlobalPath = execSync('/bin/echo -n "$(npm -g prefix)/lib/node_modules"', {
env: Object.assign({
npm_config_loglevel: 'silent',
npm_update_notifier: 'false',
}, process.env),
}).toString('utf8')

execSync('npm rebuild --unsafe-perm', {
cwd: process.env.UIX_BASE_PATH,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt homebridge-config-ui-x for Node.js ${targetNodeVersion}.`, 'succeed')

if (all === true) {
// rebuild all global node_modules
try {
execSync('npm rebuild --unsafe-perm', {
cwd: npmGlobalPath,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt plugins in ${npmGlobalPath} for Node.js ${targetNodeVersion}.`, 'succeed')
} catch (e) {
this.hbService.logger('Could not rebuild all plugins - check logs.', 'warn')
}
if (all === true) {
// rebuild all global node_modules
try {
execSync('npm rebuild --unsafe-perm', {
cwd: npmGlobalPath,
stdio: 'inherit',
})
this.hbService.logger(`Rebuilt plugins in ${npmGlobalPath} for Node.js ${targetNodeVersion}.`, 'succeed')
} catch (e) {
this.hbService.logger('Could not rebuild all plugins - check logs.', 'warn')
}
}
} catch (e) {
Expand Down
1 change: 0 additions & 1 deletion src/core/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export class ConfigService {
public enableTerminalAccess = this.runningInDocker || this.runningInSynologyPackage || this.runningInPackageMode || Boolean(process.env.HOMEBRIDGE_CONFIG_UI_TERMINAL === '1')

// plugin management
public usePnpm = (process.env.UIX_USE_PNPM === '1')
public usePluginBundles = (process.env.UIX_USE_PLUGIN_BUNDLES === '1')

// recommend child bridges on platforms with > 2GB ram
Expand Down
17 changes: 4 additions & 13 deletions src/modules/plugins/plugins.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,7 @@ export class PluginsService {
const installOptions: Array<string> = []

// check to see if custom plugin path is using a package.json file
if (
installPath === this.configService.customPluginPath
&& !(action === 'uninstall' && this.configService.usePnpm)
&& await pathExists(resolve(installPath, '../package.json'))
) {
if (installPath === this.configService.customPluginPath && await pathExists(resolve(installPath, '../package.json'))) {
installOptions.push('--save')
}

Expand Down Expand Up @@ -1176,8 +1172,8 @@ export class PluginsService {
this.logger.error('ERROR: You might be able to fix this problem by running: npm install -g npm')
}
}
// Linux and macOS don't require the full path to npm / pnpm
return this.configService.usePnpm ? ['pnpm'] : ['npm']
// Linux and macOS don't require the full path to npm
return ['npm']
}

/**
Expand Down Expand Up @@ -1401,14 +1397,9 @@ export class PluginsService {
npm_config_update_notifier: 'false',
npm_config_prefer_online: 'true',
npm_config_foreground_scripts: 'true',
npm_config_loglevel: 'error',
})

if (!this.configService.usePnpm) {
Object.assign(env, {
npm_config_loglevel: 'error',
})
}

// set global prefix for unix based systems
if (command.includes('-g') && basename(cwd) === 'lib') {
cwd = dirname(cwd)
Expand Down
15 changes: 4 additions & 11 deletions src/self-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ function tryRebuildNodePtyModule() {
logger.warn('[node-pty] Trying to rebuild automatically...')
logger.warn(`[node-pty] Path: ${modulePath}`)
try {
if (process.env.UIX_USE_PNPM === '1' && process.env.UIX_CUSTOM_PLUGIN_PATH) {
execSync('pnpm rebuild @homebridge/node-pty-prebuilt-multiarch', {
cwd: process.env.UIX_CUSTOM_PLUGIN_PATH,
stdio: 'ignore',
})
} else {
execSync('npm run install --unsafe-perm', {
cwd: modulePath,
stdio: 'ignore',
})
}
execSync('npm run install --unsafe-perm', {
cwd: modulePath,
stdio: 'ignore',
})
} catch (e) {
if (platform() !== 'win32') {
execSync('sudo -E -n run install --unsafe-perm', {
Expand Down
12 changes: 4 additions & 8 deletions test/e2e/status.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,17 @@ describe('StatusController (e2e)', () => {
it('GET /status/nodejs', async () => {
const data = [
{
version: 'v21.6.1',
version: 'v22.2.0',
lts: false,
},
{
version: 'v20.12.2',
version: 'v20.13.1',
lts: 'Iron',
},
{
version: 'v18.19.0',
version: 'v18.20.3',
lts: 'Hydrogen',
},
{
version: 'v16.20.2',
lts: 'Gallium',
},
]

const response: AxiosResponse<any> = {
Expand All @@ -234,7 +230,7 @@ describe('StatusController (e2e)', () => {

expect(res.statusCode).toBe(200)
expect(res.json().currentVersion).toEqual(process.version)
// expect(res.json().latestVersion).toBe('v20.14.0' || 'v22.3.0');
// expect(res.json().latestVersion).toBe('v20.13.1');
})

afterAll(async () => {
Expand Down
Loading
Loading