From 354b935c6a334de3d418495b11674a799293a8bd Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Mon, 7 Sep 2020 08:34:25 -0700 Subject: [PATCH 01/11] fix(webpack): react config (#8822) --- packages/webpack/package.json | 2 +- packages/webpack/templates/webpack.react.js | 140 ++++++++------------ 2 files changed, 59 insertions(+), 83 deletions(-) diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 7c94b8ef9..e674ab6f6 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "3.0.1", + "version": "3.0.2", "main": "index", "description": "Webpack plugin for NativeScript", "homepage": "https://nativescript.org", diff --git a/packages/webpack/templates/webpack.react.js b/packages/webpack/templates/webpack.react.js index 27d5912cf..d9c3f9062 100644 --- a/packages/webpack/templates/webpack.react.js +++ b/packages/webpack/templates/webpack.react.js @@ -1,3 +1,7 @@ +/** + * @see https://github.com/NativeScript/NativeScript/tree/feat/ns7-finishing-touches/packages/webpack/templates + * @see https://github.com/NativeScript/NativeScript/pull/8801/files + */ const webpackConfig = require("./webpack.typescript"); const webpack = require("webpack"); const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); @@ -8,105 +12,77 @@ module.exports = (env) => { const production = env.production; const isAnySourceMapEnabled = !!env.sourceMap || !!env.hiddenSourceMap; - const babelOptions = { - sourceMaps: isAnySourceMapEnabled ? "inline" : false, - babelrc: false, - presets: [ - // https://github.com/Microsoft/TypeScript-Babel-Starter - "@babel/env", - "@babel/typescript", - "@babel/react" - ], - plugins: [ - ...( - hmr && !production ? - [ - require.resolve('react-refresh/babel') - ] : - [] - ), - ["@babel/plugin-proposal-class-properties", { loose: true }] - ] - }; - const baseConfig = webpackConfig(env); - // Remove ts-loader as we'll be using Babel to transpile the TypeScript instead. - baseConfig.module.rules = baseConfig.module.rules.filter((rule) => { - const isTsLoader = rule.use && rule.use.loader === "ts-loader"; - return !isTsLoader; - }); + /** Find the rule for transpiling ts files ("ts-loader"), and modify it to test for .tsx files too. */ + const tsxRule = baseConfig.module.rules.find(rule => rule.use && rule.use.loader === "ts-loader"); + tsxRule.test = /\.(ts|tsx)$/; + tsxRule.use = [ + /** + * Add React Refresh HMR support. + * @see https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/55028c6355b31e697e21bf3e9a48613a7b94bee7/examples/typescript-without-babel/webpack.config.js#L18-L21 + */ + hmr && !production && { + loader: "babel-loader", + options: { + sourceMaps: isAnySourceMapEnabled ? "inline" : false, + babelrc: false, + plugins: ['react-refresh/babel'] + } + }, + tsxRule.use, + ].filter(Boolean); - // Modify "nativescript-dev-webpack/hmr/hot-loader" to test for .tsx files - // (and also js(x) files, which it should have been doing to begin with!) - baseConfig.module.rules.some(rule => { - const isNativeScriptDevWebpackHotLoader = rule.use === "nativescript-dev-webpack/hmr/hot-loader"; - - if(isNativeScriptDevWebpackHotLoader){ - rule.test = /\.(ts|tsx|js|jsx|css|scss|html|xml)$/; - } - - return isNativeScriptDevWebpackHotLoader; // Break loop once we've found the one. - }); - - baseConfig.module.rules.push( - { - test: /\.[jt]s(x?)$/, - exclude: /node_modules/, - use: [ - { - loader: "babel-loader", - options: babelOptions - } - ], - } + /** + * Modify "nativescript-dev-webpack/hmr/hot-loader" to test for .tsx files + * (and also js files, which it should have been doing to begin with!) + */ + const nativeScriptDevWebpackHotLoader = baseConfig.module.rules.find(rule => + rule.use === "@nativescript/webpack/hmr/hot-loader" ); + nativeScriptDevWebpackHotLoader.test = /\.(ts|tsx|js|css|scss|html|xml)$/; - baseConfig.resolve.extensions = [".ts", ".tsx", ".js", ".jsx", ".scss", ".css"]; + /** We don't officially support JSX. Makes the webpack config rather more complicated to set up. */ + baseConfig.resolve.extensions = [".tsx", ...baseConfig.resolve.extensions]; baseConfig.resolve.alias["react-dom"] = "react-nativescript"; - // Remove ForkTsCheckerWebpackPlugin because, now that we're using Babel, we'll leave type-checking to the IDE instead. - baseConfig.plugins = baseConfig.plugins.filter(plugin => { - const isForkTsCheckerWebpackPlugin = plugin && plugin.constructor && plugin.constructor.name === "ForkTsCheckerWebpackPlugin"; - return !isForkTsCheckerWebpackPlugin; - }); + /** Augment NativeScript's existing DefinePlugin definitions with a few more of our own. */ + const existingDefinePlugin = baseConfig.plugins.find(plugin => + plugin && plugin.constructor && plugin.constructor.name === "DefinePlugin" + ); + baseConfig.plugins.splice( + baseConfig.plugins.indexOf(existingDefinePlugin), + 1, + new webpack.DefinePlugin({ + ...existingDefinePlugin.definitions, + /** For various libraries in the React ecosystem. */ + "__DEV__": production ? "false" : "true", + "__TEST__": "false", + /** + * Primarily for React Fast Refresh plugin, but technically the allowHmrInProduction option could be used instead. + * Worth including anyway, as there are plenty of Node libraries that use this flag. + */ + "process.env.NODE_ENV": JSON.stringify(production ? "production" : "development"), + }), + ); - // Augment NativeScript's existing DefinePlugin definitions with a few more of our own. - let existingDefinePlugin; - baseConfig.plugins = baseConfig.plugins.filter(plugin => { - const isDefinePlugin = plugin && plugin.constructor && plugin.constructor.name === "DefinePlugin"; - existingDefinePlugin = plugin; - return !isDefinePlugin; - }); - const newDefinitions = { - ...existingDefinePlugin.definitions, - /* For various libraries in the React ecosystem. */ - "__DEV__": production ? "false" : "true", - "__TEST__": "false", - /* - * Primarily for React Fast Refresh plugin, but technically the forceEnable option could be used instead. - * Worth including anyway, as there are plenty of Node libraries that use this flag. - */ - "process.env.NODE_ENV": JSON.stringify(production ? "production" : "development"), - }; - baseConfig.plugins.unshift(new webpack.DefinePlugin(newDefinitions)); - - /** - * Set forceEnable to `true` if you want to use HMR on a production build. - */ - const forceEnable = false; - if(hmr && (!production || forceEnable)){ + if(hmr && !production){ baseConfig.plugins.push(new ReactRefreshWebpackPlugin({ /** * Maybe one day we'll implement an Error Overlay, but the work involved is too daunting for now. * @see https://github.com/pmmmwh/react-refresh-webpack-plugin/issues/79#issuecomment-644324557 */ overlay: false, - forceEnable, + /** + * If you (temporarily) want to enable HMR on a production build: + * 1) Set `forceEnable` to `true` + * 2) Remove the `!production` condition on `tsxRule` to ensure that babel-loader gets used. + */ + forceEnable: false, })); } else { baseConfig.plugins = baseConfig.plugins.filter(p => !(p && p.constructor && p.constructor.name === "HotModuleReplacementPlugin")); } return baseConfig; -}; +}; \ No newline at end of file From 5286adf081cb75ea17251edd498266be7fe7189a Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Wed, 9 Sep 2020 08:16:42 +0200 Subject: [PATCH 02/11] feat(core): boolean to disable systemAppearanceChanged (theme) (#8827) --- packages/core/application/application-common.ts | 7 ++++++- packages/core/application/index.d.ts | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/core/application/application-common.ts b/packages/core/application/application-common.ts index 2a083eb32..d27dee9c5 100644 --- a/packages/core/application/application-common.ts +++ b/packages/core/application/application-common.ts @@ -148,9 +148,14 @@ export function orientationChanged(rootView: View, newOrientation: 'portrait' | applyCssClass(rootModalView, ORIENTATION_CSS_CLASSES, newOrientationCssClass); }); } +export let autoSystemAppearanceChanged = true; + +export function setAutoSystemAppearanceChanged(value: boolean) { + autoSystemAppearanceChanged = value; +} export function systemAppearanceChanged(rootView: View, newSystemAppearance: 'dark' | 'light'): void { - if (!rootView) { + if (!rootView || !autoSystemAppearanceChanged) { return; } diff --git a/packages/core/application/index.d.ts b/packages/core/application/index.d.ts index 9b14fe31c..9d0106c3a 100644 --- a/packages/core/application/index.d.ts +++ b/packages/core/application/index.d.ts @@ -54,6 +54,16 @@ export const orientationChangedEvent: string; */ export const systemAppearanceChangedEvent: string; +/** + * Boolean to enable/disable systemAppearanceChanged + */ +export let autoSystemAppearanceChanged = true; + +/** + * enable/disable systemAppearanceChanged + */ +export function setAutoSystemAppearanceChanged (value: boolean); + /** * Updates root view classes including those of modals * @param rootView the root view From c7623839f940ca713444e44d3c5d0b38e7513075 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Wed, 9 Sep 2020 11:25:21 +0200 Subject: [PATCH 03/11] chore(release): @nativescript/webpack v3.0.3 --- packages/webpack/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webpack/package.json b/packages/webpack/package.json index e674ab6f6..4a0e2d8c7 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "3.0.2", + "version": "3.0.3", "main": "index", "description": "Webpack plugin for NativeScript", "homepage": "https://nativescript.org", From a2e1aa246e6a9cbdd6d2c4647c9740ef411ad51a Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 9 Sep 2020 09:15:57 -0700 Subject: [PATCH 04/11] feat(core): export additional properties for plugin usage (#8835) --- packages/core/index.d.ts | 8 +++++++- packages/core/index.ts | 15 +++++++++++---- packages/core/ui/index.ts | 2 +- workspace.json | 28 +++++++--------------------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/packages/core/index.d.ts b/packages/core/index.d.ts index 423232b1d..99a8e4f3f 100644 --- a/packages/core/index.d.ts +++ b/packages/core/index.d.ts @@ -8,7 +8,7 @@ export type { NativeScriptConfig } from './config'; export { iOSApplication, AndroidApplication } from './application'; export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application'; -import { systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, run, orientation, getNativeApplication, hasLaunched, systemAppearance } from './application'; +import { systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, systemAppearance } from './application'; export declare const Application: { launchEvent: string; displayedEvent: string; @@ -32,6 +32,8 @@ export declare const Application: { addCss: typeof addCss; on: typeof on; off: typeof off; + notify: typeof notify; + hasListeners: typeof hasListeners; run: typeof run; orientation: typeof orientation; getNativeApplication: typeof getNativeApplication; @@ -113,6 +115,10 @@ export declare const Utils: { android: typeof androidUtils; ad: typeof androidUtils; ios: typeof iosUtils; + setTimeout: typeof setTimeout; + setInterval: typeof setInterval; + clearInterval: typeof clearInterval; + clearTimeout: typeof clearTimeout; Source: typeof Source; ClassInfo: typeof ClassInfo; getClass: typeof getClass; diff --git a/packages/core/index.ts b/packages/core/index.ts index 39a56d0dc..68f03d56b 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -6,7 +6,7 @@ nsGlobals.initGlobal(); export { iOSApplication, AndroidApplication } from './application'; export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application'; -import { launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application'; +import { launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application'; export const Application = { launchEvent, displayedEvent, @@ -30,7 +30,9 @@ export const Application = { loadAppCss, addCss, on, - off, + off, + notify, + hasListeners, run, orientation, getNativeApplication, @@ -103,7 +105,8 @@ export { profile, enable as profilingEnable, disable as profilingDisable, time a export type { InstrumentationMode, TimerInfo } from './profiling'; export { encoding } from './text'; - +// for developers to be explicit if they desire around globals (allows access via Utils below) +import { setTimeout, setInterval, clearInterval, clearTimeout } from './timer'; export * from './trace'; export * from './ui'; @@ -133,7 +136,11 @@ export const Utils = { android: androidUtils, // legacy (a lot of plugins use the shorthand "ad" Utils.ad instead of Utils.android) ad: androidUtils, - ios: iosUtils, + ios: iosUtils, + setTimeout, + setInterval, + clearInterval, + clearTimeout, Source, ClassInfo, getClass, diff --git a/packages/core/ui/index.ts b/packages/core/ui/index.ts index 3cf1adefd..4304ae45c 100644 --- a/packages/core/ui/index.ts +++ b/packages/core/ui/index.ts @@ -74,7 +74,7 @@ export type { TabStripItemEventData } from './tab-navigation-base/tab-strip'; export { TabStripItem } from './tab-navigation-base/tab-strip-item'; export { TabView, TabViewItem } from './tab-view'; export { Tabs } from './tabs'; -export { TextBase, getTransformedText } from './text-base'; +export { TextBase, getTransformedText, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, whiteSpaceProperty, lineHeightProperty } from './text-base'; export type { TextTransform } from './text-base'; export { FormattedString } from './text-base/formatted-string'; export { Span } from './text-base/span'; diff --git a/workspace.json b/workspace.json index f11d5a5a8..d08978ac0 100644 --- a/workspace.json +++ b/workspace.json @@ -300,12 +300,8 @@ "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ - { - "command": "./build.sh" - }, - { - "command": "cp -R dist/package/platforms/* ../../packages/core/platforms" - } + "./build.sh", + "cp -R dist/package/platforms/* ../../packages/core/platforms" ], "cwd": "packages/ui-mobile-base", "parallel": false @@ -337,12 +333,8 @@ "builder": "@nrwl/workspace:run-commands", "options": { "commands": [ - { - "command": "npm run tsc" - }, - { - "command": "npm run jasmine" - } + "npm run tsc", + "npm run jasmine" ], "cwd": "packages/webpack", "parallel": false @@ -353,15 +345,9 @@ "outputs": ["dist/packages"], "options": { "commands": [ - { - "command": "npm run setup" - }, - { - "command": "mkdir -p ../../dist/packages" - }, - { - "command": "mv \"$(npm pack | tail -n 1)\" ../../dist/packages/nativescript-webpack.tgz" - } + "npm run setup", + "mkdir -p ../../dist/packages", + "mv \"$(npm pack | tail -n 1)\" ../../dist/packages/nativescript-webpack.tgz" ], "cwd": "packages/webpack", "parallel": false From 0e3af4d9b33a9023bdbbc1e090f339049a82f626 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 9 Sep 2020 11:50:11 -0700 Subject: [PATCH 05/11] chore(release): @nativescript/core 7.0.1 (#8836) --- CHANGELOG.md | 18 ++++++++++++++++++ package.json | 2 +- packages/core/package.json | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9f9ba752..ee4e97446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## [7.0.1](https://github.com/NativeScript/NativeScript/compare/7.0.0...7.0.1) (2020-09-09) + + +### Bug Fixes + +* **webpack:** react config ([#8822](https://github.com/NativeScript/NativeScript/issues/8822)) ([354b935](https://github.com/NativeScript/NativeScript/commit/354b935c6a334de3d418495b11674a799293a8bd)) +* invalid cli tag version ([#8821](https://github.com/NativeScript/NativeScript/issues/8821)) ([d51abef](https://github.com/NativeScript/NativeScript/commit/d51abef6bfeb66ed647d5bd2e1711d0ce9d07113)) +* **webpack:** apply-css-loader not applying css ([#8811](https://github.com/NativeScript/NativeScript/issues/8811)) ([c1a2d54](https://github.com/NativeScript/NativeScript/commit/c1a2d543b8a9aad0551ae5bb445ef4e08bac99b2)) +* **webpack:** Change NativeClass properties to enumerable ([#8813](https://github.com/NativeScript/NativeScript/issues/8813)) ([e4a2930](https://github.com/NativeScript/NativeScript/commit/e4a2930c6a019e3b65a7968afe4fa2653246ecf4)) + + +### Features + +* **core:** boolean to disable systemAppearanceChanged (theme) ([#8827](https://github.com/NativeScript/NativeScript/issues/8827)) ([5286adf](https://github.com/NativeScript/NativeScript/commit/5286adf081cb75ea17251edd498266be7fe7189a)) +* **core:** export additional properties for plugin usage ([#8835](https://github.com/NativeScript/NativeScript/issues/8835)) ([a2e1aa2](https://github.com/NativeScript/NativeScript/commit/a2e1aa246e6a9cbdd6d2c4647c9740ef411ad51a)) + + + # [7.0.0](https://github.com/NativeScript/NativeScript/compare/6.5.15...7.0.0) (2020-09-03) diff --git a/package.json b/package.json index a9c26211b..8758ffa40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.0.0", + "version": "7.0.1", "license": "MIT", "scripts": { "setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", diff --git a/packages/core/package.json b/packages/core/package.json index 16bc1fa8a..b41577142 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.0.0", + "version": "7.0.1", "homepage": "https://nativescript.org", "repository": { "type": "git", From c30a9c3e3569e0367056bfd80fa730ae79e29066 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Wed, 9 Sep 2020 22:47:26 +0200 Subject: [PATCH 06/11] fix(core): autoSystemAppearanceChanged typings in ambient context fix --- packages/core/application/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/application/index.d.ts b/packages/core/application/index.d.ts index 9d0106c3a..909627aa3 100644 --- a/packages/core/application/index.d.ts +++ b/packages/core/application/index.d.ts @@ -57,7 +57,7 @@ export const systemAppearanceChangedEvent: string; /** * Boolean to enable/disable systemAppearanceChanged */ -export let autoSystemAppearanceChanged = true; +export let autoSystemAppearanceChanged: boolean; /** * enable/disable systemAppearanceChanged From df86162d3ee10b5c07ca7ce073cb71ad12f4bc26 Mon Sep 17 00:00:00 2001 From: tarunama Date: Thu, 10 Sep 2020 10:28:13 +0900 Subject: [PATCH 07/11] chore: add repository --- apps/automated/package.json | 7 +++++-- apps/toolbox/package.json | 7 +++++-- apps/ui/package.json | 7 +++++-- package.json | 6 +++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/apps/automated/package.json b/apps/automated/package.json index dd43297b8..dac032e77 100644 --- a/apps/automated/package.json +++ b/apps/automated/package.json @@ -1,8 +1,11 @@ { "main": "main.js", "description": "NativeScript Application", - "license": "SEE LICENSE IN ", - "repository": "", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/NativeScript/NativeScript.git" + }, "scripts": { "clean": "npx rimraf hooks node_modules platforms package-lock.json && npm i" }, diff --git a/apps/toolbox/package.json b/apps/toolbox/package.json index 6e9b5ae7e..16167ec77 100644 --- a/apps/toolbox/package.json +++ b/apps/toolbox/package.json @@ -1,8 +1,11 @@ { "main": "main.js", "description": "NativeScript Application", - "license": "SEE LICENSE IN ", - "repository": "", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/NativeScript/NativeScript.git" + }, "dependencies": { "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core", "@nativescript/core": "file:../../packages/core" diff --git a/apps/ui/package.json b/apps/ui/package.json index a47721bdf..100413761 100644 --- a/apps/ui/package.json +++ b/apps/ui/package.json @@ -1,8 +1,11 @@ { "main": "main.js", "description": "NativeScript Application", - "license": "SEE LICENSE IN ", - "repository": "", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/NativeScript/NativeScript.git" + }, "dependencies": { "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core", "@nativescript/core": "file:../../packages/core" diff --git a/package.json b/package.json index 8758ffa40..201033255 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,11 @@ "start": "nps", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s" }, - "private": true, + "private": true, + "repository": { + "type": "git", + "url": "https://github.com/NativeScript/NativeScript.git" + }, "dependencies": { "nativescript-theme-core": "^1.0.4" }, From f7713c40a63959c2b5934a25bd3577f07d0401c0 Mon Sep 17 00:00:00 2001 From: Ken Southerland Date: Wed, 9 Sep 2020 15:01:39 -0700 Subject: [PATCH 08/11] fix(webpack): verify now works properly closes https://github.com/NativeScript/NativeScript/issues/8840 --- packages/webpack/verify/update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webpack/verify/update.js b/packages/webpack/verify/update.js index fe0e43c76..cceb756f8 100644 --- a/packages/webpack/verify/update.js +++ b/packages/webpack/verify/update.js @@ -5,7 +5,7 @@ const { getPackageJson, getProjectDir, writePackageJson, -} = require("../projectHelpers"); +} = require("../helpers/projectHelpers"); const { forceUpdateProjectFiles } = require("../helpers/projectFilesManager"); const { forceUpdateProjectDeps } = require("../helpers/dependencyManager"); From bd04a4710fa108de69b8099af0e98107801d12e6 Mon Sep 17 00:00:00 2001 From: tarunama Date: Thu, 10 Sep 2020 12:27:07 +0900 Subject: [PATCH 09/11] chore: cleanup navigation-helper.ts (#8834) --- apps/ui/e2e/helpers/navigation-helper.ts | 64 +++++++++++++++--------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/apps/ui/e2e/helpers/navigation-helper.ts b/apps/ui/e2e/helpers/navigation-helper.ts index d93ce7322..a0d1c36b1 100644 --- a/apps/ui/e2e/helpers/navigation-helper.ts +++ b/apps/ui/e2e/helpers/navigation-helper.ts @@ -1,4 +1,10 @@ -import { AppiumDriver, IRectangle, logInfo, logWarn, Point } from "nativescript-dev-appium"; +import { + AppiumDriver, + IRectangle, + logInfo, + logWarn, + Point +} from "nativescript-dev-appium"; export enum ElementCacheStrategy { allAtOnce, @@ -18,12 +24,15 @@ export class NavigationHelper { private _cachedElements: ICachedElement; private _currentSuite: ICachedElement; - constructor(protected _driver: AppiumDriver, protected _suitMainPageNavigationLinks: Array, private _elemtsCacheStrategy: ElementCacheStrategy = ElementCacheStrategy.onload) { - } + constructor( + protected _driver: AppiumDriver, + protected _suitMainPageNavigationLinks: Array, + private _elementsCacheStrategy: ElementCacheStrategy = ElementCacheStrategy.onload + ) {} - async initSuite() { - if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce - || this._elemtsCacheStrategy === ElementCacheStrategy.onload) { + async initSuite(): Promise { + if (this._elementsCacheStrategy === ElementCacheStrategy.allAtOnce + || this._elementsCacheStrategy === ElementCacheStrategy.onload) { if (this._currentSuite) { while (this._currentSuite.parent) { this._currentSuite = this._currentSuite.parent; @@ -31,7 +40,7 @@ export class NavigationHelper { } else { if (!this._cachedElements || this._cachedElements.children.size === 0) { this._cachedElements = { name: "initSuite", children: new Map() }; - if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce) { + if (this._elementsCacheStrategy === ElementCacheStrategy.allAtOnce) { await this.cacheAllElements(this._cachedElements); } } @@ -43,12 +52,12 @@ export class NavigationHelper { await this.navigateToSuitMainPage(); } - async endSuite() { - logInfo("End of suit 'button' tests!"); + async endSuite(): Promise { + logInfo(`End of suit 'button' tests!`); await this._driver.takeScreenshot("end_button_suit"); } - async navigateToSuitMainPage() { + async navigateToSuitMainPage(): Promise { for (let index = 0; index < this._suitMainPageNavigationLinks.length; index++) { const mainPage = this._suitMainPageNavigationLinks[index]; await this.navigateToSample(mainPage); @@ -59,7 +68,7 @@ export class NavigationHelper { logInfo(`Navigate to ${sample}`); const sampleName = sample.toLowerCase(); - if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce) { + if (this._elementsCacheStrategy === ElementCacheStrategy.allAtOnce) { if (!this._currentSuite.children.has(sampleName)) { await this.cacheAllElements(this._currentSuite); } @@ -69,7 +78,7 @@ export class NavigationHelper { const sampleElement = this._currentSuite.children.get(sampleName).rect; await this._driver.clickPoint(sampleElement.x + (sampleElement.width / 2), sampleElement.y + (sampleElement.height / 2)); this._currentSuite = this._currentSuite.children.get(sampleName); - } else if (this._elemtsCacheStrategy === ElementCacheStrategy.onload) { + } else if (this._elementsCacheStrategy === ElementCacheStrategy.onload) { if (this._currentSuite.children.has(sampleName)) { const sampleElement = this._currentSuite.children.get(sampleName).rect; await this._driver.clickPoint(sampleElement.x + (sampleElement.width / 2), sampleElement.y + (sampleElement.height / 2)); @@ -94,14 +103,14 @@ export class NavigationHelper { async navigateBackToSuitMainPage() { logInfo(`Navigate to back`); - if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce - || this._elemtsCacheStrategy === ElementCacheStrategy.onload) { + if (this._elementsCacheStrategy === ElementCacheStrategy.allAtOnce + || this._elementsCacheStrategy === ElementCacheStrategy.onload) { this._currentSuite = this._currentSuite && this._currentSuite.parent; } await this._driver.navBack(); } - async swipeBackToSuitMainPage() { + async swipeBackToSuitMainPage(): Promise { logInfo(`Swipe to back`); const startPoint = {}; const endPoint = {}; @@ -115,20 +124,29 @@ export class NavigationHelper { await this._driver.swipe(startPoint, endPoint); } else { - logWarn("Swipe back is not supported from android!"); + logWarn(`Swipe back is not supported from android!`); } } - private async cacheAllElements(cachedElements: ICachedElement) { - const allSamples = await this._driver.findElementsByClassName(this._driver.locators.button); + private async cacheAllElements(cachedElements: ICachedElement): Promise { + const allSamples = await this._driver.findElementsByClassName(this._driver.locators.button); for (let index = 0; index < allSamples.length; index++) { const element = allSamples[index]; const rect = await element.getRectangle(); - const text = (await element.text()).toLowerCase(); - if (!cachedElements.children.has(text)) { - console.log(text); - cachedElements.children.set(text, { parent: cachedElements, name: text, rect: rect, children: new Map() }); - } + const text = (await element.text()).toLowerCase(); + + if (cachedElements.children.has(text)) continue + + logInfo(text); + cachedElements.children.set( + text, + { + parent: cachedElements, + name: text, + rect: rect, + children: new Map() + } + ); } } } From 1623a567b6eaa195d075936103d2f7d829e1fa07 Mon Sep 17 00:00:00 2001 From: Martin Guillon Date: Thu, 10 Sep 2020 05:46:50 +0200 Subject: [PATCH 10/11] fix(core): bundle-config-loader global handling (#8838) --- packages/core/globals/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/globals/index.ts b/packages/core/globals/index.ts index 9ccbf5fba..d47733635 100644 --- a/packages/core/globals/index.ts +++ b/packages/core/globals/index.ts @@ -358,3 +358,6 @@ export function initGlobal() { }; } } +if (!global.NativeScriptHasInitGlobal) { + initGlobal(); +} From 8753605788b98b504f8b0075fae5a66d8ce83317 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 9 Sep 2020 20:57:49 -0700 Subject: [PATCH 11/11] chore(release): @nativescript/core 7.0.2, @nativescript/webpack 3.0.4 (#8842) --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- packages/core/package.json | 2 +- packages/webpack/package.json | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee4e97446..7b68251ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [7.0.2](https://github.com/NativeScript/NativeScript/compare/7.0.0...7.0.2) (2020-09-10) + + +### Bug Fixes + +* **core:** autoSystemAppearanceChanged typings in ambient context fix ([c30a9c3](https://github.com/NativeScript/NativeScript/commit/c30a9c3e3569e0367056bfd80fa730ae79e29066)) +* **core:** bundle-config-loader global handling ([#8838](https://github.com/NativeScript/NativeScript/issues/8838)) ([1623a56](https://github.com/NativeScript/NativeScript/commit/1623a567b6eaa195d075936103d2f7d829e1fa07)) +* **webpack:** verify now works properly ([f7713c4](https://github.com/NativeScript/NativeScript/commit/f7713c40a63959c2b5934a25bd3577f07d0401c0)) + + + ## [7.0.1](https://github.com/NativeScript/NativeScript/compare/7.0.0...7.0.1) (2020-09-09) diff --git a/package.json b/package.json index 201033255..445162952 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "7.0.1", + "version": "7.0.2", "license": "MIT", "scripts": { "setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", diff --git a/packages/core/package.json b/packages/core/package.json index b41577142..d2a2b886a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "main": "index", "types": "index.d.ts", "description": "NativeScript Core Modules", - "version": "7.0.1", + "version": "7.0.2", "homepage": "https://nativescript.org", "repository": { "type": "git", diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 4a0e2d8c7..af66a5281 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/webpack", - "version": "3.0.3", + "version": "3.0.4", "main": "index", "description": "Webpack plugin for NativeScript", "homepage": "https://nativescript.org",