Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/services/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -131,14 +132,16 @@ export class ProjectService implements IProjectService {

private async ensureAppResourcesExist(projectDir: string): Promise<void> {
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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nativescript",
"preferGlobal": true,
"version": "4.2.0",
"version": "4.2.1",
"author": "Telerik <support@telerik.com>",
"description": "Command-line interface for building NativeScript projects",
"bin": {
Expand Down