diff --git a/.github/workflows/secure_nx_release.yml b/.github/workflows/secure_nx_release.yml index 643e3ff14b..683a036a77 100644 --- a/.github/workflows/secure_nx_release.yml +++ b/.github/workflows/secure_nx_release.yml @@ -386,19 +386,39 @@ jobs: rm -f "$NPM_CONFIG_USERCONFIG" || true fi - npx nx release publish \ - --projects "${{ steps.taginfo.outputs.project }}" \ - --tag "${{ steps.taginfo.outputs.dist_tag }}" \ - --access public \ - --verbose + project="${{ steps.taginfo.outputs.project }}" + dist_tag="${{ steps.taginfo.outputs.dist_tag }}" + + echo "Building $project..." + npx nx build "$project" --skip-nx-cache + + echo "Publishing from dist/packages/$project..." + cd "dist/packages/$project" + + npm pack + tgz_file=$(ls *.tgz | head -n 1) + npm publish "$tgz_file" --tag "$dist_tag" --access public --verbose - - name: nx release publish (tag, token) + - name: Build and Publish (tag, token) if: ${{ steps.ctx.outputs.mode == 'tag' && vars.USE_NPM_TOKEN == 'true' }} + shell: bash env: NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} NPM_CONFIG_PROVENANCE: true run: | - npx nx release publish --projects "${{ steps.taginfo.outputs.project }}" --tag "${{ steps.taginfo.outputs.dist_tag }}" --access public --verbose + set -euo pipefail + project="${{ steps.taginfo.outputs.project }}" + dist_tag="${{ steps.taginfo.outputs.dist_tag }}" + + echo "Building $project..." + npx nx build "$project" --skip-nx-cache + + echo "Publishing from dist/packages/$project..." + cd "dist/packages/$project" + + npm pack + tgz_file=$(ls *.tgz | head -n 1) + npm publish "$tgz_file" --tag "$dist_tag" --access public --verbose - name: Summary if: always() diff --git a/.vscode/settings.json b/.vscode/settings.json index 1358635a74..88a01adfab 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,5 +6,6 @@ "**/*.js": true, "**/*.js.map": true }, - "eslint.validate": ["json"] + "eslint.validate": ["json"], + "js/ts.tsdk.path": "./node_modules/typescript/lib" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6ee699681f..e505763d5d 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -8,7 +8,28 @@ "type": "shell", "problemMatcher": "$tsc", "command": "./node_modules/.bin/tsc", - "args": [ "-p", "unit-tests/tsconfig.json" ], + "args": [ "-p", "unit-tests/tsconfig.json" ] + }, + { + "label": "apps-toolbox-prepare-ios", + "type": "shell", + "command": "npx", + "args": ["nx", "prepare", "apps-toolbox", "ios"], + "problemMatcher": [ + { + "owner": "typescript", + "fileLocation": ["relative", "apps/toolbox"], + "pattern": { + "regexp": "^(.*):(\\d+):(\\d+) - error TS(\\d+): (.*)$", + "file": 1, + "line": 2, + "column": 3, + "code": 4, + "message": 5 + } + } + ], + "group": "build" } ] } diff --git a/apps/automated/nativescript.config.ts b/apps/automated/nativescript.config.ts index 7dfd261e33..b3b9251401 100644 --- a/apps/automated/nativescript.config.ts +++ b/apps/automated/nativescript.config.ts @@ -11,6 +11,6 @@ export default { packageManager: 'npm', additionalPathsToClean: ['.ns-vite-build'], }, - // bundler: 'vite', - // bundlerConfigPath: 'vite.config.ts', + bundler: 'vite', + bundlerConfigPath: 'vite.config.ts', } as NativeScriptConfig; diff --git a/apps/automated/package.json b/apps/automated/package.json index 56964cd456..e2f41c27b5 100644 --- a/apps/automated/package.json +++ b/apps/automated/package.json @@ -17,7 +17,7 @@ "@nativescript/vite": "file:../../dist/packages/vite", "@nativescript/webpack": "file:../../dist/packages/webpack5", "circular-dependency-plugin": "^5.2.2", - "typescript": "~5.8.0" + "typescript": "~5.9.3" }, "gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3", "readme": "NativeScript Application" diff --git a/apps/automated/src/accessibility/accessibility-properties-tests.ts b/apps/automated/src/accessibility/accessibility-properties-tests.ts index 6c40f61200..c935eaf60b 100644 --- a/apps/automated/src/accessibility/accessibility-properties-tests.ts +++ b/apps/automated/src/accessibility/accessibility-properties-tests.ts @@ -16,9 +16,9 @@ export function test_iosAccessibilityAdjustsFontSize_property() { layout.style.iosAccessibilityAdjustsFontSize = false; layout.style.fontScaleInternal = deviceFontScaleMock; - const nativeFontSize = testView.nativeTextViewProtected.font.pointSize; + const nativeFontSize = (testView.nativeTextViewProtected as unknown as TNSLabel).font.pointSize; layout.style.iosAccessibilityAdjustsFontSize = true; - const nativeFontSizeWithAdjust = testView.nativeTextViewProtected.font.pointSize; + const nativeFontSizeWithAdjust = (testView.nativeTextViewProtected as unknown as TNSLabel).font.pointSize; TKUnit.assertEqual(nativeFontSize, testView.style.fontInternal.fontSize, 'View font size was scaled even though iosAccessibilityAdjustsFontSize is disabled'); TKUnit.assertEqual(nativeFontSizeWithAdjust, testView.style.fontInternal.fontSize * deviceFontScaleMock, 'View font size was not scaled even though iosAccessibilityAdjustsFontSize is enabled'); @@ -41,7 +41,7 @@ export function test_iosAccessibilityMinFontScale_property() { testView.style.iosAccessibilityMinFontScale = 2.0; - const nativeFontSize = testView.nativeTextViewProtected.font.pointSize; + const nativeFontSize = (testView.nativeTextViewProtected as unknown as TNSLabel).font.pointSize; const expectedNativeFontSize = testView.style.fontInternal.fontSize * testView.style.iosAccessibilityMinFontScale; TKUnit.assertEqual(nativeFontSize, expectedNativeFontSize, 'View font size scaling does not respect iosAccessibilityMinFontScale'); } @@ -63,7 +63,7 @@ export function test_iosAccessibilityMaxFontScale_property() { testView.style.iosAccessibilityMaxFontScale = 2.0; - const nativeFontSize = testView.nativeTextViewProtected.font.pointSize; + const nativeFontSize = (testView.nativeTextViewProtected as unknown as TNSLabel).font.pointSize; const expectedNativeFontSize = testView.style.fontInternal.fontSize * testView.style.iosAccessibilityMaxFontScale; TKUnit.assertEqual(nativeFontSize, expectedNativeFontSize, 'View font size scaling does not respect iosAccessibilityMaxFontScale'); } diff --git a/apps/automated/src/debugger/dom-node-tests.ts b/apps/automated/src/debugger/dom-node-tests.ts index 80d76e21c4..9c86225de0 100644 --- a/apps/automated/src/debugger/dom-node-tests.ts +++ b/apps/automated/src/debugger/dom-node-tests.ts @@ -259,7 +259,7 @@ export function test_property_change_from_native_calls_attributeModified() { callbackCalled = true; }; - textProperty.nativeValueChange(tv, 'new value'); + textProperty.nativeValueChange(tv as any, 'new value'); assert(callbackCalled, 'attributeModified not called'); } diff --git a/apps/automated/src/image-source/image-source-tests.ts b/apps/automated/src/image-source/image-source-tests.ts index 2c0715616d..1ab4e179b4 100644 --- a/apps/automated/src/image-source/image-source-tests.ts +++ b/apps/automated/src/image-source/image-source-tests.ts @@ -33,7 +33,7 @@ export function testDrawableSetNativeSource() { // >> imagesource-setNativeSource const img = new ImageSource(); - img.setNativeSource(icon); + img.setNativeSource(icon as any); // << imagesource-setNativeSource TKUnit.assert(img.height > 0, `image ${type} setNativeSource failed`); @@ -41,7 +41,7 @@ export function testDrawableSetNativeSource() { type = splashScreen?.getClass?.().toString?.() ?? ''; // >> imagesource-setNativeSource - img.setNativeSource(splashScreen); + img.setNativeSource(splashScreen as any); // << imagesource-setNativeSource TKUnit.assert(img.height > 0, `image ${type} setNativeSource failed`); @@ -69,7 +69,7 @@ export function testFromUrl(done) { // console.log("Error loading image: " + error); //completed = true; done(error); - } + }, ); } @@ -123,7 +123,7 @@ export function testFromAssetFileNotFound(done) { (error) => { TKUnit.assertNotNull(error); done(); - } + }, ); } @@ -143,7 +143,7 @@ export function testFromAssetSimple(done) { }, (error) => { done(error); - } + }, ); } @@ -181,7 +181,7 @@ export function testFromAssetWithExactScaling(done) { }, (error) => { done(error); - } + }, ); } @@ -203,7 +203,7 @@ export function testFromAssetWithScalingAndAspectRatio(done) { }, (error) => { done(error); - } + }, ); } @@ -222,7 +222,7 @@ export function testFromAssetWithScalingAndDefaultAspectRatio(done) { }, (error) => { done(error); - } + }, ); } @@ -244,7 +244,7 @@ export function testFromAssetWithBiggerScaling(done) { }, (error) => { done(error); - } + }, ); } diff --git a/apps/automated/src/livesync/livesync-tests.ts b/apps/automated/src/livesync/livesync-tests.ts index 67e69e8a94..30294fd185 100644 --- a/apps/automated/src/livesync/livesync-tests.ts +++ b/apps/automated/src/livesync/livesync-tests.ts @@ -248,6 +248,6 @@ function livesync(context: ModuleContext) { ls(context); } -function waitUntilLivesyncComplete(frame: Frame) { +function waitUntilLivesyncComplete(frame: { navigationQueueIsEmpty(): boolean }) { TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty()); } diff --git a/apps/automated/src/navigation/custom-transition.android.ts b/apps/automated/src/navigation/custom-transition.android.ts index e9afae7e30..7ad1b612e9 100644 --- a/apps/automated/src/navigation/custom-transition.android.ts +++ b/apps/automated/src/navigation/custom-transition.android.ts @@ -1,7 +1,7 @@ import { PageTransition, Transition } from '@nativescript/core'; export class CustomTransition extends Transition { - constructor(duration: number, curve: any) { + constructor(duration?: number, curve?: any) { super(duration, curve); } diff --git a/apps/automated/src/navigation/custom-transition.ios.ts b/apps/automated/src/navigation/custom-transition.ios.ts index 644b9c4743..4acb0f0924 100644 --- a/apps/automated/src/navigation/custom-transition.ios.ts +++ b/apps/automated/src/navigation/custom-transition.ios.ts @@ -1,7 +1,7 @@ import { PageTransition, SharedTransition, SharedTransitionAnimationType, SharedTransitionHelper, Transition, Utils } from '@nativescript/core'; export class CustomTransition extends Transition { - constructor(duration: number, curve: any) { + constructor(duration?: number, curve?: any) { super(duration, curve); } diff --git a/apps/automated/src/navigation/navigation-tests.ts b/apps/automated/src/navigation/navigation-tests.ts index 5f6eec22e7..72eb2ef54a 100644 --- a/apps/automated/src/navigation/navigation-tests.ts +++ b/apps/automated/src/navigation/navigation-tests.ts @@ -32,7 +32,7 @@ function attachEventListeners(page: Page, events: Array) { }); } -function attachFrameEventListeners(frame: Frame, events: Array) { +function attachFrameEventListeners(frame: { on(eventName: string, callback: (...args: any[]) => void): void }, events: Array) { let argsToString = (args: frame.NavigationData) => { return `${(args.entry).resolvedPage.id} ${args.eventName} ${args.isBack ? 'back' : 'forward'}`; }; diff --git a/apps/automated/src/profiling/profiling-tests.ts b/apps/automated/src/profiling/profiling-tests.ts index 51b8d4a1df..5a0383fa1f 100644 --- a/apps/automated/src/profiling/profiling-tests.ts +++ b/apps/automated/src/profiling/profiling-tests.ts @@ -38,7 +38,7 @@ class TestClass { } } -const testFunction1 = profile(function testFunction1() { +const testFunction1 = profile('testFunction1', function testFunction1() { // noop }); const testFunction2 = profile('testFunction2', () => { diff --git a/apps/automated/src/ui-helper.ts b/apps/automated/src/ui-helper.ts index 3e1879dbec..ce7e6e864d 100644 --- a/apps/automated/src/ui-helper.ts +++ b/apps/automated/src/ui-helper.ts @@ -199,7 +199,7 @@ export function waitUntilNavigatedTo(page: Page, action: Function) { TKUnit.waitUntilReady(() => completed, 5); } -export function waitUntilNavigatedFrom(action: Function, topFrame?: Frame) { +export function waitUntilNavigatedFrom(action: Function, topFrame?: { currentPage: Page }) { const currentPage = topFrame ? topFrame.currentPage : Frame.topmost().currentPage; let completed = false; function navigatedFrom(args) { @@ -292,7 +292,7 @@ export function _generateFormattedString(): FormattedString { return formattedString; } -export function nativeView_recycling_test(createNew: () => View, createLayout?: () => LayoutBase, nativeGetters?: Map any>, customSetters?: Map) { +export function nativeView_recycling_test(createNew: () => View, createLayout?: () => View, nativeGetters?: Map any>, customSetters?: Map) { return; // if (__APPLE__) { diff --git a/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts b/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts index 0dca1d7ce9..8437d5fff7 100644 --- a/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts +++ b/apps/automated/src/ui/action-bar/action-bar-tests.ios.ts @@ -108,7 +108,7 @@ export function test_actionItem_visibility() { } export function test_navigationButton_visibility() { - var actionItem = new actionBar.ActionItem(); + var actionItem = new actionBar.NavigationButton(); actionItem.text = 'Test'; var page = createPageAndNavigate(); diff --git a/apps/automated/src/ui/activity-indicator/activity-indicator-tests.ts b/apps/automated/src/ui/activity-indicator/activity-indicator-tests.ts index b06a470ec8..79679005f3 100644 --- a/apps/automated/src/ui/activity-indicator/activity-indicator-tests.ts +++ b/apps/automated/src/ui/activity-indicator/activity-indicator-tests.ts @@ -55,7 +55,8 @@ export function test_set_color() { ai.color = new color.Color('red'); function testAction(views: Array) { - TKUnit.assertEqual(ai.color.ios.CGColor, ai.nativeViewProtected.color.CGColor, 'ai.color'); + const nativeView = ai.nativeViewProtected as unknown as UIActivityIndicatorView; + TKUnit.assertEqual(ai.color.ios.CGColor, nativeView.color.CGColor, 'ai.color'); } helper.buildUIAndRunTest(ai, testAction); diff --git a/apps/automated/src/ui/frame/frame-tests-common.ts b/apps/automated/src/ui/frame/frame-tests-common.ts index d078dcb5a2..454980477a 100644 --- a/apps/automated/src/ui/frame/frame-tests-common.ts +++ b/apps/automated/src/ui/frame/frame-tests-common.ts @@ -7,7 +7,7 @@ import { Page } from '@nativescript/core/ui/page'; import * as TKUnit from '../../tk-unit'; const NAV_WAIT = 15; -function emptyNavigationQueue(frame: Frame) { +function emptyNavigationQueue(frame: { navigationQueueIsEmpty(): boolean }) { TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty(), NAV_WAIT); } @@ -242,8 +242,8 @@ export function test_frame_retrieval_API_when_navigating() { const initialTopmost = Frame.topmost(); const initialFrameById = Frame.getFrameById('initialFrame'); - TKUnit.assertEqual(initialTopmost, initialFrame); - TKUnit.assertEqual(initialFrameById, initialFrame); + TKUnit.assertEqual(initialTopmost as any, initialFrame as any); + TKUnit.assertEqual(initialFrameById as any, initialFrame as any); const newFrame = new Frame(); newFrame.id = 'newFrame'; @@ -252,16 +252,16 @@ export function test_frame_retrieval_API_when_navigating() { const newTopmost = Frame.topmost(); const newFrameById = Frame.getFrameById('newFrame'); - TKUnit.assertEqual(newTopmost, newFrame); - TKUnit.assertEqual(newFrameById, newFrame); + TKUnit.assertEqual(newTopmost as any, newFrame as any); + TKUnit.assertEqual(newFrameById as any, newFrame as any); initialFrame.navigate(() => new Page()); const previousTopmost = Frame.topmost(); const previousFrameById = Frame.getFrameById('initialFrame'); - TKUnit.assertEqual(previousTopmost, initialFrame); - TKUnit.assertEqual(previousFrameById, initialFrame); + TKUnit.assertEqual(previousTopmost as any, initialFrame as any); + TKUnit.assertEqual(previousFrameById as any, initialFrame as any); // clean up the frame stack initialFrame._removeFromFrameStack(); diff --git a/apps/automated/src/ui/label/label-tests.ts b/apps/automated/src/ui/label/label-tests.ts index 9696aca3fe..413c4b1db9 100644 --- a/apps/automated/src/ui/label/label-tests.ts +++ b/apps/automated/src/ui/label/label-tests.ts @@ -1,6 +1,6 @@ import * as TKUnit from '../../tk-unit'; import * as testModule from '../../ui-test'; -import { Label, GridLayout, LayoutBase, StackLayout, BindingOptions, CoreTypes, Span, FormattedString, Utils, Color, Observable, path } from '@nativescript/core'; +import { Label, GridLayout, StackLayout, BindingOptions, CoreTypes, Span, FormattedString, Utils, Color, Observable, path, View } from '@nativescript/core'; import * as labelTestsNative from './label-tests-native'; import * as helper from '../../ui-helper'; @@ -588,7 +588,7 @@ export class LabelTest extends testModule.UITest