From 2fef640f084fca2837cbf342e1a68bbb6eae4abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20de=20Dios=20Mart=C3=ADnez=20Vallejo?= Date: Mon, 17 Mar 2025 18:31:41 +0100 Subject: [PATCH 1/5] fix(vue): useColorMod break app without frame --- .gitignore | 3 ++ .prettierignore | 3 ++ nx.json | 32 ++++++++++++------- package.json | 19 +++++------ packages/change-icon/project.json | 2 +- packages/nativescript-clipboard/project.json | 18 +++-------- .../project.json | 2 +- packages/nativescript-keyboard/project.json | 18 +++-------- .../nativescript-localstorage/project.json | 2 +- .../nativescript-media-query/project.json | 2 +- .../nativescript-orientation/project.json | 18 +++-------- packages/nativescript-task/project.json | 2 +- packages/vue/nativescript.webpack.ts | 4 --- packages/vue/package.json | 11 +++---- packages/vue/project.json | 2 +- packages/vue/src/useColorMode/index.ts | 6 ++-- .../vue/src/useSyncObservableArray/index.ts | 6 ++++ 17 files changed, 70 insertions(+), 80 deletions(-) diff --git a/.gitignore b/.gitignore index dcf0ae7..742dab1 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,6 @@ Thumbs.db *.tgz packages/**/angular/dist + +.nx/cache +.nx/workspace-data \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 413ca14..342760a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,3 +3,6 @@ /dist /coverage native-src + +/.nx/cache +/.nx/workspace-data \ No newline at end of file diff --git a/nx.json b/nx.json index 0d94756..f466283 100644 --- a/nx.json +++ b/nx.json @@ -1,20 +1,12 @@ { - "npmScope": "", - "affected": { - "defaultBase": "master" - }, "workspaceLayout": { "appsDir": "apps", "libsDir": "packages" }, "tasksRunnerOptions": { "default": { - "runner": "nx/tasks-runners/default", "options": { - "cacheableOperations": ["build", "build.all", "lint", "test", "e2e"], - "runtimeCacheInputs": ["node -v"], - "parallel": 1, - "useDaemonProcess": false + "runtimeCacheInputs": ["node -v"] } } }, @@ -26,10 +18,26 @@ }, "targetDefaults": { "build": { - "inputs": ["production", "^production"] + "inputs": ["production", "^production"], + "cache": true }, "lint": { - "inputs": ["default", "{workspaceRoot}/.eslintrc.json"] + "inputs": ["default", "{workspaceRoot}/.eslintrc.json"], + "cache": true + }, + "build.all": { + "cache": true + }, + "test": { + "cache": true + }, + "e2e": { + "cache": true } - } + }, + "neverConnectToCloud": true, + + "useDaemonProcess": false, + "parallel": 1, + "defaultBase": "master" } diff --git a/package.json b/package.json index c47f024..74b38f7 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,12 @@ "remove-package": "nx g @nativescript/plugin-tools:remove-package", "add-demo": "nx g @nativescript/plugin-tools:add-demo", "ts-vue": "cd packages/vue && npx tsc --watch", - "build:all": "nx run-many --target=build.all --all", + "build:all": "NX_DISABLE_DB=true nx run-many --target=build.all --all --verbose --skip-nx-cache ", + "build:vue": "nx run-many --target=vue ", "demo:vue:android": "npx nx run demo-vue:android", "demo:vue:ios": "npx nx run demo-vue:ios", "docs:dev": "vitepress dev packages/vue", - "docs:build": "npx vue-demi-switch 3 && vitepress build packages/vue ", + "docs:build": "vitepress build packages/vue ", "docs:preview": "vitepress preview packages/vue" }, "workspaces": [ @@ -28,20 +29,20 @@ "private": true, "devDependencies": { "@nativescript-use/vue": "^0.0.5", - "@nativescript/core": "~8.5.0", - "@nativescript/plugin-tools": "5.1.0", + "@nativescript/core": "~8.9.0", + "@nativescript/plugin-tools": "5.5.1", "@nativescript/tailwind": "^2.0.1", - "@nativescript/types": "~8.5.0", - "@nativescript/webpack": "^5.0.15", + "@nativescript/types": "~8.9.0", + "@nativescript/webpack": "^5.0.23", "autoprefixer": "^10.4.14", "husky": "^8.0.0", "nativescript-vue": "3.0.0-beta.8", - "ng-packagr": "^15.0.0", + "ng-packagr": "^19.2.0", "patch-package": "~6.4.0", "postcss": "^8.4.24", "tailwindcss": "^3.3.2", - "typescript": "^5.4.5", - "vitepress": "^1.0.0-rc.40" + "typescript": "~5.6.0", + "vitepress": "^1.6.3" }, "lint-staged": { "**/*.{js,ts,scss,json,html}": [ diff --git a/packages/change-icon/project.json b/packages/change-icon/project.json index 1f3e1f2..65c256b 100644 --- a/packages/change-icon/project.json +++ b/packages/change-icon/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/change-icon", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/change-icon", "tsConfig": "packages/change-icon/tsconfig.json", diff --git a/packages/nativescript-clipboard/project.json b/packages/nativescript-clipboard/project.json index 3186adc..7a1d586 100644 --- a/packages/nativescript-clipboard/project.json +++ b/packages/nativescript-clipboard/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/nativescript-clipboard", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/nativescript-clipboard", "tsConfig": "packages/nativescript-clipboard/tsconfig.json", @@ -32,14 +32,10 @@ "build.all": { "executor": "nx:run-commands", "options": { - "commands": [ - "node tools/scripts/build-finish.ts nativescript-clipboard" - ], + "commands": ["node tools/scripts/build-finish.ts nativescript-clipboard"], "parallel": false }, - "outputs": [ - "dist/packages/nativescript-clipboard" - ], + "outputs": ["dist/packages/nativescript-clipboard"], "dependsOn": [ { "target": "build.all", @@ -54,18 +50,14 @@ "focus": { "executor": "nx:run-commands", "options": { - "commands": [ - "nx g @nativescript/plugin-tools:focus-packages nativescript-clipboard" - ], + "commands": ["nx g @nativescript/plugin-tools:focus-packages nativescript-clipboard"], "parallel": false } }, "lint": { "executor": "@nrwl/linter:eslint", "options": { - "lintFilePatterns": [ - "packages/nativescript-clipboard/**/*.ts" - ] + "lintFilePatterns": ["packages/nativescript-clipboard/**/*.ts"] } } }, diff --git a/packages/nativescript-intersection-observer/project.json b/packages/nativescript-intersection-observer/project.json index 9dca210..bedbfae 100644 --- a/packages/nativescript-intersection-observer/project.json +++ b/packages/nativescript-intersection-observer/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/nativescript-intersection-observer", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/nativescript-intersection-observer", "tsConfig": "packages/nativescript-intersection-observer/tsconfig.json", diff --git a/packages/nativescript-keyboard/project.json b/packages/nativescript-keyboard/project.json index 40baaed..16064fe 100644 --- a/packages/nativescript-keyboard/project.json +++ b/packages/nativescript-keyboard/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/nativescript-keyboard", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/nativescript-keyboard", "tsConfig": "packages/nativescript-keyboard/tsconfig.json", @@ -32,14 +32,10 @@ "build.all": { "executor": "nx:run-commands", "options": { - "commands": [ - "node tools/scripts/build-finish.ts nativescript-keyboard" - ], + "commands": ["node tools/scripts/build-finish.ts nativescript-keyboard"], "parallel": false }, - "outputs": [ - "dist/packages/nativescript-keyboard" - ], + "outputs": ["dist/packages/nativescript-keyboard"], "dependsOn": [ { "target": "build.all", @@ -54,18 +50,14 @@ "focus": { "executor": "nx:run-commands", "options": { - "commands": [ - "nx g @nativescript/plugin-tools:focus-packages nativescript-keyboard" - ], + "commands": ["nx g @nativescript/plugin-tools:focus-packages nativescript-keyboard"], "parallel": false } }, "lint": { "executor": "@nrwl/linter:eslint", "options": { - "lintFilePatterns": [ - "packages/nativescript-keyboard/**/*.ts" - ] + "lintFilePatterns": ["packages/nativescript-keyboard/**/*.ts"] } } }, diff --git a/packages/nativescript-localstorage/project.json b/packages/nativescript-localstorage/project.json index 5ee55c7..7d59d3a 100644 --- a/packages/nativescript-localstorage/project.json +++ b/packages/nativescript-localstorage/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/nativescript-localstorage", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/nativescript-localstorage", "tsConfig": "packages/nativescript-localstorage/tsconfig.json", diff --git a/packages/nativescript-media-query/project.json b/packages/nativescript-media-query/project.json index f2c8771..ec5b327 100644 --- a/packages/nativescript-media-query/project.json +++ b/packages/nativescript-media-query/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/nativescript-media-query", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/nativescript-media-query", "tsConfig": "packages/nativescript-media-query/tsconfig.json", diff --git a/packages/nativescript-orientation/project.json b/packages/nativescript-orientation/project.json index 61ad1c7..5b67f55 100644 --- a/packages/nativescript-orientation/project.json +++ b/packages/nativescript-orientation/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/nativescript-orientation", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/nativescript-orientation", "tsConfig": "packages/nativescript-orientation/tsconfig.json", @@ -32,14 +32,10 @@ "build.all": { "executor": "nx:run-commands", "options": { - "commands": [ - "node tools/scripts/build-finish.ts nativescript-orientation" - ], + "commands": ["node tools/scripts/build-finish.ts nativescript-orientation"], "parallel": false }, - "outputs": [ - "dist/packages/nativescript-orientation" - ], + "outputs": ["dist/packages/nativescript-orientation"], "dependsOn": [ { "target": "build.all", @@ -54,18 +50,14 @@ "focus": { "executor": "nx:run-commands", "options": { - "commands": [ - "nx g @nativescript/plugin-tools:focus-packages nativescript-orientation" - ], + "commands": ["nx g @nativescript/plugin-tools:focus-packages nativescript-orientation"], "parallel": false } }, "lint": { "executor": "@nrwl/linter:eslint", "options": { - "lintFilePatterns": [ - "packages/nativescript-orientation/**/*.ts" - ] + "lintFilePatterns": ["packages/nativescript-orientation/**/*.ts"] } } }, diff --git a/packages/nativescript-task/project.json b/packages/nativescript-task/project.json index 147e889..a394750 100644 --- a/packages/nativescript-task/project.json +++ b/packages/nativescript-task/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/nativescript-task", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/nativescript-task", "tsConfig": "packages/nativescript-task/tsconfig.json", diff --git a/packages/vue/nativescript.webpack.ts b/packages/vue/nativescript.webpack.ts index 005b8ec..d21ca62 100644 --- a/packages/vue/nativescript.webpack.ts +++ b/packages/vue/nativescript.webpack.ts @@ -4,8 +4,4 @@ const webpack = require('@nativescript/webpack'); module.exports = (env) => { const wepackTask = require('@nativescript-use/nativescript-task/nativescript.webpack.js'); wepackTask(webpack); - webpack.chainWebpack((config) => { - //@ts-ignore - config.resolve.alias.set('vue-demi', require.resolve('vue-demi')); - }); }; diff --git a/packages/vue/package.json b/packages/vue/package.json index 1dca5f2..54d0ed3 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript-use/vue", - "version": "0.0.46", + "version": "0.0.48", "description": "Add a plugin description", "main": "index", "typings": "index.d.ts", @@ -10,20 +10,17 @@ "android": "6.0.0" } }, - "scripts": { - "postinstall": "npx vue-demi-switch 3 nativescript-vue" - }, + "scripts": {}, "dependencies": { "@nativescript-use/nativescript-clipboard": "0.0.3", + "@nativescript-use/nativescript-intersection-observer": "0.0.1", "@nativescript-use/nativescript-keyboard": "0.0.1", "@nativescript-use/nativescript-localstorage": "0.0.1", "@nativescript-use/nativescript-media-query": "0.0.4", "@nativescript-use/nativescript-orientation": "0.0.3", - "@nativescript-use/nativescript-intersection-observer": "0.0.1", "@nativescript-use/nativescript-task": "^0.0.11", - "@vueuse/core": "^10.10.1" + "@vueuse/core": "^12.5.0" }, - "peerDependencies": {}, "repository": { "type": "git", "url": "https://github.com/NativeScript-Use/NativeScript-Use.git" diff --git a/packages/vue/project.json b/packages/vue/project.json index 322e0a0..678fecd 100644 --- a/packages/vue/project.json +++ b/packages/vue/project.json @@ -5,7 +5,7 @@ "sourceRoot": "packages/vue", "targets": { "build": { - "executor": "@nrwl/js:tsc", + "executor": "@nx/js:tsc", "options": { "outputPath": "dist/packages/vue", "tsConfig": "packages/vue/tsconfig.json", diff --git a/packages/vue/src/useColorMode/index.ts b/packages/vue/src/useColorMode/index.ts index e1aedcf..89080b8 100644 --- a/packages/vue/src/useColorMode/index.ts +++ b/packages/vue/src/useColorMode/index.ts @@ -1,8 +1,8 @@ import { Application, ApplicationSettings, CSSUtils, Frame } from '@nativescript/core'; -import { ref, Ref, watch, computed, onUnmounted, getCurrentInstance, readonly } from 'nativescript-vue'; +import { computed, getCurrentInstance, onUnmounted, readonly, ref, Ref, watch } from 'nativescript-vue'; +import { createGlobalState } from '../globalState'; import { getSystemTheme } from './util'; import removeSystemCssClass = CSSUtils.removeSystemCssClass; -import { createGlobalState } from '../globalState'; export type BasicColorMode = 'light' | 'dark'; export type BasicColorSchema = BasicColorMode | 'auto'; @@ -100,7 +100,7 @@ export function useColorMode(options: UseColo CSSUtils.pushToSystemCssClasses(classToApply); rootView.className = Array.from(rootViewClass).join(' '); const frame = Frame.topmost(); - frame.backStack.forEach((backStack) => backStack.resolvedPage?._onCssStateChange()); + frame?.backStack.forEach((backStack) => backStack?.resolvedPage?._onCssStateChange()); rootView._getRootModalViews()?.forEach((view) => { view?._onCssStateChange(); }); diff --git a/packages/vue/src/useSyncObservableArray/index.ts b/packages/vue/src/useSyncObservableArray/index.ts index e94770a..2963525 100644 --- a/packages/vue/src/useSyncObservableArray/index.ts +++ b/packages/vue/src/useSyncObservableArray/index.ts @@ -80,6 +80,12 @@ export function useSyncObservableArray( return; } + // If the array is empty, we will clear the observableArray + if (itemList.length === 0 && observableArray.length !== 0) { + observableArray.splice(0, observableArray.length); + return; + } + if (checkRemoved) { const indexRemoved: number[] = []; observableArray.forEach((itemObservable: any, index: number) => { From f3b59cd68adad3ec9a4eb9a5a2b1f879d02c1f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20de=20Dios=20Mart=C3=ADnez=20Vallejo?= Date: Mon, 17 Mar 2025 21:13:05 +0100 Subject: [PATCH 2/5] feat(vue): added creatingView event to useEventListener and support useTemplateRef in ViewRef --- packages/vue/package.json | 2 +- packages/vue/src/types.ts | 11 +++++++++-- packages/vue/src/useEventListener/index.md | 7 ++++++- packages/vue/src/useEventListener/index.ts | 10 +++++++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/vue/package.json b/packages/vue/package.json index 54d0ed3..e2efd4d 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript-use/vue", - "version": "0.0.48", + "version": "0.0.49", "description": "Add a plugin description", "main": "index", "typings": "index.d.ts", diff --git a/packages/vue/src/types.ts b/packages/vue/src/types.ts index 2456eee..28ca8b1 100644 --- a/packages/vue/src/types.ts +++ b/packages/vue/src/types.ts @@ -1,4 +1,11 @@ import { View } from '@nativescript/core'; -import { Ref } from 'nativescript-vue'; +import { Ref, ShallowRef } from 'nativescript-vue'; -export type ViewRef = T | Ref; +type NativeElement = { + nativeView?: T; + $el?: { + nativeView: T; + }; +}; + +export type ViewRef = T | Ref> | Readonly>>; diff --git a/packages/vue/src/useEventListener/index.md b/packages/vue/src/useEventListener/index.md index e7926ab..891b921 100644 --- a/packages/vue/src/useEventListener/index.md +++ b/packages/vue/src/useEventListener/index.md @@ -42,7 +42,7 @@ cleanup() // off all events ## Type declaration ```ts import { ViewRef } from "@nativescript-use/vue"; -import { EventData, GestureEventData, ShownModallyData, View } from "@nativescript/core"; +import { EventData, GestureEventData, ShownModallyData, View, CreateViewEventData } from "@nativescript/core"; type ViewEventData = Omit & { object: T; @@ -53,6 +53,9 @@ type ViewGestureEventData = Omit & { type ViewShownModallyData = Omit & { object: T; }; +type CreatingViewEventData = Omit & { + object: Placeholder; +}; interface Event { /* Lifecycle */ loaded?: (eventData: ViewEventData) => void; @@ -77,6 +80,8 @@ interface Event { accessibilityPerformEscape?: (eventData: ViewEventData) => void; /* Layouts */ scroll?: (eventData: ViewScrollEventData) => void; + /* Components */ + creatingView?: (eventData: CreatingViewEventData) => void; } /** * Register using view.on on mounted, and view.off automatically on unmounted. diff --git a/packages/vue/src/useEventListener/index.ts b/packages/vue/src/useEventListener/index.ts index 4434c11..bb3a6b3 100644 --- a/packages/vue/src/useEventListener/index.ts +++ b/packages/vue/src/useEventListener/index.ts @@ -1,13 +1,15 @@ +import { CreateViewEventData, EventData, GestureEventData, Placeholder, ScrollEventData, ScrollView, ShownModallyData, View } from '@nativescript/core'; import { onMounted, onUnmounted } from 'nativescript-vue'; -import { unrefView } from '../unrefView'; import { ViewRef } from '../types'; -import { EventData, GestureEventData, ShownModallyData, View, ScrollEventData, ScrollView } from '@nativescript/core'; +import { unrefView } from '../unrefView'; type ViewEventData = Omit & { object: T }; type ViewGestureEventData = Omit & { object: T }; type ViewShownModallyData = Omit & { object: T }; type ViewScrollEventData = Omit & { object: T }; - +type CreatingViewEventData = Omit & { + object: Placeholder; +}; interface Event { /* Lifecycle */ loaded?: (eventData: ViewEventData) => void; @@ -32,6 +34,8 @@ interface Event { accessibilityPerformEscape?: (eventData: ViewEventData) => void; /* Layouts */ scroll?: (eventData: ViewScrollEventData) => void; + /* Components */ + creatingView?: (eventData: CreatingViewEventData) => void; } /** From 341ead1cc5eec9a62ff8f3a30309c5b8d3be0e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20de=20Dios=20Mart=C3=ADnez=20Vallejo?= Date: Tue, 18 Mar 2025 20:48:33 +0100 Subject: [PATCH 3/5] feat(vue): release v0.0.51 --- package.json | 3 ++- packages/vue/package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 74b38f7..509af95 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "remove-package": "nx g @nativescript/plugin-tools:remove-package", "add-demo": "nx g @nativescript/plugin-tools:add-demo", "ts-vue": "cd packages/vue && npx tsc --watch", - "build:all": "NX_DISABLE_DB=true nx run-many --target=build.all --all --verbose --skip-nx-cache ", + "build:all": "nx run-many --target=build.all --all --verbose --skip-nx-cache && node scripts/copy-packages.ts", + "postbuild": "node scripts/copy-packages.ts", "build:vue": "nx run-many --target=vue ", "demo:vue:android": "npx nx run demo-vue:android", "demo:vue:ios": "npx nx run demo-vue:ios", diff --git a/packages/vue/package.json b/packages/vue/package.json index e2efd4d..d74f5b8 100644 --- a/packages/vue/package.json +++ b/packages/vue/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript-use/vue", - "version": "0.0.49", + "version": "0.0.51", "description": "Add a plugin description", "main": "index", "typings": "index.d.ts", From b97e6b444a02aa48bf291a5ec5d7252f11738005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20de=20Dios=20Mart=C3=ADnez=20Vallejo?= Date: Tue, 18 Mar 2025 20:49:19 +0100 Subject: [PATCH 4/5] fix output module packages --- nx.json | 5 ++-- packages/change-icon/project.json | 1 + packages/nativescript-clipboard/project.json | 1 + .../project.json | 1 + packages/nativescript-keyboard/project.json | 1 + .../nativescript-localstorage/project.json | 1 + .../nativescript-media-query/project.json | 1 + .../nativescript-orientation/project.json | 1 + packages/nativescript-task/project.json | 1 + packages/vue/project.json | 1 + scripts/copy-packages.ts | 25 +++++++++++++++++++ 11 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 scripts/copy-packages.ts diff --git a/nx.json b/nx.json index f466283..7fd1e92 100644 --- a/nx.json +++ b/nx.json @@ -35,9 +35,8 @@ "cache": true } }, - "neverConnectToCloud": true, - "useDaemonProcess": false, "parallel": 1, - "defaultBase": "master" + "defaultBase": "master", + "useLegacyCache": true } diff --git a/packages/change-icon/project.json b/packages/change-icon/project.json index 65c256b..b64afe9 100644 --- a/packages/change-icon/project.json +++ b/packages/change-icon/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/change-icon/tsconfig.json", "packageJson": "packages/change-icon/package.json", "main": "packages/change-icon/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/change-icon/*.md", "packages/change-icon/index.d.ts", diff --git a/packages/nativescript-clipboard/project.json b/packages/nativescript-clipboard/project.json index 7a1d586..24a3abe 100644 --- a/packages/nativescript-clipboard/project.json +++ b/packages/nativescript-clipboard/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/nativescript-clipboard/tsconfig.json", "packageJson": "packages/nativescript-clipboard/package.json", "main": "packages/nativescript-clipboard/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/nativescript-clipboard/*.md", "packages/nativescript-clipboard/index.d.ts", diff --git a/packages/nativescript-intersection-observer/project.json b/packages/nativescript-intersection-observer/project.json index bedbfae..aa97506 100644 --- a/packages/nativescript-intersection-observer/project.json +++ b/packages/nativescript-intersection-observer/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/nativescript-intersection-observer/tsconfig.json", "packageJson": "packages/nativescript-intersection-observer/package.json", "main": "packages/nativescript-intersection-observer/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/nativescript-intersection-observer/*.md", "packages/nativescript-intersection-observer/index.d.ts", diff --git a/packages/nativescript-keyboard/project.json b/packages/nativescript-keyboard/project.json index 16064fe..7c2158e 100644 --- a/packages/nativescript-keyboard/project.json +++ b/packages/nativescript-keyboard/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/nativescript-keyboard/tsconfig.json", "packageJson": "packages/nativescript-keyboard/package.json", "main": "packages/nativescript-keyboard/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/nativescript-keyboard/*.md", "packages/nativescript-keyboard/index.d.ts", diff --git a/packages/nativescript-localstorage/project.json b/packages/nativescript-localstorage/project.json index 7d59d3a..7ca149b 100644 --- a/packages/nativescript-localstorage/project.json +++ b/packages/nativescript-localstorage/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/nativescript-localstorage/tsconfig.json", "packageJson": "packages/nativescript-localstorage/package.json", "main": "packages/nativescript-localstorage/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/nativescript-localstorage/*.md", "packages/nativescript-localstorage/index.d.ts", diff --git a/packages/nativescript-media-query/project.json b/packages/nativescript-media-query/project.json index ec5b327..b4d9527 100644 --- a/packages/nativescript-media-query/project.json +++ b/packages/nativescript-media-query/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/nativescript-media-query/tsconfig.json", "packageJson": "packages/nativescript-media-query/package.json", "main": "packages/nativescript-media-query/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/nativescript-media-query/*.md", "packages/nativescript-media-query/index.d.ts", diff --git a/packages/nativescript-orientation/project.json b/packages/nativescript-orientation/project.json index 5b67f55..878872f 100644 --- a/packages/nativescript-orientation/project.json +++ b/packages/nativescript-orientation/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/nativescript-orientation/tsconfig.json", "packageJson": "packages/nativescript-orientation/package.json", "main": "packages/nativescript-orientation/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/nativescript-orientation/*.md", "packages/nativescript-orientation/index.d.ts", diff --git a/packages/nativescript-task/project.json b/packages/nativescript-task/project.json index a394750..cf0550b 100644 --- a/packages/nativescript-task/project.json +++ b/packages/nativescript-task/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/nativescript-task/tsconfig.json", "packageJson": "packages/nativescript-task/package.json", "main": "packages/nativescript-task/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/nativescript-task/*.md", "packages/nativescript-task/index.d.ts", diff --git a/packages/vue/project.json b/packages/vue/project.json index 678fecd..1b58fb4 100644 --- a/packages/vue/project.json +++ b/packages/vue/project.json @@ -11,6 +11,7 @@ "tsConfig": "packages/vue/tsconfig.json", "packageJson": "packages/vue/package.json", "main": "packages/vue/index.d.ts", + "generatePackageJson": false, "assets": [ "packages/vue/*.md", "packages/vue/index.d.ts", diff --git a/scripts/copy-packages.ts b/scripts/copy-packages.ts new file mode 100644 index 0000000..15f3d56 --- /dev/null +++ b/scripts/copy-packages.ts @@ -0,0 +1,25 @@ +import fs from 'fs'; +import path, { dirname } from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +console.log('Copying package.json files to dist'); + +const packagePatchs = path.resolve(__dirname, '..', 'packages'); +const dist = path.resolve(__dirname, '..', 'dist', 'packages'); + +const packages = fs.readdirSync(packagePatchs, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()); + +packages.forEach((dirent) => { + const packagePath = path.resolve(packagePatchs, dirent.name, 'package.json'); + if (fs.existsSync(packagePath)) { + const distPackagePath = path.resolve(dist, dirent.name, 'package.json'); + + if (!fs.existsSync(distPackagePath)) { + fs.copyFileSync(packagePath, distPackagePath); + console.log(`Copied ${dirent.name} package.json`); + } + } +}); From 42beecf3760cee4a73612ea5e87e4d17566a2df2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20de=20Dios=20Mart=C3=ADnez=20Vallejo?= Date: Mon, 24 Mar 2025 01:04:23 +0100 Subject: [PATCH 5/5] chore(@nativescript-use/nativescript-media-query): NativeScript introduced media queries in version 8.8. We've deprecated this package in favor of using @nativescript/core --- packages/nativescript-media-query/README.md | 3 +++ packages/nativescript-media-query/index.ts | 12 ++++++++++++ packages/nativescript-media-query/package.json | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/nativescript-media-query/README.md b/packages/nativescript-media-query/README.md index 87101b9..1dd009b 100644 --- a/packages/nativescript-media-query/README.md +++ b/packages/nativescript-media-query/README.md @@ -1,3 +1,6 @@ +# DEPRECATED. NativeScript introduced media queries in version 8.8. We've deprecated this package in favor of using @nativescript/core. Official documentation is available [here](https://docs.nativescript.org/guide/styling#media-queries-8-8). + + # @nativescript-use/nativescript-media-query ```javascript diff --git a/packages/nativescript-media-query/index.ts b/packages/nativescript-media-query/index.ts index 4f43037..c8c7878 100644 --- a/packages/nativescript-media-query/index.ts +++ b/packages/nativescript-media-query/index.ts @@ -1,5 +1,8 @@ import { Screen, Application } from '@nativescript/core'; +/** + * @deprecated. NativeScript introduced media queries in version 8.8. We've deprecated this package in favor of using @nativescript/core. Official documentation is available [here](https://docs.nativescript.org/guide/styling#media-queries-8-8) + */ export interface MediaQueryList { readonly matches: boolean; readonly media: string; @@ -8,13 +11,22 @@ export interface MediaQueryList { removeListener(listener: MediaQueryListListener): void; } +/** + * @deprecated. NativeScript introduced media queries in version 8.8. We've deprecated this package in favor of using @nativescript/core. Official documentation is available [here](https://docs.nativescript.org/guide/styling#media-queries-8-8) + */ export type MediaQueryListListener = (mql: MediaQueryList) => void; +/** + * @deprecated. NativeScript introduced media queries in version 8.8. We've deprecated this package in favor of using @nativescript/core. Official documentation is available [here](https://docs.nativescript.org/guide/styling#media-queries-8-8) + */ export interface MediaQueryListEvent { readonly matches: boolean; readonly media: string; } +/** + * @deprecated. NativeScript introduced media queries in version 8.8. We've deprecated this package in favor of using @nativescript/core. Official documentation is available [here](https://docs.nativescript.org/guide/styling#media-queries-8-8) + */ export const matchMedia = (mediaQueryString: string) => { const factory = MediaQueryListFactory.getInstance(); const mql = factory.create(mediaQueryString); diff --git a/packages/nativescript-media-query/package.json b/packages/nativescript-media-query/package.json index 6bf7721..9a73832 100644 --- a/packages/nativescript-media-query/package.json +++ b/packages/nativescript-media-query/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript-use/nativescript-media-query", - "version": "0.0.4", + "version": "0.0.5", "description": "Add a plugin description", "main": "index", "typings": "index.d.ts",