ci: fix npm_install for core on CI (docs) (#9155)

* chore(release): @nativescript/core@7.1.1

* feat(core): rollup additional Utils

* fix(webpack): support other workspace config styles

* chore(release): @nativescript/core@7.1.2

* fix(android): BottomNavigation fragment child already has a parent (#9148)

closes https://github.com/NativeScript/NativeScript/issues/8132
closes https://github.com/NativeScript/NativeScript/issues/7901
closes https://github.com/NativeScript/NativeScript/issues/9051
closes https://github.com/NativeScript/NativeScript/issues/8251

* chore(release): @nativescript/core@7.1.3

* types: missing typings for iosIgnoreSafeArea (#9153)

* Update build-docs.sh

Co-authored-by: Nathan Walker <walkerrunpdx@gmail.com>
Co-authored-by: Martin Guillon <martin.guillon@akylas.fr>
This commit is contained in:
Igor Randjelovic
2021-01-20 16:19:10 +01:00
committed by GitHub
parent ed52345167
commit 8a36e79c9b
11 changed files with 143 additions and 53 deletions

View File

@ -1,3 +1,35 @@
## [7.1.3](https://github.com/NativeScript/NativeScript/compare/7.1.2-core...7.1.3) (2021-01-17)
### Bug Fixes
* **android:** BottomNavigation fragment child already has a parent ([#9148](https://github.com/NativeScript/NativeScript/issues/9148)) ([4690162](https://github.com/NativeScript/NativeScript/commit/4690162384c731d6d652d90a9347cae06c0a0e0c))
## [7.1.2](https://github.com/NativeScript/NativeScript/compare/7.1.1-core...7.1.2) (2021-01-14)
### Bug Fixes
* **webpack:** support other workspace config styles ([7a79a89](https://github.com/NativeScript/NativeScript/commit/7a79a8988b55e7e0896e7ad38f571aba6987edb5))
### Features
* **core:** rollup additional Utils ([882aa42](https://github.com/NativeScript/NativeScript/commit/882aa42e8573615aa5ba89396d0f0cdbb711bed3))
## [7.1.1](https://github.com/NativeScript/NativeScript/compare/7.1.0-core...7.1.1) (2021-01-13)
### Bug Fixes
* **core:** const initializer in an ambient context ([#9136](https://github.com/NativeScript/NativeScript/issues/9136)) ([47ebb1d](https://github.com/NativeScript/NativeScript/commit/47ebb1d262aa9ebf29fe445e57d19910612d047f)), closes [#9135](https://github.com/NativeScript/NativeScript/issues/9135)
# [7.1.0](https://github.com/NativeScript/NativeScript/compare/4.0.0-webpack...7.1.0) (2020-12-30) # [7.1.0](https://github.com/NativeScript/NativeScript/compare/4.0.0-webpack...7.1.0) (2020-12-30)

View File

@ -1,6 +1,6 @@
{ {
"name": "nativescript", "name": "nativescript",
"version": "7.1.0", "version": "7.1.3",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup", "setup": "npx rimraf hooks node_modules package-lock.json && npm i && ts-patch install && nx run core:setup",

View File

@ -95,7 +95,7 @@ export type { InstrumentationMode, TimerInfo } from './profiling';
export { encoding } from './text'; export { encoding } from './text';
export * from './trace'; export * from './trace';
export * from './ui'; export * from './ui';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source } from './utils'; import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, escapeRegexSymbols, convertString } from './utils';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types'; import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types';
export declare const Utils: { export declare const Utils: {
GC: typeof GC; GC: typeof GC;
@ -109,6 +109,8 @@ export declare const Utils: {
isMainThread: typeof isMainThread; isMainThread: typeof isMainThread;
dispatchToMainThread: typeof dispatchToMainThread; dispatchToMainThread: typeof dispatchToMainThread;
releaseNativeObject: typeof releaseNativeObject; releaseNativeObject: typeof releaseNativeObject;
escapeRegexSymbols: typeof escapeRegexSymbols;
convertString: typeof convertString;
getModuleName: typeof getModuleName; getModuleName: typeof getModuleName;
openFile: typeof openFile; openFile: typeof openFile;
openUrl: typeof openUrl; openUrl: typeof openUrl;

View File

@ -110,7 +110,7 @@ export * from './trace';
export * from './ui'; export * from './ui';
import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, queueMacrotask, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX } from './utils'; import { GC, isFontIconURI, isDataURI, isFileOrResourcePath, executeOnMainThread, mainThreadify, isMainThread, dispatchToMainThread, queueMacrotask, releaseNativeObject, getModuleName, openFile, openUrl, isRealDevice, layout, ad as androidUtils, iOSNativeHelper as iosUtils, Source, RESOURCE_PREFIX, FILE_PREFIX, escapeRegexSymbols, convertString } from './utils';
import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types'; import { ClassInfo, getClass, getBaseClasses, getClassInfo, isBoolean, isDefined, isFunction, isNullOrUndefined, isNumber, isObject, isString, isUndefined, toUIString, verifyCallback } from './utils/types';
export const Utils = { export const Utils = {
@ -126,6 +126,8 @@ export const Utils = {
dispatchToMainThread, dispatchToMainThread,
queueMacrotask, queueMacrotask,
releaseNativeObject, releaseNativeObject,
convertString,
escapeRegexSymbols,
getModuleName, getModuleName,
openFile, openFile,

View File

@ -3,7 +3,7 @@
"main": "index", "main": "index",
"types": "index.d.ts", "types": "index.d.ts",
"description": "NativeScript Core Modules", "description": "NativeScript Core Modules",
"version": "7.1.0", "version": "7.1.3",
"homepage": "https://nativescript.org", "homepage": "https://nativescript.org",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -428,7 +428,7 @@ export class BottomNavigation extends TabNavigationBase {
const fragmentToDetach = this._currentFragment; const fragmentToDetach = this._currentFragment;
if (fragmentToDetach) { if (fragmentToDetach) {
this.destroyItem((<any>fragmentToDetach).index, fragmentToDetach); this.destroyItem((<any>fragmentToDetach).index, fragmentToDetach);
this.commitCurrentTransaction(); this.removeFragment(fragmentToDetach);
} }
} }
@ -454,28 +454,42 @@ export class BottomNavigation extends TabNavigationBase {
private disposeTabFragments(): void { private disposeTabFragments(): void {
const fragmentManager = this._getFragmentManager(); const fragmentManager = this._getFragmentManager();
const transaction = fragmentManager.beginTransaction();
const fragments = fragmentManager.getFragments().toArray(); const fragments = fragmentManager.getFragments().toArray();
for (let i = 0; i < fragments.length; i++) { for (let i = 0; i < fragments.length; i++) {
transaction.remove(fragments[i]); this.removeFragment(fragments[i]);
} }
transaction.commitNowAllowingStateLoss();
} }
private get currentTransaction(): androidx.fragment.app.FragmentTransaction { private attachFragment(fragment: androidx.fragment.app.Fragment, id?: number, name?: string): void {
if (!this._currentTransaction) { const fragmentManager = this._getFragmentManager();
const fragmentManager = this._getFragmentManager(); if (fragment) {
this._currentTransaction = fragmentManager.beginTransaction(); if (fragment.isAdded() || fragment.isRemoving()) {
} // ignore
} else {
return this._currentTransaction; const fragmentExitTransition = fragment.getExitTransition();
} if (fragmentExitTransition && fragmentExitTransition instanceof org.nativescript.widgets.CustomTransition) {
fragmentExitTransition.setResetOnTransitionEnd(true);
private commitCurrentTransaction(): void { }
if (this._currentTransaction) { if (fragmentManager) {
this._currentTransaction.commitNowAllowingStateLoss(); if (!fragmentManager.isDestroyed()) {
this._currentTransaction = null; try {
if (fragmentManager.isStateSaved()) {
if (id && name) {
fragmentManager.beginTransaction().add(id, fragment, name).commitNowAllowingStateLoss();
} else {
fragmentManager.beginTransaction().attach(fragment).commitNowAllowingStateLoss();
}
} else {
if (id && name) {
fragmentManager.beginTransaction().add(id, fragment, name).commitNow();
} else {
fragmentManager.beginTransaction().attach(fragment).commitNow();
}
}
} catch (e) {}
}
}
}
} }
} }
@ -495,8 +509,6 @@ export class BottomNavigation extends TabNavigationBase {
const fragment = this.instantiateItem(this._contentView, index); const fragment = this.instantiateItem(this._contentView, index);
this.setPrimaryItem(index, fragment); this.setPrimaryItem(index, fragment);
this.commitCurrentTransaction();
} }
private instantiateItem(container: android.view.ViewGroup, position: number): androidx.fragment.app.Fragment { private instantiateItem(container: android.view.ViewGroup, position: number): androidx.fragment.app.Fragment {
@ -505,10 +517,10 @@ export class BottomNavigation extends TabNavigationBase {
const fragmentManager = this._getFragmentManager(); const fragmentManager = this._getFragmentManager();
let fragment: androidx.fragment.app.Fragment = fragmentManager.findFragmentByTag(name); let fragment: androidx.fragment.app.Fragment = fragmentManager.findFragmentByTag(name);
if (fragment != null) { if (fragment != null) {
this.currentTransaction.attach(fragment); this.attachFragment(fragment);
} else { } else {
fragment = TabFragment.newInstance(this._domId, position); fragment = TabFragment.newInstance(this._domId, position);
this.currentTransaction.add(container.getId(), fragment, name); this.attachFragment(fragment, container.getId(), name);
} }
if (fragment !== this._currentFragment) { if (fragment !== this._currentFragment) {
@ -545,7 +557,7 @@ export class BottomNavigation extends TabNavigationBase {
private destroyItem(position: number, fragment: androidx.fragment.app.Fragment): void { private destroyItem(position: number, fragment: androidx.fragment.app.Fragment): void {
if (fragment) { if (fragment) {
this.currentTransaction.detach(fragment); this.removeFragment(fragment);
if (this._currentFragment === fragment) { if (this._currentFragment === fragment) {
this._currentFragment = null; this._currentFragment = null;
} }
@ -555,6 +567,34 @@ export class BottomNavigation extends TabNavigationBase {
this.items[position].canBeLoaded = false; this.items[position].canBeLoaded = false;
} }
} }
private removeFragment(fragment: androidx.fragment.app.Fragment, fragmentManager?: any) {
if (!fragmentManager) {
fragmentManager = this._getFragmentManager();
}
if (fragment) {
if (!fragment.isAdded() || fragment.isRemoving()) {
// ignore
return;
} else {
const fragmentExitTransition = fragment.getExitTransition();
if (fragmentExitTransition && fragmentExitTransition instanceof org.nativescript.widgets.CustomTransition) {
fragmentExitTransition.setResetOnTransitionEnd(true);
}
if (fragment && fragment.isAdded() && !fragment.isRemoving()) {
const pfm = (<any>fragment).getParentFragmentManager ? (<any>fragment).getParentFragmentManager() : null;
if (pfm && !pfm.isDestroyed()) {
try {
if (pfm.isStateSaved()) {
pfm.beginTransaction().remove(fragment).commitNowAllowingStateLoss();
} else {
pfm.beginTransaction().remove(fragment).commitNow();
}
} catch (e) {}
}
}
}
}
}
private setTabStripItems(items: Array<TabStripItem>) { private setTabStripItems(items: Array<TabStripItem>) {
if (!this.tabStrip || !items) { if (!this.tabStrip || !items) {

View File

@ -392,6 +392,11 @@ export abstract class View extends ViewBase {
* Enables or disables the iosOverflowSafeArea property for all children. This property is iOS specific. Default value: true * Enables or disables the iosOverflowSafeArea property for all children. This property is iOS specific. Default value: true
*/ */
iosOverflowSafeAreaEnabled: boolean; iosOverflowSafeAreaEnabled: boolean;
/**
* Gets or sets a value indicating whether the the view should totally ignore safe areas computation. This property is iOS specific. Default value: false
*/
iosIgnoreSafeArea: boolean;
/** /**
* Gets is layout is valid. This is a read-only property. * Gets is layout is valid. This is a read-only property.

View File

@ -1,6 +1,6 @@
{ {
"name": "@nativescript/ui-mobile-base", "name": "@nativescript/ui-mobile-base",
"version": "7.0.0-rc.0", "version": "7.0.0",
"description": "Native UI base components used with NativeScript.", "description": "Native UI base components used with NativeScript.",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"

View File

@ -21,21 +21,26 @@ const parseWorkspaceConfig = function(platform, envConfigs, projectName, debug)
if (workspaceConfig && projectName) { if (workspaceConfig && projectName) {
const projectSettings = workspaceConfig.projects[projectName]; const projectSettings = workspaceConfig.projects[projectName];
if (projectSettings) { if (projectSettings) {
var targetProp = 'architect';
if (!projectSettings.architect) {
targetProp = 'targets'; // Nx
}
// default project configurations // default project configurations
for (const envConfig of envConfigs) { for (const envConfig of envConfigs) {
if (projectSettings.architect.default && projectSettings.architect.default.configurations) { if (projectSettings[targetProp]) {
const defaultConfigurations = projectSettings.architect.default.configurations; if (projectSettings[targetProp].default && projectSettings[targetProp].default.configurations) {
if (defaultConfigurations && defaultConfigurations[envConfig]) { const defaultConfigurations = projectSettings[targetProp].default.configurations;
if (defaultConfigurations[envConfig].fileReplacements) { if (defaultConfigurations && defaultConfigurations[envConfig]) {
for (const fileReplace of defaultConfigurations[envConfig].fileReplacements) { if (defaultConfigurations[envConfig].fileReplacements) {
if (debug) { for (const fileReplace of defaultConfigurations[envConfig].fileReplacements) {
console.log('project fileReplacement:', fileReplace); if (debug) {
} console.log('project fileReplacement:', fileReplace);
if (fileReplace.replace.indexOf('.ts') > -1) { }
fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`); if (fileReplace.replace.indexOf('.ts') > -1) {
} else { fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`);
copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true }); } else {
copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true });
}
} }
} }
} }
@ -44,17 +49,19 @@ const parseWorkspaceConfig = function(platform, envConfigs, projectName, debug)
} }
// platform specific configurations (always override top level project configurations) // platform specific configurations (always override top level project configurations)
for (const envConfig of envConfigs) { for (const envConfig of envConfigs) {
if (projectSettings.architect && projectSettings.architect[platform]) { if (projectSettings[targetProp]) {
const platformConfig = projectSettings.architect[platform].configurations; if (projectSettings[targetProp] && projectSettings[targetProp][platform]) {
if (platformConfig && platformConfig[envConfig] && platformConfig[envConfig].fileReplacements) { const platformConfig = projectSettings[targetProp][platform].configurations;
for (const fileReplace of platformConfig[envConfig].fileReplacements) { if (platformConfig && platformConfig[envConfig] && platformConfig[envConfig].fileReplacements) {
if (debug) { for (const fileReplace of platformConfig[envConfig].fileReplacements) {
console.log(`"${platform}" specific fileReplacement:`, fileReplace); if (debug) {
} console.log(`"${platform}" specific fileReplacement:`, fileReplace);
if (fileReplace.replace.indexOf('.ts') > -1) { }
fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`); if (fileReplace.replace.indexOf('.ts') > -1) {
} else { fileReplacements[resolve(__dirname, `${rootPath}${fileReplace.replace}`)] = resolve(__dirname, `${rootPath}${fileReplace.with}`);
copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true }); } else {
copyReplacements.push({ from: resolve(__dirname, `${rootPath}${fileReplace.with}`), to: resolve(__dirname, `${rootPath}${fileReplace.replace}`), force: true });
}
} }
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@nativescript/webpack", "name": "@nativescript/webpack",
"version": "4.0.0", "version": "4.0.1",
"main": "index", "main": "index",
"description": "Webpack plugin for NativeScript", "description": "Webpack plugin for NativeScript",
"homepage": "https://nativescript.org", "homepage": "https://nativescript.org",

View File

@ -16,6 +16,8 @@ npm_install() {
MARKER_FILE="./node_modules/installed" MARKER_FILE="./node_modules/installed"
if [ ! -f "$MARKER_FILE" ] ; then if [ ! -f "$MARKER_FILE" ] ; then
# Fixes perm issue while installing
npm i -g npm@^6.13.6
npm install npm install
npm install @types/handlebars@4.0.33 npm install @types/handlebars@4.0.33
touch "$MARKER_FILE" touch "$MARKER_FILE"