From c5620bdda5a5610449630800260e545943d92c99 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 5 Mar 2025 12:02:01 -0800 Subject: [PATCH 1/5] chore: 8.9.2 next --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 89cf4e48ed..04b854cefa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "main": "./lib/nativescript-cli-lib.js", - "version": "8.9.1", + "version": "8.9.2", "author": "NativeScript ", "description": "Command-line interface for building NativeScript projects", "bin": { From ca6fb68a96cbf4006885c878527c0743b3dae248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20de=20Dios=20Mart=C3=ADnez=20Vallejo?= Date: Mon, 24 Mar 2025 21:31:05 +0100 Subject: [PATCH 2/5] fix: remove --legacy-peer-deps flag on install (#5839) --- lib/bun-package-manager.ts | 5 +---- lib/node-package-manager.ts | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/bun-package-manager.ts b/lib/bun-package-manager.ts index b2d5b8f842..cfd5ffc057 100644 --- a/lib/bun-package-manager.ts +++ b/lib/bun-package-manager.ts @@ -47,10 +47,7 @@ export class BunPackageManager extends BasePackageManager { const jsonContentBefore = this.$fs.readJson(packageJsonPath); const flags = this.getFlagsString(config, true); - // TODO: Confirm desired behavior. The npm version uses --legacy-peer-deps - // by default, we could use `--no-peer` for Bun if similar is needed; the - // pnpm version uses `--shamefully-hoist`, but Bun has no similar flag. - let params = ["install", "--legacy-peer-deps"]; + let params = ["install"]; const isInstallingAllDependencies = packageName === pathToSave; if (!isInstallingAllDependencies) { params.push(packageName); diff --git a/lib/node-package-manager.ts b/lib/node-package-manager.ts index 254ff7e5e5..bf63cae523 100644 --- a/lib/node-package-manager.ts +++ b/lib/node-package-manager.ts @@ -47,7 +47,7 @@ export class NodePackageManager extends BasePackageManager { const jsonContentBefore = this.$fs.readJson(packageJsonPath); const flags = this.getFlagsString(config, true); - let params = ["install", "--legacy-peer-deps"]; + let params = ["install"]; const isInstallingAllDependencies = packageName === pathToSave; if (!isInstallingAllDependencies) { params.push(packageName); From af8149113844a7aebcd6bf66eeae73154ac7927b Mon Sep 17 00:00:00 2001 From: Dimitris-Rafail Katsampas Date: Mon, 24 Mar 2025 22:36:06 +0200 Subject: [PATCH 3/5] fix: icon generator color type error (#5838) --- .../assets-generation-service.ts | 81 ++++++++++--------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/lib/services/assets-generation/assets-generation-service.ts b/lib/services/assets-generation/assets-generation-service.ts index 6f669d5bf4..fb37845e51 100644 --- a/lib/services/assets-generation/assets-generation-service.ts +++ b/lib/services/assets-generation/assets-generation-service.ts @@ -1,4 +1,4 @@ -import { Jimp, cssColorToHex, rgbaToInt, JimpInstance } from "jimp"; +import JimpModule = require("jimp"); import * as Color from "color"; import { exported } from "../../common/decorators"; import { AssetConstants } from "../../constants"; @@ -113,7 +113,7 @@ export class AssetsGenerationService implements IAssetsGenerationService { assetItem.data?.default ?? "white"; - const colorHEX: number = cssColorToHex(color); + const colorHEX: number = JimpModule.cssColorToHex(color); const hex = colorHEX?.toString(16).substring(0, 6) ?? "FFFFFF"; this.$fs.writeFile( @@ -164,7 +164,8 @@ export class AssetsGenerationService implements IAssetsGenerationService { continue; } - let image: JimpInstance; + let image: JimpModule.JimpInstance; + switch (operation) { case Operations.OverlayWith: const overlayImageScale = @@ -178,16 +179,10 @@ export class AssetsGenerationService implements IAssetsGenerationService { imageResize, imageResize, ); - image = this.generateImage( - background, - width, - height, - outputPath, - image, - ); + image = this.generateImage(background, width, height, image); break; case Operations.Blank: - image = this.generateImage(background, width, height, outputPath); + image = this.generateImage(background, width, height); break; case Operations.Resize: image = await this.resize(generationData.imagePath, width, height); @@ -200,13 +195,7 @@ export class AssetsGenerationService implements IAssetsGenerationService { assetItem.height, ); // The scale will apply to the underlying layer of the generated image - image = this.generateImage( - "#00000000", - width, - height, - outputPath, - image, - ); + image = this.generateImage("#00000000", width, height, image); break; default: throw new Error(`Invalid image generation operation: ${operation}`); @@ -214,16 +203,17 @@ export class AssetsGenerationService implements IAssetsGenerationService { // This code disables the alpha chanel, as some images for the Apple App Store must not have transparency. if (assetItem.rgba === false) { - // - // The original code here became broken at some time and there is an issue posted here.. - // https://github.com/oliver-moran/jimp/issues/954 - // But NathanaelA recommended the below change and it works so maybe that's just what we go with. - // - // image = image.rgba(false); - image = (image as any).colorType(2); + // Add an underlying white layer + image = this.generateImage("#FFFFFF", image.width, image.height, image); } - image.write(outputPath as any); + if (this.isAssetFilePath(outputPath)) { + image.write(outputPath); + } else { + this.$logger.warn( + `Incorrect destination path ${outputPath} for image ${assetItem.filename}`, + ); + } } } @@ -231,29 +221,30 @@ export class AssetsGenerationService implements IAssetsGenerationService { imagePath: string, width: number, height: number, - ): Promise { - const image = await Jimp.read(imagePath); + ): Promise { + const image = await JimpModule.Jimp.read(imagePath); return image.scaleToFit({ w: width, h: height, - }) as any; + }) as JimpModule.JimpInstance; } private generateImage( background: string, width: number, height: number, - outputPath: string, - overlayImage?: JimpInstance, - ): JimpInstance { - // Typescript declarations for Jimp are not updated to define the constructor with backgroundColor so we workaround it by casting it to for this case only. - const J = Jimp; + overlayImage?: JimpModule.JimpInstance, + ): JimpModule.JimpInstance { const backgroundColor = this.getRgbaNumber(background); - let image = new J(width, height, backgroundColor); + let image = new JimpModule.Jimp({ + width, + height, + color: backgroundColor, + }); if (overlayImage) { - const centeredWidth = (width - overlayImage.bitmap.width) / 2; - const centeredHeight = (height - overlayImage.bitmap.height) / 2; + const centeredWidth = (width - overlayImage.width) / 2; + const centeredHeight = (height - overlayImage.height) / 2; image = image.composite(overlayImage, centeredWidth, centeredHeight); } @@ -265,7 +256,21 @@ export class AssetsGenerationService implements IAssetsGenerationService { const colorRgb = color.rgb(); const alpha = Math.round(colorRgb.alpha() * 255); - return rgbaToInt(colorRgb.red(), colorRgb.green(), colorRgb.blue(), alpha); + return JimpModule.rgbaToInt( + colorRgb.red(), + colorRgb.green(), + colorRgb.blue(), + alpha, + ); + } + + private isAssetFilePath(path: string): path is `${string}.${string}` { + if (!path) { + return false; + } + + const index = path.lastIndexOf("."); + return index > -1 && index < path.length - 1; } } From a4faa9cd7f7d0cdd34bba2ea5f42bf8e0ff1004f Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 25 Mar 2025 13:12:51 -0700 Subject: [PATCH 4/5] release: 8.9.2 --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 487d817ca9..e7e3fa82ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [8.9.2](https://github.com/NativeScript/nativescript-cli/compare/v8.9.1...v8.9.2) (2025-03-25) + + +### Bug Fixes + +* icon generator color type error ([#5838](https://github.com/NativeScript/nativescript-cli/issues/5838)) ([af81491](https://github.com/NativeScript/nativescript-cli/commit/af8149113844a7aebcd6bf66eeae73154ac7927b)) +* remove --legacy-peer-deps flag on install ([#5839](https://github.com/NativeScript/nativescript-cli/issues/5839)) ([ca6fb68](https://github.com/NativeScript/nativescript-cli/commit/ca6fb68a96cbf4006885c878527c0743b3dae248)) + + + ## [8.9.1](https://github.com/NativeScript/nativescript-cli/compare/v8.9.0...v8.9.1) (2025-03-05) From 4d184bef94443b48d57665871bb2f51c4f6e0b25 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Tue, 25 Mar 2025 13:13:24 -0700 Subject: [PATCH 5/5] chore: 8.9.3 next --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 04b854cefa..5fe54c4a8a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "main": "./lib/nativescript-cli-lib.js", - "version": "8.9.2", + "version": "8.9.3", "author": "NativeScript ", "description": "Command-line interface for building NativeScript projects", "bin": {