Skip to content

Commit 7149641

Browse files
authored
Merge pull request #5148 from NativeScript/kddimitrov/update-scoped-modules
fix: update scoped core package
2 parents 3f65dc2 + 55aa1fc commit 7149641

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

lib/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const NATIVESCRIPT_KEY_NAME = "nativescript";
1010
export const NODE_MODULES_FOLDER_NAME = "node_modules";
1111
export const TNS_MODULES_FOLDER_NAME = "tns_modules";
1212
export const TNS_CORE_MODULES_NAME = "tns-core-modules";
13+
export const SCOPED_TNS_CORE_MODULES = "@nativescript/core";
1314
export const TNS_CORE_THEME_NAME = "nativescript-theme-core";
1415
export const SCOPED_TNS_CORE_THEME_NAME = "@nativescript/theme";
1516
export const WEBPACK_PLUGIN_NAME = "nativescript-dev-webpack";

lib/controllers/update-controller.ts

+20-6
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ import * as semver from "semver";
33
import * as constants from "../constants";
44
import { UpdateControllerBase } from "./update-controller-base";
55

6+
interface IPackage {
7+
name: string;
8+
alias?: string;
9+
}
10+
611
export class UpdateController extends UpdateControllerBase implements IUpdateController {
7-
static readonly updatableDependencies: string[] = [
8-
constants.TNS_CORE_MODULES_NAME,
9-
constants.TNS_CORE_MODULES_WIDGETS_NAME,
10-
constants.WEBPACK_PLUGIN_NAME];
12+
static readonly updatableDependencies: IPackage[] = [
13+
{ name: constants.SCOPED_TNS_CORE_MODULES, alias: constants.TNS_CORE_MODULES_NAME },
14+
{ name: constants.TNS_CORE_MODULES_NAME },
15+
{ name: constants.TNS_CORE_MODULES_WIDGETS_NAME },
16+
{ name: constants.WEBPACK_PLUGIN_NAME }];
1117
static readonly folders: string[] = [
1218
constants.LIB_DIR_NAME,
1319
constants.HOOKS_DIR_NAME,
@@ -184,9 +190,17 @@ export class UpdateController extends UpdateControllerBase implements IUpdateCon
184190
}
185191

186192
private getUpdatableDependencies(dependencies: IDictionary<string>): IDictionary<string> {
187-
return _.pickBy(dependencies, (value, key) => {
188-
return UpdateController.updatableDependencies.indexOf(key) > -1;
193+
const updatableDependencies: IDictionary<string> = {};
194+
195+
UpdateController.updatableDependencies.forEach(updatableDependency => {
196+
if (dependencies[updatableDependency.name]) {
197+
updatableDependencies[updatableDependency.name] = dependencies[updatableDependency.name];
198+
} else if (updatableDependency.alias && dependencies[updatableDependency.alias]) {
199+
updatableDependencies[updatableDependency.name] = dependencies[updatableDependency.alias];
200+
}
189201
});
202+
203+
return updatableDependencies;
190204
}
191205

192206
private getTemplateName(projectData: IProjectData) {

0 commit comments

Comments
 (0)