From 7ea02391767dce40e410979109d55a8b19bc93a9 Mon Sep 17 00:00:00 2001 From: Kristian Dimitrov Date: Tue, 7 Aug 2018 12:42:19 +0300 Subject: [PATCH 1/2] chore: bump version to 4.2.1 --- npm-shrinkwrap.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index d7c614ea19..d03661f709 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "nativescript", - "version": "4.2.0", + "version": "4.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cb894aa2d7..0f594a1488 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "preferGlobal": true, - "version": "4.2.0", + "version": "4.2.1", "author": "Telerik ", "description": "Command-line interface for building NativeScript projects", "bin": { From 60ee551e473be8ac881e76faa77e21789c1b77d6 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Tue, 7 Aug 2018 13:43:10 +0300 Subject: [PATCH 2/2] fix: incorrect project is created when template does not have App_Resources In case the project does not have App_Resources dir, CLI tries to extract the content of the default template's App_Resources. However, as the structure of the default template has changed (to v2), CLI extracts the resources to incorrect location. This makes the newly created project unbuildable. In order to fix this behavior and allow the default template to specify where App_Resources are located (via nsconfig.json file), change the logic in CLI to extract the default template to a temp location, read where the App_Resources is located and after that copy the content to the new project. --- lib/services/project-service.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/services/project-service.ts b/lib/services/project-service.ts index 8e5addb6b0..a71156ee1d 100644 --- a/lib/services/project-service.ts +++ b/lib/services/project-service.ts @@ -4,6 +4,7 @@ import * as shelljs from "shelljs"; import { format } from "util"; import { exported } from "../common/decorators"; import { Hooks, TemplatesV2PackageJsonKeysToRemove } from "../constants"; +import * as temp from "temp"; export class ProjectService implements IProjectService { @@ -131,14 +132,16 @@ export class ProjectService implements IProjectService { private async ensureAppResourcesExist(projectDir: string): Promise { const projectData = this.$projectDataService.getProjectData(projectDir); - const appPath = projectData.getAppDirectoryPath(projectDir); const appResourcesDestinationPath = projectData.getAppResourcesDirectoryPath(projectDir); if (!this.$fs.exists(appResourcesDestinationPath)) { this.$fs.createDirectory(appResourcesDestinationPath); - + const tempDir = temp.mkdirSync("ns-default-template"); // the template installed doesn't have App_Resources -> get from a default template - await this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["default"], appPath, { filter: (name: string, entry: any) => entry.path.indexOf(constants.APP_RESOURCES_FOLDER_NAME) !== -1 }); + await this.$pacoteService.extractPackage(constants.RESERVED_TEMPLATE_NAMES["default"], tempDir); + const templateProjectData = this.$projectDataService.getProjectData(tempDir); + const templateAppResourcesDir = templateProjectData.getAppResourcesDirectoryPath(tempDir); + this.$fs.copyFile(path.join(templateAppResourcesDir, "*"), appResourcesDestinationPath); } }