Skip to content

Metadata / Client Project Migration

Mobile Development Kit Client 6.0 requires the use of NativeScript 8 which introduces some prominent changes. To use these changes, you will need to update your metadata/client project.

Migrate Tool

You can use the migration tool: metadata-migrate.command / metadata-migrate.cmd (locate at folder: tools/create-client/) to migrate your metadata/client project files.

./metadata-migrate.command --help

# e.g.
./metadata-migrate.command -s /my/test.mdkproject
./metadata-migrate.command -s /my/test.mdkproject -o /my/outdir -v -l "./log.txt"

Note

The migration tool will cover most of the common cases for migration, however, there might still be some changes that you have to do manually. Please see the "Changes In Detail" topic below for more information.

Changes In Detail

The following are the detailed explanation of the changes that are required

Third Party NativeScript Plugins

If you are using third party NativeScript plugins, check if it is compatible with NativeScript 8.

For more information, see an up-to-date listing of NativeScript plugins

e.g. nativescript-toasty needs to be changed to @triniwiz/nativescript-toasty

@NativeClass() Decorator

In extension, If a class inherits from a native class in typescript files, then you need to add @NativeClass() decorator to it.

For more information, see How to update plugins for NativeScript 7 or newer

e.g.

test.mdkproject/extensions/extension-BarcodeScanner/plugin/Plugin-BarcodeScanner/Common/BarcodeScannerControlDelegate.ios.ts

@NativeClass()
export class BarcodeScannerControlDelegate extends NSObject {
  ...
}

test.mdkproject/extensions/extension-HierarchyFramework/plugin/Plugin-HierarchyFramework/Common/HierarchyControlDelegate.android.ts

@NativeClass()
@Interfaces([com.sap.sam.android.plugin.hierarchy.IHierarchyDelegate])
export class HierarchyControlDelegate extends java.lang.Object {
  ...
}

Import Reference Changes

To import reference changes, see NativeScript new import reference guide

e.g.

// old way, now need change
import * as app from 'tns-core-modules/application/application';

// change to
import * as app from '@nativescript/core/application';
// or (different with * as)
import { Application } from '@nativescript/core';
// or (different with * as)
import { Application as app } from '@nativescript/core';

// old way, now need change
import { Label } from 'tns-core-modules/ui/label/label';
// change to
import { Label } from '@nativescript/core';

Externals and NSPlugins in MDKProject.json

@nativescript/core & mdk-core imports are by default part of the externals now, so you don't need to add them to Externals array in MDKProject.json.

// old way, now need change
"Externals": [
  "file-system",
  "ui/dialogs",
  "tns-core-modules/ui/dialogs",
  "mdk-core/controls/IControl",
  "nativescript-toasty"
],
"NSPlugins": ["nativescript-toasty"],

// change to
"Externals": ["@triniwiz/nativescript-toasty"],
"NSPlugins": ["@triniwiz/nativescript-toasty"],

Below are some additional information about NativeScript 7 / 8:

NativeScript 8.0 Released

NativeScript 7.0 Released

How to update plugins for NativeScript 7 or newer

An up-to-date listing of NativeScript plugins

NativeScript 7 or newer import reference guide

tns migrate


Last update: November 18, 2021